<?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.xt.hb.data.system.mapper.SysParamMapper" >
  <resultMap id="BaseResultMap" type="com.xt.hb.data.system.model.SysParam" >
    <id column="ID" property="id" jdbcType="VARCHAR" />
    <result column="KEY" property="key" jdbcType="VARCHAR" />
    <result column="VALUE" property="value" jdbcType="VARCHAR" />
    <result column="CLAZZ" property="clazz" jdbcType="VARCHAR" />
    <result column="DISP" property="disp" jdbcType="VARCHAR" />
    <result column="VALID" property="valid" jdbcType="CHAR" />
    <result column="SYSTEM" property="system" jdbcType="CHAR" />
  </resultMap>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    delete from T_SYS_PARAM
    where ID = #{id,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" parameterType="com.xt.hb.data.system.model.SysParam" >
    insert into T_SYS_PARAM (ID, KEY, VALUE, 
      CLAZZ, DISP, VALID,SYSTEM)
    values (#{id,jdbcType=VARCHAR}, #{key,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR}, 
      #{clazz,jdbcType=VARCHAR}, #{disp,jdbcType=VARCHAR}, #{valid,jdbcType=CHAR}, #{system,jdbcType=VARCHAR})
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.xt.hb.data.system.model.SysParam" >
    UPDATE T_SYS_PARAM
    SET KEY = #{key,jdbcType=VARCHAR},
      VALUE = #{value,jdbcType=VARCHAR},
      CLAZZ = #{clazz,jdbcType=VARCHAR},
      DISP = #{disp,jdbcType=VARCHAR},
      VALID = #{valid,jdbcType=CHAR},
      SYSTEM = #{system,jdbcType=VARCHAR}
    WHERE ID = #{id,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select ID, KEY, VALUE, CLAZZ, DISP, VALID, SYSTEM
    from T_SYS_PARAM
    where ID = #{id,jdbcType=VARCHAR}
  </select>
  <select id="selectAll" resultMap="BaseResultMap" >
    select ID, KEY, VALUE, CLAZZ, DISP, VALID, SYSTEM
    from T_SYS_PARAM
  </select>
  <select id="selectBySystemOrNull" resultMap="BaseResultMap" parameterType="java.lang.String">
    select ID, KEY, VALUE, CLAZZ, DISP, VALID, SYSTEM
    from T_SYS_PARAM
    where (SYSTEM=#{system,jdbcType=VARCHAR} OR SYSTEM IS NULL) AND VALID='1'
  </select>
</mapper>