TemplateDataSourceMapper.xml
5.48 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.templateDataSource.mapper.TemplateDataSourceMapper">
<resultMap type="TemplateDataSource" id="TemplateDataSourceResult">
<result property="id" column="id" />
<result property="modelKey" column="modelKey" />
<result property="modelName" column="modelName" />
<result property="apiUrl" column="apiUrl" />
<result property="localFunction" column="localFunction" />
<result property="dataHandle" column="dataHandle" />
<result property="docPath" column="docPath" />
<result property="dataType" column="dataType" />
<result property="reportKey" column="reportKey" />
<result property="lastUpdateTime" column="lastUpdateTime" />
</resultMap>
<sql id="selectTemplateDataSourceVo">
select id, modelKey, modelName, apiUrl,reportKey, localFunction, dataType,dataHandle, docPath, lastUpdateTime from template_data_source
</sql>
<select id="selectTemplateDataSourceList" parameterType="TemplateDataSource" resultMap="TemplateDataSourceResult">
<include refid="selectTemplateDataSourceVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="modelKey != null and modelKey != '' "> and modelKey = #{modelKey}</if>
<if test="modelName != null and modelName != '' "> and modelName = #{modelName}</if>
<if test="apiUrl != null and apiUrl != '' "> and apiUrl = #{apiUrl}</if>
<if test="localFunction != null and localFunction != '' "> and localFunction = #{localFunction}</if>
<if test="dataHandle != null and dataHandle != '' "> and dataHandle = #{dataHandle}</if>
<if test="reportKey != null and reportKey != '' "> and reportKey = #{reportKey}</if>
<if test="docPath != null and docPath != '' "> and docPath = #{docPath}</if>
<if test="dataType != null and dataType != '' "> and dataType = #{dataType}</if>
<if test="lastUpdateTime != null "> and lastUpdateTime = #{lastUpdateTime}</if>
</where>
</select>
<select id="selectTemplateDataSourceById" parameterType="Integer" resultMap="TemplateDataSourceResult">
<include refid="selectTemplateDataSourceVo"/>
where id = #{id}
</select>
<insert id="insertTemplateDataSource" parameterType="TemplateDataSource" useGeneratedKeys="true" keyProperty="id">
insert into template_data_source
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="modelKey != null and modelKey != '' ">modelKey,</if>
<if test="modelName != null and modelName != '' ">modelName,</if>
<if test="apiUrl != null and apiUrl != '' ">apiUrl,</if>
<if test="localFunction != null and localFunction != '' ">localFunction,</if>
<if test="dataHandle != null and dataHandle != '' ">dataHandle,</if>
<if test="docPath != null and docPath != '' ">docPath,</if>
<if test="dataType != null and dataType != '' ">dataType,</if>
<if test="reportKey != null and reportKey != '' ">reportKey,</if>
<if test="lastUpdateTime != null ">lastUpdateTime,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="modelKey != null and modelKey != '' ">#{modelKey},</if>
<if test="modelName != null and modelName != '' ">#{modelName},</if>
<if test="apiUrl != null and apiUrl != '' ">#{apiUrl},</if>
<if test="localFunction != null and localFunction != '' ">#{localFunction},</if>
<if test="dataHandle != null and dataHandle != '' ">#{dataHandle},</if>
<if test="docPath != null and docPath != '' ">#{docPath},</if>
<if test="dataType != null and dataType != '' ">#{dataType},</if>
<if test="reportKey != null and reportKey != '' ">#{reportKey},</if>
<if test="lastUpdateTime != null ">#{lastUpdateTime},</if>
</trim>
</insert>
<update id="updateTemplateDataSource" parameterType="TemplateDataSource">
update template_data_source
<trim prefix="SET" suffixOverrides=",">
<if test="modelKey != null and modelKey != '' ">modelKey = #{modelKey},</if>
<if test="modelName != null and modelName != '' ">modelName = #{modelName},</if>
<if test="apiUrl != null and apiUrl != '' ">apiUrl = #{apiUrl},</if>
<if test="localFunction != null and localFunction != '' ">localFunction = #{localFunction},</if>
<if test="dataHandle != null and dataHandle != '' ">dataHandle = #{dataHandle},</if>
<if test="docPath != null and docPath != '' ">docPath = #{docPath},</if>
<if test="dataType != null and dataType != '' ">dataType = #{dataType},</if>
<if test="reportKey != null and reportKey != '' ">reportKey = #{reportKey},</if>
<if test="lastUpdateTime != null ">lastUpdateTime = #{lastUpdateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTemplateDataSourceById" parameterType="Integer">
delete from template_data_source where id = #{id}
</delete>
<delete id="deleteTemplateDataSourceByIds" parameterType="String">
delete from template_data_source where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>