ConfigMapper.xml
4.57 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
<?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.huaheng.pc.system.config.mapper.ConfigMapper">
<resultMap type="com.huaheng.pc.system.config.domain.Config" id="ConfigResult">
<id property="id" column="id" />
<result property="configName" column="configName" />
<result property="configKey" column="configKey" />
<result property="configValue" column="configValue" />
<result property="configType" column="configType" />
<result property="createBy" column="createBy" />
<result property="createTime" column="createTime" />
<result property="updateBy" column="updateBy" />
<result property="updateTime" column="updateTime" />
</resultMap>
<sql id="selectConfigVo">
select id, configName, configKey, configValue, configType, createBy, createTime, updateBy, updateTime, remark from sys_config
</sql>
<!-- 查询条件 -->
<sql id="sqlwhereSearch">
<where>
<if test="id !=null">
and id = #{id}
</if>
<if test="configKey !=null and configKey != ''">
and configKey = #{configKey}
</if>
</where>
</sql>
<select id="selectConfig" parameterType="com.huaheng.pc.system.config.domain.Config" resultMap="ConfigResult">
<include refid="selectConfigVo"/>
<include refid="sqlwhereSearch"/>
</select>
<select id="selectConfigList" parameterType="com.huaheng.pc.system.config.domain.Config" resultMap="ConfigResult">
<include refid="selectConfigVo"/>
<where>
<if test="configName != null and configName != ''">
AND configName like concat('%', #{configName}, '%')
</if>
<if test="configType != null and configType != ''">
AND configType = #{configType}
</if>
<if test="configKey != null and configKey != ''">
AND configKey like concat('%', #{configKey}, '%')
</if>
<if test="params != null and params.beginTime != null"><!-- 开始时间检索 -->
and date_format(createTime,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params != null and params.endTime != null"><!-- 结束时间检索 -->
and date_format(createTime,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
</select>
<select id="checkConfigKeyUnique" parameterType="String" resultMap="ConfigResult">
<include refid="selectConfigVo"/>
where configKey = #{configKey}
</select>
<insert id="insertConfig" parameterType="com.huaheng.pc.system.config.domain.Config">
insert into sys_config (
<if test="configName != null and configName != '' ">configName,</if>
<if test="configKey != null and configKey != '' ">configKey,</if>
<if test="configValue != null and configValue != '' ">configValue,</if>
<if test="configType != null and configType != '' ">configType,</if>
<if test="createBy != null and createBy != ''">createBy,</if>
<if test="remark != null and remark != ''">remark,</if>
createTime
)values(
<if test="configName != null and configName != ''">#{configName},</if>
<if test="configKey != null and configKey != ''">#{configKey},</if>
<if test="configValue != null and configValue != ''">#{configValue},</if>
<if test="configType != null and configType != ''">#{configType},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
)
</insert>
<update id="updateConfig" parameterType="com.huaheng.pc.system.config.domain.Config">
update sys_config
<set>
<if test="configName != null and configName != ''">configName = #{configName},</if>
<if test="configKey != null and configKey != ''">configKey = #{configKey},</if>
<if test="configValue != null and configValue != ''">configValue = #{configValue},</if>
<if test="configType != null and configType != ''">configType = #{configType},</if>
<if test="updateBy != null and updateBy != ''">updateBy = #{updateBy},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
updateTime = sysdate()
</set>
where id = #{id}
</update>
<delete id="deleteConfigByIds" parameterType="String">
delete from sys_config where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>