| | |
| | | <if test="user.cardid!=null and user.cardid != ''"> |
| | | and bu.cardid like concat('%', #{user.cardid},'%') |
| | | </if> |
| | | <if test="user.unitName!=null and user.unitName != ''"> |
| | | and bu.unit_name like concat('%', #{user.unitName},'%') |
| | | </if> |
| | | <if test="user.sortName!=null and user.sortName!=''"> |
| | | ORDER BY bu.${user.sortName} ${user.sort},bu.id desc |
| | | </if> |
| | |
| | | <if test="user.realName!=null and user.realName != ''"> |
| | | and bu.real_name like concat('%', #{user.realName},'%') |
| | | </if> |
| | | <if test="user.unitName!=null and user.unitName != ''"> |
| | | and bu.unit_name like concat('%', #{user.unitName},'%') |
| | | </if> |
| | | <if test="user.dispatch!=null and user.dispatch != ''"> |
| | | <if test="user.dispatch == 0"> |
| | | and bu.dispatch = #{user.dispatch} |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <!--用户列表信息--> |
| | | <select id="selectUserPage" resultMap="userResultMap"> |
| | | select bu.* from blade_user bu |
| | | left join |
| | | blade_dept bd |
| | | on |
| | | bd.id = bu.dept_id |
| | | left join |
| | | sys_jurisdiction sj |
| | | on |
| | | sj.id = bu.jurisdiction |
| | | left join |
| | | blade_role br |
| | | on |
| | | br.id = bu.role_id |
| | | where bu.is_deleted = 0 |
| | | left join blade_dept bd on bd.id = bu.dept_id |
| | | left join sys_jurisdiction sj on sj.id = bu.jurisdiction |
| | | left join blade_role br on br.id = bu.role_id |
| | | where bu.is_deleted = 0 and bu.id != 1123598821738675201 |
| | | <if test="user.tenantId!=null and user.tenantId != ''"> |
| | | and tenant_id = #{user.tenantId} |
| | | </if> |
| | |
| | | and account like concat('%', #{user.account},'%') |
| | | </if> |
| | | <if test="user.roleId!=null and user.roleId != ''"> |
| | | and br.role_alias = '公安管理员' |
| | | and (br.role_alias = '公安管理员' or br.role_alias = '民警') |
| | | </if> |
| | | <if test="user.realName!=null and user.realName != ''"> |
| | | and real_name like concat(concat('%', #{user.realName}),'%') |
| | |
| | | </if> |
| | | <if test="user.nativeplace!=null and user.nativeplace != ''"> |
| | | and nativeplace = #{user.nativeplace} |
| | | </if> |
| | | <if test="user.unitName!=null and user.unitName != ''"> |
| | | and bu.unit_name like concat('%', #{user.unitName},'%') |
| | | </if> |
| | | <if test="user.sex!=null and user.sex != ''"> |
| | | and sex = #{user.sex} |
| | |
| | | <if test="user.jurisdiction!=null and user.jurisdiction != ''"> |
| | | and bu.jurisdiction = #{user.jurisdiction} |
| | | </if> |
| | | <if test="user.unitName!=null and user.unitName != ''"> |
| | | and bu.unit_name like concat('%', #{user.unitName},'%') |
| | | </if> |
| | | <if test="user.securitynumber!=null and user.securitynumber != ''"> |
| | | and bu.securitynumber = #{user.securitynumber} |
| | | </if> |
| | |
| | | </if> |
| | | <if test="user.realName!=null and user.realName != ''"> |
| | | and bu.real_name like concat('%', #{user.realName},'%') |
| | | </if> |
| | | <if test="user.unitName!=null and user.unitName != ''"> |
| | | and bu.unit_name like concat('%', #{user.unitName},'%') |
| | | </if> |
| | | <if test="user.userType!=null and user.userType != ''"> |
| | | and bu.user_type = #{user.userType} |
| | |
| | | bu.cardid, |
| | | bu.nation, |
| | | bu.registered, |
| | | if(bu.hold=1,"是","否") hold, |
| | | bu.securitynumber |
| | | from |
| | | blade_user bu |
| | | left join |
| | | blade_dept bd |
| | | on |
| | | bu.dept_id = bd.id |
| | | left join |
| | | sys_information si |
| | | on |
| | | si.departmentid = bd.id |
| | | left join |
| | | sys_jurisdiction sj |
| | | on |
| | | sj.id = si.jurisdiction |
| | | left join |
| | | blade_role br |
| | | on |
| | | br.id = bu.role_id |
| | | left join |
| | | sys_training_registration str |
| | | on |
| | | bu.id = str.user_id |
| | | where |
| | | bu.is_deleted = 0 |
| | | bu.unit_name unitName, |
| | | case when bu.education=1 then '初中及以下' |
| | | when bu.education=2 then '高中/中技/中专' |
| | | when bu.education=3 then '大专' |
| | | when bu.education=4 then '本科' |
| | | when bu.education=5 then '博士' |
| | | when bu.education=6 then '硕士' |
| | | else '' end as education, |
| | | bu.politicaloutlook, |
| | | bu.address |
| | | from blade_user bu left join blade_dept bd on bu.dept_id = bd.id |
| | | left join sys_information si on si.departmentid = bd.id |
| | | left join sys_jurisdiction sj on sj.id = si.jurisdiction |
| | | left join blade_role br on br.id = bu.role_id |
| | | left join sys_training_registration str on bu.id = str.user_id |
| | | where bu.is_deleted = 0 |
| | | <if test="user.examinationType!=null and user.examinationType != ''"> |
| | | <if test="user.examinationType == 0"> |
| | | and (bu.examination_type = #{user.examinationType} or bu.examination_type is null or bu.examination_type ='') |
| | |
| | | </if> |
| | | <if test="user.isAvatar==2"> |
| | | and (bu.avatar is null or bu.avatar="") |
| | | </if> |
| | | <if test="user.unitName!=null and user.unitName != ''"> |
| | | and bu.unit_name like concat('%', #{user.unitName},'%') |
| | | </if> |
| | | <if test="user.isFingerprint==1"> |
| | | and bu.fingerprint is not null and bu.fingerprint!="" |
| | |
| | | tenant_id,account,password,name,real_name,avatar,email,phone,sex, |
| | | role_id,dept_id,cardid,nativePlace,nation,fingerprint,education, |
| | | politicaloutlook,healstats,height,address,registered,securitynumber, |
| | | hold,jurisdiction,examination_type,status,is_deleted,dispatch,create_time |
| | | hold,jurisdiction,examination_type,status,is_deleted,dispatch,create_time,unit_name |
| | | ) |
| | | values |
| | | <foreach collection="list" item="user" separator=","> |
| | |
| | | #{user.tenantId},#{user.account},#{user.password},#{user.name},#{user.realName},#{user.avatar},#{user.email},#{user.phone},#{user.sex}, |
| | | #{user.roleId},#{user.deptId},#{user.cardid},#{user.nativeplace},#{user.nation},#{user.fingerprint},#{user.education}, |
| | | #{user.politicaloutlook},#{user.healstats},#{user.height},#{user.address},#{user.registered},#{user.securitynumber}, |
| | | #{user.hold},#{user.jurisdiction},#{user.examinationType},#{user.status},#{user.isDeleted},#{user.dispatch},#{user.createTime} |
| | | #{user.hold},#{user.jurisdiction},#{user.examinationType},#{user.status},#{user.isDeleted},#{user.dispatch},#{user.createTime},#{user.unitName} |
| | | ) |
| | | </foreach> |
| | | </insert> |
| | |
| | | ) |
| | | </select> |
| | | |
| | | <select id="getUserById" resultType="org.springblade.modules.system.entity.User"> |
| | | select * from blade_user where id = #{id} |
| | | </select> |
| | | |
| | | <!--根据手机号获取用户信息--> |
| | | <select id="getUserByPhone" resultType="org.springblade.modules.system.entity.User"> |
| | | select * from blade_user where is_deleted = 0 and status = 1 |
| | | and tenant_id = #{tenantId} and phone = #{phone} |
| | | </select> |
| | | |
| | | <!--按天查询 day 天未登录的人员ids集合信息--> |
| | | <select id="getMoreDayNotLoginUser" resultType="java.lang.String"> |
| | | select bu.id from blade_user bu |
| | | left join ( |
| | | select user_id,max(create_time) as create_time from sys_login_record GROUP BY user_id |
| | | )slr on bu.id = slr.user_id |
| | | where bu.status = 1 and bu.is_deleted = 0 and bu.role_id = 1412226235153731586 |
| | | and DATE_SUB(CURDATE(), INTERVAL #{day} DAY) > date(bu.create_time) |
| | | and DATE_SUB(CURDATE(), INTERVAL #{day} DAY) > date(slr.create_time) |
| | | </select> |
| | | |
| | | <!--用户冻结操作--> |
| | | <update id="updateFreeze"> |
| | | update blade_user set is_deleted = 1 |
| | | <choose> |
| | | <when test="list!=null and list.size()>0"> |
| | | where id in |
| | | <foreach collection="list" item="id" open="(" close=")" separator=","> |
| | | #{id} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | where id in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </update> |
| | | |
| | | <!--用户注销操作--> |
| | | <update id="updateLogout"> |
| | | update blade_user set is_deleted = 1 |
| | | <choose> |
| | | <when test="list!=null and list.size()>0"> |
| | | where id in |
| | | <foreach collection="list" item="id" open="(" close=")" separator=","> |
| | | #{id} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | where id in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </update> |
| | | |
| | | |
| | | </mapper> |