CompanyMapper.xml
4.17 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
113
114
115
116
117
118
119
120
121
122
<?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.huaheng.pc.general.company.mapper.CompanyMapper">
<select id="selectCompanyByUserId" parameterType="Integer" resultType="com.huaheng.pc.general.company.domain.Company">
SELECT c.id, c.name, c.code
FROM sys_user_company suc
INNER JOIN company c ON suc.companyId = c.id AND suc.userId = #{userId}
</select>
<select id="selectCompanyList" resultType="com.huaheng.pc.general.company.domain.Company">
SELECT c.id, c.code, c.name, c.enable
FROM company c
INNER JOIN warehouse_company wc ON c.id = wc.warehouseId
<where>
<if test="id != null">
AND c.id = #{id}
</if>
<if test="code != null">
AND c.code = #{code}
</if>
<if test="parentId != null">
AND c.parentId = #{parentId}
</if>
<if test="type != null">
AND c.type = #{type}
</if>
<if test="name != null">
AND c.name = #{name}
</if>
<if test="address1 != null">
AND c.address1 = #{address1}
</if>
<if test="address2 != null">
AND c.address2 = #{address2}
</if>
<if test="city != null">
AND c.city = #{city}
</if>
<if test="province != null">
AND c.province = #{province}
</if>
<if test="country != null">
AND c.country = #{country}
</if>
<if test="postalCode != null">
AND c.postalCode = #{postalCode}
</if>
<if test="attentionTo != null">
AND c.attentionTo = #{attentionTo}
</if>
<if test="phoneNum != null">
AND c.phoneNum = #{phoneNum}
</if>
<if test="mobile != null">
AND c.mobile = #{mobile}
</if>
<if test="faxNum != null">
AND c.faxNum = #{faxNum}
</if>
<if test="email != null">
AND c.email = #{email}
</if>
<if test="created != null">
AND c.created = #{created}
</if>
<if test="createdBy != null">
AND c.createdBy = #{createdBy}
</if>
<if test="lastUpdated != null">
AND c.lastUpdated = #{lastUpdated}
</if>
<if test="lastUpdatedBy != null">
AND c.lastUpdatedBy = #{lastUpdatedBy}
</if>
<if test="enable != null">
AND c.enable = #{enable}
</if>
<if test="deleted != null">
AND c.deleted = #{deleted}
</if>
<if test="userDef1 != null">
AND c.userDef1 = #{userDef1}
</if>
<if test="userDef2 != null">
AND c.userDef2 = #{userDef2}
</if>
<if test="userDef3 != null">
AND c.userDef3 = #{userDef3}
</if>
<if test="warehouseId != null">
AND wc.warehouseId = #{warehouseId}
</if>
<if test="warehouseCode != null">
AND wc.warehouseCode = #{warehouseCode}
</if>
</where>
</select>
<select id="CompanyParent" resultType="java.util.Map">
SELECT c.id, c.code, c.name, c.enable
FROM company c
INNER JOIN warehouse_company wc ON c.id = wc.warehouseId
<if test="enable != null and enable != ''">
AND c.enable = #{enable}
</if>
<if test="deleted != null and deleted != ''">
AND c.deleted = #{deleted}
</if>
<if test="type != null">
AND c.type = #{type}
</if>
<if test="warehouseId != null">
AND wc.warehouseId = #{warehouseId}
</if>
</select>
<delete id="deleteCompanyByIds" parameterType="Integer">
update company set deleted=true where id in (#{ids})
</delete>
</mapper>