PhoneLogMapper.xml
6.23 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
168
169
170
<?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.portal.base.dao.PhoneLogMapper" >
<resultMap id="BaseResultMap" type="cn.runsa.portal.base.entity.PhoneLog" >
<id column="eplId" property="id" jdbcType="INTEGER" />
<result column="emPhone" property="emphone" jdbcType="VARCHAR" />
<result column="eplType" property="type" jdbcType="INTEGER" />
<result column="eplStatus" property="status" jdbcType="INTEGER" />
<result column="emType" property="emType" jdbcType="INTEGER" />
<result column="ptUpTime" property="uptime" jdbcType="TIMESTAMP" />
<result column="ptUpdater" property="updater" jdbcType="INTEGER" />
<result column="ptUpdater" property="updater" jdbcType="INTEGER" />
<result column="ptUpdaterName" property="updaterName" jdbcType="INTEGER" />
<association property="employee" javaType="cn.runsa.portal.base.entity.Employee">
<id column="plId" property="id" />
<result column="emName" property="name"/>
<result column="emCode" property="code"/>
</association>
<association property="corp" javaType="cn.runsa.portal.base.entity.Corp">
<id column="coId" property="id" />
<result column="coName" property="name"/>
</association>
<association property="dept" javaType="cn.runsa.portal.base.entity.Dept">
<id column="deId" property="id" />
<result column="deName" property="name"/>
</association>
<association property="post" javaType="cn.runsa.portal.base.entity.Post">
<id column="poId" property="id" />
<result column="poName" property="name"/>
</association>
</resultMap>
<sql id="Base_Column_List" >
eplId, emPhone, eplType, eplStatus, ptUpTime, ptUpdater
</sql>
<select id="selectByEmPhone" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from smPhoneLog
where emPhone = #{emPhone,jdbcType=VARCHAR}
AND eplStatus=1
ORDER BY ptUpTime DESC
LIMIT 1
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from smPhoneLog
where eplId = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.runsa.portal.base.entity.PhoneLog" >
<selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
SELECT LAST_INSERT_ID()
</selectKey>
insert into smPhoneLog (emPhone, eplType, eplStatus,
ptUpTime, ptUpdater)
values (#{emphone,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
#{uptime,jdbcType=TIMESTAMP}, #{updater,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="cn.runsa.portal.base.entity.PhoneLog" >
<selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
SELECT LAST_INSERT_ID()
</selectKey>
insert into smPhoneLog
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="emphone != null" >
emPhone,
</if>
<if test="type != null" >
eplType,
</if>
<if test="status != null" >
eplStatus,
</if>
<if test="uptime != null" >
ptUpTime,
</if>
<if test="updater != null" >
ptUpdater,
</if>
<if test="plId != null" >
plId,
</if>
<if test="emType != null" >
emType,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="emphone != null" >
#{emphone,jdbcType=VARCHAR},
</if>
<if test="type != null" >
#{type,jdbcType=INTEGER},
</if>
<if test="status != null" >
#{status,jdbcType=INTEGER},
</if>
<if test="uptime != null" >
#{uptime,jdbcType=TIMESTAMP},
</if>
<if test="updater != null" >
#{updater,jdbcType=INTEGER},
</if>
<if test="plId != null" >
#{plId,jdbcType=INTEGER},
</if>
<if test="emType != null" >
#{emType,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateSelective" parameterType="cn.runsa.portal.base.entity.PhoneLog" >
update smPhoneLog
<set >
<if test="emphone != null" >
emPhone = #{emphone,jdbcType=VARCHAR},
</if>
<if test="type != null" >
eplType = #{type,jdbcType=INTEGER},
</if>
<if test="status != null" >
eplStatus = #{status,jdbcType=INTEGER},
</if>
<if test="uptime != null" >
ptUpTime = #{uptime,jdbcType=TIMESTAMP},
</if>
<if test="updater != null" >
ptUpdater = #{updater,jdbcType=INTEGER},
</if>
</set>
where eplId = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.runsa.portal.base.entity.PhoneLog" >
update smPhoneLog
set emPhone = #{emphone,jdbcType=VARCHAR},
eplType = #{type,jdbcType=INTEGER},
eplStatus = #{status,jdbcType=INTEGER},
ptUpTime = #{uptime,jdbcType=TIMESTAMP},
ptUpdater = #{updater,jdbcType=INTEGER}
where eplId = #{id,jdbcType=INTEGER}
</update>
<select id="findList" resultMap="BaseResultMap" parameterType="cn.runsa.portal.base.entity.PhoneLog" >
select
ph.eplId, ph.emPhone, ph.eplType, ph.eplStatus, ph.ptUpTime, ph.ptUpdater,em.emName as ptUpdaterName
from
smPhoneLog ph
LEFT JOIN mtEmployee em ON ph.ptUpdater = em.emId
where ph.ptUpdater = #{updater,jdbcType=INTEGER}
order by ph.ptUpTime DESC
</select>
<select id="existsByName" resultType="java.lang.Integer" parameterType="cn.runsa.portal.base.entity.PhoneLog">
SELECT count(*) FROM smUsername usn LEFT JOIN smUsers us ON us.emId = usn.emId WHERE usn.usnType=2 AND usn.usnName =#{emphone,jdbcType=VARCHAR}
</select>
<select id="findPhone" resultMap="BaseResultMap" parameterType="cn.runsa.portal.base.entity.PhoneLog">
SELECT
t1.usnName,
t2.emCode,
t2.emName,
t3.coName,
t5.deName,
t7.poName
FROM
smUsername t1
INNER JOIN mtEmployee t2 ON t1.emId = t2.emId
LEFT JOIN mtCorp t3 ON t2.coId = t3.coId
LEFT JOIN mtEmployeeDept t4 ON t4.emId = t1.emId
LEFT JOIN mtDept t5 ON t5.deId = t4.deId
LEFT JOIN mtEmployeePost t6 ON t6.emId = t1.emId
LEFT JOIN mtPost t7 ON t7.poId = t6.poId
WHERE
t1.usnName = #{emphone,jdbcType=VARCHAR}
</select>
</mapper>