fix:车间对象增加负责人id属性。系统部门编码做唯一校验

This commit is contained in:
zhangxuanming
2025-02-06 11:37:42 +08:00
parent b4d9add499
commit 04154b7f06
7 changed files with 50 additions and 4 deletions

View File

@@ -121,4 +121,11 @@ public interface SysDeptMapper
* @return
*/
List<SysDept> selectAllDeptList();
/**
* 校验部门编码是否唯一
* @param deptCode
* @return
*/
SysDept checkDeptCodeUnique(@Param("deptCode") String deptCode);
}

View File

@@ -119,4 +119,11 @@ public interface ISysDeptService
* @return
*/
List<SysDept> selectAllDeptList();
/**
* 校验部门编码是否唯一
* @param dept
* @return
*/
String checkDeptCodeUnique(SysDept dept);
}

View File

@@ -289,6 +289,17 @@ public class SysDeptServiceImpl implements ISysDeptService
return deptMapper.selectAllDeptList();
}
@Override
public String checkDeptCodeUnique(SysDept dept) {
Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
SysDept info = deptMapper.checkDeptCodeUnique(dept.getDeptCode());
if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 递归列表
*/

View File

@@ -88,6 +88,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectAllDeptList" resultType="com.ktg.common.core.domain.entity.SysDept" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
</select>
<select id="checkDeptCodeUnique" resultType="com.ktg.common.core.domain.entity.SysDept" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where dept_code = #{deptCode}
limit 1
</select>
<insert id="insertDept" parameterType="SysDept">
insert into sys_dept(