AdministerStationRoleMapper.xml
3.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?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.laowu.mapper.AdministerStationRoleMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.AdministerStationRoleDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="administer_id" property="administerId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, administer_id, province, city, county, town, village
</sql>
<select id="workstationRoleAdministers" resultType="com.laowu.vo.admin.WorkstationRolesAdministersVO">
SELECT DISTINCT
t2.id,
t.role_id,
t.workstation_id,
t.administer_id,
t2.user_name,
t2.account,
t2.telephone
FROM
administer_station_role t
LEFT JOIN administer t2 ON t.administer_id = t2.id
WHERE
t.delete_date IS NULL
AND t.workstation_id = #{workstationId}
AND t.role_id = #{roleId}
<if test="province != null and province != ''">
AND t.province = #{province}
</if>
<if test="city != null and city != ''">
AND t.city = #{city}
</if>
<if test="county != null and county != ''">
AND t.county = #{county}
</if>
<if test="town != null and town != ''">
AND t.town = #{town}
</if>
<if test="village!=null and village != ''">
AND t.village = ##{village}
</if>
</select>
<select id="workstationAdministerGeos" resultType="com.laowu.model.AdministerStationRoleDO">
SELECT
t.*
FROM
administer_station_role t
WHERE
t.delete_date IS NULL
AND t.administer_id = #{administerId}
AND t.workstation_id = #{workstationId}
AND t.role_id = #{roleId}
</select>
<select id="geoCount" resultType="integer">
SELECT
count(1)
FROM
administer_station_role t
WHERE
t.delete_date IS NULL
AND t.administer_id = #{administerId}
AND t.workstation_id = #{workstationId}
AND t.role_id = #{roleId}
AND t.province = #{province}
AND t.city = #{city}
AND t.county = #{county}
AND t.town = #{town}
AND t.village = #{village}
</select>
<select id="administerStations" parameterType="long" resultType="com.laowu.vo.admin.AdministerStationsVO">
SELECT
t.id,
t2.workstation_name,
t.county,
t.town,
t.village
FROM
administer_station_role t
LEFT JOIN workstation_dict t2 ON t.workstation_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.administer_id = #{administerId}
</select>
<select id="administerRegionIds" parameterType="long" resultType="long">
SELECT
t.id
FROM
administer_station_role t
WHERE
t.delete_date IS NULL
AND t.administer_id = #{administerId}
</select>
</mapper>