ActivtyTemplatedMapper.xml 2.16 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.ActivtyTemplatedMapper" >
  <resultMap id="BaseResultMap" type="com.yoho.resource.model.ActivtyTemplated" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="title" property="title" jdbcType="VARCHAR" />
    <result column="status" property="status" jdbcType="TINYINT" />
    <result column="is_del" property="isDel" jdbcType="TINYINT" />
    <result column="create_time" property="createTime" jdbcType="INTEGER" />
    <result column="update_time" property="updateTime" jdbcType="INTEGER" />
    <result column="update_user" property="updateUser" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, title, status, is_del, create_time, update_time, update_user
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from activty_templated
    where id = #{id,jdbcType=INTEGER}
  </select>

  <select id="selectList" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from activty_templated WHERE is_del = 0 ORDER BY id DESC limit #{start,jdbcType=INTEGER}, #{size,jdbcType=INTEGER}
  </select>

  <select id="selectCount" resultType="java.lang.Integer">
    select count(1)
    from activty_templated WHERE is_del = 0
  </select>

  <insert id="insert" parameterType="com.yoho.resource.model.ActivtyTemplated"  useGeneratedKeys="true" keyProperty="id">
    insert into activty_templated (title,  create_time, update_time)
    values (#{title,jdbcType=VARCHAR}, unix_timestamp(now()), unix_timestamp(now()))
  </insert>

  <update id="updateStatus">
    update activty_templated
    set status = #{status,jdbcType=INTEGER},  update_time = unix_timestamp(now())
    where id = #{id,jdbcType=INTEGER}
  </update>

  <update id="updateByPrimaryKey" parameterType="com.yoho.resource.model.ActivtyTemplated" >
    update activty_templated set  title = #{title,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>