DegradeConfigMapper.xml 7.37 KB
<?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.monitor.mysql.mapper.DegradeConfigMapper" >
  <resultMap id="BaseResultMap" type="com.monitor.model.domain.DegradeConfig" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="config_name" property="configName" jdbcType="VARCHAR" />
    <result column="config_show_name" property="configShowName" jdbcType="VARCHAR" />
    <result column="switch_on" property="switchOn" jdbcType="CHAR" />
    <result column="config_desc" property="configDesc" jdbcType="VARCHAR" />
    <result column="level" property="level" jdbcType="TINYINT" />
    <result column="img_url" property="imgUrl" jdbcType="VARCHAR" />
    <result column="function_point_name" property="functionPointName" jdbcType="VARCHAR" />
    <result column="level1_page" property="level1Page" jdbcType="VARCHAR" />
    <result column="level2_page" property="level2Page" jdbcType="VARCHAR" />
    <result column="api_name" property="apiName" jdbcType="VARCHAR" />
    <result column="client_type" property="clientType" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, config_name, config_show_name, switch_on, config_desc, level, img_url,function_point_name,level1_page,level2_page,api_name,client_type
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from degrade_info
    where id = #{id,jdbcType=INTEGER}
  </select>
  <select id="selectByCondition" resultMap="BaseResultMap" parameterType="com.monitor.model.request.DegradeInfoReq">
      select
      <include refid="Base_Column_List" />
      from degrade_info
      where 1=1
      <if test="switchOn != null &amp;&amp; switchOn != '' " >
          and switch_on = #{switchOn}
      </if>
      <if test="level != null &amp;&amp; level != '' " >
          and level = #{level}
      </if>
      <if test="level1Page != null &amp;&amp; level1Page != '' " >
          and level1_page = #{level1Page}
      </if>
      <if test="level2Page != null &amp;&amp; level2Page != '' " >
          and level2_page = #{level2Page}
      </if>
      <if test="clientType != null &amp;&amp; clientType != '' &amp;&amp;clientType != '全部' " >
          and client_type = #{clientType}
      </if>
  </select>

    <select id="selectInitInfo" resultMap="BaseResultMap">
        select DISTINCT function_point_name,level1_page,level2_page
        from degrade_info
    </select>

  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from degrade_info
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.monitor.model.domain.DegradeConfig" >
    insert into degrade_info (id, config_name, config_show_name, switch_on,
      config_desc, level, img_url,function_point_name,level1_page,level2_page,api_name,client_type
      )
    values (#{id,jdbcType=INTEGER}, #{configName,jdbcType=VARCHAR}, #{configShowName,jdbcType=VARCHAR}, #{switchOn,jdbcType=CHAR},
      #{configDesc,jdbcType=VARCHAR}, #{level,jdbcType=TINYINT}, #{imgUrl,jdbcType=VARCHAR},#{functionPointName,jdbcType=VARCHAR},
      #{level1Page,jdbcType=VARCHAR},#{level2Page,jdbcType=VARCHAR},#{apiName,jdbcType=VARCHAR},#{clientType,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.monitor.model.domain.DegradeConfig" >
    insert into degrade_info
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="configName != null" >
        config_name,
      </if>
      <if test="configShowName != null" >
          config_show_name,
      </if>
      <if test="switchOn != null" >
        switch_on,
      </if>
      <if test="configDesc != null" >
        config_desc,
      </if>
      <if test="level != null" >
        level,
      </if>
      <if test="imgUrl != null" >
        img_url,
      </if>
        <if test="functionPointName != null" >
            function_point_name,
        </if>
        <if test="level1Page != null" >
            level1_page,
        </if>
        <if test="level2Page != null" >
            level2_page,
        </if>
        <if test="apiName != null" >
            api_name,
        </if>
        <if test="clientType != null" >
            client_type,
        </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="configName != null" >
        #{configName,jdbcType=VARCHAR},
      </if>
      <if test="configShowName != null" >
        #{configShowName,jdbcType=VARCHAR},
      </if>
      <if test="switchOn != null" >
        #{switchOn,jdbcType=CHAR},
      </if>
      <if test="configDesc != null" >
        #{configDesc,jdbcType=VARCHAR},
      </if>
      <if test="level != null" >
        #{level,jdbcType=TINYINT},
      </if>
      <if test="imgUrl != null" >
        #{imgUrl,jdbcType=VARCHAR},
      </if>
        <if test="functionPointName != null" >
            #{functionPointName,jdbcType=VARCHAR},
        </if>
        <if test="level1Page != null" >
            #{level1Page,jdbcType=VARCHAR},
        </if>
        <if test="level2Page != null" >
            #{level2Page,jdbcType=VARCHAR},
        </if>
        <if test="apiName != null" >
            #{apiName,jdbcType=VARCHAR},
        </if>
        <if test="clientType != null" >
            #{clientType,jdbcType=VARCHAR},
        </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.monitor.model.domain.DegradeConfig" >
    update degrade_info
    <set >
      <if test="configShowName != null" >
        config_show_name = #{configShowName,jdbcType=VARCHAR},
      </if>
      <if test="switchOn != null" >
        switch_on = #{switchOn,jdbcType=CHAR},
      </if>
      <if test="configDesc != null" >
        config_desc = #{configDesc,jdbcType=VARCHAR},
      </if>
      <if test="level != null" >
        level = #{level,jdbcType=TINYINT},
      </if>
      <if test="imgUrl != null" >
        img_url = #{imgUrl,jdbcType=VARCHAR},
      </if>
        <if test="functionPointName != null" >
            function_point_name = #{functionPointName,jdbcType=VARCHAR},
        </if>
        <if test="level1Page != null" >
            level1_page = #{level1Page,jdbcType=VARCHAR},
        </if>
        <if test="level2Page != null" >
            level2_page = #{level2Page,jdbcType=VARCHAR},
        </if>
        <if test="apiName != null" >
            api_name = #{apiName,jdbcType=VARCHAR},
        </if>
        <if test="clientType != null" >
            client_type = #{clientType,jdbcType=VARCHAR},
        </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.monitor.model.domain.DegradeConfig" >
    update degrade_info
    set config_name = #{configName,jdbcType=VARCHAR},
      config_show_name = #{configShowName,jdbcType=VARCHAR},
      switch_on = #{switchOn,jdbcType=CHAR},
      config_desc = #{configDesc,jdbcType=VARCHAR},
      level = #{level,jdbcType=TINYINT},
      img_url = #{imgUrl,jdbcType=VARCHAR},
      function_point_name = #{functionPointName,jdbcType=VARCHAR},
      level1_page = #{level1Page,jdbcType=VARCHAR},
      level2_page = #{level2Page,jdbcType=VARCHAR},
      api_name = #{apiName,jdbcType=VARCHAR},
      client_type = #{clientType,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>