VehiclePermitMapper.xml
3.73 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
<?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.com.glsx.admin.modules.mapper.VehiclePermitMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.admin.modules.entity.VehiclePermit">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="content_id" jdbcType="INTEGER" property="contentId"/>
<result column="accorder_id" jdbcType="INTEGER" property="accorderId"/>
<result column="receiver_id" jdbcType="INTEGER" property="receiverId"/>
<result column="content_type" jdbcType="TINYINT" property="contentType"/>
<result column="permit_type" jdbcType="VARCHAR" property="permitType"/>
<result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
<result column="created_date" jdbcType="TIMESTAMP" property="createdDate"/>
<result column="created_by" jdbcType="INTEGER" property="createdBy"/>
<result column="updated_date" jdbcType="TIMESTAMP" property="updatedDate"/>
<result column="updated_by" jdbcType="INTEGER" property="updatedBy"/>
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, content_id, accorder_id, receiver_id, content_type, permit_type, del_flag, created_date,
created_by, updated_date, updated_by
</sql>
<select id="selectByContentIdAndReceiverId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_vehicle_permit
where del_flag = 0
and content_id = #{contentId}
and receiver_id = #{receiverId}
</select>
<select id="selectByReceiverId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_vehicle_permit
where del_flag = 0
and receiver_id = #{receiverId}
</select>
<select id="selectPermitVehicleByReceiverId" resultType="cn.com.glsx.admin.modules.model.view.VehiclePermitDTO">
select concat('v', tvp.content_id) as id,
tvp.accorder_id accorderId,
tv.id vehicleId,
tv.vin,
tv.owner_name ownerName,
concat('u', tv.created_by) as pid
from t_vehicle_permit tvp
left join t_vehicle tv on tvp.content_id = tv.id
where tvp.del_flag = 0
and tv.del_flag = 0
and tv.created_by is not null
and tvp.receiver_id = #{receiverId}
</select>
<insert id="insertIgnoreExistedPermit">
INSERT IGNORE INTO t_vehicle_permit (content_id, accorder_id, receiver_id, content_type, permit_type, del_flag, created_date, created_by)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.contentId},
#{item.accorderId},
#{item.receiverId},
#{item.contentType},
#{item.permitType},
0,
sysdate(),
#{item.createdBy}
)
</foreach>
</insert>
<delete id="deleteExistedPermit">
delete from t_vehicle_permit
where del_flag = 0
and content_type = #{contentType}
and receiver_id = #{receiverId}
and content_id in
<foreach collection="contentIds" separator="," open="(" close=")" item="item">
#{item}
</foreach>
</delete>
<delete id="deletePermitByReceiverId">
delete from t_vehicle_permit
where del_flag = 0
and content_type = #{contentType}
and receiver_id = #{receiverId}
</delete>
</mapper>