src/main/resources/mapper/SystemConfigMapper.xml
@@ -2,74 +2,97 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.everyday.word.dao.config.SystemConfigMapper">
  <resultMap id="BaseResultMap" type="com.everyday.word.entity.config.SystemConfig">
    <id column="id" property="id" jdbcType="BIGINT"/>
    <result column="key" property="key" jdbcType="VARCHAR"/>
    <result column="value" property="value" jdbcType="VARCHAR"/>
    <result column="name" property="name" jdbcType="VARCHAR"/>
    <result column="system" property="system" jdbcType="VARCHAR"/>
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">id,key,value,name,system,create_time,update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/> from table_system_config where id = #{id,jdbcType=BIGINT}
  </select>
  <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/> from table_system_config where id = #{id,jdbcType=BIGINT} for update
  </select>
  <sql id="listWhereSQL">
    <if test="query.id!=null">AND id = #{query.id}</if>
    <if test="query.key!=null">AND key = #{query.key}</if>
    <if test="query.value!=null">AND value = #{query.value}</if>
    <if test="query.name!=null">AND name = #{query.name}</if>
    <if test="query.system!=null">AND system = #{query.system}</if>
    <if test="query.minCreateTime!=null">AND create_time >= #{query.minCreateTime}</if>
    <if test="query.maxCreateTime!=null">AND #{query.maxCreateTime} > create_time</if>
    <if test="query.minUpdateTime!=null">AND update_time >= #{query.minUpdateTime}</if>
    <if test="query.maxUpdateTime!=null">AND #{query.maxUpdateTime} > update_time</if>
  </sql>
  <select id="list" resultMap="BaseResultMap">select
    <include refid="Base_Column_List"/> from table_system_config where 1=1
    <include refid="listWhereSQL"/>
    <if test="query.sortList!=null">
      <foreach collection="query.sortList" item="item" open=" order by " separator=",">#{item}</foreach>
    </if>limit #{query.start},#{query.count}
  </select>
  <select id="count" resultType="java.lang.Long">select count(*) from table_system_config where 1=1
    <include refid="listWhereSQL"/>
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from table_system_config where id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.everyday.word.entity.config.SystemConfig" useGeneratedKeys="true" keyProperty="id">insert into table_system_config (id,key,value,name,system,create_time,update_time) values (#{id,jdbcType=BIGINT},#{key,jdbcType=VARCHAR},#{value,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},#{system,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.everyday.word.entity.config.SystemConfig" useGeneratedKeys="true" keyProperty="id">insert into table_system_config
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">id,</if>
      <if test="key != null">key,</if>
      <if test="value != null">value,</if>
      <if test="name != null">name,</if>
      <if test="system != null">system,</if>
      <if test="createTime != null">create_time,</if>
      <if test="updateTime != null">update_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="key != null">#{key,jdbcType=VARCHAR},</if>
      <if test="value != null">#{value,jdbcType=VARCHAR},</if>
      <if test="name != null">#{name,jdbcType=VARCHAR},</if>
      <if test="system != null">#{system,jdbcType=VARCHAR},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.everyday.word.entity.config.SystemConfig">update table_system_config set key = #{key,jdbcType=VARCHAR},value = #{value,jdbcType=VARCHAR},name = #{name,jdbcType=VARCHAR},system = #{system,jdbcType=VARCHAR},create_time = #{createTime,jdbcType=TIMESTAMP},update_time = #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.everyday.word.entity.config.SystemConfig">update table_system_config
    <set>
      <if test="key != null">key=#{key,jdbcType=VARCHAR},</if>
      <if test="value != null">value=#{value,jdbcType=VARCHAR},</if>
      <if test="name != null">name=#{name,jdbcType=VARCHAR},</if>
      <if test="system != null">system=#{system,jdbcType=VARCHAR},</if>
      <if test="createTime != null">create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where id = #{id,jdbcType=BIGINT}
  </update>
    <resultMap id="BaseResultMap" type="com.everyday.word.entity.config.SystemConfig">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="key" property="key" jdbcType="VARCHAR"/>
        <result column="value" property="value" jdbcType="VARCHAR"/>
        <result column="name" property="name" jdbcType="VARCHAR"/>
        <result column="system" property="system" jdbcType="VARCHAR"/>
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    </resultMap>
    <sql id="Base_Column_List">id
    ,`key`,`value`,`name`,`system`,create_time,update_time</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
        <include refid="Base_Column_List"/>
        from table_system_config where id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" parameterType="java.lang.Long">select
        <include refid="Base_Column_List"/>
        from table_system_config where id = #{id,jdbcType=BIGINT} for update
    </select>
    <sql id="listWhereSQL">
        <if test="query.id!=null">AND id = #{query.id}</if>
        <if test="query.key!=null">AND `key` = #{query.key}</if>
        <if test="query.value!=null">AND `value` = #{query.value}</if>
        <if test="query.name!=null">AND `name` = #{query.name}</if>
        <if test="query.system!=null">AND `system` = #{query.system}</if>
        <if test="query.minCreateTime!=null">AND create_time >= #{query.minCreateTime}</if>
        <if test="query.maxCreateTime!=null">AND #{query.maxCreateTime} > create_time</if>
        <if test="query.minUpdateTime!=null">AND update_time >= #{query.minUpdateTime}</if>
        <if test="query.maxUpdateTime!=null">AND #{query.maxUpdateTime} > update_time</if>
    </sql>
    <select id="list" resultMap="BaseResultMap">select
        <include refid="Base_Column_List"/>
        from table_system_config where 1=1
        <include refid="listWhereSQL"/>
        <if test="query.sortList!=null">
            <foreach collection="query.sortList" item="item" open=" order by " separator=",">#{item}</foreach>
        </if>
        limit #{query.start},#{query.count}
    </select>
    <select id="count" resultType="java.lang.Long">select count(*) from table_system_config where 1=1
        <include refid="listWhereSQL"/>
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete
                                                                   from table_system_config
                                                                   where id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="com.everyday.word.entity.config.SystemConfig" useGeneratedKeys="true"
            keyProperty="id">insert into table_system_config (id, `key`, `value`, `name`, `system`, create_time, update_time)
                             values (#{id,jdbcType=BIGINT}, #{key,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR},
                                     #{name,jdbcType=VARCHAR}, #{system,jdbcType=VARCHAR},
                                     #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})</insert>
    <insert id="insertSelective" parameterType="com.everyday.word.entity.config.SystemConfig" useGeneratedKeys="true"
            keyProperty="id">insert into table_system_config
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="key != null">`key`,</if>
            <if test="value != null">`value`,</if>
            <if test="name != null">`name`,</if>
            <if test="system != null">`system`,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="key != null">#{key,jdbcType=VARCHAR},</if>
            <if test="value != null">#{value,jdbcType=VARCHAR},</if>
            <if test="name != null">#{name,jdbcType=VARCHAR},</if>
            <if test="system != null">#{system,jdbcType=VARCHAR},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey"
            parameterType="com.everyday.word.entity.config.SystemConfig">update table_system_config
                                                                         set `key`         = #{key,jdbcType=VARCHAR},
                                                                             `value`       = #{value,jdbcType=VARCHAR},
                                                                             `name`        = #{name,jdbcType=VARCHAR},
                                                                             `system`      = #{system,jdbcType=VARCHAR},
                                                                             create_time = #{createTime,jdbcType=TIMESTAMP},
                                                                             update_time = #{updateTime,jdbcType=TIMESTAMP}
                                                                         where id = #{id,jdbcType=BIGINT}</update>
    <update id="updateByPrimaryKeySelective" parameterType="com.everyday.word.entity.config.SystemConfig">update
        table_system_config
        <set>
            <if test="key != null">`key`=#{key,jdbcType=VARCHAR},</if>
            <if test="value != null">`value`=#{value,jdbcType=VARCHAR},</if>
            <if test="name != null">`name`=#{name,jdbcType=VARCHAR},</if>
            <if test="system != null">`system`=#{system,jdbcType=VARCHAR},</if>
            <if test="createTime != null">create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
</mapper>