EventMapper.xml 6.01 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="cn.runsa.crmapp.common.mapper.EventMapper" >
  <resultMap id="BaseResultMap" type="cn.runsa.crmapp.common.entity.Event" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="EVT_ID" property="evtId" jdbcType="INTEGER" />
    <result column="EVT_CODE" property="evtCode" jdbcType="VARCHAR" />
    <result column="EVT_NAME" property="evtName" jdbcType="VARCHAR" />
    <result column="EVT_DESC" property="evtDesc" jdbcType="VARCHAR" />
    <result column="GLOBAL" property="global" jdbcType="BIT" />
    <result column="INTERNAL" property="internal" jdbcType="BIT" />
    <result column="REC_TIME" property="recTime" jdbcType="TIMESTAMP" />
    <result column="REC_USER" property="recUser" jdbcType="BIGINT" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    `EVT_ID`, `EVT_CODE`, `EVT_NAME`, `EVT_DESC`, `GLOBAL`, `INTERNAL`, `REC_TIME`, `REC_USER`
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from crm_event
    where `EVT_ID` = #{evtId,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from crm_event
    where `EVT_ID` = #{evtId,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="cn.runsa.crmapp.common.entity.Event" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <selectKey resultType="java.lang.Integer" keyProperty="evtId" order="AFTER" >
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into crm_event (`EVT_CODE`, `EVT_NAME`, `EVT_DESC`, 
      `GLOBAL`, `INTERNAL`, `REC_TIME`, 
      `REC_USER`)
    values (#{evtCode,jdbcType=VARCHAR}, #{evtName,jdbcType=VARCHAR}, #{evtDesc,jdbcType=VARCHAR}, 
      #{global,jdbcType=BIT}, #{internal,jdbcType=BIT}, #{recTime,jdbcType=TIMESTAMP}, 
      #{recUser,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" parameterType="cn.runsa.crmapp.common.entity.Event" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <selectKey resultType="java.lang.Integer" keyProperty="evtId" order="AFTER" >
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into crm_event
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="evtCode != null" >
        `EVT_CODE`,
      </if>
      <if test="evtName != null" >
        `EVT_NAME`,
      </if>
      <if test="evtDesc != null" >
        `EVT_DESC`,
      </if>
      <if test="global != null" >
        `GLOBAL`,
      </if>
      <if test="internal != null" >
        `INTERNAL`,
      </if>
      <if test="recTime != null" >
        `REC_TIME`,
      </if>
      <if test="recUser != null" >
        `REC_USER`,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="evtCode != null" >
        #{evtCode,jdbcType=VARCHAR},
      </if>
      <if test="evtName != null" >
        #{evtName,jdbcType=VARCHAR},
      </if>
      <if test="evtDesc != null" >
        #{evtDesc,jdbcType=VARCHAR},
      </if>
      <if test="global != null" >
        #{global,jdbcType=BIT},
      </if>
      <if test="internal != null" >
        #{internal,jdbcType=BIT},
      </if>
      <if test="recTime != null" >
        #{recTime,jdbcType=TIMESTAMP},
      </if>
      <if test="recUser != null" >
        #{recUser,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="cn.runsa.crmapp.common.entity.Event" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update crm_event
    <set >
      <if test="evtCode != null" >
        `EVT_CODE` = #{evtCode,jdbcType=VARCHAR},
      </if>
      <if test="evtName != null" >
        `EVT_NAME` = #{evtName,jdbcType=VARCHAR},
      </if>
      <if test="evtDesc != null" >
        `EVT_DESC` = #{evtDesc,jdbcType=VARCHAR},
      </if>
      <if test="global != null" >
        `GLOBAL` = #{global,jdbcType=BIT},
      </if>
      <if test="internal != null" >
        `INTERNAL` = #{internal,jdbcType=BIT},
      </if>
      <if test="recTime != null" >
        `REC_TIME` = #{recTime,jdbcType=TIMESTAMP},
      </if>
      <if test="recUser != null" >
        `REC_USER` = #{recUser,jdbcType=BIGINT},
      </if>
    </set>
    where `EVT_ID` = #{evtId,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.runsa.crmapp.common.entity.Event" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update crm_event
    set `EVT_CODE` = #{evtCode,jdbcType=VARCHAR},
      `EVT_NAME` = #{evtName,jdbcType=VARCHAR},
      `EVT_DESC` = #{evtDesc,jdbcType=VARCHAR},
      `GLOBAL` = #{global,jdbcType=BIT},
      `INTERNAL` = #{internal,jdbcType=BIT},
      `REC_TIME` = #{recTime,jdbcType=TIMESTAMP},
      `REC_USER` = #{recUser,jdbcType=BIGINT}
    where `EVT_ID` = #{evtId,jdbcType=INTEGER}
  </update>
  <select id="selectOuters" resultMap="BaseResultMap">
  	select EVT_CODE,EVT_ID,EVT_NAME,EVT_DESC,GLOBAL
  	from crm_event where INTERNAL = 0
  </select>
  
  <select id="selectByEventCode" resultMap="BaseResultMap" parameterType="java.lang.String">
  	 select 
    <include refid="Base_Column_List" />
    from crm_event
    where `EVT_CODE` = #{evtCode}
  </select>
</mapper>