AcademyDictMapper.xml
2.91 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
<?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.subsidy.mapper.AcademyDictMapper">
<select id="academies" resultType="com.subsidy.vo.academy.AcademiesVO">
SELECT distinct
t2.id AS academy_id,
t2.academy_name,
t2.short_name,
t2.location,
t2.academy_type,
t4.account_name,
t4.PASSWORD,
t4.user_name,
t4.telephone
FROM
academy_dict t2
LEFT JOIN administer_academy_mapping t5 ON t2.id = t5.academy_id
LEFT JOIN administer t4 ON t4.id = t5.administer_id
WHERE
t2.delete_date IS NULL
AND t5.delete_date IS NULL
AND t4.delete_date IS NULL
AND role =4
<if test="academyName != null and academyName != ''">
and t2.academy_name like concat('%',#{academyName} ,'%')
</if>
</select>
<select id="academyAccount" resultType="com.subsidy.vo.academy.AcademyAccountVO">
SELECT distinct
t2.id,
t2.user_name,
t2.`password`,
t2.telephone,
t2.remark,
t2.role,
t2.account_name
FROM
administer t2
LEFT JOIN administer_academy_mapping t1 ON t2.id = t1.administer_id
LEFT JOIN academy_dict t3 ON t1.academy_id = t3.id
WHERE
t2.delete_date IS NULL
AND t1.delete_date IS NULL
AND t3.delete_date IS NULL
AND t2.role = 5
<if test="academyName != null and academyName != ''">
and (t3.academy_name like concat('%',#{academyName} ,'%') or t2.account_name like concat('%',#{academyName}
,'%') )
</if>
</select>
<select id="accountAcademies" parameterType="long" resultType="com.subsidy.model.AcademyDictDO">
SELECT
t3.*
FROM
administer_academy_mapping t1
LEFT JOIN academy_dict t3 ON t1.academy_id = t3.id
WHERE
t1.delete_date IS NULL
AND t3.delete_date IS NULL
and t1.administer_id = #{administerId}
</select>
<select id="accountAcademyIds" parameterType="long" resultType="long">
SELECT
t3.id
FROM
administer_academy_mapping t1
LEFT JOIN academy_dict t3 ON t1.academy_id = t3.id
WHERE
t1.delete_date IS NULL
AND t3.delete_date IS NULL
and t1.administer_id = #{administerId}
</select>
<select id="mainAccount" parameterType="long" resultType="com.subsidy.model.AdministerDO">
SELECT
t2.*
FROM
administer_academy_mapping t
LEFT JOIN administer t2 ON t.administer_id = t2.id
AND t2.role = 4
where t.delete_date is null
and t2.delete_date is null
and t.academy_id = #{academyId}
</select>
</mapper>