<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="org.springblade.modules.system.mapper.UserWxMapper">
|
<!-- 通用查询映射结果 -->
|
<resultMap id="userResultMap" type="org.springblade.modules.system.vo.UserVO">
|
<result column="id" property="id"/>
|
<result column="tenant_id" property="tenantId"/>
|
<result column="create_user" property="createUser"/>
|
<result column="create_time" property="createTime"/>
|
<result column="update_user" property="updateUser"/>
|
<result column="update_time" property="updateTime"/>
|
<result column="status" property="status"/>
|
<result column="is_deleted" property="isDeleted"/>
|
<result column="code" property="code"/>
|
<result column="user_type" property="userType"/>
|
<result column="account" property="account"/>
|
<result column="password" property="password"/>
|
<result column="name" property="name"/>
|
<result column="real_name" property="realName"/>
|
<result column="email" property="email"/>
|
<result column="phone" property="phone"/>
|
<result column="birthday" property="birthday"/>
|
<result column="sex" property="sex"/>
|
<result column="role_id" property="roleId"/>
|
<result column="dept_id" property="deptId"/>
|
<result column="post_id" property="postId"/>
|
<result column="cardid" property="cardid"/>
|
<result column="nativeplace" property="nativeplace"/>
|
<result column="nation" property="nation"/>
|
<result column="education" property="education"/>
|
<result column="politicaloutlook" property="politicaloutlook"/>
|
<result column="height" property="height"/>
|
<result column="cell" property="cell"/>
|
<result column="emails" property="emails"/>
|
<result column="hold" property="hold"/>
|
<result column="jurisdiction" property="jurisdiction"/>
|
<result column="securitynumber" property="securitynumber"/>
|
<result column="dispatch" property="dispatch"/>
|
<result column="my_picture" property="myPicture"/>
|
<result column="is_apply" property="isApply"/>
|
<result column="is_apply" property="isApply"/>
|
<result column="is_train" property="isTrain"/>
|
<result column="birthtime" property="birthtime"/>
|
<result column="healstats" property="healstats"/>
|
<result column="soil" property="soil"/>
|
<result column="reason_for_leav" property="reasonForLeav"/>
|
<result column="accreditationStatus" property="accreditationStatus"/>
|
</resultMap>
|
|
<select id="getUserWx" resultType="org.springblade.modules.system.entity.UserWx">
|
SELECT *
|
FROM blade_user_wx
|
WHERE tenant_id = #{param1}
|
and account = #{param2}
|
and password = #{param3}
|
and is_deleted = 0
|
and status = 1
|
</select>
|
|
|
<!--查询当前部门名称及父级部门名称-->
|
<select id="getDeptName" resultType="java.lang.String">
|
(select dept_name from blade_dept where id = #{deptId} and 1=1)
|
union
|
(
|
select dept_name from blade_dept where id = (select parent_id from blade_dept where id= #{deptId} and 1=1)
|
)
|
</select>
|
|
|
<!--用户列表信息-->
|
<select id="selectUserPage" resultMap="userResultMap">
|
select bu.* from blade_user_wx 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 and bu.id != 1123598821738675201
|
<if test="user.cardid != null and user.cardid !=''">
|
and bu.cardid like concat('%', #{user.cardid},'%')
|
</if>
|
<if test="user.tenantId!=null and user.tenantId != ''">
|
and tenant_id = #{user.tenantId}
|
</if>
|
<if test="user.account!=null and user.account != ''">
|
and account like concat('%', #{user.account},'%')
|
</if>
|
<if test="user.isFreeze!=null">
|
and bu.is_freeze = #{user.isFreeze}
|
</if>
|
<if test="user.roleId!=null and user.roleId != ''">
|
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.deptId!=null and user.deptId != ''">
|
and bd.id in
|
(
|
select id from blade_dept where id = #{user.deptId}
|
union
|
SELECT
|
id
|
FROM
|
(
|
SELECT
|
t1.id,t1.parent_id,t1.dept_name,
|
IF
|
( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild
|
FROM
|
( SELECT id, parent_id,dept_name FROM blade_dept t ORDER BY parent_id, id ) t1,
|
( SELECT @pids := #{user.deptId} ) t2
|
) t3
|
WHERE
|
ischild != 0
|
)
|
</if>
|
<if test="user.userType!=null and user.userType != ''">
|
and user_type = #{user.userType}
|
</if>
|
<if test="user.nativeplace!=null and user.nativeplace != ''">
|
and nativeplace = #{user.nativeplace}
|
</if>
|
<if test="user.sex!=null and user.sex != ''">
|
and sex = #{user.sex}
|
</if>
|
<if test="user.status!=null and user.status != ''">
|
and status = #{user.status}
|
</if>
|
<if test="user.hold!=null and user.hold != ''">
|
and hold = #{user.hold}
|
</if>
|
<if test="user.jurisdiction!=null and user.jurisdiction != '' and user.jurisdiction!='1372091709474910209'">
|
and (sj.id = #{user.jurisdiction} or sj.parent_id = #{user.jurisdiction})
|
</if>
|
<if test="user.securitynumber!=null and user.securitynumber != ''">
|
and securitynumber = #{user.securitynumber}
|
</if>
|
<if test="user.examinationType!=null and user.examinationType != ''">
|
and examination_type = #{user.examinationType}
|
</if>
|
ORDER BY bu.id desc
|
</select>
|
<select id="getUserDetailById" resultType="org.springblade.modules.system.vo.UserVO">
|
select bu.* from blade_user_wx bu
|
where bu.is_deleted = 0
|
and bu.id = #{id}
|
</select>
|
|
|
</mapper>
|