[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);
|
||||
|
||||
|
||||
int queryEquipmentByCode(@Param("code")String code);
|
||||
|
||||
}
|
||||
|
@ -62,6 +62,10 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
||||
BeanCopyUtils.copy(sysEquipmentDto, sysEquipment);
|
||||
|
||||
SysUserVo sysUserVo = (SysUserVo) StpUtil.getTokenSession().get(SessionUtil.SESSION_USER_KEY);
|
||||
// 判断设备编码是否存在
|
||||
if (sysEquipmentMapper.queryEquipmentByCode(sysEquipment.getCode()) > 0) {
|
||||
throw new RuntimeException("设备编码已存在");
|
||||
}
|
||||
sysEquipment.setCreatedTime(new Date());
|
||||
sysEquipment.setUpdatedTime(new Date());
|
||||
sysEquipment.setCreatedBy(sysUserVo.getAccount());
|
||||
|
@ -132,4 +132,8 @@
|
||||
where se.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="queryEquipmentByCode" resultType="java.lang.Integer">
|
||||
select count(1) from sys_equipment where code = #{code}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user