企业名称查重

main
zhangyue 2025-11-22 18:00:51 +08:00
parent 9c84548f12
commit a4aa60c540
3 changed files with 19 additions and 11 deletions

View File

@ -145,7 +145,10 @@ public class CorpInfoRepositoryImpl extends BaseRepositoryImpl<CorpInfoMapper, C
public Long checkCorpName(Map<String, Object> parmas) {
QueryWrapper<CorpInfoDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("corp_name", parmas.get("corpName"));
queryWrapper.ne("id", parmas.get("id"));
if(!ObjectUtil.isEmpty(parmas.get("id"))){
queryWrapper.ne("id", parmas.get("id"));
}
return corpInfoMapper.selectCount(queryWrapper);
}

View File

@ -1,5 +1,6 @@
package com.zcloud.basic.info.persistence.repository.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.Response;

View File

@ -252,16 +252,20 @@
<select id="countUser" resultType="Integer">
select count(1)
from user
where id != #{params.id}
<if test="params.username != null">
and username = #{params.username}
</if>
<if test="params.userIdCard != null">
and user_id_card = #{params.userIdCard}
</if>
<if test="params.phone != null">
and phone = #{params.phone}
</if>
<where>
<if test="params.id != null">
and id != #{params.id}
</if>
<if test="params.username != null">
and username = #{params.username}
</if>
<if test="params.userIdCard != null">
and user_id_card = #{params.userIdCard}
</if>
<if test="params.phone != null">
and phone = #{params.phone}
</if>
</where>
</select>
</mapper>