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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?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.jd.JDGoodsClassMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.jd.JDGoodsClass">
    <id column="cjd_id" property="id" jdbcType="BIGINT"/>
    <result column="cjd_cid" property="cid" jdbcType="INTEGER"/>
    <result column="cjd_name" property="name" jdbcType="VARCHAR"/>
    <result column="cjd_level" property="level" jdbcType="INTEGER"/>
    <result column="cjd_super_id" property="superId" jdbcType="INTEGER"/>
    <result column="cjp_self_comm" property="selfComm" jdbcType="DECIMAL"/>
    <result column="cjp_pop_comm" property="popComm" jdbcType="DECIMAL"/>
    <result column="cjd_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="cjd_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">cjd_id,cjd_cid,cjd_name,cjd_level,cjd_super_id,cjp_self_comm,cjp_pop_comm,cjd_create_time,cjd_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_class_jd where cjd_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_class_jd where cjd_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.jd.JDGoodsClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_class_jd (cjd_id,cjd_cid,cjd_name,cjd_level,cjd_super_id,cjp_self_comm,cjp_pop_comm,cjd_create_time,cjd_update_time) values (#{id,jdbcType=BIGINT},#{cid,jdbcType=INTEGER},#{name,jdbcType=VARCHAR},#{level,jdbcType=INTEGER},#{superId,jdbcType=INTEGER},#{selfComm,jdbcType=DECIMAL},#{popComm,jdbcType=DECIMAL},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.jd.JDGoodsClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_class_jd
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">cjd_id,</if>
      <if test="cid != null">cjd_cid,</if>
      <if test="name != null">cjd_name,</if>
      <if test="level != null">cjd_level,</if>
      <if test="superId != null">cjd_super_id,</if>
      <if test="selfComm != null">cjp_self_comm,</if>
      <if test="popComm != null">cjp_pop_comm,</if>
      <if test="createTime != null">cjd_create_time,</if>
      <if test="updateTime != null">cjd_update_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="cid != null">#{cid,jdbcType=INTEGER},</if>
      <if test="name != null">#{name,jdbcType=VARCHAR},</if>
      <if test="level != null">#{level,jdbcType=INTEGER},</if>
      <if test="superId != null">#{superId,jdbcType=INTEGER},</if>
      <if test="selfComm != null">#{selfComm,jdbcType=DECIMAL},</if>
      <if test="popComm != null">#{popComm,jdbcType=DECIMAL},</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.jd.JDGoodsClass">update yeshi_ec_class_jd set cjd_cid = #{cid,jdbcType=INTEGER},cjd_name = #{name,jdbcType=VARCHAR},cjd_level = #{level,jdbcType=INTEGER},cjd_super_id = #{superId,jdbcType=INTEGER},cjp_self_comm = #{selfComm,jdbcType=DECIMAL},cjp_pop_comm = #{popComm,jdbcType=DECIMAL},cjd_create_time = #{createTime,jdbcType=TIMESTAMP},cjd_update_time = #{updateTime,jdbcType=TIMESTAMP} where cjd_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.jd.JDGoodsClass">update yeshi_ec_class_jd
    <set>
      <if test="cid != null">cjd_cid=#{cid,jdbcType=INTEGER},</if>
      <if test="name != null">cjd_name=#{name,jdbcType=VARCHAR},</if>
      <if test="level != null">cjd_level=#{level,jdbcType=INTEGER},</if>
      <if test="superId != null">cjd_super_id=#{superId,jdbcType=INTEGER},</if>
      <if test="selfComm != null">cjp_self_comm=#{selfComm,jdbcType=DECIMAL},</if>
      <if test="popComm != null">cjp_pop_comm=#{popComm,jdbcType=DECIMAL},</if>
      <if test="createTime != null">cjd_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">cjd_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where cjd_id = #{id,jdbcType=BIGINT}
  </update>
  
  <delete id="deleteByDate">
      DELETE FROM yeshi_ec_class_jd 
      WHERE cjd_level = #{level} AND cjd_create_time <![CDATA[<]]>#{date}
  </delete>
  
  
  <select id="getByLevel" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_class_jd d
    WHERE d.`cjd_level`= #{level}
  </select>
  
  <select id="getByPid" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_class_jd d
    WHERE d.`cjd_super_id`= #{pid}
  </select>
  
  
  <select id="getByCid" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_class_jd d
    WHERE d.`cjd_level` = #{level} AND d.`cjd_cid` = #{cid}
    ORDER BY d.`cjd_create_time` DESC
    LIMIT 1
  </select>
</mapper>