1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?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.demo.wjj.mapper.OfferMapper">
- <!--插入置换报价-->
- <insert id="insert">
- INSERT INTO tb_offer(id, displace_id, offer_users, offer_times, max_offer, show_status, offer_bj_status, offer_gj_status, agent_show, plat_show, gj_price, is_kxc, gj_desc, gj_push_id, is_push, push_content)
- VALUES(#{offerId}, #{displaceId}, 1, 1, #{price}, 1, 0, 0, 1, 1, null, #{isKxc}, null, null, 0, null)
- </insert>
- <!--更新置换报价信息-->
- <update id="update">
- UPDATE tb_offer t, (
- SELECT o.offer_id, o.price, o.is_kxc, (
- SELECT COUNT(1)
- FROM tb_offer_detail t1
- WHERE t1.offer_id = #{existsOfferId}
- ) offer_times, (
- SELECT COUNT(DISTINCT t1.da_id)
- FROM tb_offer_detail t1
- WHERE t1.offer_id = #{existsOfferId}
- ) offer_users
- FROM tb_offer_detail o
- WHERE o.price = (
- SELECT MAX(d.price)
- FROM tb_offer_detail d
- WHERE d.offer_id = #{existsOfferId}
- ) AND o.offer_id = #{existsOfferId}
- ) a SET t.max_offer = a.price, t.is_kxc = a.is_kxc, t.offer_times = a.offer_times, t.offer_users = a.offer_users
- WHERE t.id = a.offer_id
- </update>
- <!--查询是否已支付保证金-->
- <select id="selectBeforePay" resultType="integer">
- SELECT COUNT(1)
- FROM tb_weixin_pay p JOIN tb_displace_audit a ON p.product_id = a.displace_id
- JOIN tb_deposit t ON p.order_no = t.agent_pay_no
- WHERE p.digger_agent_id = #{daId} AND p.deposit > 0 AND a.displace_id = #{displaceId}
- AND p.order_status = 2 AND t.pay_status = '1' AND t.refund_no IS NULL
- </select>
- <!--查询车商置换保证金-->
- <select id="selectDisplaceDeposit" resultType="java.lang.Integer">
- SELECT IFNULL(a.bail, 0)
- FROM tb_displace_audit a
- WHERE a.displace_id = #{displaceId}
- </select>
- <!--查询置换报价数量-->
- <select id="selectDisplaceOffer" resultType="java.lang.String">
- SELECT o.id
- FROM tb_offer o
- WHERE o.displace_id = #{displaceId}
- </select>
- <!--查询相同报价的数量-->
- <select id="selectSamePriceCount" resultType="java.lang.Integer">
- SELECT COUNT(1)
- FROM tb_offer_detail d JOIN tb_offer o ON d.offer_id = o.id
- WHERE d.price = #{price} AND o.displace_id = #{displaceId}
- </select>
- <!--查询旧支付订单编号-->
- <select id="selectOldOrderNo" resultType="java.lang.String">
- SELECT order_no
- FROM tb_weixin_pay
- WHERE order_status = '2' AND digger_agent_id = #{diggerAgentId} AND product_id = #{displaceId}
- ORDER BY create_time DESC
- LIMIT 1
- </select>
- <select id="selectOne" resultType="com.demo.wjj.po.Offer">
- SELECT o.id id,
- o.displace_id displaceId,
- o.max_offer maxOffer
- from tb_offer o
- WHERE o.displace_id = #{displaceId}
- </select>
- </mapper>
|