123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <?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.DisplaceAuditMapper">
- <!--插入置换审核-->
- <insert id="insert">
- <selectKey keyProperty="displaceId" resultType="string" order="BEFORE">
- SELECT CONCAT(#{agentId}, '-', 'ZH', LPAD(COUNT(1) + 1, 4, '0'))
- FROM tb_displace_audit
- WHERE agent_id = #{agentId}
- </selectKey>
- INSERT INTO tb_displace_audit(id, agent_id, agent_name, displace_id, idea_price, pub_time, audit_time, journalist_name, journalist_tel, audit_status, state, sale_id, others_desc, first_pic_url,is_good,storage)
- VALUES(#{id}, #{agentId}, #{agentName}, #{displaceId}, #{ideaPrice}, #{pubTime}, #{auditTime}, #{joumalistName}, #{joumalistTel}, #{auditStatus}, #{state}, #{saleId}, #{othersDesc}, #{firstPicUrl}, #{is_good}, #{storage})
- </insert>
- <!--更新置换审核-->
- <update id="update">
- UPDATE tb_displace_audit
- SET agent_id = #{agentId},
- agent_name = #{agentName},
- idea_price = #{ideaPrice},
- journalist_name = #{joumalistName},
- journalist_tel = #{joumalistTel},
- audit_status = #{auditStatus},
- state = #{state},
- sale_id = #{saleId},
- storage = #{storage},
- is_good = #{is_good},
- first_pic_url = #{firstPicUrl}
- WHERE id = #{id}
- </update>
- <!--更新报价结束时间-->
- <update id="updateEndTime">
- UPDATE tb_displace_audit SET end_time = #{endTime} WHERE id = #{id}
- </update>
- <!--查询置换-->
- <select id="selectDisplaceList" resultType="com.demo.wjj.bo.DisplaceListBo">
- SELECT a.id, a.displace_id displaceId, a.audit_status auditStatus, a.first_pic_url picUrl
- FROM tb_displace_audit a JOIN tb_sales s ON a.sale_id = s.sale_id
- WHERE
- <if test="auditStatus == 0">
- a.audit_status IN ('0', '2')
- </if>
- <if test="auditStatus == 1">
- a.audit_status IN ('1', '3')
- </if>
- AND a.agent_id = #{agentId} AND s.agent_id = #{agentId} AND s.wx_openid = #{openId}
- AND a.state = '1'
- ORDER BY a.displace_id DESC
- </select>
- <!--查询待确认-->
- <select id="selectDisplaceConfirmList" resultType="com.demo.wjj.bo.DisplaceListBo">
- SELECT a.id, a.displace_id displaceId, a.audit_status auditStatus, a.first_pic_url picUrl
- FROM tb_displace_audit a
- JOIN tb_sales s ON a.sale_id = s.sale_id
- JOIN tb_digger_agent d ON d.wx_openid = s.wx_openid
- JOIN tb_deposit b ON b.da_id = d.id
- WHERE
- a.audit_status = #{auditStatus}
- AND a.agent_id = #{agentId} AND s.agent_id = #{agentId} AND s.wx_openid = #{openId}
- AND a.state = '1'
- AND b.is_common='0'
- AND b.pay_status='0'
- ORDER BY a.displace_id DESC
- </select>
- <!--查询置换详情-->
- <select id="select" resultType="com.demo.wjj.po.DisplaceAudit">
- SELECT a.id, a.displace_id displaceId, a.idea_price ideaPrice, a.journalist_name joumalistName, a.journalist_tel joumalistTel, a.others_desc othersDesc
- FROM tb_displace_audit a
- WHERE a.state = '1' AND a.id = #{id}
- </select>
- <resultMap id="displaceAudit" type="com.demo.wjj.po.DisplaceAudit">
- <result column="id" property="id"/>
- <result column="displace_id" property="displaceId"/>
- <result column="agent_id" property="agentId"/>
- <result column="audit_status" property="auditStatus"/>
- <result column="start_time" property="startTime"/>
- <result column="end_time" property="endTime"/>
- <result column="time_delay" property="timeDelay"/>
- <result column="min_money" property="minMoney"/>
- </resultMap>
- <!--查询置换审核-->
- <select id="selectDisplaceAudit" resultMap="displaceAudit">
- SELECT a.id, a.displace_id, a.agent_id, a.audit_status, a.start_time, a.end_time, a.bail, a.time_delay, a.min_money,a.persist_price
- FROM tb_displace_audit a
- WHERE a.state = '1' AND a.displace_id = #{displaceId}
- </select>
- <!--查询被驳回的置换设备数量-->
- <select id="selectRejectedDisplaceCount" resultType="java.lang.Integer">
- SELECT COUNT(1)
- FROM tb_displace_audit a JOIN tb_sales s ON a.sale_id = s.sale_id
- WHERE a.agent_id = #{agentId} AND a.state = '1' AND s.agent_id = #{agentId} AND s.wx_openid = #{openId} AND a.audit_status = '2'
- </select>
- <!--在售设备-->
- <select id="selectDisplaceOnList" resultType="com.demo.wjj.bo.DisplaceListBo">
- SELECT a.id,a.is_kxc isKxc, a.up_type upType, a.displace_id displaceId, IFNULL(a.look_times, 0) lookTimes, IFNULL(d.offer_times, 0) offerTimes, a.first_pic_url picUrl, a.start_time , a.end_time startTime, IFNULL(d.max_offer, a.min_money) currentPrice,a.storage,a.is_good,a.min_price,a.max_price,a.persist_price
- FROM tb_displace_audit a JOIN tb_offer d ON d.displace_id=a.displace_id
- WHERE
- a.audit_status IN ('1', '3')
- AND #{now} BETWEEN a.start_time AND a.end_time
- AND a.agent_id = #{agentId}
- AND a.state = '1'
- AND a.is_good='2'
- AND a.storage='1'
- ORDER BY a.start_time DESC
- </select>
- <!--已售设备-->
- <select id="selectDisplaceSaleList" resultType="com.demo.wjj.bo.DisplaceListBo">
- SELECT a.id,a.is_kxc isKxc, a.up_type upType, a.displace_id displaceId, IFNULL(a.look_times, 0) lookTimes, IFNULL(b.offer_times, 0) offerTimes, a.first_pic_url picUrl, a.start_time , a.end_time startTime, IFNULL(b.max_offer, a.min_money) currentPrice,a.storage,a.is_good,a.min_price,a.max_price,a.persist_price
- FROM tb_displace_audit a JOIN tb_offer b ON b.displace_id=a.displace_id
- WHERE
- a.audit_status IN ('1', '3')
- AND #{now} > a.end_time
- AND a.agent_id = #{agentId}
- AND a.state = '1'
- AND b.displace_id=a.displace_id
- AND b.offer_times > 0
- AND a.is_good='2'
- AND a.storage='1'
- ORDER BY a.start_time DESC
- </select>
- <!--停售设备-->
- <select id="selectDisplaceHaltList" resultType="com.demo.wjj.bo.DisplaceListBo">
- SELECT a.id,a.is_kxc isKxc, a.up_type upType, a.displace_id displaceId, IFNULL(a.look_times, 0) lookTimes, IFNULL(b.offer_times, 0) offerTimes, a.first_pic_url picUrl, a.start_time , a.end_time startTime, IFNULL(b.max_offer, a.min_money) currentPrice,a.storage,a.is_good,a.min_price,a.max_price,a.persist_price
- FROM tb_displace_audit a JOIN tb_offer b ON b.displace_id=a.displace_id
- WHERE
- a.audit_status IN ('1', '3')
- AND #{now} > a.end_time
- AND a.agent_id = #{agentId}
- AND a.state = '1'
- AND b.offer_times = 0
- AND b.displace_id=a.displace_id
- AND a.is_good='2'
- AND a.storage='1'
- ORDER BY a.start_time DESC
- </select>
- <!--我的秒杀-->
- <select id="selectDisplaceMyList" resultType="com.demo.wjj.bo.DisplaceListBo">
- SELECT a.id,a.is_kxc isKxc, a.up_type upType, a.displace_id displaceId, IFNULL(a.look_times, 0) lookTimes, IFNULL(d.offer_times, 0) offerTimes, a.first_pic_url picUrl, a.start_time , a.end_time startTime, IFNULL(d.max_offer, a.min_money) currentPrice,a.storage,a.is_good,a.min_price,a.max_price,a.persist_price
- FROM tb_displace_audit a,tb_offer_detail b,tb_digger_agent c,tb_offer d
- WHERE
- a.state = '1'
- AND d.displace_id=a.displace_id
- AND c.da_id=b.da_id
- AND b.offer_id=d.id
- AND #{now} > a.end_time
- AND a.agent_id = #{agentId}
- AND a.state = '1'
- AND d.offer_times > 0
- AND c.wx_openid = #{openId}
- AND a.is_good='2'
- AND a.storage='1'
- ORDER BY a.start_time DESC
- </select>
- <!--我要卖精品机-->
- <select id="getDisplaceGoodSaleList" resultType="com.demo.wjj.bo.DisplaceListBo">
- SELECT a.id,a.is_kxc isKxc, a.up_type upType, a.displace_id displaceId, IFNULL(a.look_times, 0) lookTimes, IFNULL(d.offer_times, 0) offerTimes, a.first_pic_url picUrl, a.start_time , a.end_time startTime, IFNULL(d.max_offer, a.min_money) currentPrice,a.storage,a.is_good,a.min_price,a.max_price,a.persist_price
- from tb_displace_audit a,tb_sales b,tb_digger_agent c,tb_offer d
- where
- a.audit_status = '1'
- and a.sale_id=b.sale_id
- and b.wx_openid=#{openId}
- and a.agent_id = #{agentId}
- AND d.displace_id=a.displace_id
- ORDER BY a.start_time DESC
- </select>
- <!--我的暂存列表-->
- <select id="getDisplaceStorageList" resultType="com.demo.wjj.bo.DisplaceListBo">
- SELECT a.id,a.is_kxc isKxc, a.up_type upType, a.displace_id displaceId, IFNULL(a.look_times, 0) lookTimes, a.first_pic_url picUrl, a.start_time , a.end_time startTime,a.storage,a.is_good,a.min_price,a.max_price,a.persist_price
- from tb_displace_audit a,tb_sales b
- where
- b.wx_openid= #{openId}
- and a.agent_id = #{agentId}
- AND a.storage= #{storageStatus}
- and a.sale_id=b.sale_id
- ORDER BY a.pub_time DESC
- </select>
- </mapper>
|