DiliServiceCoverageMapper.xml
3.54 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
<?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.diligrp.website.dao.impl.DiliServiceCoverageDaoImpl">
<resultMap id="DiliServiceCoverageRM" type="com.diligrp.website.domain.DiliServiceCoverage">
<id property="id" column="id"/>
<result property="serviceId" column="service_id"/>
<result property="coverageId" column="coverage_id"/>
</resultMap>
<select id="getById" parameterType="Long" resultMap="DiliServiceCoverageRM">
<![CDATA[
SELECT
id
,service_id
,coverage_id
FROM t_dili_service_coverage
WHERE id=#{pk}
]]>
</select>
<select id="getByServiceId" parameterType="Long" resultMap="DiliServiceCoverageRM">
<![CDATA[
SELECT
id
,service_id
,coverage_id
FROM t_dili_service_coverage
WHERE service_id=#{pk}
]]>
</select>
<select id="getByPickUpId" parameterType="Long" resultMap="DiliServiceCoverageRM">
<![CDATA[
SELECT
id
,service_id
,coverage_id
FROM t_dili_service_coverage
WHERE coverage_id=#{pk}
]]>
</select>
<insert id="save" parameterType="com.diligrp.website.domain.DiliServiceCoverage">
<selectKey keyProperty="id" resultType="long" order="AFTER">
SELECT LAST_INSERT_ID();
</selectKey>
<![CDATA[
INSERT INTO t_dili_service_coverage(
service_id
,coverage_id
) VALUES(
#{serviceId}
,#{coverageId}
)
]]>
</insert>
<update id="update" parameterType="com.diligrp.website.domain.DiliServiceCoverage">
<![CDATA[
UPDATE t_dili_service_coverage set
service_id=#{serviceId}
,coverage_id=#{coverageId}
where 1=1
and id = #{id}
]]>
</update>
<select id="countByCondition" parameterType="Query" resultType="Integer">
<![CDATA[
SELECT count(1) FROM t_dili_service_coverage where 1=1
]]>
<if test="param != null">
<if test="param.id != null and param.id != ''">
and id = #{param.id}
</if>
<if test="param.serviceId != null and param.serviceId != ''">
and service_id = #{param.serviceId}
</if>
<if test="param.coverageId != null and param.coverageId != ''">
and coverage_id = #{param.coverageId}
</if>
</if>
</select>
<select id="listByCondition" parameterType="Query" resultMap="DiliServiceCoverageRM">
<![CDATA[
SELECT
id
,service_id
,coverage_id
FROM t_dili_service_coverage where 1=1
]]>
<if test="param != null">
<if test="param.id != null and param.id != ''">
and id = #{param.id}
</if>
<if test="param.serviceId != null and param.serviceId != ''">
and service_id = #{param.serviceId}
</if>
<if test="param.coverageId != null and param.coverageId != ''">
and coverage_id = #{param.coverageId}
</if>
</if>
order by id desc
<![CDATA[
limit #{startRow},#{pageSize}
]]>
</select>
<update id="deleteById" parameterType="Long">
<![CDATA[
update t_dili_service_coverage set
yn = 2
where 1 = 1
and id = #{id}
]]>
</update>
<delete id="deleteByServiceId" parameterType="Long">
delete from t_dili_service_coverage where 1 = 1
and service_id = #{id}
</delete>
</mapper>