| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459 |
- <?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="cn.hobbystocks.auc.mapper.LotMapper">
- <resultMap type="cn.hobbystocks.auc.domain.Lot" id="LotResult">
- <result property="id" column="id" />
- <result property="goodsId" column="goods_id" />
- <result property="auctionId" column="auction_id" />
- <result property="name" column="name" />
- <result property="num" column="num" />
- <result property="unit" column="unit" />
- <result property="imgs" column="imgs" />
- <result property="detail" column="detail" />
- <result property="pubStatus" column="pub_status" />
- <result property="pubTime" column="pub_time" />
- <result property="status" column="status" />
- <result property="startTime" column="start_time" />
- <result property="endTime" column="end_time" />
- <result property="realEndTime" column="real_end_time" />
- <result property="ruleType" column="rule_type" />
- <result property="ruleContent" column="rule_content" />
- <result property="lastPrice" column="last_price" />
- <result property="lastPriceTime" column="last_price_time" />
- <result property="dealPrice" column="deal_price" />
- <result property="dealTime" column="deal_time" />
- <result property="dealAccountId" column="deal_account_id" />
- <result property="dealAccount" column="deal_account" />
- <result property="paid" column="paid" />
- <result property="bidCount" column="bid_count" />
- <result property="bidPersionCount" column="bid_persion_count" />
- <result property="delFlag" column="del_flag" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- <result property="sort" column="sort" />
- <result property="carouselImgs" column="carousel_imgs"/>
- <result property="merchantId" column="merchant_id"/>
- <result property="merchantName" column="merchant_name"/>
- <result property="merchantAvatar" column="merchant_avatar"/>
- <result property="goodsName" column="goods_name"/>
- <result property="goodsType" column="goods_type"/>
- <result property="privateDomain" column="private_domain"/>
- <result property="delayPublish" column="delay_publish"/>
- <result property="groupId" column="group_id"/>
- <result property="deposit" column="deposit"/>
- <result property="serviceTariff" column="service_tariff"/>
- </resultMap>
- <sql id="selectLotVo">
- select id, goods_id, auction_id, name, num, unit, imgs, detail, pub_status, pub_time, status, start_time, end_time, real_end_time, rule_type, rule_content, last_price, last_price_time, deal_price, deal_time, deal_account_id, deal_account, paid, bid_count, bid_persion_count, del_flag, create_by, create_time, update_by, update_time, sort,
- carousel_imgs,merchant_id,merchant_name,merchant_avatar,goods_name,goods_type,private_domain,delay_publish,pub_status,group_id,deposit,service_tariff
- from lot
- </sql>
- <sql id="selectLotVoEx">
- select l.id, l.goods_id, l.auction_id, l.name, l.num, l.unit, l.imgs, l.detail,
- l.pub_status, l.pub_time, l.status, l.start_time, l.end_time, l.real_end_time, l.rule_type,
- l.rule_content, l.last_price, l.last_price_time, l.deal_price, l.deal_time, l.deal_account_id,
- l.deal_account, l.paid, l.bid_count, l.bid_persion_count, l.del_flag, l.create_by,
- l.create_time, l.update_by, l.update_time, l.sort,l.carousel_imgs,l.merchant_id,l.merchant_name,
- l.merchant_avatar,l.goods_name,l.goods_type,l.private_domain,l.group_id,l.live_id
- from
- lot l left join bid b on b.lot_id = l.id
- </sql>
- <select id="selectLotList" parameterType="cn.hobbystocks.auc.domain.Lot" resultMap="LotResult">
- <include refid="selectLotVo"/>
- <where>
- <if test="lot.name != null and lot.name != ''"> and name like concat('%', #{lot.name}, '%')</if>
- <if test="lot.pubStatus != null "> and pub_status = #{lot.pubStatus}</if>
- </where>
- order by sort desc,id desc
- </select>
- <select id="selectLotByGroupIds" parameterType="Long" resultMap="LotResult">
- <include refid="selectLotVo"/>
- <where>
- <foreach collection="lotGroupIds" index="index" item="lotGroupId" open="id in (" separator="," close=")">
- #{lotGroupId}
- </foreach>
- and del_flag <> 1
- </where>
- </select>
- <select id="selectLotById" parameterType="Long" resultMap="LotResult">
- <include refid="selectLotVo"/>
- where id = #{id} and del_flag <> 1
- </select>
- <select id="selectLotByAucId" parameterType="Long" resultMap="LotResult">
- <include refid="selectLotVo"/>
- where auction_id = #{id} and del_flag <> 1
- order by last_price_time desc
- </select>
- <insert id="insertLot" parameterType="cn.hobbystocks.auc.domain.Lot" useGeneratedKeys="true" keyProperty="id">
- insert into lot
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,</if>
- <if test="goodsId != null">goods_id,</if>
- <if test="auctionId != null">auction_id,</if>
- <if test="name != null">name,</if>
- <if test="num != null">num,</if>
- <if test="unit != null">unit,</if>
- <if test="imgs != null">imgs,</if>
- <if test="detail != null">detail,</if>
- <if test="pubStatus != null">pub_status,</if>
- <if test="pubTime != null">pub_time,</if>
- <if test="status != null">status,</if>
- <if test="startTime != null">start_time,</if>
- <if test="endTime != null">end_time,</if>
- <if test="realEndTime != null">real_end_time,</if>
- <if test="ruleType != null and ruleType != ''">rule_type,</if>
- <if test="ruleContent != null and ruleContent != ''">rule_content,</if>
- <if test="lastPrice != null">last_price,</if>
- <if test="lastPriceTime != null">last_price_time,</if>
- <if test="dealPrice != null">deal_price,</if>
- <if test="dealTime != null">deal_time,</if>
- <if test="dealAccountId != null">deal_account_id,</if>
- <if test="dealAccount != null">deal_account,</if>
- <if test="paid != null">paid,</if>
- <if test="bidCount != null">bid_count,</if>
- <if test="bidPersionCount != null">bid_persion_count,</if>
- <if test="delFlag != null">del_flag,</if>
- <if test="createBy != null">create_by,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="sort != null">sort,</if>
- <if test="carouselImgs != null">carousel_imgs,</if>
- <if test="merchantId != null">merchant_id,</if>
- <if test="merchantName != null">merchant_name,</if>
- <if test="merchantAvatar != null">merchant_avatar,</if>
- <if test="goodsName != null">goods_name,</if>
- <if test="goodsType != null">goods_type,</if>
- <if test="privateDomain != null">private_domain,</if>
- <if test="delayPublish != null">delay_publish,</if>
- <if test="groupId != null ">group_id,</if>
- <if test="deposit !=null ">deposit,</if>
- <if test="serviceTariff !=null ">service_tariff,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id},</if>
- <if test="goodsId != null">#{goodsId},</if>
- <if test="auctionId != null">#{auctionId},</if>
- <if test="name != null">#{name},</if>
- <if test="num != null">#{num},</if>
- <if test="unit != null">#{unit},</if>
- <if test="imgs != null">#{imgs},</if>
- <if test="detail != null">#{detail},</if>
- <if test="pubStatus != null">#{pubStatus},</if>
- <if test="pubTime != null">#{pubTime},</if>
- <if test="status != null">#{status},</if>
- <if test="startTime != null">#{startTime},</if>
- <if test="endTime != null">#{endTime},</if>
- <if test="realEndTime != null">#{realEndTime},</if>
- <if test="ruleType != null and ruleType != ''">#{ruleType},</if>
- <if test="ruleContent != null and ruleContent != ''">#{ruleContent},</if>
- <if test="lastPrice != null">#{lastPrice},</if>
- <if test="lastPriceTime != null">#{lastPriceTime},</if>
- <if test="dealPrice != null">#{dealPrice},</if>
- <if test="dealTime != null">#{dealTime},</if>
- <if test="dealAccountId != null">#{dealAccountId},</if>
- <if test="dealAccount != null">#{dealAccount},</if>
- <if test="paid != null">#{paid},</if>
- <if test="bidCount != null">#{bidCount},</if>
- <if test="bidPersionCount != null">#{bidPersionCount},</if>
- <if test="delFlag != null">#{delFlag},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="sort != null">#{sort},</if>
- <if test="carouselImgs != null">#{carouselImgs},</if>
- <if test="merchantId != null">#{merchantId},</if>
- <if test="merchantName != null">#{merchantName},</if>
- <if test="merchantAvatar != null">#{merchantAvatar},</if>
- <if test="goodsName != null">#{goodsName},</if>
- <if test="goodsType != null">#{goodsType},</if>
- <if test="privateDomain != null">#{privateDomain},</if>
- <if test="delayPublish != null">#{delayPublish},</if>
- <if test="groupId != null ">#{groupId},</if>
- <if test="deposit !=null ">#{deposit},</if>
- <if test="serviceTariff !=null ">#{serviceTariff},</if>
- </trim>
- </insert>
- <insert id="insertLotClone" parameterType="cn.hobbystocks.auc.domain.Lot" useGeneratedKeys="true" keyProperty="id">
- insert into lot
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="goodsId != null">goods_id,</if>
- <if test="auctionId != null">auction_id,</if>
- <if test="name != null">name,</if>
- <if test="num != null">num,</if>
- <if test="unit != null">unit,</if>
- <if test="imgs != null">imgs,</if>
- <if test="detail != null">detail,</if>
- <if test="pubStatus != null">pub_status,</if>
- <if test="status != null">status,</if>
- <if test="startTime != null">start_time,</if>
- <if test="endTime != null">end_time,</if>
- <if test="ruleType != null and ruleType != ''">rule_type,</if>
- <if test="ruleContent != null and ruleContent != ''">rule_content,</if>
- <if test="delFlag != null">del_flag,</if>
- <if test="createBy != null">create_by,</if>
- <if test="createTime != null">create_time,</if>
- <if test="sort != null">sort,</if>
- <if test="carouselImgs != null">carousel_imgs,</if>
- <if test="merchantId != null">merchant_id,</if>
- <if test="merchantName != null">merchant_name,</if>
- <if test="merchantAvatar != null">merchant_avatar,</if>
- <if test="goodsName != null">goods_name,</if>
- <if test="goodsType != null">goods_type,</if>
- <if test="privateDomain != null">private_domain,</if>
- <if test="delayPublish != null">delay_publish,</if>
- <if test="groupId != null ">group_id,</if>
- <if test="deposit !=null ">deposit,</if>
- <if test="serviceTariff !=null ">service_tariff,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="goodsId != null">#{goodsId},</if>
- <if test="auctionId != null">#{auctionId},</if>
- <if test="name != null">#{name},</if>
- <if test="num != null">#{num},</if>
- <if test="unit != null">#{unit},</if>
- <if test="imgs != null">#{imgs},</if>
- <if test="detail != null">#{detail},</if>
- <if test="pubStatus != null">#{pubStatus},</if>
- <if test="status != null">#{status},</if>
- <if test="startTime != null">#{startTime},</if>
- <if test="endTime != null">#{endTime},</if>
- <if test="ruleType != null and ruleType != ''">#{ruleType},</if>
- <if test="ruleContent != null and ruleContent != ''">#{ruleContent},</if>
- <if test="delFlag != null">#{delFlag},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="sort != null">#{sort},</if>
- <if test="carouselImgs != null">#{carouselImgs},</if>
- <if test="merchantId != null">#{merchantId},</if>
- <if test="merchantName != null">#{merchantName},</if>
- <if test="merchantAvatar != null">#{merchantAvatar},</if>
- <if test="goodsName != null">#{goodsName},</if>
- <if test="goodsType != null">#{goodsType},</if>
- <if test="privateDomain != null">#{privateDomain},</if>
- <if test="delayPublish != null">#{delayPublish},</if>
- <if test="groupId != null ">#{groupId},</if>
- <if test="deposit !=null ">#{deposit},</if>
- <if test="serviceTariff !=null ">#{serviceTariff},</if>
- </trim>
- </insert>
- <update id="updateLot" parameterType="cn.hobbystocks.auc.domain.Lot">
- update lot
- <trim prefix="SET" suffixOverrides=",">
- <if test="goodsId != null">goods_id = #{goodsId},</if>
- <if test="auctionId != null">auction_id = #{auctionId},</if>
- <if test="name != null">name = #{name},</if>
- <if test="num != null">num = #{num},</if>
- <if test="unit != null">unit = #{unit},</if>
- <if test="imgs != null">imgs = #{imgs},</if>
- <if test="detail != null">detail = #{detail},</if>
- <if test="pubStatus != null">pub_status = #{pubStatus},</if>
- <if test="pubTime != null">pub_time = #{pubTime},</if>
- <if test="status != null">status = #{status},</if>
- <if test="startTime != null">start_time = #{startTime},</if>
- <if test="endTime != null">end_time = #{endTime},</if>
- <if test="realEndTime != null">real_end_time = #{realEndTime},</if>
- <if test="ruleType != null and ruleType != ''">rule_type = #{ruleType},</if>
- <if test="ruleContent != null and ruleContent != ''">rule_content = #{ruleContent},</if>
- <if test="lastPrice != null">last_price = #{lastPrice},</if>
- <if test="lastPriceTime != null">last_price_time = #{lastPriceTime},</if>
- <if test="dealPrice != null">deal_price = #{dealPrice},</if>
- <if test="dealTime != null">deal_time = #{dealTime},</if>
- <if test="dealAccountId != null">deal_account_id = #{dealAccountId},</if>
- <if test="dealAccount != null">deal_account = #{dealAccount},</if>
- <if test="paid != null">paid = #{paid},</if>
- <if test="bidCount != null">bid_count = #{bidCount},</if>
- <if test="bidPersionCount != null">bid_persion_count = #{bidPersionCount},</if>
- <if test="delFlag != null">del_flag = #{delFlag},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="sort != null">sort = #{sort},</if>
- <if test="carouselImgs != null">carousel_imgs = #{carouselImgs},</if>
- <if test="merchantId != null">merchant_id = #{merchantId},</if>
- <if test="merchantName != null">merchant_name = #{merchantName},</if>
- <if test="merchantAvatar != null">merchant_avatar = #{merchantAvatar},</if>
- <if test="goodsName != null">goods_name = #{goodsName},</if>
- <if test="goodsType != null">goods_type = #{goodsType},</if>
- <if test="privateDomain != null">private_domain = #{privateDomain},</if>
- <if test="delayPublish != null">delay_publish = #{delayPublish},</if>
- <if test="groupId != null ">group_id = #{groupId},</if>
- <if test="deposit !=null ">deposit=#{deposit},</if>
- <if test="serviceTariff !=null ">service_tariff=#{serviceTariff},</if>
- </trim>
- where id = #{id}
- </update>
- <update id="updateLotView" parameterType="cn.hobbystocks.auc.domain.Lot">
- update lot
- <trim prefix="SET" suffixOverrides=",">
- <if test="goodsId != null">goods_id = #{goodsId},</if>
- <if test="auctionId != null">auction_id = #{auctionId},</if>
- <if test="name != null">name = #{name},</if>
- <if test="num != null">num = #{num},</if>
- <if test="unit != null">unit = #{unit},</if>
- <if test="imgs != null">imgs = #{imgs},</if>
- <if test="detail != null">detail = #{detail},</if>
- <if test="pubStatus != null">pub_status = #{pubStatus},</if>
- <if test="pubTime != null">pub_time = #{pubTime},</if>
- <if test="status != null">status = #{status},</if>
- <if test="startTime != null">start_time = #{startTime},</if>
- <if test="endTime != null">end_time = #{endTime},</if>
- <if test="realEndTime != null">real_end_time = #{realEndTime},</if>
- <if test="ruleType != null and ruleType != ''">rule_type = #{ruleType},</if>
- <if test="ruleContent != null and ruleContent != ''">rule_content = #{ruleContent},</if>
- <if test="lastPrice != null">last_price = #{lastPrice},</if>
- <if test="lastPriceTime != null">last_price_time = #{lastPriceTime},</if>
- <if test="dealPrice != null">deal_price = #{dealPrice},</if>
- <if test="dealTime != null">deal_time = #{dealTime},</if>
- <if test="dealAccountId != null">deal_account_id = #{dealAccountId},</if>
- <if test="dealAccount != null">deal_account = #{dealAccount},</if>
- <if test="paid != null">paid = #{paid},</if>
- <if test="bidCount != null">bid_count = #{bidCount},</if>
- <if test="bidPersionCount != null">bid_persion_count = #{bidPersionCount},</if>
- <if test="delFlag != null">del_flag = #{delFlag},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="sort != null">sort = #{sort},</if>
- <if test="carouselImgs != null">carousel_imgs = #{carouselImgs},</if>
- <if test="merchantId != null">merchant_id = #{merchantId},</if>
- <if test="merchantName != null">merchant_name = #{merchantName},</if>
- <if test="merchantAvatar != null">merchant_avatar = #{merchantAvatar},</if>
- <if test="goodsName != null">goods_name = #{goodsName},</if>
- <if test="goodsType != null">goods_type = #{goodsType},</if>
- <if test="privateDomain != null">private_domain = #{privateDomain},</if>
- <if test="1==1">delay_publish = #{delayPublish},</if>
- <if test="groupId != null ">group_id = #{groupId},</if>
- </trim>
- where id = #{id}
- </update>
- <select id="selectBidding" resultMap="LotResult">
- select id, auction_id
- from
- lot
- where
- status in ('Waiting','Starting','Bidding') and del_flag <> 1 and pub_status = 1
- and start_time is not null and end_time is not null
- </select>
- <select id="selectByLiveIdAndInStatus" resultMap="LotResult">
- select id
- from
- lot
- where
- status in
- <foreach item="status" collection="statusList" open="(" separator="," close=")">
- #{status}
- </foreach>
- and del_flag <> 1 and pub_status = 1
- </select>
- <select id="selectLotFinishOrWin" resultMap="LotResult">
- <include refid="selectLotVoEx"/>
- where
- l.status = 'Sold'
- and b.account_id = #{userId}
- <if test="win != null and win == 1">
- and b.status = 1
- </if>
- group by l.id
- order by l.last_price_time desc
- </select>
- <select id="selectCancel" resultMap="LotResult">
- select id, auction_id
- from
- lot
- where
- status = 'Cancelled' and del_flag <> 1
- </select>
- <select id="selectLotByGroupId" resultMap="LotResult">
- <include refid="selectLotVo"/>
- where group_id = #{groupId} and del_flag <> 1 order by id desc
- </select>
- <update id="updatePay">
- update lot set paid = #{paid} where id = #{lotId}
- </update>
- <update id="updateLotEx" parameterType="cn.hobbystocks.auc.domain.Lot">
- update lot
- <trim prefix="SET" suffixOverrides=",">
- <if test="goodsId != null">goods_id = #{goodsId},</if>
- <if test="name != null">name = #{name},</if>
- <if test="num != null">num = #{num},</if>
- <if test="unit != null">unit = #{unit},</if>
- <if test="imgs != null">imgs = #{imgs},</if>
- <if test="detail != null">detail = #{detail},</if>
- <if test="startTime != null">start_time = #{startTime},</if>
- <if test="endTime != null">end_time = #{endTime},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="sort != null">sort = #{sort},</if>
- <if test="carouselImgs != null">carousel_imgs = #{carouselImgs},</if>
- <if test="merchantId != null">merchant_id = #{merchantId},</if>
- <if test="merchantName != null">merchant_name = #{merchantName},</if>
- <if test="merchantAvatar != null">merchant_avatar = #{merchantAvatar},</if>
- <if test="goodsName != null">goods_name = #{goodsName},</if>
- <if test="goodsType != null">goods_type = #{goodsType},</if>
- <if test="privateDomain != null">private_domain = #{privateDomain},</if>
- <if test="1 == 1">delay_publish = #{delayPublish},</if>
- <if test="groupId != null ">group_id = #{groupId},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteLotById" parameterType="Long">
- delete from lot where id = #{id}
- </delete>
- <delete id="deleteLotByIds" parameterType="String">
- delete from lot where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="dynamicLot" resultMap="LotResult">
- <include refid="selectLotVo"/>
- where delay_publish is not null and delay_publish <> '' and del_flag <> 1
- </select>
- <select id="selectNotEndLotList" resultMap="LotResult">
- select id, auction_id
- from
- lot
- where
- status in ('Waiting','Starting','Bidding') and del_flag <> 1 and pub_status = 1
- and auction_id=#{auctionId}
- </select>
- <select id="countLotByAucId" resultType="long" parameterType="long">
- select count(*) from lot where auction_id=#{auctionId} and del_flag <> 1
- </select>
- </mapper>
|