<?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="com.panzhihua.sangeshenbian.dao.SystemUserMapper">
|
|
|
<select id="list" resultType="com.panzhihua.sangeshenbian.warpper.SystemUserListVo">
|
select
|
a.id,
|
a.name,
|
a.phone,
|
IF(a.four_department_id is not null, e.`name`, IF(a.three_department_id is not null, d.`name`, IF(a.two_department_id is not null, c.`name`, b.`name`))) as departmentName,
|
f.`name` as systemPostName,
|
g.`name` as systemRoleName,
|
a.account_level as accountLevel,
|
a.`status`
|
from sgsb_system_user a
|
left join sgsb_department b on (a.one_department_id = b.id)
|
left join sgsb_department c on (a.two_department_id = c.id)
|
left join sgsb_department d on (a.three_department_id = d.id)
|
left join sgsb_department e on (a.four_department_id = e.id)
|
left join sgsb_system_post f on (a.system_post_id = f.id)
|
left join sgsb_system_role g on (a.system_role_id = g.id)
|
where a.`status` != 3
|
<if test="1 != accountLevel or 5 != accountLevel">
|
and a.account_level <= #{accountLevel}
|
</if>
|
<if test="5 == accountLevel">
|
and a.id = 0
|
</if>
|
<if test="null != query.name and '' != query.name">
|
and a.name like CONCAT('%', #{query.name}, '%')
|
</if>
|
<if test="null != query.phone and '' != query.phone">
|
and a.phone like CONCAT('%', #{query.phone}, '%')
|
</if>
|
<if test="null != query.departmentId">
|
and (a.one_department_id = #{query.departmentId} or a.two_department_id = #{query.departmentId} or a.three_department_id = #{query.departmentId} or a.four_department_id = #{query.departmentId})
|
</if>
|
<if test="null != query.systemRoleId">
|
and a.system_role_id = #{query.systemRoleId}
|
</if>
|
<if test="null != query.accountLevel">
|
and a.account_level = #{query.accountLevel}
|
</if>
|
order by a.create_time desc
|
</select>
|
|
|
|
<select id="getRegion" resultType="map">
|
select region_code as id, region_name as name from bc_region where parent_id = #{pcode}
|
</select>
|
|
|
<select id="getStreet" resultType="map">
|
select street_id as id, name as name from com_street where area_code = #{pcode}
|
</select>
|
|
|
<select id="getCommunity" resultType="map">
|
select community_id as id, name as name from com_act where street_id = #{streetId}
|
</select>
|
</mapper>
|