heheng
4 天以前 4a91f037d3488ed7bc00664e1acc004810651f43
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
<?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.gkhy.exam.system.mapper.SysConfigMapper">
 
    <resultMap type="com.gkhy.exam.system.domain.SysConfig" id="SysConfigResult">
        <id     property="id"      column="id"      />
        <result property="name"    column="name"    />
        <result property="configKey"     column="config_key"     />
        <result property="configValue"   column="config_value"   />
        <result property="type"    column="type"    />
        <result property="createBy"      column="create_by"      />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"      column="update_by"      />
        <result property="updateTime"    column="update_time"    />
    </resultMap>
 
    <sql id="selectConfigVo">
        select id, name, config_key, config_value, type, create_by, create_time, update_by, update_time, remark
        from sys_config
    </sql>
 
    <!-- 查询条件 -->
    <sql id="sqlwhereSearch">
        <where>
            <if test="id !=null">
                and id = #{id}
            </if>
            <if test="configKey !=null and configKey != ''">
                and config_key = #{configKey}
            </if>
        </where>
    </sql>
 
    <select id="getConfig" resultMap="SysConfigResult">
        <include refid="selectConfigVo"></include>
        <include refid="sqlwhereSearch"></include>
    </select>
 
    <select id="selectConfigList" resultMap="SysConfigResult">
        <include refid="selectConfigVo"/>
        <where>
            <if test="name != null and name != ''">
                AND name like concat('%', #{name}, '%')
            </if>
            <if test="type != null and type != ''">
                AND type = #{type}
            </if>
            <if test="configKey != null and configKey != ''">
                AND config_key like concat('%', #{configKey}, '%')
            </if>
            <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
                and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
            </if>
            <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
                and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
            </if>
        </where>
    </select>
</mapper>