ActivtyTemplatedFloorMapper.xml 2.49 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.yoho.resource.dal.ActivtyTemplatedFloorMapper" >
  <resultMap id="BaseResultMap" type="com.yoho.resource.model.ActivtyTemplatedFloor" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="activty_templated_id" property="activtyTemplatedId" jdbcType="INTEGER" />
    <result column="order" property="order" jdbcType="INTEGER" />
    <result column="is_del" property="isDel" jdbcType="TINYINT" />
  </resultMap>
  <resultMap id="ResultMapWithBLOBs" type="com.yoho.resource.model.ActivtyTemplatedFloor" extends="BaseResultMap" >
    <result column="module_data" property="moduleData" jdbcType="LONGVARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, activty_templated_id, `order`, is_del
  </sql>
  <sql id="Blob_Column_List" >
    module_data
  </sql>
  <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from activty_templated_floor
    where id = #{id,jdbcType=INTEGER}
  </select>

  <insert id="insertBatch">
    insert into activty_templated_floor (activty_templated_id, `order`, module_data)
    values
    <foreach collection="floors" item="item" separator=",">
      (#{item.activtyTemplatedId,jdbcType=INTEGER}, #{item.order,jdbcType=INTEGER},  #{item.moduleData,jdbcType=LONGVARCHAR})
    </foreach>

  </insert>

  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.yoho.resource.model.ActivtyTemplatedFloor" >
    update activty_templated_floor
    set activty_templated_id = #{activtyTemplatedId,jdbcType=INTEGER},
      `order` = #{order,jdbcType=INTEGER},
      is_del = #{isDel,jdbcType=TINYINT},
      module_data = #{moduleData,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByTemplateId" parameterType="java.lang.Integer" >
    update activty_templated_floor
    set
      is_del = 1
    where activty_templated_id = #{templatedId,jdbcType=INTEGER}
  </update>

  <select id="selectByTemplatedId" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer">
    select
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from activty_templated_floor
    where activty_templated_id = #{templatedId,jdbcType=INTEGER} AND is_del = 0 ORDER BY `order` ASC
  </select>
</mapper>