123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <?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.DiggerAgentDisplaceManageMapper">
- <resultMap id="displaceListBo" type="com.demo.wjj.bo.DisplaceListBo">
- <result column="id" property="id"/>
- <result column="displace_id" property="displaceId"/>
- <result column="look_time" property="lookTimes"/>
- <result column="offer_times" property="offerTimes"/>
- <result column="first_pic_url" property="picUrl"/>
- <result column="current_price" property="currentPrice"/>
- <result column="up_type" property="upType"/>
- <result column="is_kxc" property="isKxc"/>
- <result column="start_time" property="startTime"/>
- <result column="end_time" property="endTime"/>
- </resultMap>
- <!--更新围观记录-->
- <update id="updateLookTimes">
- UPDATE tb_displace_audit SET look_times = IFNULL(look_times, 0) + 1 WHERE id = #{displaceId}
- </update>
- <!--查询待报价的置换列表-->
- <select id="selectWaitingList" resultMap="displaceListBo">
- SELECT a.id,a.is_kxc, a.up_type,a.start_time ,a.end_time, a.displace_id, IFNULL(a.look_times, 0) look_time, IFNULL(o.offer_times, 0) offer_times, a.first_pic_url, IFNULL(o.max_offer, a.min_money) current_price,a.storage,a.is_good,a.min_price,a.max_price,a.persist_price
- FROM tb_displace_audit a LEFT JOIN tb_offer o ON a.displace_id = o.displace_id
- JOIN tb_agent g ON a.agent_id = g.agent_id AND g.state = '1'
- WHERE a.audit_status IN ('1', '3') AND a.state = '1' AND a.start_time > #{now}
- <if test="hasAuthority">
- AND (a.agent_id = #{agentId} OR g.is_attent = '1')
- </if>
- <if test="!hasAuthority">
- AND a.agent_id = #{agentId}
- </if>
- ORDER BY a.start_time DESC
- </select>
- <!--查询进行中的置换列表-->
- <select id="selectDoingList" resultMap="displaceListBo">
- SELECT a.id, a.is_kxc,a.start_time ,a.end_time, a.up_type, a.displace_id, IFNULL(a.look_times, 0) look_time, IFNULL(o.offer_times, 0) offer_times, a.first_pic_url, IFNULL(o.max_offer, a.min_money) current_price,a.storage,a.is_good,a.min_price,a.max_price,a.persist_price
- FROM tb_displace_audit a LEFT JOIN tb_offer o ON a.displace_id = o.displace_id
- JOIN tb_agent g ON a.agent_id = g.agent_id AND g.state = '1'
- WHERE a.audit_status IN ('1', '3') AND a.state = '1' AND #{now} BETWEEN a.start_time AND a.end_time
- <if test="hasAuthority">
- AND (a.agent_id = #{agentId} OR g.is_attent = '1')
- </if>
- <if test="!hasAuthority">
- AND a.agent_id = #{agentId}
- </if>
- ORDER BY a.start_time DESC
- </select>
- <!--查询已结束的置换列表-->
- <select id="selectEndList" resultMap="displaceListBo">
- SELECT a.id, a.is_kxc, a.up_type, a.displace_id, IFNULL(a.look_times, 0) look_time, IFNULL(o.offer_times, 0) offer_times, a.first_pic_url, a.start_time , a.end_time, IFNULL(o.max_offer, a.min_money) current_price,a.storage,a.is_good,a.min_price,a.max_price,a.persist_price
- FROM tb_displace_audit a LEFT JOIN tb_offer o ON a.displace_id = o.displace_id
- JOIN tb_agent g ON a.agent_id = g.agent_id AND g.state = '1'
- WHERE a.audit_status IN ('1', '3') AND a.state = '1' AND a.end_time < #{now}
- <if test="hasAuthority">
- AND (a.agent_id = #{agentId} OR g.is_attent = '1')
- </if>
- <if test="!hasAuthority">
- AND a.agent_id = #{agentId}
- </if>
- <if test="date eq 'Day' ">
- AND to_days(a.end_time) = to_days(now())
- </if>
- <if test="date eq 'Week' ">
- AND YEARWEEK(a.end_time) = YEARWEEK(now()) AND to_days(a.end_time) != to_days(now())
- </if>
- <if test="date eq 'WeekEnd' ">
- AND YEARWEEK(a.end_time) = YEARWEEK(now())-1
- </if>
- ORDER BY a.start_time DESC
- </select>
- <!--查询我的报价置换列表-->
- <select id="selectMyList" resultMap="displaceListBo">
- SELECT a.id,a.is_kxc, a.up_type, a.displace_id, IFNULL(a.look_times, 0) look_time, IFNULL(o.offer_times, 0) offer_times, a.first_pic_url, a.start_time , a.end_time, IFNULL(o.max_offer, a.min_money) current_price,a.storage,a.is_good,a.min_price,a.max_price,a.persist_price
- FROM (
- SELECT DISTINCT o.displace_id
- FROM tb_offer_detail d JOIN tb_offer o ON d.offer_id = o.id
- WHERE d.da_id = #{diggerAgentId}
- ) t JOIN tb_displace_audit a ON t.displace_id = a.displace_id LEFT JOIN tb_offer o ON a.displace_id = o.displace_id
- WHERE a.audit_status IN ('1', '3') AND a.state = '1' AND a.agent_id = #{agentId}
- ORDER BY a.start_time DESC
- </select>
- <resultMap id="displaceDetailBo" type="com.demo.wjj.bo.DisplaceDetailBo">
- <result column="id" property="id"/>
- <result column="agent_name" property="agentName"/>
- <result column="displace_id" property="displaceId"/>
- <result column="warranty_desc" property="warrantyDesc"/>
- <result column="idea_price" property="ideaPrice"/>
- <result column="look_times" property="lookTimes"/>
- <result column="offer_times" property="offerTimes"/>
- <result column="start_time" property="startTime"/>
- <result column="end_time" property="endTime"/>
- <result column="offer_status" property="offerStatus"/>
- <result column="agent_id" property="agentId"/>
- <result column="money_range" property="moneyRange"/>
- <result column="min_money" property="minMoney"/>
- <result column="others_desc" property="othersDesc"/>
- <result column="up_type" property="upType"/>
- <result column="is_kxc" property="isKxc"/>
- </resultMap>
- <!--查询置换详情-->
- <select id="selectDetails" resultMap="displaceDetailBo">
- SELECT a.id, a.displace_id,a.agent_name,a.agent_id, a.is_kxc, a.up_type, a.warranty_desc, a.idea_price, a.start_time , a.end_time, IFNULL(a.look_times, 0) look_times, IFNULL(a.money_range, '0') money_range,
- IFNULL(o.offer_times, 0) offer_times, a.end_time, a.time_delay, a.min_money, a.others_desc,a.storage,a.is_good,a.min_price,a.max_price,a.persist_price,
- CASE WHEN a.start_time > #{now} THEN 1
- WHEN #{now} BETWEEN a.start_time AND a.end_time THEN 2
- ELSE 3
- END offer_status, a.agent_id
- FROM tb_displace_audit a LEFT JOIN tb_offer o ON a.displace_id = o.displace_id
- WHERE a.id = #{id}
- </select>
- <!--查询置换报价详情-->
- <select id="selectOfferList" resultType="com.demo.wjj.po.OfferDetail">
- SELECT d.da_id daId, DATE_FORMAT(d.offer_time, '%m-%d %H:%i:%s') offerTimeStr, a.start_time , a.end_time, d.price, d.offer_nc offerNc, d.is_kxc isKxc,a.storage,a.is_good,a.min_price,a.max_price,a.persist_price
- FROM tb_offer_detail d JOIN tb_offer o ON d.offer_id = o.id
- JOIN tb_displace_audit a ON o.displace_id = a.displace_id
- WHERE a.id = #{id} AND d.is_show = '1'
- ORDER BY d.price DESC
- </select>
- </mapper>
|