| | |
| | | co_order_goods_id,co_count,co_state,co_state_whole_order, |
| | | co_estimate,co_eIncome,co_payment,co_settlement, co_third_create_time, |
| | | MAX(co_settle_time) AS co_settle_time, co_order_by, co_create_time, |
| | | co_update_time,co_state_desc |
| | | co_update_time,co_state_desc,co_urank |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> |
| | | <!-- 订单时间 --> |
| | | <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> |
| | | |
| | | <if test="payment != null"> |
| | | AND co.co_payment <![CDATA[<]]> #{payment} |
| | | </if> |
| | | |
| | | ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} |
| | | </select> |
| | | <select id="countQueryByUid" resultType="java.lang.Long"> |
| | |
| | | </if> |
| | | <!-- 订单来源 --> |
| | | <if test="source != null">AND co.co_source_type = #{source}</if> |
| | | <if test="payment != null"> |
| | | AND co.co_payment <![CDATA[<]]> #{payment} |
| | | </if> |
| | | ORDER BY co.co_third_create_time DESC LIMIT ${start},${count} ) A LEFT |
| | | JOIN yeshi_ec_user u ON u.id = A.hb_uid |
| | | </select> |
| | |
| | | <foreach collection="listShopId" item="shopId" open=" and (" |
| | | separator=" or " close=")">g.`cog_shop_id` =#{shopId}</foreach> |
| | | </if> |
| | | <if test="payment != null"> |
| | | AND co.co_payment <![CDATA[<]]> #{payment} |
| | | </if> |
| | | <if test="minTime != null"> |
| | | <!-- 高风险订单 --> |
| | | AND co.`co_third_create_time`>#{minTime} AND<![CDATA[ (co.`co_estimate`>= ${money} OR co.`co_eIncome`> ${money})]]> |
| | |
| | | <if test="key != null and key != '' "> |
| | | <if test="keyType == 1 ">AND co.co_order_no = '${key}'</if> |
| | | <if test="keyType == 2 ">AND hb.hb_uid = ${key}</if> |
| | | </if> |
| | | <if test="payment != null"> |
| | | AND co.co_payment <![CDATA[<]]> #{payment} |
| | | </if> |
| | | <!-- 订单来源 --> |
| | | <if test="source != null">AND co.co_source_type = #{source}</if> |
| | |
| | | </foreach> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` )A |
| | | </select> |
| | | |
| | | <select id="getMinSettleTimeAndUid" resultMap="BaseResultMap"> |
| | | SELECT d.`co_uid`,MAX(d.`co_settle_time`) AS co_settle_time FROM `yeshi_ec_common_order` d |
| | | WHERE d.`co_settle_time` IS NOT NULL AND d.`co_payment` > 1 |
| | | GROUP BY d.`co_uid` |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="getOrderList" resultMap="ResultMap"> |
| | | SELECT hb.`hb_type` AS hongBaoType, MAX(hb.`hb_get_time`) AS |
| | | accountTime, MAX(hb.`hb_pre_get_time`) AS preAccountTime, |
| | | <include refid="Order_Column_List" /> |
| | | FROM yeshi_ec_hongbao_order ho LEFT JOIN (SELECT |
| | | <include refid="Hongbao_Column_List" /> |
| | | FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]> |
| | | <include refid="SELECT_PARAM_HONGBAO_TYPE" /> |
| | | <if test="type == 2 and day == 5"> |
| | | <!-- 本月月将要到账分享订单 --> |
| | | AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') = |
| | | DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | <if test="type == 3 and day == 5"> |
| | | <!-- 本月将要到账邀请订单 --> |
| | | AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') = |
| | | DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | <!-- 红包类型 --> |
| | | )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <include refid="SELECT_PARAM_ORDER_STATE" /> |
| | | <!-- 订单状态 --> |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> |
| | | <!-- 订单时间 --> |
| | | <include refid="SELECT_PARAM_HONGBAO_STATE" /> |
| | | <!-- 订单号查询 --> |
| | | <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> |
| | | <!-- 订单来源 --> |
| | | <if test="listSource != null and listSource.size() > 0"> |
| | | <foreach collection="listSource" item="item" open="AND (" close=")" separator="or"> |
| | | co.co_source_type = #{item} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` ORDER BY |
| | | co.co_third_create_time DESC LIMIT ${start},${count} |
| | | </select> |
| | | <select id="countOrderList" resultType="java.lang.Long"> |
| | | SELECT IFNULL(COUNT(ho_id),0) FROM (SELECT ho.ho_id FROM |
| | | yeshi_ec_hongbao_order ho LEFT JOIN (SELECT |
| | | <include refid="Hongbao_Column_List" /> |
| | | FROM yeshi_ec_hongbao_v2 v2 WHERE v2.`hb_uid`= #{uid} AND <![CDATA[v2.`hb_type`<> 10 ]]> |
| | | <include refid="SELECT_PARAM_HONGBAO_TYPE" /> |
| | | <!-- 红包类型 --> |
| | | <if test="type == 2 and day == 5"> |
| | | <!-- 本月月将要到账分享订单 --> |
| | | AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') = |
| | | DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | <if test="type == 3 and day == 5"> |
| | | <!-- 本月将要到账邀请订单 --> |
| | | AND DATE_FORMAT(v2.`hb_pre_get_time`,'%Y%m') = |
| | | DATE_FORMAT(CURDATE(),'%Y%m') |
| | | </if> |
| | | )hb ON IF(hb.hb_pid IS NULL,hb.hb_id,hb.hb_pid)=ho.`ho_hongbao_id` |
| | | LEFT JOIN yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | WHERE hb.hb_id IS NOT NULL |
| | | <include refid="SELECT_PARAM_ORDER_STATE" /> |
| | | <!-- 订单状态 --> |
| | | <include refid="SELECT_PARAM_ORDER_CREATE_TIME" /> |
| | | <!-- 订单时间 --> |
| | | <include refid="SELECT_PARAM_HONGBAO_STATE" /> |
| | | <!-- 订单号查询 --> |
| | | <if test="orderNo != null and orderNo !='' ">AND co.co_order_no = #{orderNo}</if> |
| | | <!-- 订单来源 --> |
| | | <if test="listSource != null and listSource.size() > 0"> |
| | | <foreach collection="listSource" item="item" open="AND (" close=")" separator="or"> |
| | | co.co_source_type = #{item} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY co.`co_order_no`, co.`co_source_type` )A |
| | | </select> |
| | | |
| | | |
| | | </mapper> |