|
|
@@ -143,6 +143,74 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
order by u.user_id desc
|
|
|
</select>
|
|
|
|
|
|
+ <select id="selectCardUserList" parameterType="SysUser" resultMap="SysUserResult">
|
|
|
+ select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader, u.user_type, u.user_type_id, u.account_type
|
|
|
+ ,u.card_id,u.end_year,u.location,u.invite_code,u.exam_type from sys_user u
|
|
|
+ left join sys_dept d on u.dept_id = d.dept_id
|
|
|
+ left join dz_cards c on u.card_id = c.card_id
|
|
|
+ left join dz_agent a on CAST(u.invite_code AS UNSIGNED) = a.agent_id
|
|
|
+ where u.del_flag = '0'
|
|
|
+ <if test="userId != null and userId != 0">
|
|
|
+ AND u.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="userName != null and userName != ''">
|
|
|
+ AND u.user_name like concat('%', #{userName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="status != null and status != ''">
|
|
|
+ AND u.status = #{status}
|
|
|
+ </if>
|
|
|
+ <if test="phonenumber != null and phonenumber != ''">
|
|
|
+ AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
|
|
+ AND date_format(u.create_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
|
|
+ AND date_format(u.create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="agentId != null and agentId != ''"> and (c.agent_id = #{agentId} or c.leaf_agent_id = #{agentId} or a.agent_id = #{agentId} OR a.agent_id IN ( SELECT t.agent_id FROM dz_agent t WHERE t.parent_id = #{agentId})</if>
|
|
|
+ <if test="deptId != null and deptId != 0">
|
|
|
+ AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) )
|
|
|
+ <if test="inviteDeptId != null and inviteDeptId != 0"> OR a.dept_id = #{inviteDeptId}</if>)
|
|
|
+ </if>
|
|
|
+ <if test="userType != null and userType != ''">
|
|
|
+ AND u.user_type = #{userType}
|
|
|
+ </if>
|
|
|
+ <if test="location != null and location != ''">
|
|
|
+ AND u.location like concat('%', #{location}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="endYear != null">
|
|
|
+ AND u.end_year = #{endYear}
|
|
|
+ </if>
|
|
|
+ <if test="nickName != null and nickName != ''">
|
|
|
+ AND u.nick_name like concat('%', #{nickName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="examType != null">
|
|
|
+ AND u.exam_type = #{examType}
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
+ AND d.dept_name like concat('%', #{deptName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="inviteCode != null and inviteCode != ''">
|
|
|
+ AND u.invite_code like concat('%', #{inviteCode}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="usercardType != null and usercardType != ''">
|
|
|
+ <choose>
|
|
|
+ <when test="usercardType == '99' or usercardType == 99">
|
|
|
+ AND u.card_id IS NULL
|
|
|
+ </when>
|
|
|
+ <when test="usercardType == '1' or usercardType == 1">
|
|
|
+ AND u.card_id IS NOT NULL AND c.type IS NOT NULL AND c.type IN (1, 2, 6, 7)
|
|
|
+ </when>
|
|
|
+ <when test="usercardType == '9' or usercardType == 9">
|
|
|
+ AND u.card_id IS NOT NULL AND c.type IS NOT NULL AND c.type = 9
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ order by u.user_id desc
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
|
|
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
|
|
from sys_user u
|