yujian
2020-06-09 554de444b87aab5f93cb1593a8095612cf9479a7
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
<?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.goods.SuperRecommendSpecialMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendSpecial">
    <id column="id" property="id" jdbcType="BIGINT"/>
    
      <association property="recommendSpecial" column="recommendspecial_id" 
        select="com.yeshi.fanli.dao.mybatis.goods.RecommendSpecialMapper.selectByPrimaryKey"/>
    
    <association property="system" column="system_id" javaType="com.yeshi.fanli.entity.system.BusinessSystem">
        <id column="system_id" property="id" jdbcType="BIGINT" />    
    </association>
 
  </resultMap>
 
 
 
  <sql id="Base_Column_List">id,recommendspecial_id,system_id</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_super_recommendspecial where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_super_recommendspecial where id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendSpecial" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_super_recommendspecial (id,recommendspecial_id,system_id) values (#{id,jdbcType=BIGINT},#{recommendSpecia.id,jdbcType=BIGINT},#{system.id,jdbcType=BIGINT})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendSpecial" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_super_recommendspecial
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">id,</if>
      <if test="recommendSpecial != null">recommendspecial_id,</if>
      <if test="system != null">system_id,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="recommendSpecial != null">#{recommendSpecia.id,jdbcType=BIGINT},</if>
      <if test="system != null">#{system.id,jdbcType=BIGINT},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendSpecial">update yeshi_ec_super_recommendspecial set recommendspecial_id = #{recommendSpecia.id,jdbcType=BIGINT},system_id = #{system.id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendSpecial">update yeshi_ec_super_recommendspecial
    <set>
      <if test="recommendSpecial != null">recommendspecial_id=#{recommendSpecia.id,jdbcType=BIGINT},</if>
      <if test="system != null">system_id=#{system.id,jdbcType=BIGINT},</if>
    </set> where id = #{id,jdbcType=BIGINT}
  </update>
  
  <select id="listBySystemId" resultMap="BaseResultMap">
      SELECT sp.* FROM yeshi_ec_super_recommendspecial sp 
    LEFT JOIN yeshi_ec_recommend_special ds ON sp.`recommendspecial_id` = ds.`id`
    WHERE sp.`system_id` = #{systemId}
    ORDER BY ds.`orderby`
  </select>
  
</mapper>