添加与编辑重复校验
检查部门名称是否重复
int checkNameExist(Department department);
<select id="checkNameExist" resultType="java.lang.Integer">
SELECT count(depart_id)
FROM department
<where>
is_deleted = 0
<if test="departId !=null and departId !=''">
AND depart_id != #{departId}
</if>
AND depart_name = #{departName}
</where>
</select>

本文介绍如何使用SQL查询来检查部门名称是否存在并防止数据冗余,通过intcheckNameExist函数实现实时验证,确保数据一致性。
1230

被折叠的 条评论
为什么被折叠?



