yujian
2019-03-27 cdcbed9af813b2a02cdc01eefa24db8bec6b51a9
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
<?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.SuperRecommendBannerV2Mapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendBannerV2">
    <id column="id" property="id" jdbcType="BIGINT"/>
     
     <association property="recommendBanner" column="recommendbanner_id" 
        select="com.yeshi.fanli.dao.mybatis.RecommendBannerV2Mapper.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,recommendbanner_id,system_id</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_super_recommendbanner_v2 where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_super_recommendbanner_v2 where id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendBannerV2" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_super_recommendbanner_v2 (id,recommendbanner_id,system_id) values (#{id,jdbcType=BIGINT},#{recommendBanner.id,jdbcType=BIGINT},#{system.id,jdbcType=BIGINT})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendBannerV2" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_super_recommendbanner_v2
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">id,</if>
      <if test="recommendBanner != null">recommendbanner_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="recommendBanner != null">#{recommendBanner.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.SuperRecommendBannerV2">update yeshi_ec_super_recommendbanner_v2 set recommendbanner_id = #{recommendBanner.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.SuperRecommendBannerV2">update yeshi_ec_super_recommendbanner_v2
    <set>
      <if test="recommendBanner != null">recommendbanner_id=#{recommendBanner.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 vp.* FROM yeshi_ec_super_recommendbanner_v2 vp 
    LEFT JOIN yeshi_ec_recommend_banner_v2  vb ON vb.`id` = vp.`recommendbanner_id`
    WHERE vp.`system_id` = #{systemId}
    ORDER BY vb.`orderby`
  </select>
  
  
</mapper>