NoticeRuleMapper.xml 3.56 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.yohoufo.dal.order.NoticeRuleMapper">
  <resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.NoticeRule">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="case_id" jdbcType="INTEGER" property="caseId" />
    <result column="method" jdbcType="SMALLINT" property="method" />
    <result column="quantity" jdbcType="INTEGER" property="quantity" />
    <result column="time_unit_region" jdbcType="INTEGER" property="timeUnitRegion" />
    <result column="time_unit" jdbcType="SMALLINT" property="timeUnit" />
  </resultMap>
  <sql id="Base_Column_List">
    id, case_id, method, quantity, time_unit_region, time_unit
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from notice_rule
    where id = #{id,jdbcType=INTEGER}
  </select>

  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.NoticeRule" useGeneratedKeys="true">
    insert into notice_rule (case_id, method, quantity, 
      time_unit_region, time_unit)
    values (#{caseId,jdbcType=INTEGER}, #{method,jdbcType=SMALLINT}, #{quantity,jdbcType=INTEGER}, 
      #{timeUnitRegion,jdbcType=INTEGER}, #{timeUnit,jdbcType=SMALLINT})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.NoticeRule" useGeneratedKeys="true">
    insert into notice_rule
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="caseId != null">
        case_id,
      </if>
      <if test="method != null">
        method,
      </if>
      <if test="quantity != null">
        quantity,
      </if>
      <if test="timeUnitRegion != null">
        time_unit_region,
      </if>
      <if test="timeUnit != null">
        time_unit,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="caseId != null">
        #{caseId,jdbcType=INTEGER},
      </if>
      <if test="method != null">
        #{method,jdbcType=SMALLINT},
      </if>
      <if test="quantity != null">
        #{quantity,jdbcType=INTEGER},
      </if>
      <if test="timeUnitRegion != null">
        #{timeUnitRegion,jdbcType=INTEGER},
      </if>
      <if test="timeUnit != null">
        #{timeUnit,jdbcType=SMALLINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.NoticeRule">
    update notice_rule
    <set>
      <if test="caseId != null">
        case_id = #{caseId,jdbcType=INTEGER},
      </if>
      <if test="method != null">
        method = #{method,jdbcType=SMALLINT},
      </if>
      <if test="quantity != null">
        quantity = #{quantity,jdbcType=INTEGER},
      </if>
      <if test="timeUnitRegion != null">
        time_unit_region = #{timeUnitRegion,jdbcType=INTEGER},
      </if>
      <if test="timeUnit != null">
        time_unit = #{timeUnit,jdbcType=SMALLINT},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yohoufo.dal.order.model.NoticeRule">
    update notice_rule
    set case_id = #{caseId,jdbcType=INTEGER},
      method = #{method,jdbcType=SMALLINT},
      quantity = #{quantity,jdbcType=INTEGER},
      time_unit_region = #{timeUnitRegion,jdbcType=INTEGER},
      time_unit = #{timeUnit,jdbcType=SMALLINT}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>