<?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 distinct
|
a.id,
|
a.name,
|
a.phone,
|
f.`name` as systemPostName,
|
g.`name` as systemRoleName,
|
a.`status`
|
from sgsb_system_user a
|
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)
|
left join sgsb_system_user_level h on (a.id = h.system_user_id)
|
where a.`status` != 3
|
<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.systemRoleId">
|
and a.system_role_id = #{query.systemRoleId}
|
</if>
|
<if test="null != query.accountLevel and 2 == query.accountLevel and query.type==2 and query.code != null and query.code !='' ">
|
and h.level >= #{query.accountLevel} and h.districts_code = #{query.code}
|
</if>
|
<if test="null != query.accountLevel and 2 == query.accountLevel and query.type==2 and query.code == null">
|
and h.level >= #{query.accountLevel}
|
</if>
|
<if test="null != query.accountLevel and 2 == query.accountLevel and query.type==1 and query.code != null and query.code !=''">
|
and h.level = #{query.accountLevel} and h.districts_code = #{query.code}
|
</if>
|
<if test="null != query.accountLevel and 2 == query.accountLevel and query.type==1 and query.code == null ">
|
and h.level = #{query.accountLevel}
|
</if>
|
<if test="null != query.accountLevel and 3 == query.accountLevel and query.type==2 and query.code != null and query.code !=''">
|
and h.level >= #{query.accountLevel} and h.street_id = #{query.code}
|
</if>
|
<if test="null != query.accountLevel and 3 == query.accountLevel and query.type==2 and query.code == null">
|
and h.level >= #{query.accountLevel}
|
</if>
|
<if test="null != query.accountLevel and 3 == query.accountLevel and query.type==1 and query.code != null and query.code !=''">
|
and h.level = #{query.accountLevel} and h.street_id = #{query.code}
|
</if>
|
<if test="null != query.accountLevel and 3 == query.accountLevel and query.type==1 and query.code == null">
|
and h.level = #{query.accountLevel}
|
</if>
|
<if test="null != query.accountLevel and 4 == query.accountLevel and query.type==2 and query.code != null and query.code !=''">
|
and h.level >= #{query.accountLevel} and h.community_id = #{query.code}
|
</if>
|
<if test="null != query.accountLevel and 4 == query.accountLevel and query.type==2 and query.code == null">
|
and h.level >= #{query.accountLevel}
|
</if>
|
<if test="null != query.accountLevel and 4 == query.accountLevel and query.type==1 and query.code != null and query.code !=''">
|
and h.level = #{query.accountLevel} and h.community_id = #{query.code}
|
</if>
|
<if test="null != query.accountLevel and 4 == query.accountLevel and query.type==1 and query.code == null">
|
and h.level = #{query.accountLevel}
|
</if>
|
<if test="null != user.accountLevel and 5 == user.accountLevel">
|
and a.id = 0
|
</if>
|
order by a.create_time desc
|
</select>
|
|
|
|
<select id="getRegion" resultType="com.panzhihua.sangeshenbian.model.vo.RegionVO">
|
select region_code as id, region_name as name from bc_region where parent_id = #{pcode}
|
</select>
|
|
|
<select id="getStreet" resultType="com.panzhihua.sangeshenbian.model.vo.RegionVO">
|
select CAST(street_id AS CHAR) as id, name as name from com_street where area_code = #{areaCode}
|
</select>
|
|
|
<select id="getCommunity" resultType="com.panzhihua.sangeshenbian.model.vo.RegionVO">
|
select CAST(community_id AS CHAR) as id, name as name from com_act where street_id = #{streetId}
|
</select>
|
|
</mapper>
|