新增用户相关dao方法

This commit is contained in:
zhangchenbiao
2023-06-15 16:08:39 +08:00
parent 5c690435d4
commit 39782aec34
12 changed files with 93 additions and 2 deletions

View File

@@ -261,4 +261,23 @@
<update id="deleteUserByUserId">
update enterprise_user set deleted = 1 where user_id = #{userId}
</update>
<select id="searchUserByRegionIdsAndKeyword" resultMap="BaseResultMap">
select
user_id, name, mobile
from
enterprise_user
<where>
deleted = 0
<if test="regionIds != null and regionIds.size()>0">
and <foreach collection="regionIds" item="regionId" separator="or" open="(" close=")"> user_region_ids like concat("%", #{regionId}, "%") </foreach>
</if>
<if test="keyword != null">
and (name like concat("%", #{keyword}, "%") or mobile like concat("%", #{keyword}, "%"))
</if>
<if test="isLeader!= null and isLeader">
and is_leader = 1 and leader_dept_ids in <foreach collection="regionIds" item="regionId" separator="," open="(" close=")">#{regionId}</foreach>
</if>
</where>
</select>
</mapper>

View File

@@ -123,4 +123,12 @@
update user_region_mapping set deleted = 1 where user_id = #{userId}
</update>
<select id="getUserListByRegionId" resultType="string">
select user_id from user_region_mapping where region_id = #{regionId}
</select>
<select id="getRegionIdsByUserId" resultType="string">
select region_id from user_region_mapping where user_id = #{userId}
</select>
</mapper>