[301]
设备编码 没做唯一性校验,可以新增相同编码的设备
This commit is contained in:
parent
3665f8c153
commit
fc7297cbc3
@ -33,4 +33,6 @@ public interface SysEquipmentMapper extends BaseMapperPlus<SysEquipment, SysEqui
|
|||||||
List<BaseImptabmappingVo> getEquipmentServiceInfo(Long equipmentId);
|
List<BaseImptabmappingVo> getEquipmentServiceInfo(Long equipmentId);
|
||||||
|
|
||||||
|
|
||||||
|
int queryEquipmentByCode(@Param("code")String code);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,10 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
|||||||
BeanCopyUtils.copy(sysEquipmentDto, sysEquipment);
|
BeanCopyUtils.copy(sysEquipmentDto, sysEquipment);
|
||||||
|
|
||||||
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||||
|
// 判断设备编码是否存在
|
||||||
|
if (sysEquipmentMapper.queryEquipmentByCode(sysEquipment.getCode()) > 0) {
|
||||||
|
throw new RuntimeException("设备编码已存在");
|
||||||
|
}
|
||||||
sysEquipment.setCreatedTime(new Date());
|
sysEquipment.setCreatedTime(new Date());
|
||||||
sysEquipment.setUpdatedTime(new Date());
|
sysEquipment.setUpdatedTime(new Date());
|
||||||
sysEquipment.setCreatedBy(sysUserVo.getAccount());
|
sysEquipment.setCreatedBy(sysUserVo.getAccount());
|
||||||
|
@ -132,4 +132,8 @@
|
|||||||
where se.id = #{id}
|
where se.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="queryEquipmentByCode" resultType="java.lang.Integer">
|
||||||
|
select count(1) from sys_equipment where code = #{code}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
Reference in New Issue
Block a user