admin
2020-05-20 98b1a0affd69bbe63223c21fdd2c404e8bedfccb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?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.yeshi.fanli.dao.mybatis.homemodule.CommonShareInfoMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.homemodule.CommonShareInfo">
    <id column="csi_id" property="id" jdbcType="BIGINT"/>
    <result column="csi_pid" property="pid" jdbcType="BIGINT"/>
    <result column="csi_need_spin" property="needSpin" jdbcType="BOOLEAN"/>
    <result column="csi_comment" property="comment" jdbcType="VARCHAR"/>
    <result column="csi_createtime" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="csi_updatetime" property="updateTime" jdbcType="TIMESTAMP"/>
    <result column="csi_type" property="type" typeHandler="com.yeshi.fanli.util.mybatishandler.CommonShareInfoEnumHandler"/>
    
  </resultMap>
  <sql id="Base_Column_List">csi_id,csi_pid,csi_type,csi_need_spin,csi_comment,csi_createtime,csi_updatetime</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_common_share_info where csi_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_common_share_info where csi_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.homemodule.CommonShareInfo" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_share_info (csi_id,csi_pid,csi_type,csi_need_spin,csi_comment,csi_createtime,csi_updatetime) values (#{id,jdbcType=BIGINT},#{pid,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{needSpin,jdbcType=BOOLEAN},#{comment,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.CommonShareInfo" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_common_share_info
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">csi_id,</if>
      <if test="pid != null">csi_pid,</if>
      <if test="type != null">csi_type,</if>
      <if test="needSpin != null">csi_need_spin,</if>
      <if test="comment != null">csi_comment,</if>
      <if test="createTime != null">csi_createtime,</if>
      <if test="updateTime != null">csi_updatetime,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="pid != null">#{pid,jdbcType=BIGINT},</if>
      <if test="type != null">#{type,jdbcType=VARCHAR},</if>
      <if test="needSpin != null">#{needSpin,jdbcType=BOOLEAN},</if>
      <if test="comment != null">#{comment,jdbcType=VARCHAR},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.homemodule.CommonShareInfo">update yeshi_ec_common_share_info set csi_pid = #{pid,jdbcType=BIGINT},csi_type = #{type,jdbcType=VARCHAR},csi_need_spin = #{needSpin,jdbcType=BOOLEAN},csi_comment = #{comment,jdbcType=VARCHAR},csi_createtime = #{createTime,jdbcType=TIMESTAMP},csi_updatetime = #{updateTime,jdbcType=TIMESTAMP} where csi_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.CommonShareInfo">update yeshi_ec_common_share_info
    <set>
      <if test="pid != null">csi_pid=#{pid,jdbcType=BIGINT},</if>
      <if test="type != null">csi_type=#{type,jdbcType=VARCHAR},</if>
      <if test="needSpin != null">csi_need_spin=#{needSpin,jdbcType=BOOLEAN},</if>
      <if test="comment != null">csi_comment=#{comment,jdbcType=VARCHAR},</if>
      <if test="createTime != null">csi_createtime=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">csi_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where csi_id = #{id,jdbcType=BIGINT}
  </update>
  
  <select id="getByPidAndType" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_common_share_info
    WHERE csi_pid = #{pid}  AND csi_type = #{type} 
    ORDER BY csi_id DESC
    LIMIT 1
  </select>
  
 <delete id="deleteByPidAndType">
     delete from yeshi_ec_common_share_info where csi_pid = #{pid} AND csi_type = #{type} 
 </delete>
  
</mapper>