123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- package com.ruoyi.web.controller.app;
- import java.util.List;
- import javax.servlet.http.HttpServletResponse;
- import com.ruoyi.app.domain.PigCategory;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.validation.annotation.Validated;
- 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.app.domain.Pigpen;
- import com.ruoyi.app.service.IPigpenService;
- import com.ruoyi.common.utils.poi.ExcelUtil;
- import com.ruoyi.common.core.page.TableDataInfo;
- /**
- * 待宰圈Controller
- *
- * @author coede
- * @date 2025-03-19
- */
- @RestController
- @RequestMapping("/app/pigpen")
- public class PigpenController extends BaseController
- {
- @Autowired
- private IPigpenService pigpenService;
- /**
- * 查询待宰圈列表
- */
- @PreAuthorize("@ss.hasPermi('app:pigpen:list')")
- @GetMapping("/list")
- public TableDataInfo list(Pigpen pigpen)
- {
- startPage();
- List<Pigpen> list = pigpenService.selectPigpenList(pigpen);
- return getDataTable(list);
- }
- /**
- * 导出待宰圈列表
- */
- @PreAuthorize("@ss.hasPermi('app:pigpen:export')")
- @Log(title = "待宰圈", businessType = BusinessType.EXPORT)
- @PostMapping("/export")
- public void export(HttpServletResponse response, Pigpen pigpen)
- {
- List<Pigpen> list = pigpenService.selectPigpenList(pigpen);
- ExcelUtil<Pigpen> util = new ExcelUtil<Pigpen>(Pigpen.class);
- util.exportExcel(response, list, "待宰圈数据");
- }
- /**
- * 获取待宰圈详细信息
- */
- @PreAuthorize("@ss.hasPermi('app:pigpen:query')")
- @GetMapping(value = "/{id}")
- public AjaxResult getInfo(@PathVariable("id") Long id)
- {
- return success(pigpenService.selectPigpenById(id));
- }
- /**
- * 新增待宰圈
- */
- @PreAuthorize("@ss.hasPermi('app:pigpen:add')")
- @Log(title = "待宰圈", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@Validated @RequestBody Pigpen pigpen)
- {
- if (!pigpenService.checkPigpenNameUnique(pigpen))
- {
- return error("新增待宰圈'" + pigpen.getPigpenName() + "'失败,列表中存在重复的待宰圈号");
- }
- pigpen.setCreateBy(getUsername());
- return toAjax(pigpenService.insertPigpen(pigpen));
- }
- /**
- * 修改待宰圈
- */
- @PreAuthorize("@ss.hasPermi('app:pigpen:edit')")
- @Log(title = "待宰圈", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@Validated @RequestBody Pigpen pigpen)
- {
- if (!pigpenService.checkPigpenNameUnique(pigpen))
- {
- return error("修改待宰圈'" + pigpen.getPigpenName() + "'失败,列表中存在重复的待宰圈号");
- }
- pigpen.setUpdateBy(getUsername());
- return toAjax(pigpenService.updatePigpen(pigpen));
- }
- /**
- * 删除待宰圈
- */
- @PreAuthorize("@ss.hasPermi('app:pigpen:remove')")
- @Log(title = "待宰圈", businessType = BusinessType.DELETE)
- @DeleteMapping("/{ids}")
- public AjaxResult remove(@PathVariable Long[] ids)
- {
- return toAjax(pigpenService.deletePigpenByIds(ids));
- }
- /**
- * 获取待宰圈选择框列表
- */
- @GetMapping("/optionselect")
- public AjaxResult optionselect()
- {
- Pigpen pigpen = new Pigpen();
- List<Pigpen> list = pigpenService.selectPigpenList(pigpen);
- return success(list);
- }
- }
|