diff --git a/klp-admin/pom.xml b/klp-admin/pom.xml index d289d8ac..102d6552 100644 --- a/klp-admin/pom.xml +++ b/klp-admin/pom.xml @@ -89,6 +89,11 @@ com.klp klp-wms + + + com.klp + klp-mes + diff --git a/klp-mes/src/main/java/com/klp/mes/dv/controller/DvSubjectController.java b/klp-mes/src/main/java/com/klp/mes/dv/controller/DvSubjectController.java new file mode 100644 index 00000000..fa8c7f67 --- /dev/null +++ b/klp-mes/src/main/java/com/klp/mes/dv/controller/DvSubjectController.java @@ -0,0 +1,104 @@ +package com.klp.mes.dv.controller; + +import com.klp.common.annotation.Log; +import com.klp.common.constant.UserConstants; +import com.klp.common.core.controller.BaseController; +import com.klp.common.core.domain.AjaxResult; +import com.klp.common.core.domain.R; +import com.klp.common.core.page.TableDataInfo; +import com.klp.common.enums.BusinessType; +import com.klp.common.excel.ExcelUtil; +import com.klp.mes.dv.domain.DvSubject; +import com.klp.mes.dv.service.IDvSubjectService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 设备点检保养项目Controller + * + * @author yinjinlu + * @date 2022-06-16 + */ +@RestController +@RequestMapping("/mes/dv/dvsubject") +public class DvSubjectController extends BaseController +{ + @Autowired + private IDvSubjectService dvSubjectService; + + /** + * 查询设备点检保养项目列表 + */ + @GetMapping("/list") + public TableDataInfo list(DvSubject dvSubject) + { + startPage(); + List list = dvSubjectService.selectDvSubjectList(dvSubject); + return getDataTable(list); + } + + /** + * 导出设备点检保养项目列表 + */ + + @Log(title = "设备点检保养项目", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DvSubject dvSubject) + { + List list = dvSubjectService.selectDvSubjectList(dvSubject); + ExcelUtil util = new ExcelUtil(DvSubject.class); + util.exportExcel(response, list, "设备点检保养项目数据"); + } + + /** + * 获取设备点检保养项目详细信息 + */ + + @GetMapping(value = "/{subjectId}") + public AjaxResult getInfo(@PathVariable("subjectId") Long subjectId) + { + return AjaxResult.success(dvSubjectService.selectDvSubjectBySubjectId(subjectId)); + } + + /** + * 新增设备点检保养项目 + */ + + @Log(title = "设备点检保养项目", businessType = BusinessType.INSERT) + @PostMapping + public R add(@RequestBody DvSubject dvSubject) + { + if(UserConstants.NOT_UNIQUE.equals(dvSubjectService.checkSubjectCodeUnique(dvSubject))){ + return R.fail("项目编码已存在!"); + } + return toAjax(dvSubjectService.insertDvSubject(dvSubject)); + } + + /** + * 修改设备点检保养项目 + */ + + @Log(title = "设备点检保养项目", businessType = BusinessType.UPDATE) + @PutMapping + public R edit(@RequestBody DvSubject dvSubject) + { + if(UserConstants.NOT_UNIQUE.equals(dvSubjectService.checkSubjectCodeUnique(dvSubject))){ + return R.fail("项目编码已存在!"); + } + return toAjax(dvSubjectService.updateDvSubject(dvSubject)); + } + + /** + * 删除设备点检保养项目 + */ + + @Log(title = "设备点检保养项目", businessType = BusinessType.DELETE) + @DeleteMapping("/{subjectIds}") + public R remove(@PathVariable Long[] subjectIds) + { + return toAjax(dvSubjectService.deleteDvSubjectBySubjectIds(subjectIds)); + } +} diff --git a/pom.xml b/pom.xml index 222b8bdf..055b4d22 100644 --- a/pom.xml +++ b/pom.xml @@ -369,7 +369,11 @@ klp-reader ${klp-flowable-plus.version} - + + com.klp + klp-mes + ${klp-flowable-plus.version} +