admin
2018-12-25 4cb15e222cd7d099d533ccbeb7f9a8cd99bf180c
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
<?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.SuperSpecialMapper">
  
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.homemodule.SuperSpecial">
    <id column="sup_id" property="id" jdbcType="BIGINT"/>
   
    <association property="special" column="sup_special_id" 
         select="com.yeshi.fanli.dao.mybatis.homemodule.SpecialMapper.selectByPrimaryKey"> 
    </association>
    
    <association property="system" column="sup_system_id" 
         select="com.yeshi.fanli.dao.mybatis.SystemMapper.selectByPrimaryKey"> 
    </association>
    
  </resultMap>
  
  <sql id="Base_Column_List">sup_id,sup_special_id,sup_system_id</sql>
  
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_super_special where sup_id = #{id,jdbcType=BIGINT}
  </select>
 
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_super_special where sup_id = #{id,jdbcType=BIGINT}</delete>
 
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.homemodule.SuperSpecial" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_super_special (sup_id,sup_special_id,sup_system_id) values (#{id,jdbcType=BIGINT},#{special.id,jdbcType=BIGINT},#{system.id,jdbcType=BIGINT})</insert>
 
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.SuperSpecial" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_super_special
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">sup_id,</if>
      <if test="special != null">sup_special_id,</if>
      <if test="system != null">sup_system_id,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="special != null">#{special.id,jdbcType=BIGINT},</if>
      <if test="system != null">#{system.id,jdbcType=BIGINT},</if>
    </trim>
  </insert>
 
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.homemodule.SuperSpecial">update yeshi_ec_super_special set sup_special_id = #{special.id,jdbcType=BIGINT},sup_system_id = #{system.id,jdbcType=BIGINT} where sup_id = #{id,jdbcType=BIGINT}</update>
 
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.SuperSpecial">update yeshi_ec_super_special
    <set>
      <if test="special != null">sup_special_id=#{special.id,jdbcType=BIGINT},</if>
      <if test="system != null">sup_system_id=#{system.id,jdbcType=BIGINT},</if>
    </set> where sup_id = #{id,jdbcType=BIGINT}
  </update>
  
  <select id="listBySystemAndCard" resultMap="BaseResultMap">
     SELECT * FROM `yeshi_ec_super_special` sp 
     LEFT JOIN `yeshi_ec_special` pp  ON sp.sup_special_id = pp.`b_id`
     WHERE sp.sup_system_id = #{systemId} AND pp.`b_card` = #{card}
     ORDER BY pp.b_orderby 
  </select>
  
</mapper>