CompanyDictMapper.xml
3.53 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
111
112
<?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.CompanyDictMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, company_name, place_id, position_id, company_code, account, desc
</sql>
<select id="company" resultType="com.laowu.vo.company.CompanyVO">
SELECT
t.id,
t3.id as business_id,
t.company_name,
t3.business,
t.company_code,
t.company_property,
t.company_desc,
t.province,
t.city,
t.county,
t.company_origin
FROM
company_dict t
LEFT JOIN business_dict t3 ON t.business_id = t3.id
WHERE
t.delete_date IS NULL
AND t3.delete_date IS NULL
<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="companyName != null and companyName != ''">
AND t.company_name LIKE concat('%', #{companyName}, '%')
</if>
</select>
<select id="stationCompanyCount" parameterType="long" resultType="integer">
SELECT
count(distinct(t4.id))
FROM
workstation_dict t1
LEFT JOIN workstation_alone_mapping t2 ON t1.id = t2.station_id
LEFT JOIN position_alone_info t3 ON t2.alone_id = t3.id
LEFT JOIN company_dict t4 ON t3.company_id = t4.id
WHERE
t1.id = 1
AND t1.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t4.delete_date IS NULL UNION
SELECT
t1.id,
t4.company_name
FROM
workstation_dict t1
LEFT JOIN workstation_require_mapping t2 ON t1.id = t2.station_id
LEFT JOIN position_require_item t3 ON t2.require_id = t3.id
LEFT JOIN company_dict t4 ON t3.company_id = t4.id
WHERE
t1.id = 1
AND t1.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t4.delete_date IS NULL
</select>
<select id="stationCompany" resultType="com.laowu.vo.company.CompanyVO">
SELECT
t2.id,
t2.business_id,
t2.company_name,
t3.business,
t2.company_code,
t2.company_desc,
t2.province,
t2.company_property,
t2.city,
t2.county
FROM
company_relate_work t
LEFT JOIN company_dict t2 ON t.company_id = t2.id
LEFT JOIN business_dict t3 ON t2.business_id = t3.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
and t.station_id = #{stationId}
<if test="province != null and province != ''">
and t2.province = #{province}
</if>
<if test="city != null and city != ''">
and t2.city = #{city}
</if>
<if test="county != null and county != ''">
and t2.county = #{county}
</if>
<if test="companyName != null and companyName != ''">
AND t2.company_name LIKE concat('%', #{companyName}, '%')
</if>
</select>
</mapper>