CustomTemplateMapper.xml
4.62 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
<?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.lhcredit.project.business.customTemplate.mapper.CustomTemplateMapper">
<resultMap type="CustomTemplate" id="CustomTemplateResult">
<result property="id" column="id" />
<result property="orgId" column="org_id" />
<result property="tName" column="t_name" />
<result property="sourceJson" column="source_json" />
<result property="templateModel" column="template_model" />
<result property="demoUrl" column="demo_url" />
<result property="status" column="status" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectCustomTemplateVo">
select id, org_id, t_name, source_json, template_model, demo_url, status, create_time from custom_template
</sql>
<select id="selectCustomTemplateList" parameterType="CustomTemplate" resultMap="CustomTemplateResult">
<include refid="selectCustomTemplateVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="orgId != null "> and org_id = #{orgId}</if>
<if test="tName != null and tName != ''">
and t_name LIKE CONCAT('%', #{tName}, '%')
</if>
<if test="sourceJson != null and sourceJson != '' "> and source_json = #{sourceJson}</if>
<if test="templateModel != null and templateModel != '' "> and template_model = #{templateModel}</if>
<if test="demoUrl != null and demoUrl != '' "> and demo_url = #{demoUrl}</if>
<if test="status != null "> and status = #{status}</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
</where>
</select>
<select id="selectCustomTemplateById" parameterType="Integer" resultMap="CustomTemplateResult">
<include refid="selectCustomTemplateVo"/>
where id = #{id}
</select>
<select id="getByOrgId" parameterType="CustomTemplate" resultMap="CustomTemplateResult">
<include refid="selectCustomTemplateVo"/>
<where>
<if test="orgId != null "> org_id = #{orgId}</if>
and status = 0
</where>
</select>
<insert id="insertCustomTemplate" parameterType="CustomTemplate" useGeneratedKeys="true" keyProperty="id">
insert into custom_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orgId != null ">org_id,</if>
<if test="tName != null and tName != '' ">t_name,</if>
<if test="sourceJson != null and sourceJson != '' ">source_json,</if>
<if test="templateModel != null and templateModel != '' ">template_model,</if>
<if test="demoUrl != null and demoUrl != '' ">demo_url,</if>
<if test="status != null ">status,</if>
<if test="createTime != null ">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orgId != null ">#{orgId},</if>
<if test="tName != null and tName != '' ">#{tName},</if>
<if test="sourceJson != null and sourceJson != '' ">#{sourceJson},</if>
<if test="templateModel != null and templateModel != '' ">#{templateModel},</if>
<if test="demoUrl != null and demoUrl != '' ">#{demoUrl},</if>
<if test="status != null ">#{status},</if>
<if test="createTime != null ">#{createTime},</if>
</trim>
</insert>
<update id="updateCustomTemplate" parameterType="CustomTemplate">
update custom_template
<trim prefix="SET" suffixOverrides=",">
<if test="orgId != null ">org_id = #{orgId},</if>
<if test="tName != null and tName != '' ">t_name = #{tName},</if>
<if test="sourceJson != null and sourceJson != '' ">source_json = #{sourceJson},</if>
<if test="templateModel != null and templateModel != '' ">template_model = #{templateModel},</if>
<if test="demoUrl != null and demoUrl != '' ">demo_url = #{demoUrl},</if>
<if test="status != null ">status = #{status},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCustomTemplateById" parameterType="Integer">
delete from custom_template where id = #{id}
</delete>
<delete id="deleteCustomTemplateByIds" parameterType="String">
delete from custom_template where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>