GuiderMapper.xml
6.82 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?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="cn.runsa.crmapp.customer.mapper.GuiderMapper" >
<resultMap id="BaseResultMap" type="cn.runsa.crmapp.customer.entity.Guider" >
<!--
WARNING - @mbggenerated
-->
<id column="GUIDER_ID" property="guiderId" jdbcType="VARCHAR" />
<result column="EMP_ID" property="empId" jdbcType="INTEGER" />
<result column="SITE_ID" property="siteId" jdbcType="INTEGER" />
<result column="role" property="role" jdbcType="INTEGER" />
<result column="HEADER" property="header" jdbcType="VARCHAR" />
<result column="role_description" property="roleDescription" jdbcType="INTEGER" />
<result column="state" property="state" jdbcType="INTEGER" />
<result column="REC_TIME" property="recTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
<!--
WARNING - @mbggenerated
-->
GUIDER_ID, EMP_ID, SITE_ID, role, HEADER, role_description, state, REC_TIME
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
<!--
WARNING - @mbggenerated
-->
select
<include refid="Base_Column_List" />
from crm_guider
where GUIDER_ID = #{guiderId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
<!--
WARNING - @mbggenerated
-->
delete from crm_guider
where GUIDER_ID = #{guiderId,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="cn.runsa.crmapp.customer.entity.Guider" >
<!--
WARNING - @mbggenerated
-->
insert into crm_guider (GUIDER_ID, EMP_ID, SITE_ID,
role, HEADER, role_description, state,
REC_TIME)
values (#{guiderId,jdbcType=VARCHAR}, #{empId,jdbcType=INTEGER}, #{siteId,jdbcType=INTEGER},
#{role,jdbcType=INTEGER}, #{header,jdbcType=VARCHAR}, #{roleDescription,jdbcType=INTEGER}, #{state,jdbcType=INTEGER},
#{recTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="cn.runsa.crmapp.customer.entity.Guider" >
<!--
WARNING - @mbggenerated
-->
insert into crm_guider
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="guiderId != null" >
GUIDER_ID,
</if>
<if test="empId != null" >
EMP_ID,
</if>
<if test="siteId != null" >
SITE_ID,
</if>
<if test="role != null" >
role,
</if>
<if test="header != null" >
HEADER,
</if>
<if test="roleDescription != null" >
role_description,
</if>
<if test="state != null" >
state,
</if>
<if test="recTime != null" >
REC_TIME,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="guiderId != null" >
#{guiderId,jdbcType=VARCHAR},
</if>
<if test="empId != null" >
#{empId,jdbcType=INTEGER},
</if>
<if test="siteId != null" >
#{siteId,jdbcType=INTEGER},
</if>
<if test="role != null" >
#{role,jdbcType=INTEGER},
</if>
<if test="header != null" >
#{header,jdbcType=VARCHAR},
</if>
<if test="roleDescription != null" >
#{roleDescription,jdbcType=INTEGER},
</if>
<if test="state != null" >
#{state,jdbcType=INTEGER},
</if>
<if test="recTime != null" >
#{recTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.runsa.crmapp.customer.entity.Guider" >
<!--
WARNING - @mbggenerated
-->
update crm_guider
<set >
<if test="empId != null" >
EMP_ID = #{empId,jdbcType=INTEGER},
</if>
<if test="siteId != null" >
SITE_ID = #{siteId,jdbcType=INTEGER},
</if>
<if test="role != null" >
role = #{role,jdbcType=INTEGER},
</if>
<if test="header != null" >
HEADER = #{header,jdbcType=VARCHAR},
</if>
<if test="roleDescription != null" >
role_description = #{roleDescription,jdbcType=INTEGER},
</if>
<if test="state != null" >
state = #{state,jdbcType=INTEGER},
</if>
<if test="recTime != null" >
REC_TIME = #{recTime,jdbcType=TIMESTAMP},
</if>
</set>
where GUIDER_ID = #{guiderId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="cn.runsa.crmapp.customer.entity.Guider" >
<!--
WARNING - @mbggenerated
-->
update crm_guider
set EMP_ID = #{empId,jdbcType=INTEGER},
SITE_ID = #{siteId,jdbcType=INTEGER},
role = #{role,jdbcType=INTEGER},
HEADER = #{header,jdbcType=VARCHAR},
role_description = #{roleDescription,jdbcType=INTEGER},
state = #{state,jdbcType=INTEGER},
REC_TIME = #{recTime,jdbcType=TIMESTAMP}
where GUIDER_ID = #{guiderId,jdbcType=VARCHAR}
</update>
<update id="updateGuider" parameterType="cn.runsa.crmapp.customer.entity.Guider" >
UPDATE crm_guider t SET t.role = #{role,jdbcType=INTEGER}, t.state = #{state,jdbcType=INTEGER} WHERE t.GUIDER_ID = #{guiderId,jdbcType=VARCHAR}
</update>
<!-- 获取导购信息 -->
<select id="getGuiders" resultType="map" parameterType="map" >
SELECT T1.GUIDER_ID, T1.EMP_ID, T3.siCode SITE_ID, T1.ROLE, T1.HEADER, T1.ROLE_DESCRIPTION, T1.STATE,T2.EMCODE, T2.EMNAME, T2.EMSEX, T2.PTPHONE, T2.PTEMAIL, T3.SICODE, T3.SINAME, T3.PTADDR, T3.SINAVLNG, T3.SINAVLAT FROM CRM_GUIDER T1 LEFT JOIN MTEMPLOYEE T2 ON T1.EMP_ID = T2.EMID LEFT JOIN MTSITE T3 ON T1.SITE_ID = T3.SIID WHERE T1.GUIDER_ID IN ( SELECT T.GUIDER_ID FROM CRM_CUSTOMER_GUIDER T WHERE T.CST_ID = #{cst_id,jdbcType=BIGINT} ) AND T1.SITE_ID IN ( SELECT T1.SIT_ID FROM CRM_ACCOUNT_SET_SITE T1 LEFT JOIN CRM_SITE_GROUP_WXGZH T2 ON T1.GRP_ID = T2.GRP_ID WHERE T2.GZH_ID = #{gzh_id,jdbcType=VARCHAR} )
</select>
<!-- 根据网点ID获取导购信息 -->
<select id="getGuidersBySiteId" resultType="map" parameterType="long" >
SELECT T1.GUIDER_ID, T1.EMP_ID, T3.siCode SITE_ID, T1.ROLE, T1.HEADER, T1.ROLE_DESCRIPTION, T1.STATE, T2.EMNAME, T2.EMSEX, T2.PTPHONE, T2.PTEMAIL, T3.SINAME, T3.PTADDR, T3.SINAVLNG, T3.SINAVLAT FROM CRM_GUIDER T1 LEFT JOIN MTEMPLOYEE T2 ON T1.EMP_ID = T2.EMID LEFT JOIN MTSITE T3 ON T1.SITE_ID = T3.SIID WHERE T1.SITE_ID = #{site_id,jdbcType=INTEGER}
</select>
<!-- 获取导购信息 -->
<select id="getGuider" resultType="map" parameterType="string" >
SELECT T1.GUIDER_ID, T1.EMP_ID, T3.siCode SITE_ID, T1.ROLE, T1.HEADER, T1.ROLE_DESCRIPTION, T1.STATE, T2.EMNAME, T2.EMSEX, T2.PTPHONE, T2.PTEMAIL, T3.SINAME, T3.PTADDR, T3.SINAVLNG, T3.SINAVLAT FROM CRM_GUIDER T1 LEFT JOIN MTEMPLOYEE T2 ON T1.EMP_ID = T2.EMID LEFT JOIN MTSITE T3 ON T1.SITE_ID = T3.SIID WHERE T1.GUIDER_ID = #{guider_id,jdbcType=VARCHAR}
</select>
</mapper>