diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/controller/WsMaInfoController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/controller/WsMaInfoController.java index 7b101472..ed070fb2 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/controller/WsMaInfoController.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/controller/WsMaInfoController.java @@ -126,4 +126,25 @@ public class WsMaInfoController extends BaseController { public AjaxResult addWsMaInfoData(@RequestBody WsMaInfo info) { return service.addWsMaInfoData(info); } + + @ApiOperation(value = "删除小工具编码信息") + @SysLog(title = "删除小工具编码信息", businessType = OperaType.DELETE, logType = 1, module = "小工具编码信息管理->删除") + @PostMapping("/delGadget") + public AjaxResult delGadget(@RequestBody WsMaInfo info) { + return service.delGadget(info); + } + + @ApiOperation(value = "根据ID获取小工具信息") + @SysLog(title = "机具信息查询", businessType = OperaType.QUERY, logType = 1, module = "小工具编码信息管理->查询") + @GetMapping("/getGadgetInfo/{id}") + public AjaxResult getGadgetInfo(@PathVariable Integer id) { + return service.getGadgetInfo(id); + } + + @ApiOperation(value = "更新小工具信息") + @SysLog(title = "更新小工具信息", businessType = OperaType.UPDATE, logType = 1, module = "小工具编码信息管理->更新") + @PostMapping("/updateGadgetInfo") + public AjaxResult updateGadgetInfo(@RequestBody WsMaInfo info) { + return service.updateGadgetInfo(info); + } } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/domain/WsMaInfo.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/domain/WsMaInfo.java index 4350bbc5..f6a5d2d1 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/domain/WsMaInfo.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/domain/WsMaInfo.java @@ -128,4 +128,7 @@ public class WsMaInfo { @ApiModelProperty(value = "结束时间") private String endTime; + + private Long deviceTypeId; + private Long deviceModelId; } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java index a4fe6f56..02f400bf 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/mapper/WsMaInfoMapper.java @@ -114,4 +114,32 @@ public interface WsMaInfoMapper { * @return 机具信息集合 */ int selectCountByCode(WsMaInfo info); + + /** + * 删除小工具编码信息 + * @param info 删除条件 + * @return 条数 + */ + int delGadget(WsMaInfo info); + + /** + * 根据ID获取小工具信息 + * @param id ID + * @return 机具信息 + */ + WsMaInfo getGadgetInfo(Integer id); + + /** + * 根据机型、规格、编码查询机具信息 + * @param info 查询条件 + * @return 机具信息 + */ + WsMaInfo getInfoByTypeAndModelAndCode(WsMaInfo info); + + /** + * 更新小工具信息 + * @param info 更新条件 + * @return 条数 + */ + int updateGadgetInfo(WsMaInfo info); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/WsMaInfoService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/WsMaInfoService.java index dce7612a..1b6808d3 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/WsMaInfoService.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/WsMaInfoService.java @@ -99,4 +99,25 @@ public interface WsMaInfoService { * @return */ AjaxResult addWsMaInfoData(WsMaInfo info); + + /** + * 删除小工具编码信息 + * @param info + * @return + */ + AjaxResult delGadget(WsMaInfo info); + + /** + * 根据ID获取小工具信息 + * @param id + * @return + */ + AjaxResult getGadgetInfo(Integer id); + + /** + * 更新小工具信息 + * @param info + * @return + */ + AjaxResult updateGadgetInfo(WsMaInfo info); } diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/impl/WsMaInfoServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/impl/WsMaInfoServiceImpl.java index a59c6746..3eade8d3 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/impl/WsMaInfoServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/codeCollection/service/impl/WsMaInfoServiceImpl.java @@ -238,4 +238,47 @@ public class WsMaInfoServiceImpl implements WsMaInfoService { return AjaxResult.error("添加小工具编码信息列表失败"); } } + + @Override + public AjaxResult delGadget(WsMaInfo info) { + try { + int i = mapper.delGadget(info); + return i > 0 ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败"); + } catch (Exception e) { + log.error("删除小工具编码信息列表:", e.getMessage()); + return AjaxResult.error("删除失败"); + } + } + + @Override + public AjaxResult getGadgetInfo(Integer id) { + try { + WsMaInfo info = mapper.getGadgetInfo(id); + return AjaxResult.success(info); + } catch (Exception e) { + log.error("查询小工具编码信息列表:", e.getMessage()); + return AjaxResult.error("查询失败"); + } + } + + @Override + public AjaxResult updateGadgetInfo(WsMaInfo info) { + try { + if (info.getId() == null) { + return AjaxResult.error("ID不能为空"); + } + //查询是否存在,如果存在id不同则不能更新 + //用传入的类型、型号、编号查询记录 + WsMaInfo wsMaInfo = mapper.getInfoByTypeAndModelAndCode(info); + if (wsMaInfo != null && !wsMaInfo.getId().equals(info.getId())) { + return AjaxResult.error("该类型下此编码已存在"); + } + info.setOptUser(SecurityUtils.getLoginUser().getSysUser().getNickName()); + int i = mapper.updateGadgetInfo(info); + return i > 0 ? AjaxResult.success("更新成功") : AjaxResult.error("更新失败"); + } catch (Exception e) { + log.error("更新小工具编码信息列表:", e.getMessage()); + return AjaxResult.error("更新失败"); + } + } } diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/codeCollection/WsMaInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/codeCollection/WsMaInfoMapper.xml index f69b555d..750e9bc4 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/codeCollection/WsMaInfoMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/codeCollection/WsMaInfoMapper.xml @@ -151,6 +151,34 @@ ]]> + - - + INSERT INTO ws_ma_info (ma_name, ma_model, ma_code, supplier, this_check_time, next_check_time, @@ -212,12 +254,33 @@ update_time = NOW() WHERE ma_code = #{maCode} + + UPDATE ws_ma_info + SET ma_name = #{maName}, + ma_model = #{maModel}, + ma_code = #{maCode}, + this_check_time = #{thisCheckTime}, + next_check_time = #{nextCheckTime}, + repair_man = #{repairMan}, + check_man = #{checkMan}, + phone = #{phone}, + result = #{result}, + model_id = #{modelId}, + opt_user = #{optUser}, + opt_time = NOW() + WHERE id = #{id} + DELETE FROM ws_ma_info WHERE id = #{id} + + DELETE + FROM ws_ma_info + WHERE id = #{id} +