猫妈狗爸伴宠师小程序后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

105 lines
3.5 KiB

package com.ruoyi.catdog.controller;
import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.catdog.domain.CleanItems;
import com.ruoyi.catdog.service.ICleanItemsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 清洁物品Controller
*
* @author ruoyi
* @date 2025-03-02
*/
@RestController
@RequestMapping("/catdog/items")
public class CleanItemsController extends BaseController
{
@Autowired
private ICleanItemsService cleanItemsService;
/**
* 查询清洁物品列表
*/
@PreAuthorize("@ss.hasPermi('catdog:items:list')")
@GetMapping("/list")
public TableDataInfo list(CleanItems cleanItems)
{
startPage();
List<CleanItems> list = cleanItemsService.selectCleanItemsList(cleanItems);
return getDataTable(list);
}
/**
* 导出清洁物品列表
*/
@PreAuthorize("@ss.hasPermi('catdog:items:export')")
@Log(title = "清洁物品", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CleanItems cleanItems) throws IOException {
List<CleanItems> list = cleanItemsService.selectCleanItemsList(cleanItems);
ExcelUtil<CleanItems> util = new ExcelUtil<CleanItems>(CleanItems.class);
util.exportExcel(response, list, "清洁物品数据");
}
/**
* 获取清洁物品详细信息
*/
@PreAuthorize("@ss.hasPermi('catdog:items:query')")
@GetMapping(value = "/{cleanItemsId}")
public AjaxResult getInfo(@PathVariable("cleanItemsId") Long cleanItemsId)
{
// return success(cleanItemsService.selectCleanItemsByCleanItemsId(cleanItemsId));
return null;
}
/**
* 新增清洁物品
*/
@PreAuthorize("@ss.hasPermi('catdog:items:add')")
@Log(title = "清洁物品", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CleanItems cleanItems)
{
return toAjax(cleanItemsService.insertCleanItems(cleanItems));
}
/**
* 修改清洁物品
*/
@PreAuthorize("@ss.hasPermi('catdog:items:edit')")
@Log(title = "清洁物品", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CleanItems cleanItems)
{
return toAjax(cleanItemsService.updateCleanItems(cleanItems));
}
/**
* 删除清洁物品
*/
@PreAuthorize("@ss.hasPermi('catdog:items:remove')")
@Log(title = "清洁物品", businessType = BusinessType.DELETE)
@DeleteMapping("/{cleanItemsIds}")
public AjaxResult remove(@PathVariable Long[] cleanItemsIds)
{
return toAjax(cleanItemsService.deleteCleanItemsByCleanItemsIds(cleanItemsIds));
}
}