<?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>
|
|
|
</mapper>
|