设备管理-故障类型V1.1

highway
wws 1 year ago
parent 433a307c75
commit 9b7791718c

@ -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);
}
/**

@ -42,7 +42,7 @@ public interface IEquFaultTypeService {
* @param equFaultType
* @return
*/
public int updateEquFaultType(EquFaultType equFaultType);
public AjaxResult updateEquFaultType(EquFaultType equFaultType);
/**
*

@ -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<EquCheckItem> 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<EquCheckItem> 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);

@ -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<EquFaultType> 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<EquFaultType> 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("修改成功");
}
/**

@ -113,11 +113,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteEquFaultTypeByFaultId" parameterType="String">
delete from equ_fault_type where fault_id = #{faultId}
delete equ_fault_type set del_flag = '1' where fault_id = #{faultId}
</delete>
<delete id="deleteEquFaultTypeByFaultIds" parameterType="String">
delete from equ_fault_type where fault_id in
update equ_fault_type set del_flag = '1' where fault_id in
<foreach item="faultId" collection="array" open="(" separator="," close=")">
#{faultId}
</foreach>

Loading…
Cancel
Save