|
|
@@ -4,35 +4,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="cn.hobbystocks.auc.mapper.LotFansMapper">
|
|
|
|
|
|
- <resultMap type="LotFans" id="LotFansResult">
|
|
|
+ <resultMap type="LotFans" id="BaseResultMap">
|
|
|
<result property="id" column="id" />
|
|
|
<result property="userId" column="user_id" />
|
|
|
<result property="lotId" column="lot_id" />
|
|
|
- <result property="createTime" column="create_time" />
|
|
|
<result property="type" column="type" />
|
|
|
<result property="expire" column="expire"/>
|
|
|
<result property="merchantId" column="merchant_id"/>
|
|
|
+ <result property="createUser" column="create_user"/>
|
|
|
+ <result property="updateUser" column="update_user"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectLotFansVo">
|
|
|
- select id, user_id, lot_id, create_time, type, expire,merchant_id from lot_fans
|
|
|
+ select id, user_id, lot_id, create_time, type, expire,merchant_id,update_time,create_user,update_user
|
|
|
</sql>
|
|
|
|
|
|
- <select id="selectLotFansList" parameterType="LotFans" resultMap="LotFansResult">
|
|
|
+ <select id="selectLotFansList" parameterType="LotFans" resultMap="BaseResultMap">
|
|
|
<include refid="selectLotFansVo"/>
|
|
|
- where del_flag = 0
|
|
|
- <if test="lotId != null"> and lot_id = #{lotId}</if>
|
|
|
- <if test="userId != null"> and user_id = #{userId}</if>
|
|
|
- <if test="type != null"> and type = #{type}</if>
|
|
|
- <if test="merchantId != null"> and merchant_id = #{merchantId}</if>
|
|
|
+ from
|
|
|
+ lot_fans
|
|
|
+ <where>
|
|
|
+ del_flag = 0
|
|
|
+ <if test="lotId != null"> and lot_id = #{lotId}</if>
|
|
|
+ <if test="userId != null"> and user_id = #{userId}</if>
|
|
|
+ <if test="type != null"> and type = #{type}</if>
|
|
|
+ <if test="merchantId != null"> and merchant_id = #{merchantId}</if>
|
|
|
+ </where>
|
|
|
</select>
|
|
|
|
|
|
<delete id="lotFansListCheck">
|
|
|
delete from lot_fans where type = 'pay_expire' and expire < NOW()
|
|
|
</delete>
|
|
|
|
|
|
- <select id="selectLotFansById" parameterType="Long" resultMap="LotFansResult">
|
|
|
+ <select id="selectLotFansById" parameterType="Long" resultMap="BaseResultMap">
|
|
|
<include refid="selectLotFansVo"/>
|
|
|
+ from
|
|
|
+ lot_fans
|
|
|
where id = #{id}
|
|
|
</select>
|
|
|
|
|
|
@@ -42,19 +51,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="id != null">id,</if>
|
|
|
<if test="userId != null">user_id,</if>
|
|
|
<if test="lotId != null">lot_id,</if>
|
|
|
- <if test="createTime != null">create_time,</if>
|
|
|
<if test="type != null and type != ''">type,</if>
|
|
|
<if test="expire != null">expire,</if>
|
|
|
<if test="merchantId != null">merchant_id,</if>
|
|
|
+ <if test="createUser != null">create_user,</if>
|
|
|
+ <if test="updateUser != null">update_user,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="id != null">#{id},</if>
|
|
|
<if test="userId != null">#{userId},</if>
|
|
|
<if test="lotId != null">#{lotId},</if>
|
|
|
- <if test="createTime != null">#{createTime},</if>
|
|
|
<if test="type != null and type != ''">#{type},</if>
|
|
|
<if test="expire != null">#{expire},</if>
|
|
|
<if test="merchantId != null">#{merchantId},</if>
|
|
|
+ <if test="createUser != null">#{createUser},</if>
|
|
|
+ <if test="updateUser != null">#{updateUser},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
|
@@ -82,9 +97,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</foreach>
|
|
|
</delete>
|
|
|
|
|
|
- <delete id="deleteLotFans">
|
|
|
- delete from lot_fans where user_id = #{userId} and lot_id = #{lotId} and type = #{type}
|
|
|
- </delete>
|
|
|
+ <update id="deleteLotFans">
|
|
|
+ update lot_fans set del_flag = 1 ,update_time = now() where user_id = #{userId} and lot_id = #{lotId} and type = #{type}
|
|
|
+ </update>
|
|
|
|
|
|
<update id="updateLotFansDel">
|
|
|
update lot_fans set del_flag = 1 where id = #{id}
|
|
|
@@ -92,6 +107,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
<select id="selectLotFansByLotIdAndType" resultType="cn.hobbystocks.auc.domain.LotFans">
|
|
|
<include refid="selectLotFansVo"/>
|
|
|
+ from
|
|
|
+ lot_fans
|
|
|
where lot_id = #{lotId} and type = #{type} and del_flag = 0
|
|
|
</select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="selectLotFansPageList" parameterType="cn.hobbystocks.auc.domain.LotFans" resultMap="BaseResultMap">
|
|
|
+ <include refid="selectLotFansVo"/>
|
|
|
+ from
|
|
|
+ lot_fans
|
|
|
+ <where>
|
|
|
+ del_flag = 0
|
|
|
+ <if test="request.lotId != null"> and lot_id = #{request.lotId}</if>
|
|
|
+ <if test="request.userId != null"> and user_id = #{request.userId}</if>
|
|
|
+ <if test="request.type != null"> and type = #{request.type}</if>
|
|
|
+ <if test="request.merchantId != null"> and merchant_id = #{request.merchantId}</if>
|
|
|
+ </where>
|
|
|
+ order by create_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|