MetaConfigMapper.xml
3.01 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
<?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.yoho.order.dal.MetaConfigMapper">
<resultMap id="BaseResultMap" type="com.yoho.order.model.MetaConfig">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="create_time" jdbcType="INTEGER" property="createTime" />
<result column="desc" jdbcType="VARCHAR" property="desc" />
<result column="value" property="value" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
id, code, title,`desc`, create_time
</sql>
<select id="selectByPrimaryKey" parameterType="int" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>,`value`
from meta_config
where id = #{id}
limit 1
</select>
<select id="countByCondition" parameterType="com.yoho.order.model.MetaConfigReq" resultType="int">
select count(1)
from meta_config
<where>
1 = 1
<if test="code != null and code != ''">
and code like concat('%',#{code,jdbcType=VARCHAR},'%')
</if>
<if test="title != null and title != ''">
and title like concat('%', #{title,jdbcType=VARCHAR},'%')
</if>
</where>
</select>
<select id="listByCondition" resultMap="BaseResultMap" parameterType="com.yoho.order.model.MetaConfigReq">
select
<include refid="Base_Column_List"/>
from meta_config
<where>
1 = 1
<if test="code != null and code != ''">
and code like concat('%',#{code,jdbcType=VARCHAR},'%')
</if>
<if test="title != null and title != ''">
and title like concat('%', #{title,jdbcType=VARCHAR},'%')
</if>
</where>
order by id asc
limit #{start},#{size}
</select>
<select id="selectByCode" parameterType="string" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>,`value`
from meta_config
where code = #{code,jdbcType=VARCHAR}
limit 1
</select>
<update id="updateByPrimaryKey" parameterType="com.yoho.order.model.MetaConfig">
update meta_config
<set>
<if test="code != null and code != ''">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="title != null and title != ''">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="desc != null and desc != ''">
`desc` = #{desc,jdbcType=VARCHAR},
</if>
<if test="value != null and value != ''">
`value` = #{value,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>