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
<?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.TaoBaoClassMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.clazz.TaoBaoClass">
    <id column="tc_id" property="id" jdbcType="BIGINT"/>
    <result column="tc_category_id" property="categoryId" jdbcType="INTEGER"/>
    <result column="tc_category_name" property="categoryName" jdbcType="VARCHAR"/>
    <result column="tc_parent_category_id" property="parentCategoryId" jdbcType="INTEGER"/>
    <result column="tc_createtime" property="createtime" jdbcType="TIMESTAMP"/>
    <result column="tc_updatetime" property="updatetime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">tc_id,tc_category_id,tc_category_name,tc_parent_category_id,tc_createtime,tc_updatetime</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_taobao_class where tc_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_taobao_class where tc_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.clazz.TaoBaoClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_taobao_class (tc_id,tc_category_id,tc_category_name,tc_parent_category_id,tc_createtime,tc_updatetime) values (#{id,jdbcType=BIGINT},#{categoryId,jdbcType=INTEGER},#{categoryName,jdbcType=VARCHAR},#{parentCategoryId,jdbcType=INTEGER},#{createtime,jdbcType=TIMESTAMP},#{updatetime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.clazz.TaoBaoClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_taobao_class
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">tc_id,</if>
      <if test="categoryId != null">tc_category_id,</if>
      <if test="categoryName != null">tc_category_name,</if>
      <if test="parentCategoryId != null">tc_parent_category_id,</if>
      <if test="createtime != null">tc_createtime,</if>
      <if test="updatetime != null">tc_updatetime,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="categoryId != null">#{categoryId,jdbcType=INTEGER},</if>
      <if test="categoryName != null">#{categoryName,jdbcType=VARCHAR},</if>
      <if test="parentCategoryId != null">#{parentCategoryId,jdbcType=INTEGER},</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.clazz.TaoBaoClass">update yeshi_ec_taobao_class set tc_category_id = #{categoryId,jdbcType=INTEGER},tc_category_name = #{categoryName,jdbcType=VARCHAR},tc_parent_category_id = #{parentCategoryId,jdbcType=INTEGER},tc_createtime = #{createtime,jdbcType=TIMESTAMP},tc_updatetime = #{updatetime,jdbcType=TIMESTAMP} where tc_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.clazz.TaoBaoClass">update yeshi_ec_taobao_class
    <set>
      <if test="categoryId != null">tc_category_id=#{categoryId,jdbcType=INTEGER},</if>
      <if test="categoryName != null">tc_category_name=#{categoryName,jdbcType=VARCHAR},</if>
      <if test="parentCategoryId != null">tc_parent_category_id=#{parentCategoryId,jdbcType=INTEGER},</if>
      <if test="createtime != null">tc_createtime=#{createtime,jdbcType=TIMESTAMP},</if>
      <if test="updatetime != null">tc_updatetime=#{updatetime,jdbcType=TIMESTAMP},</if>
    </set> where tc_id = #{id,jdbcType=BIGINT}
  </update>
  
   <select id="listBySystemCid" resultMap="BaseResultMap">
         SELECT <include refid="Base_Column_List"/> FROM `yeshi_ec_taobao_class` tc 
         LEFT JOIN `yeshi_ec_taobao_class_mapper` tm ON tc.`tc_id` = tm.`tm_taobao_cid` 
         WHERE tm.`tm_system_cid`= #{systemCid} 
         ORDER BY tm.`tm_weight` DESC
         LIMIT  ${start},${count}
  </select>
  
   <select id="listBySystemSubCid" resultMap="BaseResultMap">
         SELECT <include refid="Base_Column_List"/> FROM `yeshi_ec_taobao_class` tc 
         LEFT JOIN `yeshi_ec_taobao_class_mapper` tm ON tc.`tc_id` = tm.`tm_taobao_cid` 
         WHERE tm.`tm_system_sub_cid`= #{systemCid} 
         ORDER BY tm.`tm_weight` DESC
         LIMIT  ${start},${count}
  </select>
  
   <select id="getByCategoryId" resultMap="BaseResultMap">
         SELECT * FROM `yeshi_ec_taobao_class` 
         WHERE tc_category_id = #{categoryId}
        LIMIT 1
  </select>
  
</mapper>