From 2efd13594d61d0c9cd6f9b0f3d10b9be2a87cba4 Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Fri, 13 Oct 2023 11:02:39 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E6=95=85=E9=9A=9C=E7=B1=BB=E5=9E=8BV1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../op/device/config/DynamicDatasource.java | 53 +++++ .../controller/EquFaultTypeController.java | 119 ++++++------ .../op/device/mapper/EquFaultTypeMapper.java | 10 +- .../device/service/IEquFaultTypeService.java | 4 +- .../service/impl/EquCheckItemServiceImpl.java | 3 +- .../service/impl/EquFaultTypeServiceImpl.java | 182 +++++++++++------- .../mapper/device/EquFaultTypeMapper.xml | 15 +- 7 files changed, 247 insertions(+), 139 deletions(-) create mode 100644 op-modules/op-device/src/main/java/com/op/device/config/DynamicDatasource.java diff --git a/op-modules/op-device/src/main/java/com/op/device/config/DynamicDatasource.java b/op-modules/op-device/src/main/java/com/op/device/config/DynamicDatasource.java new file mode 100644 index 00000000..0a04d199 --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/config/DynamicDatasource.java @@ -0,0 +1,53 @@ +package com.op.device.config; + +import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty; +import com.op.common.core.domain.R; +import com.op.common.datasource.creator.DynamicDatasourceCreator; +import com.op.system.api.RemoteUserService; +import com.op.system.api.domain.SysUser; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * 初始化动态数据源 + * + * @ClassName: DynamicDatasource + * @Description: TODO + * @author shichangzhou + * @date 2023年4月19日 下午1:01:30 + */ +@Component +public class DynamicDatasource { + + @Resource + private DynamicDatasourceCreator dynamicDatasourceCreator; + @Autowired + private RemoteUserService remoteUserService; + + @PostConstruct + public void init() { + // 加载sf-cloud库的sys_datasource + SysUser sysUser = new SysUser(); + sysUser.setUserId(1L); + R>> dateSources0 = remoteUserService.getPoolNameList(sysUser); + List> dateSources = dateSources0.getData(); + for (Map dateSource : dateSources) { + DataSourceProperty sdp = new DataSourceProperty(); + sdp.setUrl(dateSource.get("url")); + sdp.setUsername(dateSource.get("userName")); + sdp.setPassword(dateSource.get("password")); + sdp.setDriverClassName(dateSource.get("driveClassName")); + sdp.setPoolName(dateSource.get("poolName"));// 这是数据源的key + sdp.setLazy(false); + dynamicDatasourceCreator.createDynamicDataSource(sdp); + } + + } +} diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquFaultTypeController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquFaultTypeController.java index a2a66249..5c0ffa5e 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquFaultTypeController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquFaultTypeController.java @@ -2,6 +2,7 @@ package com.op.device.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -23,75 +24,75 @@ import com.op.common.core.web.page.TableDataInfo; /** * 故障类型维护Controller - * + * * @author wws * @date 2023-10-12 */ @RestController @RequestMapping("/faultType") public class EquFaultTypeController extends BaseController { - @Autowired - private IEquFaultTypeService equFaultTypeService; + @Autowired + private IEquFaultTypeService equFaultTypeService; - /** - * 查询故障类型维护列表 - */ - @RequiresPermissions("device:faultType:list") - @GetMapping("/list") - public TableDataInfo list(EquFaultType equFaultType) { - startPage(); - List list = equFaultTypeService.selectEquFaultTypeList(equFaultType); - return getDataTable(list); - } + /** + * 查询故障类型维护列表 + */ + @RequiresPermissions("device:faultType:list") + @GetMapping("/list") + public TableDataInfo list(EquFaultType equFaultType) { + startPage(); + List list = equFaultTypeService.selectEquFaultTypeList(equFaultType); + return getDataTable(list); + } - /** - * 导出故障类型维护列表 - */ - @RequiresPermissions("device:faultType:export") - @Log(title = "故障类型维护", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public void export(HttpServletResponse response, EquFaultType equFaultType) { - List list = equFaultTypeService.selectEquFaultTypeList(equFaultType); - ExcelUtil util = new ExcelUtil(EquFaultType.class); - util.exportExcel(response, list, "故障类型维护数据"); - } + /** + * 导出故障类型维护列表 + */ + @RequiresPermissions("device:faultType:export") + @Log(title = "故障类型维护", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, EquFaultType equFaultType) { + List list = equFaultTypeService.selectEquFaultTypeList(equFaultType); + ExcelUtil util = new ExcelUtil(EquFaultType.class); + util.exportExcel(response, list, "故障类型维护数据"); + } - /** - * 获取故障类型维护详细信息 - */ - @RequiresPermissions("device:faultType:query") - @GetMapping(value = "/{faultId}") - public AjaxResult getInfo(@PathVariable("faultId") String faultId) { - return success(equFaultTypeService.selectEquFaultTypeByFaultId(faultId)); - } + /** + * 获取故障类型维护详细信息 + */ + @RequiresPermissions("device:faultType:query") + @GetMapping(value = "/{faultId}") + public AjaxResult getInfo(@PathVariable("faultId") String faultId) { + return success(equFaultTypeService.selectEquFaultTypeByFaultId(faultId)); + } - /** - * 新增故障类型维护 - */ - @RequiresPermissions("device:faultType:add") - @Log(title = "故障类型维护", businessType = BusinessType.INSERT) - @PostMapping - public AjaxResult add(@RequestBody EquFaultType equFaultType) { - return toAjax(equFaultTypeService.insertEquFaultType(equFaultType)); - } + /** + * 新增故障类型维护 + */ + @RequiresPermissions("device:faultType:add") + @Log(title = "故障类型维护", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody EquFaultType equFaultType) { + return equFaultTypeService.insertEquFaultType(equFaultType); + } - /** - * 修改故障类型维护 - */ - @RequiresPermissions("device:faultType:edit") - @Log(title = "故障类型维护", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody EquFaultType equFaultType) { - return toAjax(equFaultTypeService.updateEquFaultType(equFaultType)); - } + /** + * 修改故障类型维护 + */ + @RequiresPermissions("device:faultType:edit") + @Log(title = "故障类型维护", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody EquFaultType equFaultType) { + return toAjax(equFaultTypeService.updateEquFaultType(equFaultType)); + } - /** - * 删除故障类型维护 - */ - @RequiresPermissions("device:faultType:remove") - @Log(title = "故障类型维护", businessType = BusinessType.DELETE) - @DeleteMapping("/{faultIds}") - public AjaxResult remove(@PathVariable String[] faultIds) { - return toAjax(equFaultTypeService.deleteEquFaultTypeByFaultIds(faultIds)); - } + /** + * 删除故障类型维护 + */ + @RequiresPermissions("device:faultType:remove") + @Log(title = "故障类型维护", businessType = BusinessType.DELETE) + @DeleteMapping("/{faultIds}") + public AjaxResult remove(@PathVariable String[] faultIds) { + return toAjax(equFaultTypeService.deleteEquFaultTypeByFaultIds(faultIds)); + } } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquFaultTypeMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquFaultTypeMapper.java index af25869e..8f33ec25 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquFaultTypeMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquFaultTypeMapper.java @@ -44,7 +44,7 @@ public interface EquFaultTypeMapper { public int updateEquFaultType(EquFaultType equFaultType); /** - * 删除故障类型维护 + * 删除故障类型维护-逻辑 * * @param faultId 故障类型维护主键 * @return 结果 @@ -52,10 +52,16 @@ public interface EquFaultTypeMapper { public int deleteEquFaultTypeByFaultId(String faultId); /** - * 批量删除故障类型维护 + * 批量删除故障类型维护-逻辑 * * @param faultIds 需要删除的数据主键集合 * @return 结果 */ public int deleteEquFaultTypeByFaultIds(String[] faultIds); + + /** + * 获取流水号 + * @return + */ + int selectSerialNumber(); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IEquFaultTypeService.java b/op-modules/op-device/src/main/java/com/op/device/service/IEquFaultTypeService.java index f7181501..01c55cb0 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IEquFaultTypeService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IEquFaultTypeService.java @@ -1,6 +1,8 @@ package com.op.device.service; import java.util.List; + +import com.op.common.core.web.domain.AjaxResult; import com.op.device.domain.EquFaultType; /** @@ -32,7 +34,7 @@ public interface IEquFaultTypeService { * @param equFaultType 故障类型维护 * @return 结果 */ - public int insertEquFaultType(EquFaultType equFaultType); + public AjaxResult insertEquFaultType(EquFaultType equFaultType); /** * 修改故障类型维护 diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java index 8f95d4cf..2c496052 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java @@ -4,13 +4,11 @@ import java.text.Format; import java.text.SimpleDateFormat; import java.util.List; -import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.context.SecurityContextHolder; import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.web.domain.AjaxResult; -import com.op.common.log.annotation.Log; import com.op.device.domain.EquCheckItemDetail; import com.op.device.domain.EquItemEquipment; import com.op.device.domain.dto.EquCheckItemDTO; @@ -313,6 +311,7 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { * @return */ @Override + @DS("#header.poolName") public AjaxResult getEquipmentCodeListByItemCode(String itemCode) { List equipmentCodeList = equItemEquipmentMapper.selectEquipmentCodeList(itemCode); return success(equipmentCodeList); diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquFaultTypeServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquFaultTypeServiceImpl.java index 82fa9579..f476ed68 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquFaultTypeServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquFaultTypeServiceImpl.java @@ -1,89 +1,129 @@ package com.op.device.service.impl; import java.util.List; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.op.common.core.context.SecurityContextHolder; import com.op.common.core.utils.DateUtils; +import com.op.common.core.utils.uuid.IdUtils; +import com.op.common.core.web.domain.AjaxResult; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.op.device.mapper.EquFaultTypeMapper; import com.op.device.domain.EquFaultType; import com.op.device.service.IEquFaultTypeService; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; + +import static com.op.common.core.web.domain.AjaxResult.error; +import static com.op.common.core.web.domain.AjaxResult.success; /** * 故障类型维护Service业务层处理 - * + * * @author wws * @date 2023-10-12 */ @Service public class EquFaultTypeServiceImpl implements IEquFaultTypeService { - @Autowired - private EquFaultTypeMapper equFaultTypeMapper; - - /** - * 查询故障类型维护 - * - * @param faultId 故障类型维护主键 - * @return 故障类型维护 - */ - @Override - public EquFaultType selectEquFaultTypeByFaultId(String faultId) { - return equFaultTypeMapper.selectEquFaultTypeByFaultId(faultId); - } - - /** - * 查询故障类型维护列表 - * - * @param equFaultType 故障类型维护 - * @return 故障类型维护 - */ - @Override - public List selectEquFaultTypeList(EquFaultType equFaultType) { - return equFaultTypeMapper.selectEquFaultTypeList(equFaultType); - } - - /** - * 新增故障类型维护 - * - * @param equFaultType 故障类型维护 - * @return 结果 - */ - @Override - public int insertEquFaultType(EquFaultType equFaultType) { - equFaultType.setCreateTime(DateUtils.getNowDate()); - return equFaultTypeMapper.insertEquFaultType(equFaultType); - } - - /** - * 修改故障类型维护 - * - * @param equFaultType 故障类型维护 - * @return 结果 - */ - @Override - public int updateEquFaultType(EquFaultType equFaultType) { - equFaultType.setUpdateTime(DateUtils.getNowDate()); - return equFaultTypeMapper.updateEquFaultType(equFaultType); - } - - /** - * 批量删除故障类型维护 - * - * @param faultIds 需要删除的故障类型维护主键 - * @return 结果 - */ - @Override - public int deleteEquFaultTypeByFaultIds(String[] faultIds) { - return equFaultTypeMapper.deleteEquFaultTypeByFaultIds(faultIds); - } - - /** - * 删除故障类型维护信息 - * - * @param faultId 故障类型维护主键 - * @return 结果 - */ - @Override - public int deleteEquFaultTypeByFaultId(String faultId) { - return equFaultTypeMapper.deleteEquFaultTypeByFaultId(faultId); - } + @Autowired + private EquFaultTypeMapper equFaultTypeMapper; + + /** + * 查询故障类型维护 + * + * @param faultId 故障类型维护主键 + * @return 故障类型维护 + */ + @Override + @DS("#header.poolName") + public EquFaultType selectEquFaultTypeByFaultId(String faultId) { + return equFaultTypeMapper.selectEquFaultTypeByFaultId(faultId); + } + + /** + * 查询故障类型维护列表 + * + * @param equFaultType 故障类型维护 + * @return 故障类型维护 + */ + @Override + @DS("#header.poolName") + public List selectEquFaultTypeList(EquFaultType equFaultType) { + return equFaultTypeMapper.selectEquFaultTypeList(equFaultType); + } + + /** + * 新增故障类型维护 + * + * @param equFaultType 故障类型维护 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public AjaxResult insertEquFaultType(EquFaultType equFaultType) { + + //获取当前所选工厂 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + String str = request.getHeader(key.substring(8)); + int index = str.indexOf("_"); + String factory = str.substring(index + 1); + + // 获取检查项流水号 + String serialNum = String.format("%03d", equFaultTypeMapper.selectSerialNumber()); + + // 处理故障信息 + equFaultType.setFaultId(IdUtils.fastSimpleUUID()); + equFaultType.setFaultCode(DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + serialNum); + equFaultType.setFactoryCode(factory); + equFaultType.setCreateBy(SecurityContextHolder.getUserName()); + equFaultType.setCreateTime(DateUtils.getNowDate()); + equFaultType.setUpdateBy(SecurityContextHolder.getUserName()); + equFaultType.setUpdateTime(DateUtils.getNowDate()); + + // 插入数据库 + equFaultTypeMapper.insertEquFaultType(equFaultType); + + return success(); + } + + /** + * 修改故障类型维护 + * + * @param equFaultType 故障类型维护 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int updateEquFaultType(EquFaultType equFaultType) { + equFaultType.setUpdateTime(DateUtils.getNowDate()); + return equFaultTypeMapper.updateEquFaultType(equFaultType); + } + + /** + * 批量删除故障类型维护 + * + * @param faultIds 需要删除的故障类型维护主键 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int deleteEquFaultTypeByFaultIds(String[] faultIds) { + return equFaultTypeMapper.deleteEquFaultTypeByFaultIds(faultIds); + } + + /** + * 删除故障类型维护信息 + * + * @param faultId 故障类型维护主键 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int deleteEquFaultTypeByFaultId(String faultId) { + return equFaultTypeMapper.deleteEquFaultTypeByFaultId(faultId); + } } diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquFaultTypeMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquFaultTypeMapper.xml index abee114c..eac4783d 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquFaultTypeMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquFaultTypeMapper.xml @@ -41,15 +41,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and create_time = #{createTime} and update_by = #{updateBy} and update_time = #{updateTime} + and del_flag = '0' - - + + + + insert into equ_fault_type fault_id, @@ -102,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_by = #{updateBy}, update_time = #{updateTime}, - where fault_id = #{faultId} + where fault_id = #{faultId} and del_flag = '0' From 433a307c759489263f8c545aa077a205dca61fc6 Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Fri, 13 Oct 2023 11:44:33 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E5=88=9B=E5=BB=BA/=E6=9B=B4=E6=96=B0=E5=AD=97=E6=AE=B5BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/op/device/domain/EquCheckItem.java | 60 +++++++++---------- .../op/device/domain/EquCheckItemDetail.java | 48 +++++++-------- .../op/device/domain/EquItemEquipment.java | 48 +++++++-------- .../op/device/domain/dto/EquCheckItemDTO.java | 50 ++++++++-------- .../op/device/domain/vo/EquCheckItemVO.java | 40 ++++++------- .../service/impl/EquCheckItemServiceImpl.java | 52 ++++++++-------- .../device/EquCheckItemDetailMapper.xml | 46 +++++++------- .../mapper/device/EquCheckItemMapper.xml | 50 ++++++++-------- .../mapper/device/EquItemEquipmentMapper.xml | 44 +++++++------- 9 files changed, 219 insertions(+), 219 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquCheckItem.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquCheckItem.java index 897791b3..de557fa7 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquCheckItem.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquCheckItem.java @@ -68,23 +68,23 @@ public class EquCheckItem extends BaseEntity { /** 创建时间 */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date createdTime; + private Date createTime; /** 创建人 */ @Excel(name = "创建人") - private String createdBy; + private String createBy; /** 更新时间 */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date updatedTime; + private Date updateTime; /** 更新人 */ @Excel(name = "更新人") - private String updatedBy; + private String updateBy; // 创建日期范围list - private List createdTimeArray; + private List createTimeArray; // 更新日期范围list private List updateTimeArray; @@ -141,12 +141,12 @@ public class EquCheckItem extends BaseEntity { this.createTimeEnd = createTimeEnd; } - public List getCreatedTimeArray() { - return createdTimeArray; + public List getCreateTimeArray() { + return createTimeArray; } - public void setCreatedTimeArray(List createdTimeArray) { - this.createdTimeArray = createdTimeArray; + public void setCreateTimeArray(List createTimeArray) { + this.createTimeArray = createTimeArray; } public void setItemId(String itemId) { @@ -233,33 +233,33 @@ public class EquCheckItem extends BaseEntity { public String getDelFlag() { return delFlag; } - public void setCreatedTime(Date createdTime) { - this.createdTime = createdTime; + public void setCreateTime(Date createTime) { + this.createTime = createTime; } - public Date getCreatedTime() { - return createdTime; + public Date getCreateTime() { + return createTime; } - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; + public void setCreateBy(String createBy) { + this.createBy = createBy; } - public String getCreatedBy() { - return createdBy; + public String getCreateBy() { + return createBy; } - public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; } - public Date getUpdatedTime() { - return updatedTime; + public Date getUpdateTime() { + return updateTime; } - public void setUpdatedBy(String updatedBy) { - this.updatedBy = updatedBy; + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; } - public String getUpdatedBy() { - return updatedBy; + public String getUpdateBy() { + return updateBy; } @Override @@ -277,11 +277,11 @@ public class EquCheckItem extends BaseEntity { .append("attr2", getAttr2()) .append("attr3", getAttr3()) .append("delFlag", getDelFlag()) - .append("createdTime", getCreatedTime()) - .append("createdBy", getCreatedBy()) - .append("updatedTime", getUpdatedTime()) - .append("updatedBy", getUpdatedBy()) - .append("createdTimeArray",getCreatedTimeArray()) + .append("createTime", getCreateTime()) + .append("createBy", getCreateBy()) + .append("updateTime", getUpdateTime()) + .append("updateBy", getUpdateBy()) + .append("createTimeArray",getCreateTimeArray()) .toString(); } } diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquCheckItemDetail.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquCheckItemDetail.java index 9a527c27..09358df4 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquCheckItemDetail.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquCheckItemDetail.java @@ -66,20 +66,20 @@ public class EquCheckItemDetail extends BaseEntity { /** 创建时间 */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date createdTime; + private Date createTime; /** 创建人 */ @Excel(name = "创建人") - private String createdBy; + private String createBy; /** 更新时间 */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date updatedTime; + private Date updateTime; /** 更新人 */ @Excel(name = "更新人") - private String updatedBy; + private String updateBy; /** 详情编码 */ @Excel(name = "详情编码") @@ -177,33 +177,33 @@ public class EquCheckItemDetail extends BaseEntity { public String getDelFlag() { return delFlag; } - public void setCreatedTime(Date createdTime) { - this.createdTime = createdTime; + public void setCreateTime(Date createTime) { + this.createTime = createTime; } - public Date getCreatedTime() { - return createdTime; + public Date getCreateTime() { + return createTime; } - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; + public void setCreateBy(String createBy) { + this.createBy = createBy; } - public String getCreatedBy() { - return createdBy; + public String getCreateBy() { + return createBy; } - public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; } - public Date getUpdatedTime() { - return updatedTime; + public Date getUpdateTime() { + return updateTime; } - public void setUpdatedBy(String updatedBy) { - this.updatedBy = updatedBy; + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; } - public String getUpdatedBy() { - return updatedBy; + public String getUpdateBy() { + return updateBy; } @Override @@ -221,10 +221,10 @@ public class EquCheckItemDetail extends BaseEntity { .append("attr2", getAttr2()) .append("attr3", getAttr3()) .append("delFlag", getDelFlag()) - .append("createdTime", getCreatedTime()) - .append("createdBy", getCreatedBy()) - .append("updatedTime", getUpdatedTime()) - .append("updatedBy", getUpdatedBy()) + .append("createTime", getCreateTime()) + .append("createBy", getCreateBy()) + .append("updateTime", getUpdateTime()) + .append("updateBy", getUpdateBy()) .append("detailCode", getDetailCode()) .toString(); } diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquItemEquipment.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquItemEquipment.java index 99f7d1f0..31328f1e 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquItemEquipment.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquItemEquipment.java @@ -52,21 +52,21 @@ public class EquItemEquipment extends BaseEntity { /** 创建人 */ @Excel(name = "创建人") - private String createdBy; + private String createBy; /** 创建时间 */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date createdTime; + private Date createTime; /** 更新人 */ @Excel(name = "更新人") - private String updatedBy; + private String updateBy; /** 更新时间 */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") - private Date updatedTime; + private Date updateTime; public void setId(String id) { this.id = id; @@ -131,33 +131,33 @@ public class EquItemEquipment extends BaseEntity { public String getDelFlag() { return delFlag; } - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; + public void setCreateBy(String createBy) { + this.createBy = createBy; } - public String getCreatedBy() { - return createdBy; + public String getCreateBy() { + return createBy; } - public void setCreatedTime(Date createdTime) { - this.createdTime = createdTime; + public void setCreateTime(Date createTime) { + this.createTime = createTime; } - public Date getCreatedTime() { - return createdTime; + public Date getCreateTime() { + return createTime; } - public void setUpdatedBy(String updatedBy) { - this.updatedBy = updatedBy; + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; } - public String getUpdatedBy() { - return updatedBy; + public String getUpdateBy() { + return updateBy; } - public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; } - public Date getUpdatedTime() { - return updatedTime; + public Date getUpdateTime() { + return updateTime; } @Override @@ -172,10 +172,10 @@ public class EquItemEquipment extends BaseEntity { .append("attr2", getAttr2()) .append("attr3", getAttr3()) .append("delFlag", getDelFlag()) - .append("createdBy", getCreatedBy()) - .append("createdTime", getCreatedTime()) - .append("updatedBy", getUpdatedBy()) - .append("updatedTime", getUpdatedTime()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) .toString(); } } diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/dto/EquCheckItemDTO.java b/op-modules/op-device/src/main/java/com/op/device/domain/dto/EquCheckItemDTO.java index cdc9204f..8e74f792 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/dto/EquCheckItemDTO.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/dto/EquCheckItemDTO.java @@ -32,17 +32,17 @@ public class EquCheckItemDTO { /** 删除标识 */ private String delFlag ; /** 创建时间 */ - private Date createdTime ; + private Date createTime ; /** 创建人 */ - private String createdBy ; + private String createBy ; /** 更新时间 */ - private Date updatedTime ; + private Date updateTime ; /** 更新人 */ - private String updatedBy ; + private String updateBy ; // 标准列表 private List formStandard; // 创建日期范围list - private List createdTimeArray; + private List createTimeArray; // 更新日期范围list private List updateTimeArray; @@ -70,12 +70,12 @@ public class EquCheckItemDTO { this.equipmentCodeList = equipmentCodeList; } - public List getCreatedTimeArray() { - return createdTimeArray; + public List getCreateTimeArray() { + return createTimeArray; } - public void setCreatedTimeArray(List createdTimeArray) { - this.createdTimeArray = createdTimeArray; + public void setCreateTimeArray(List createTimeArray) { + this.createTimeArray = createTimeArray; } public List getUpdateTimeArray() { @@ -214,36 +214,36 @@ public class EquCheckItemDTO { this.delFlag = delFlag; } - public Date getCreatedTime() { - return createdTime; + public Date getCreateTime() { + return createTime; } - public void setCreatedTime(Date createdTime) { - this.createdTime = createdTime; + public void setCreateTime(Date createTime) { + this.createTime = createTime; } - public String getCreatedBy() { - return createdBy; + public String getCreateBy() { + return createBy; } - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; + public void setCreateBy(String createBy) { + this.createBy = createBy; } - public Date getUpdatedTime() { - return updatedTime; + public Date getUpdateTime() { + return updateTime; } - public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; } - public String getUpdatedBy() { - return updatedBy; + public String getUpdateBy() { + return updateBy; } - public void setUpdatedBy(String updatedBy) { - this.updatedBy = updatedBy; + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; } public List getFormStandard() { diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/vo/EquCheckItemVO.java b/op-modules/op-device/src/main/java/com/op/device/domain/vo/EquCheckItemVO.java index 4c98a617..3f10a6d6 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/vo/EquCheckItemVO.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/vo/EquCheckItemVO.java @@ -32,13 +32,13 @@ public class EquCheckItemVO { /** 删除标识 */ private String delFlag ; /** 创建时间 */ - private Date createdTime ; + private Date createTime ; /** 创建人 */ - private String createdBy ; + private String createBy ; /** 更新时间 */ - private Date updatedTime ; + private Date updateTime ; /** 更新人 */ - private String updatedBy ; + private String updateBy ; // 标准列表 private List formStandard; // 设备名称 @@ -158,36 +158,36 @@ public class EquCheckItemVO { this.delFlag = delFlag; } - public Date getCreatedTime() { - return createdTime; + public Date getCreateTime() { + return createTime; } - public void setCreatedTime(Date createdTime) { - this.createdTime = createdTime; + public void setCreateTime(Date createTime) { + this.createTime = createTime; } - public String getCreatedBy() { - return createdBy; + public String getCreateBy() { + return createBy; } - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; + public void setCreateBy(String createBy) { + this.createBy = createBy; } - public Date getUpdatedTime() { - return updatedTime; + public Date getUpdateTime() { + return updateTime; } - public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; } - public String getUpdatedBy() { - return updatedBy; + public String getUpdateBy() { + return updateBy; } - public void setUpdatedBy(String updatedBy) { - this.updatedBy = updatedBy; + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; } public List getFormStandard() { diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java index 2c496052..86afb64e 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java @@ -74,12 +74,12 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { @Override @DS("#header.poolName") public List selectEquCheckItemList(EquCheckItem equCheckItem) { - if (equCheckItem.getCreatedTimeArray() != null) { + if (equCheckItem.getCreateTimeArray() != null) { // 设置创建日期开始和结束值 - if (equCheckItem.getCreatedTimeArray().size() == 2) { + if (equCheckItem.getCreateTimeArray().size() == 2) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); - equCheckItem.setCreateTimeStart(formatter.format(equCheckItem.getCreatedTimeArray().get(0))); - equCheckItem.setCreateTimeEnd(formatter.format(equCheckItem.getCreatedTimeArray().get(1))); + equCheckItem.setCreateTimeStart(formatter.format(equCheckItem.getCreateTimeArray().get(0))); + equCheckItem.setCreateTimeEnd(formatter.format(equCheckItem.getCreateTimeArray().get(1))); } } if (equCheckItem.getUpdateTimeArray() != null) { @@ -126,10 +126,10 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { equCheckItem.setItemId(IdUtils.fastSimpleUUID()); equCheckItem.setFactoryCode(factory); equCheckItem.setItemCode(DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + serialNum); - equCheckItem.setCreatedBy(SecurityContextHolder.getUserName()); - equCheckItem.setCreatedTime(DateUtils.getNowDate()); - equCheckItem.setUpdatedBy(SecurityContextHolder.getUserName()); - equCheckItem.setUpdatedTime(DateUtils.getNowDate()); + equCheckItem.setCreateBy(SecurityContextHolder.getUserName()); + equCheckItem.setCreateTime(DateUtils.getNowDate()); + equCheckItem.setUpdateBy(SecurityContextHolder.getUserName()); + equCheckItem.setUpdateTime(DateUtils.getNowDate()); if (equCheckItem.getItemType().equals("spotInspection")) { equCheckItem.setItemTypeName("点检"); } @@ -152,10 +152,10 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { detail.setParentCode(equCheckItem.getItemCode()); detail.setFactoryCode(factory); detail.setDetailCode(equCheckItem.getItemCode() + detailSerialNum); - detail.setCreatedBy(SecurityContextHolder.getUserName()); - detail.setCreatedTime(DateUtils.getNowDate()); - detail.setUpdatedBy(SecurityContextHolder.getUserName()); - detail.setUpdatedTime(DateUtils.getNowDate()); + detail.setCreateBy(SecurityContextHolder.getUserName()); + detail.setCreateTime(DateUtils.getNowDate()); + detail.setUpdateBy(SecurityContextHolder.getUserName()); + detail.setUpdateTime(DateUtils.getNowDate()); // 插入到数据库 equCheckItemDetailMapper.insertEquCheckItemDetail(detail); @@ -173,10 +173,10 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { equItemEquipment.setItemCode(equCheckItem.getItemCode()); equItemEquipment.setEquipmentCode(code); equItemEquipment.setFactoryCode(factory); - equItemEquipment.setCreatedBy(SecurityContextHolder.getUserName()); - equItemEquipment.setCreatedTime(DateUtils.getNowDate()); - equItemEquipment.setUpdatedBy(SecurityContextHolder.getUserName()); - equItemEquipment.setUpdatedTime(DateUtils.getNowDate()); + equItemEquipment.setCreateBy(SecurityContextHolder.getUserName()); + equItemEquipment.setCreateTime(DateUtils.getNowDate()); + equItemEquipment.setUpdateBy(SecurityContextHolder.getUserName()); + equItemEquipment.setUpdateTime(DateUtils.getNowDate()); // 插入数据库 equItemEquipmentMapper.insertEquItemEquipment(equItemEquipment); @@ -199,8 +199,8 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { BeanUtils.copyProperties(equCheckItemDTO, equCheckItem); // 处理检查项信息 - equCheckItem.setUpdatedBy(SecurityContextHolder.getUserName()); - equCheckItem.setUpdatedTime(DateUtils.getNowDate()); + equCheckItem.setUpdateBy(SecurityContextHolder.getUserName()); + equCheckItem.setUpdateTime(DateUtils.getNowDate()); if (equCheckItem.getItemType().equals("spotInspection")) { equCheckItem.setItemTypeName("点检"); } @@ -225,10 +225,10 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { detail.setParentCode(equCheckItem.getItemCode()); detail.setFactoryCode(equCheckItem.getFactoryCode()); detail.setDetailCode(equCheckItem.getItemCode() + detailSerialNum); - detail.setCreatedBy(SecurityContextHolder.getUserName()); - detail.setCreatedTime(DateUtils.getNowDate()); - detail.setUpdatedBy(SecurityContextHolder.getUserName()); - detail.setUpdatedTime(DateUtils.getNowDate()); + detail.setCreateBy(SecurityContextHolder.getUserName()); + detail.setCreateTime(DateUtils.getNowDate()); + detail.setUpdateBy(SecurityContextHolder.getUserName()); + detail.setUpdateTime(DateUtils.getNowDate()); // 插入到数据库 equCheckItemDetailMapper.insertEquCheckItemDetail(detail); @@ -249,10 +249,10 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { equItemEquipment.setItemCode(equCheckItem.getItemCode()); equItemEquipment.setEquipmentCode(code); equItemEquipment.setFactoryCode(equCheckItemDTO.getFactoryCode()); - equItemEquipment.setCreatedBy(SecurityContextHolder.getUserName()); - equItemEquipment.setCreatedTime(DateUtils.getNowDate()); - equItemEquipment.setUpdatedBy(SecurityContextHolder.getUserName()); - equItemEquipment.setUpdatedTime(DateUtils.getNowDate()); + equItemEquipment.setCreateBy(SecurityContextHolder.getUserName()); + equItemEquipment.setCreateTime(DateUtils.getNowDate()); + equItemEquipment.setUpdateBy(SecurityContextHolder.getUserName()); + equItemEquipment.setUpdateTime(DateUtils.getNowDate()); // 插入数据库 equItemEquipmentMapper.insertEquItemEquipment(equItemEquipment); diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml index 0cb9d421..84360378 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemDetailMapper.xml @@ -17,15 +17,15 @@ - - - - + + + + - select detail_id, parent_code, standard_type, standard_name, factory_code, detail_up_limit, detail_down_limit, detail_unit, attr1, attr2, attr3, del_flag, created_time, created_by, updated_time, updated_by, detail_code from equ_check_item_detail + select detail_id, parent_code, standard_type, standard_name, factory_code, detail_up_limit, detail_down_limit, detail_unit, attr1, attr2, attr3, del_flag, create_time, create_by, update_time, update_by, detail_code from equ_check_item_detail SELECT COUNT(detail_id)+1 AS serialNum FROM equ_check_item_detail - WHERE CONVERT(date, GETDATE()) = CONVERT(date,created_time) and parent_code = #{itemCode} and del_flag = '0' + WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) and parent_code = #{itemCode} and del_flag = '0' @@ -82,10 +82,10 @@ attr2, attr3, del_flag, - created_time, - created_by, - updated_time, - updated_by, + create_time, + create_by, + update_time, + update_by, detail_code, @@ -101,10 +101,10 @@ #{attr2}, #{attr3}, #{delFlag}, - #{createdTime}, - #{createdBy}, - #{updatedTime}, - #{updatedBy}, + #{createTime}, + #{createBy}, + #{updateTime}, + #{updateBy}, #{detailCode}, @@ -123,10 +123,10 @@ attr2 = #{attr2}, attr3 = #{attr3}, del_flag = #{delFlag}, - created_time = #{createdTime}, - created_by = #{createdBy}, - updated_time = #{updatedTime}, - updated_by = #{updatedBy}, + create_time = #{createTime}, + create_by = #{createBy}, + update_time = #{updateTime}, + update_by = #{updateBy}, detail_code = #{detailCode}, where detail_id = #{detailId} and del_flag = '0' diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml index 5439d400..a6e56013 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml @@ -17,14 +17,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - + + + + - select item_id, item_code, item_name, item_method, item_type, item_type_name, item_remark, factory_code, attr1, attr2, attr3, del_flag, created_time, created_by, updated_time, updated_by from equ_check_item + select item_id, item_code, item_name, item_method, item_type, item_type_name, item_remark, factory_code, attr1, attr2, attr3, del_flag, create_time, create_by, update_time, update_by from equ_check_item @@ -65,7 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -34,10 +34,10 @@ and attr1 = #{attr1} and attr2 = #{attr2} and attr3 = #{attr3} - and created_by = #{createdBy} - and created_time = #{createdTime} - and updated_by = #{updatedBy} - and updated_time = #{updatedTime} + and create_by = #{createBy} + and create_time = #{createTime} + and update_by = #{updateBy} + and update_time = #{updateTime} and del_flag = '0' @@ -50,7 +50,7 @@ + + insert into mes_report_work From 9b7791718c7192ada3a6d722fdaf130bc1a28f33 Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Fri, 13 Oct 2023 14:58:24 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E6=95=85=E9=9A=9C=E7=B1=BB=E5=9E=8BV1.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/EquFaultTypeController.java | 2 +- .../device/service/IEquFaultTypeService.java | 2 +- .../service/impl/EquCheckItemServiceImpl.java | 22 +++++++++++++-- .../service/impl/EquFaultTypeServiceImpl.java | 28 +++++++++++++++++-- .../mapper/device/EquFaultTypeMapper.xml | 4 +-- 5 files changed, 49 insertions(+), 9 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquFaultTypeController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquFaultTypeController.java index 5c0ffa5e..ff621ea9 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquFaultTypeController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquFaultTypeController.java @@ -83,7 +83,7 @@ public class EquFaultTypeController extends BaseController { @Log(title = "故障类型维护", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody EquFaultType equFaultType) { - return toAjax(equFaultTypeService.updateEquFaultType(equFaultType)); + return equFaultTypeService.updateEquFaultType(equFaultType); } /** diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IEquFaultTypeService.java b/op-modules/op-device/src/main/java/com/op/device/service/IEquFaultTypeService.java index 01c55cb0..fef90657 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IEquFaultTypeService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IEquFaultTypeService.java @@ -42,7 +42,7 @@ public interface IEquFaultTypeService { * @param equFaultType 故障类型维护 * @return 结果 */ - public int updateEquFaultType(EquFaultType equFaultType); + public AjaxResult updateEquFaultType(EquFaultType equFaultType); /** * 批量删除故障类型维护 diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java index 86afb64e..4ddaab8e 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java @@ -104,10 +104,14 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { @Transactional public AjaxResult insertEquCheckItem(EquCheckItemDTO equCheckItemDTO) { // 检验重复 - EquCheckItem checkItem = equCheckItemMapper.selectEquCheckItemByItemName(equCheckItemDTO.getItemName()); - if (checkItem != null) { - return error("检查项已存在!新增失败!"); + EquCheckItem checkItem = new EquCheckItem(); + checkItem.setItemType(equCheckItemDTO.getItemType()); + checkItem.setItemName(equCheckItemDTO.getItemName()); + List check = equCheckItemMapper.selectEquCheckItemList(checkItem); + if (check.size() > 0) { + return error(500,"检查项已存在!新增失败!"); } + // 创建检查项对象 EquCheckItem equCheckItem = new EquCheckItem(); BeanUtils.copyProperties(equCheckItemDTO, equCheckItem); @@ -195,6 +199,18 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { @DS("#header.poolName") @Transactional public AjaxResult updateEquCheckItem(EquCheckItemDTO equCheckItemDTO) { + + // 检验 + EquCheckItem checkQuery = new EquCheckItem(); + checkQuery.setItemType(equCheckItemDTO.getItemType()); + checkQuery.setItemName(equCheckItemDTO.getItemName()); + List check = equCheckItemMapper.selectEquCheckItemList(checkQuery); + if (check.size()>0) { + if (!check.get(0).getItemCode().equals(equCheckItemDTO.getItemCode())) { + return error(500,"检查项已存在!不可修改!"); + } + } + EquCheckItem equCheckItem = new EquCheckItem(); BeanUtils.copyProperties(equCheckItemDTO, equCheckItem); diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquFaultTypeServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquFaultTypeServiceImpl.java index f476ed68..71a71ebc 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquFaultTypeServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquFaultTypeServiceImpl.java @@ -65,6 +65,15 @@ public class EquFaultTypeServiceImpl implements IEquFaultTypeService { @DS("#header.poolName") public AjaxResult insertEquFaultType(EquFaultType equFaultType) { + // 检验 + EquFaultType checkQuery = new EquFaultType(); + checkQuery.setFaultType(equFaultType.getFaultType()); + checkQuery.setFaultSubclass(equFaultType.getFaultSubclass()); + List check = equFaultTypeMapper.selectEquFaultTypeList(checkQuery); + if (check.size() > 0) { + return error(500,"故障子类已存在!不可添加!"); + } + //获取当前所选工厂 HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String key = "#header.poolName"; @@ -98,9 +107,24 @@ public class EquFaultTypeServiceImpl implements IEquFaultTypeService { */ @Override @DS("#header.poolName") - public int updateEquFaultType(EquFaultType equFaultType) { + public AjaxResult updateEquFaultType(EquFaultType equFaultType) { + + // 检验 + EquFaultType checkQuery = new EquFaultType(); + checkQuery.setFaultType(equFaultType.getFaultType()); + checkQuery.setFaultSubclass(equFaultType.getFaultSubclass()); + List check = equFaultTypeMapper.selectEquFaultTypeList(checkQuery); + if (check.size() > 0) { + if (!check.get(0).equals(equFaultType.getFaultCode())) { + return error(500,"故障子类已存在!修改失败!"); + } + } + equFaultType.setUpdateBy(SecurityContextHolder.getUserName()); equFaultType.setUpdateTime(DateUtils.getNowDate()); - return equFaultTypeMapper.updateEquFaultType(equFaultType); + // 插入数据库 + equFaultTypeMapper.updateEquFaultType(equFaultType); + + return success("修改成功"); } /** diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquFaultTypeMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquFaultTypeMapper.xml index eac4783d..415cda84 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquFaultTypeMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquFaultTypeMapper.xml @@ -113,11 +113,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from equ_fault_type where fault_id = #{faultId} + delete equ_fault_type set del_flag = '1' where fault_id = #{faultId} - delete from equ_fault_type where fault_id in + update equ_fault_type set del_flag = '1' where fault_id in #{faultId}