ApiDataServiceMapper.xml
4.04 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
<?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.apiDataService.mapper.ApiDataServiceMapper">
<resultMap type="ApiDataService" id="ApiDataServiceResult">
<result property="id" column="id" />
<result property="parentId" column="parent_id" />
<result property="dataName" column="data_name" />
<result property="directory" column="directory" />
<result property="dimension" column="dimension" />
<result property="example" column="example" />
</resultMap>
<sql id="selectApiDataServiceVo">
select id, parent_id, data_name, directory, dimension, example from api_data_service
</sql>
<select id="selectApiDataServiceList" parameterType="ApiDataService" resultMap="ApiDataServiceResult">
<include refid="selectApiDataServiceVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="dataName != null and dataName != '' "> and data_name = #{dataName}</if>
<if test="directory != null and directory != '' "> and directory = #{directory}</if>
<if test="dimension != null and dimension != '' "> and dimension = #{dimension}</if>
<if test="example != null and example != '' "> and example = #{example}</if>
</where>
</select>
<select id="selectApiDataServiceById" parameterType="Integer" resultMap="ApiDataServiceResult">
<include refid="selectApiDataServiceVo"/>
where id = #{id}
</select>
<select id="selectApiDataServiceListAll"
parameterType="ApiDataService" resultMap="ApiDataServiceResult">
select * from api_data_service
</select>
<insert id="insertApiDataService" parameterType="ApiDataService" useGeneratedKeys="true" keyProperty="id">
insert into api_data_service
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null ">id,</if>
<if test="parentId != null ">parent_id,</if>
<if test="dataName != null and dataName != '' ">data_name,</if>
<if test="directory != null and directory != '' ">directory,</if>
<if test="dimension != null and dimension != '' ">dimension,</if>
<if test="example != null and example != '' ">example,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null ">#{id},</if>
<if test="parentId != null ">#{parentId},</if>
<if test="dataName != null and dataName != '' ">#{dataName},</if>
<if test="directory != null and directory != '' ">#{directory},</if>
<if test="dimension != null and dimension != '' ">#{dimension},</if>
<if test="example != null and example != '' ">#{example},</if>
</trim>
</insert>
<update id="updateApiDataService" parameterType="ApiDataService">
update api_data_service
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null ">parent_id = #{parentId},</if>
<if test="dataName != null and dataName != '' ">data_name = #{dataName},</if>
<if test="directory != null and directory != '' ">directory = #{directory},</if>
<if test="dimension != null and dimension != '' ">dimension = #{dimension},</if>
<if test="example != null and example != '' ">example = #{example},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteApiDataServiceById" parameterType="Integer">
delete from api_data_service where id = #{id}
</delete>
<delete id="deleteApiDataServiceByIds" parameterType="String">
delete from api_data_service where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>