CompanyMapper.xml
2.74 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
<?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 id, code, parentId, type, name, address1, address2, city, province, country, postalCode, attentionTo, phoneNum, mobile, faxNum, email, created, createdBy, lastUpdated, lastUpdatedBy, enable, deleted, userDef1, userDef2, userDef3
FROM company
<where>
<if test="id != null">
AND id = #{id}
</if>
<if test="code != null">
AND code like #{code}
</if>
<if test="parentId != null">
AND parentId = #{parentId}
</if>
<if test="type != null">
AND type like #{type}
</if>
<if test="name != null">
AND name like #{name}
</if>
<if test="address1 != null">
AND address1 like #{address1}
</if>
<if test="address2 != null">
AND address2 like #{address2}
</if>
<if test="city != null">
AND city like #{city}
</if>
<if test="province != null">
AND province like #{province}
</if>
<if test="country != null">
AND country like #{country}
</if>
<if test="postalCode != null">
AND postalCode like #{postalCode}
</if>
<if test="attentionTo != null">
AND attentionTo like #{attentionTo}
</if>
<if test="phoneNum != null">
AND phoneNum like #{phoneNum}
</if>
<if test="mobile != null">
AND mobile like #{mobile}
</if>
<if test="faxNum != null">
AND faxNum like #{faxNum}
</if>
<if test="email != null">
AND email like #{email}
</if>
<if test="created != null">
AND created = #{created}
</if>
<if test="createdBy != null">
AND createdBy like #{createdBy}
</if>
<if test="lastUpdated != null">
AND lastUpdated = #{lastUpdated}
</if>
<if test="lastUpdatedBy != null">
AND lastUpdatedBy like #{lastUpdatedBy}
</if>
<if test="enable != null">
AND enable = #{enable}
</if>
<if test="deleted != null">
AND deleted = #{deleted}
</if>
<if test="userDef1 != null">
AND userDef1 like #{userDef1}
</if>
<if test="userDef2 != null">
AND userDef2 like #{userDef2}
</if>
<if test="userDef3 != null">
AND userDef3 like #{userDef3}
</if>
</where>
</select>
<delete id="deleteCompanyByIds" parameterType="Integer">
update company set deleted=true where id in (#{ids})
</delete>
</mapper>