更新问题类型重复的判断
This commit is contained in:
parent
2b2bc28bc1
commit
b1e31ec089
@ -23,7 +23,7 @@ public interface XhpcWorkTypeDictMapper {
|
||||
|
||||
XhpcWorkTypeDictDomain selectByPrimaryKey(Integer workTypeId);
|
||||
|
||||
XhpcWorkTypeDictDomain selectByName(String name);
|
||||
XhpcWorkTypeDictDomain selectByName(@Param("name") String name, @Param("parentId")Integer parentId);
|
||||
|
||||
int updateByPrimaryKeySelective(XhpcWorkTypeDictDomain record);
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ public class WorkTypeServiceImpl implements WorkTypeService {
|
||||
if(StringUtils.isEmpty(domain.getName())){
|
||||
throw new CustomException("名称不能为空");
|
||||
}
|
||||
XhpcWorkTypeDictDomain exitsDomain = typeDictMapper.selectByName(domain.getName());
|
||||
XhpcWorkTypeDictDomain exitsDomain = typeDictMapper.selectByName(domain.getName(), domain.getParentTypeId());
|
||||
if(exitsDomain != null) {
|
||||
throw new CustomException("名称不能重复");
|
||||
}
|
||||
@ -86,7 +86,7 @@ public class WorkTypeServiceImpl implements WorkTypeService {
|
||||
throw new CustomException("自身不能成为自身的子集");
|
||||
}
|
||||
|
||||
XhpcWorkTypeDictDomain exitsDomain = typeDictMapper.selectByName(domain.getName());
|
||||
XhpcWorkTypeDictDomain exitsDomain = typeDictMapper.selectByName(domain.getName(), domain.getParentTypeId());
|
||||
if(exitsDomain != null && !exitsDomain.getWorkTypeId().equals(domain.getWorkTypeId())) {
|
||||
throw new CustomException("名称不能重复");
|
||||
}
|
||||
|
||||
@ -68,11 +68,21 @@
|
||||
from xhpc_work_type_dict
|
||||
where work_type_id = #{workTypeId,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectByName" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from xhpc_work_type_dict
|
||||
where del_flag=0 and name = #{name}
|
||||
<choose>
|
||||
<if test="parentId == null">
|
||||
and parent_type_id is null
|
||||
</if>
|
||||
<otherwise>
|
||||
and parent_type_id=#{parentId}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<update id="deleteByPrimaryKeyLogic" parameterType="java.lang.Integer">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user