<?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" />
|
<result column="ip_info" property="ipInfo" jdbcType="VARCHAR" />
|
<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.selectByPrimaryKey" />
|
<association property="order" column="oid"
|
select="com.yeshi.fanli.dao.mybatis.order.OrderMapper.selectByPrimaryKey" />
|
</resultMap>
|
|
<resultMap id="ChartMap" type="com.yeshi.fanli.dto.ChartTDO">
|
<result column="showDate" property="showDate" jdbcType="VARCHAR" />
|
<result column="showValue" property="showValue" jdbcType="VARCHAR" />
|
</resultMap>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
yeshi_ec_lost_order where id = #{id,jdbcType=BIGINT}
|
</delete>
|
<select id="selectByOrderIdAndType" resultMap="BaseResultMap">select * from
|
yeshi_ec_lost_order where orderId=#{orderId} and `type`=#{type}
|
</select>
|
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
parameterType="java.lang.Long">select * from yeshi_ec_lost_order where id=#{0}</select>
|
<select id="listByStateAndResultCode" resultMap="BaseResultMap">select * from
|
yeshi_ec_lost_order where `state`=#{state} and
|
`result_code`=#{resultCode} ORDER BY id DESC limit #{start},#{count}
|
</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>
|
<if test="ipInfo !=null">ip_info =#{ipInfo,jdbcType=VARCHAR},</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>
|
<if test="type != null">AND d.type = #{type}</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>
|
<if test="type != null">AND d.type = #{type}</if>
|
</select>
|
|
<select id="countLostOrderNum" resultType="Integer">
|
SELECT COUNT(1) FROM (SELECT COUNT(t.`id`) FROM `yeshi_ec_lost_order` t
|
WHERE FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d') = #{preDay}
|
AND t.result_code = #{resultCode}
|
GROUP BY t.`orderId`,t.`orderType`)A
|
</select>
|
|
<select id="countAppealMoney" resultType="BigDecimal">
|
SELECT SUM(IFNULL(co.`co_eIncome`,co.`co_estimate`)) FROM `yeshi_ec_lost_order` t
|
LEFT JOIN yeshi_ec_common_order co ON (co.`co_order_no` = t.`orderId` AND co.`co_source_type` = t.`orderType`)
|
WHERE FROM_UNIXTIME(t.`createTime`/1000,'%Y-%m-%d') = #{preDay} AND (co.`co_state`=1 OR co.`co_state`=2)
|
</select>
|
|
|
<select id="listByMaxHandleTimeAndStateAndResultCode" resultMap="BaseResultMap">
|
select * from yeshi_ec_lost_order lo where #{maxTime} >
|
lo.`handleTime`
|
<if test="state!=null"> and lo.`state`=#{state} and result_code=#{resultCode}
|
</if>
|
|
<if test="resultCode!=null"> and lo.`result_code`=#{resultCode}
|
</if>
|
</select>
|
|
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.LostOrder"
|
useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_lost_order
|
(id,orderId,type,state,createTime,handleTime,uid,oid,remake,judge,result_code,id,ip_info)
|
values
|
(#{id,jdbcType=BIGINT},#{orderId,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=BIGINT},#{handleTime,jdbcType=BIGINT},#{userInfo.id,jdbcType=BIGINT},#{order.id,jdbcType=BIGINT},#{remake,jdbcType=VARCHAR},#{judge,jdbcType=VARCHAR},#{resultCode,jdbcType=INTEGER},#{id,jdbcType=BIGINT},#{ipInfo,jdbcType=VARCHAR})
|
</insert>
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.LostOrder"
|
useGeneratedKeys="true" keyProperty="id">
|
insert into yeshi_ec_lost_order
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">id,</if>
|
<if test="orderId != null">orderId,</if>
|
<if test="type != null">type,</if>
|
<if test="state != null">state,</if>
|
<if test="createTime != null">createTime,</if>
|
<if test="handleTime != null">handleTime,</if>
|
<if test="userInfo != null">uid,</if>
|
<if test="order != null">oid,</if>
|
<if test="remake != null">remake,</if>
|
<if test="judge != null">judge,</if>
|
<if test="resultCode != null">result_code,</if>
|
<if test="ipInfo != null">ip_info,</if>
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if>
|
<if test="type != null">#{type,jdbcType=INTEGER},</if>
|
<if test="state != null">#{state,jdbcType=INTEGER},</if>
|
<if test="createTime != null">#{createTime,jdbcType=BIGINT},</if>
|
<if test="handleTime != null">#{handleTime,jdbcType=BIGINT},</if>
|
<if test="userInfo != null">#{userInfo.id,jdbcType=BIGINT},</if>
|
<if test="order != null">#{order.id,jdbcType=BIGINT},</if>
|
<if test="remake != null">#{remake,jdbcType=VARCHAR},</if>
|
<if test="judge != null">#{judge,jdbcType=VARCHAR},</if>
|
<if test="resultCode != null">#{resultCode,jdbcType=INTEGER},</if>
|
<if test="ipInfo != null">#{ipInfo,jdbcType=VARCHAR}</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.LostOrder">update
|
yeshi_ec_lost_order set orderId = #{orderId,jdbcType=VARCHAR},type =
|
#{type,jdbcType=INTEGER},state = #{state,jdbcType=INTEGER},createTime
|
= #{createTime,jdbcType=BIGINT},handleTime =
|
#{handleTime,jdbcType=BIGINT},uid = #{userInfo.id,jdbcType=BIGINT},oid
|
= #{order.id,jdbcType=BIGINT},remake =
|
#{remake,jdbcType=VARCHAR},judge =
|
#{judge,jdbcType=VARCHAR},result_code = #{resultCode,jdbcType=INTEGER}
|
,ip_info =#{ipInfo,jdbcType=VARCHAR} where id = #{id,jdbcType=BIGINT}
|
</update>
|
<delete id="deleteByUid" parameterType="java.lang.Long">delete from
|
yeshi_ec_lost_order where uid = #{0}
|
</delete>
|
<select id="listByUidOrderByCreateTimeDesc" resultMap="BaseResultMap">select *
|
from yeshi_ec_lost_order where uid=#{uid} order by id desc limit
|
#{start},#{count}
|
</select>
|
<select id="countAllByUid" resultType="java.lang.Long">select count(id) from
|
yeshi_ec_lost_order where uid=#{0}
|
</select>
|
<select id="listByOrderIdAndTypeAndState" resultMap="BaseResultMap">
|
select * from yeshi_ec_lost_order where orderId=#{orderId}
|
<if test="type!=null">and type=#{type}</if>
|
<if test="stateList!=null">
|
<foreach collection="stateList" item="state" open="and ("
|
close=")" separator=" or ">state=#{state}</foreach>
|
</if>
|
</select>
|
<update id="processFail">UPDATE `yeshi_ec_lost_order` lo SET
|
lo.`result_code`=3 WHERE lo.`state`=1 AND lo.`result_code`=1 AND
|
UNIX_TIMESTAMP()*1000- lo.`handleTime`>1000* 60 * 60 * 24 * 3
|
</update>
|
|
<select id="countTodayAppeal" resultType="java.lang.Long">
|
SELECT
|
IFNULL(COUNT(t.`id`),0) FROM yeshi_ec_lost_order t
|
WHERE t.`uid` =
|
#{uid}
|
AND FROM_UNIXTIME(t.`createTime`/1000, '%Y-%m-%d')
|
=DATE_FORMAT(NOW(),'%Y-%m-%d')
|
</select>
|
|
</mapper>
|