<?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.yeshi.fanli.dao.mybatis.order.LostOrderMapper">
|
<resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.LostOrder">
|
<id column="id" property="id" jdbcType="BIGINT" />
|
<result column="orderId" property="orderId" jdbcType="VARCHAR" />
|
<result column="type" property="type" jdbcType="INTEGER" />
|
<result column="state" property="state" jdbcType="INTEGER" />
|
<result column="createTime" property="createTime" jdbcType="BIGINT" />
|
<result column="handleTime" property="handleTime" jdbcType="BIGINT" />
|
<result column="remake" property="remake" jdbcType="VARCHAR" />
|
<result column="judge" property="judge" jdbcType="VARCHAR" />
|
<result column="result_code" property="resultCode" jdbcType="INTEGER" />
|
<association property="userInfo" column="uid"
|
javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
|
<id column="uid" property="id" jdbcType="BIGINT" />
|
</association>
|
|
<association property="order" column="oid"
|
javaType="com.yeshi.fanli.entity.bus.user.Order">
|
<id column="oid" property="id" jdbcType="BIGINT" />
|
</association>
|
</resultMap>
|
|
<resultMap id="AllResultMap" type="com.yeshi.fanli.entity.bus.user.LostOrder">
|
<id column="id" property="id" jdbcType="BIGINT" />
|
<result column="orderId" property="orderId" jdbcType="VARCHAR" />
|
<result column="type" property="type" jdbcType="INTEGER" />
|
<result column="state" property="state" jdbcType="INTEGER" />
|
<result column="createTime" property="createTime" jdbcType="BIGINT" />
|
<result column="handleTime" property="handleTime" jdbcType="BIGINT" />
|
<result column="remake" property="remake" jdbcType="VARCHAR" />
|
<result column="judge" property="judge" jdbcType="VARCHAR" />
|
<result column="result_code" property="resultCode" jdbcType="INTEGER" />
|
<association property="userInfo" column="uid"
|
select="com.yeshi.fanli.dao.mybatis.UserInfoMapper.selectByPKey"/>
|
|
<association property="order" column="oid"
|
select="com.yeshi.fanli.dao.mybatis.order.OrderMapper.selectByPrimaryKey">
|
</association>
|
</resultMap>
|
|
<select id="selectByOrderId" resultMap="BaseResultMap"
|
parameterType="java.lang.String">
|
select * from yeshi_ec_lost_order where orderId=#{0}
|
</select>
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.LostOrder">
|
update yeshi_ec_lost_order
|
<set>
|
<if test="orderId != null">orderId=#{orderId,jdbcType=VARCHAR},</if>
|
<if test="type != null">type=#{type,jdbcType=INTEGER},</if>
|
<if test="state != null">state=#{state,jdbcType=INTEGER},</if>
|
<if test="createTime != null">createTime=#{createTime,jdbcType=BIGINT},</if>
|
<if test="handleTime != null">handleTime=#{handleTime,jdbcType=BIGINT},</if>
|
<if test="userInfo != null">uid=#{userInfo.id,jdbcType=BIGINT},</if>
|
<if test="order != null">oid=#{order.id,jdbcType=BIGINT},</if>
|
<if test="remake != null">remake=#{remake,jdbcType=VARCHAR},</if>
|
<if test="judge != null">judge=#{judge,jdbcType=VARCHAR},</if>
|
<if test="resultCode != null">result_code=#{resultCode,jdbcType=INTEGER},</if>
|
</set>
|
where id = #{id,jdbcType=BIGINT}
|
</update>
|
|
<select id="countByUid" resultType="java.util.HashMap">
|
SELECT IFNULL(COUNT(id), 0) AS total,IFNULL(SUM(CASE WHEN state = 1 THEN 1 ELSE 0 END),0) AS totalPass,
|
IFNULL(SUM(CASE WHEN state = 2 THEN 1 ELSE 0 END),0) AS totalReject
|
FROM yeshi_ec_lost_order WHERE uid = #{uid};
|
</select>
|
|
<select id="listQuery" resultMap="AllResultMap">
|
SELECT d.* FROM yeshi_ec_lost_order d
|
left join yeshi_ec_user u on d.uid = u.id
|
WHERE 1=1
|
<if test='key != null and key != ""'>
|
AND (d.orderId like '%${key}%' or d.uid like '%${key}%' or u.nick_name like '%${key}%')
|
</if>
|
<if test='state != null'>
|
AND d.state = #{state}
|
</if>
|
<if test='handleType != null and handleType == 0'>
|
AND d.state = 0
|
</if>
|
<if test='handleType != null and handleType != 0'>
|
AND (d.state = 1 or d.state = 2)
|
</if>
|
|
ORDER BY d.createTime desc
|
LIMIT ${start},${count}
|
</select>
|
|
<select id="countQuery" resultType="java.lang.Long">
|
SELECT IFNULL(count(d.id),0) FROM yeshi_ec_lost_order d
|
left join yeshi_ec_user u on d.uid = u.id
|
WHERE 1=1
|
<if test='key != null and key != ""'>
|
AND (d.orderId like '%${key}%' or d.uid like '%${key}%' or u.nick_name like '%${key}%')
|
</if>
|
<if test='state != null'>
|
AND d.state = #{state}
|
</if>
|
<if test='handleType != null and handleType == 0'>
|
AND d.state = 0
|
</if>
|
<if test='handleType != null and handleType != 0'>
|
AND (d.state = 1 or d.state = 2)
|
</if>
|
</select>
|
|
|
<select id="countLostNum" resultType="java.util.HashMap">
|
SELECT COUNT(t.`id`) AS showValue,
|
<if test="dateType == 1">
|
FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d') AS 'showDate'
|
</if>
|
<if test="dateType == 2">
|
FROM_UNIXTIME(t.`createTime`/1000,'%m') AS 'showDate'
|
</if>
|
<if test="dateType == 3">
|
FROM_UNIXTIME(t.`createTime`/1000,'%Y') AS 'showDate'
|
</if>
|
FROM `yeshi_ec_lost_order` t
|
WHERE t.`createTime`IS NOT NULL
|
<if test="startTime != null and startTime != '' ">
|
AND FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
|
</if>
|
<if test="endTime != null and endTime != '' ">
|
AND FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
|
</if>
|
<if test="year != null and year != '' ">
|
AND FROM_UNIXTIME(t.`createTime`/1000,'%Y') = '${year}'
|
</if>
|
|
<if test="resultCode != null and resultCode != 0 ">
|
AND t.`result_code` = ${resultCode}
|
</if>
|
|
<if test="dateType == 1">
|
GROUP BY FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d')
|
</if>
|
<if test="dateType == 2">
|
GROUP BY FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m')
|
</if>
|
<if test="dateType == 3">
|
GROUP BY FROM_UNIXTIME(t.`createTime`/1000,'%Y')
|
</if>
|
|
ORDER BY t.`createTime`
|
</select>
|
|
|
<select id="countAppealMoney" resultType="java.util.HashMap">
|
SELECT CAST(SUM(v.`hb_money`)AS DECIMAL(19,2)) AS showValue,
|
<if test="dateType == 1">
|
FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d') AS 'showDate'
|
</if>
|
<if test="dateType == 2">
|
FROM_UNIXTIME(t.`createTime`/1000,'%m') AS 'showDate'
|
</if>
|
<if test="dateType == 3">
|
FROM_UNIXTIME(t.`createTime`/1000,'%Y') AS 'showDate'
|
</if>
|
FROM `yeshi_ec_lost_order` t
|
LEFT JOIN `yeshi_ec_common_order` tc ON tc.`co_order_no` = t.`orderId`
|
LEFT JOIN `yeshi_ec_hongbao_order` h ON h.`ho_order_id` = tc.`co_id`
|
LEFT JOIN `yeshi_ec_hongbao_v2`v ON h.`ho_hongbao_id` = v.`hb_id`
|
WHERE t.`createTime`IS NOT NULL AND t.`result_code` = 2 AND (v.`hb_type` =1 OR v.`hb_type` = 2)
|
<if test="startTime != null and startTime != '' ">
|
AND FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d')<![CDATA[ >= ]]>'${startTime}'
|
</if>
|
<if test="endTime != null and endTime != '' ">
|
AND FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d') <![CDATA[ <= ]]> '${endTime}'
|
</if>
|
<if test="year != null and year != '' ">
|
AND FROM_UNIXTIME(t.`createTime`/1000,'%Y') = '${year}'
|
</if>
|
|
<if test="dateType == 1">
|
GROUP BY FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d')
|
</if>
|
<if test="dateType == 2">
|
GROUP BY FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m')
|
</if>
|
<if test="dateType == 3">
|
GROUP BY FROM_UNIXTIME(t.`createTime`/1000,'%Y')
|
</if>
|
|
ORDER BY t.`createTime`
|
</select>
|
|
|
</mapper>
|