<?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.ExtractAuditRecordMapper">
|
<resultMap id="BaseResultMap"
|
type="com.yeshi.fanli.entity.bus.user.ExtractAuditRecord">
|
<id column="id" property="id" jdbcType="BIGINT" />
|
<result column="beforeMoney" property="beforeMoney" jdbcType="DECIMAL" />
|
<result column="afterMoney" property="afterMoney" jdbcType="DECIMAL" />
|
<result column="countMoney" property="countMoney" jdbcType="DECIMAL" />
|
<result column="countNum" property="countNum" jdbcType="BIGINT" />
|
<result column="orderNum" property="orderNum" jdbcType="BIGINT" />
|
<result column="auditRole" property="auditRole" jdbcType="VARCHAR" />
|
<result column="cancelOrderNum" property="cancelOrderNum"
|
jdbcType="BIGINT" />
|
<result column="auditTime" property="auditTime" jdbcType="BIGINT" />
|
<result column="extraInfo" property="extraInfoStr" jdbcType="VARCHAR" />
|
<association property="adminUser" column="aid"
|
select="com.yeshi.fanli.dao.mybatis.AdminUserMapper.selectByPrimaryKey">
|
</association>
|
<association property="extract" column="extractId"
|
select="com.yeshi.fanli.dao.mybatis.ExtractMapper.selectByPrimaryKey">
|
</association>
|
</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>
|
|
<sql id="Base_Column_List">id,aid,extractId,beforeMoney,afterMoney,countMoney,countNum,orderNum,cancelOrderNum,auditTime,auditRole,extraInfo
|
</sql>
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
parameterType="java.lang.Long">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_extract_audit_record where id = #{id,jdbcType=BIGINT}
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
delete from
|
yeshi_ec_extract_audit_record where id = #{id,jdbcType=BIGINT}
|
</delete>
|
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.ExtractAuditRecord"
|
useGeneratedKeys="true" keyProperty="id">
|
insert into
|
yeshi_ec_extract_audit_record
|
(id,aid,extractId,beforeMoney,afterMoney,countMoney,countNum,auditTime,extraInfo)
|
values
|
(#{id,jdbcType=BIGINT},#{adminUser.id,jdbcType=BIGINT},#{extract.id,jdbcType=BIGINT},
|
#{beforeMoney,jdbcType=DECIMAL},#{afterMoney,jdbcType=DECIMAL},#{countMoney,jdbcType=DECIMAL},#{auditRole,jdbcType=VARCHAR})
|
#{countNum,jdbcType=BIGINT},#{orderNum,jdbcType=BIGINT},#{cancelOrderNum,jdbcType=BIGINT},#{auditTime,jdbcType=BIGINT},#{extraInfoStr,jdbcType=VARCHAR})
|
</insert>
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.ExtractAuditRecord"
|
useGeneratedKeys="true" keyProperty="id">
|
insert into yeshi_ec_extract_audit_record
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">id,</if>
|
<if test="adminUser != null">aid,</if>
|
<if test="extract != null">extractId,</if>
|
<if test="beforeMoney != null">beforeMoney,</if>
|
<if test="afterMoney != null">afterMoney,</if>
|
<if test="countMoney != null">countMoney,</if>
|
<if test="countNum != null">countNum,</if>
|
<if test="orderNum != null">orderNum,</if>
|
<if test="cancelOrderNum != null">cancelOrderNum,</if>
|
<if test="auditTime != null">auditTime,</if>
|
<if test="auditRole != null">auditRole,</if>
|
<if test="extraInfoStr != null">extraInfo,</if>
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="adminUser != null">#{adminUser.id,jdbcType=BIGINT},</if>
|
<if test="extract != null">#{extract.id,jdbcType=BIGINT},</if>
|
<if test="beforeMoney != null">#{beforeMoney,jdbcType=DECIMAL},</if>
|
<if test="afterMoney != null">#{afterMoney,jdbcType=DECIMAL},</if>
|
<if test="countMoney != null">#{countMoney,jdbcType=DECIMAL},</if>
|
<if test="countNum != null">#{countNum,jdbcType=BIGINT},</if>
|
<if test="orderNum != null">#{orderNum,jdbcType=BIGINT},</if>
|
<if test="cancelOrderNum != null">#{cancelOrderNum,jdbcType=BIGINT},</if>
|
<if test="auditTime != null">#{auditTime,jdbcType=BIGINT},</if>
|
<if test="auditRole != null">#{auditRole,jdbcType=VARCHAR},</if>
|
<if test="extraInfoStr != null">#{extraInfoStr,jdbcType=VARCHAR},</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.ExtractAuditRecord">
|
update
|
yeshi_ec_extract_audit_record set aid =
|
#{adminUser.id,jdbcType=BIGINT},
|
extractId =
|
#{extract.id,jdbcType=BIGINT},beforeMoney =
|
#{beforeMoney,jdbcType=DECIMAL},
|
afterMoney =
|
#{afterMoney,jdbcType=DECIMAL},countMoney =
|
#{countMoney,jdbcType=DECIMAL},
|
countNum =
|
#{countNum,jdbcType=BIGINT},auditRole =
|
#{auditRole,jdbcType=VARCHAR},
|
orderNum = #{orderNum,jdbcType=BIGINT},cancelOrderNum =
|
#{cancelOrderNum,jdbcType=BIGINT},
|
auditTime =
|
#{auditTime,jdbcType=BIGINT},
|
extraInfo =
|
#{extraInfoStr,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=BIGINT}
|
</update>
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.ExtractAuditRecord">
|
update yeshi_ec_extract_audit_record
|
<set>
|
<if test="adminUser != null">aid=#{adminUser.id,jdbcType=BIGINT},</if>
|
<if test="extract != null">extractId=#{extract.id,jdbcType=BIGINT},</if>
|
<if test="beforeMoney != null">beforeMoney=#{beforeMoney,jdbcType=DECIMAL},</if>
|
<if test="afterMoney != null">afterMoney=#{afterMoney,jdbcType=DECIMAL},</if>
|
<if test="countMoney != null">countMoney=#{countMoney,jdbcType=DECIMAL},</if>
|
<if test="countNum != null">countNum=#{countNum,jdbcType=BIGINT},</if>
|
<if test="orderNum != null">orderNum=#{orderNum,jdbcType=BIGINT},</if>
|
<if test="cancelOrderNum != null">cancelOrderNum=#{cancelOrderNum,jdbcType=BIGINT},</if>
|
<if test="auditTime != null">auditTime=#{auditTime,jdbcType=BIGINT},</if>
|
<if test="auditRole != null">auditRole=#{auditRole,jdbcType=VARCHAR},</if>
|
<if test="extraInfoStr != null">extraInfo=#{extraInfoStr,jdbcType=VARCHAR},</if>
|
</set>
|
where id = #{id,jdbcType=BIGINT}
|
</update>
|
|
<select id="getListbyExtractId" resultMap="BaseResultMap">
|
<!-- 查询最近一次提现记录 -->
|
SELECT * FROM yeshi_ec_extract_audit_record ear
|
WHERE ear.`extractId` =
|
#{extractId,jdbcType=BIGINT}
|
and auditTime is not null and auditTime >
|
0 ORDER BY ear.`auditTime`
|
</select>
|
|
<select id="getbyExtractId" resultMap="BaseResultMap">
|
<!-- 查询提现时已记录信息 -->
|
SELECT * FROM yeshi_ec_extract_audit_record ear
|
WHERE ear.`extractId` =
|
#{extractId,jdbcType=BIGINT}
|
and (auditTime is null or auditTime = 0)
|
ORDER BY ear.`auditTime` desc
|
</select>
|
|
<select id="getList" resultMap="BaseResultMap">
|
|
SELECT * FROM yeshi_ec_extract_audit_record ar
|
LEFT JOIN
|
yeshi_ec_extract ex ON ar.extractId=ex.id
|
WHERE
|
<![CDATA[
|
auditTime is not null and auditTime > 0 AND
|
FROM_UNIXTIME(ex.extractTime/1000) >= #{startTime}
|
AND FROM_UNIXTIME(ex.extractTime/1000) <= #{endTime}
|
]]>
|
<if test='key != null and key != ""'>
|
AND (ex.uid like '%${key}%' OR ar.aid like '%${key}%')
|
</if>
|
ORDER BY ex.extractTime DESC LIMIT ${start},${count}
|
</select>
|
|
<select id="getCount" resultType="java.lang.Integer">
|
SELECT count(ar.id) FROM yeshi_ec_extract_audit_record ar
|
LEFT JOIN
|
yeshi_ec_extract ex ON ar.extractId=ex.id
|
WHERE
|
<![CDATA[
|
auditTime is not null and auditTime > 0 AND
|
FROM_UNIXTIME(ex.`extractTime`/1000) >= #{startTime}
|
AND FROM_UNIXTIME(ex.`extractTime`/1000) <= #{endTime}
|
]]>
|
<if test='key != null and key != ""'>
|
AND (ex.uid like '%${key}%' OR ar.aid like '%${key}%')
|
</if>
|
</select>
|
|
|
<select id="getMyAuditedAllList" resultMap="BaseResultMap">
|
|
SELECT * FROM yeshi_ec_extract_audit_record ar
|
LEFT JOIN
|
yeshi_ec_extract ex ON ar.extractId=ex.id
|
WHERE ar.aid = ${adminId}
|
<if test='key != null and key != ""'>
|
AND ex.uid like '%${key}%'
|
</if>
|
<if test='state != null'>
|
AND ex.state = #{state}
|
</if>
|
ORDER BY ex.extractTime DESC LIMIT ${start},${count}
|
</select>
|
|
<select id="getMyAuditedAllCount" resultType="java.lang.Integer">
|
|
SELECT count(ar.id) FROM yeshi_ec_extract_audit_record ar
|
LEFT JOIN
|
yeshi_ec_extract ex ON ar.extractId=ex.id
|
WHERE ar.aid = ${adminId}
|
<if test='key != null and key != ""'>
|
AND ex.uid like '%${key}%'
|
</if>
|
<if test='state != null'>
|
AND ex.state = #{state}
|
</if>
|
</select>
|
|
<select id="getMyAuditedTimeSlotList" resultMap="BaseResultMap">
|
SELECT ar.*,(CASE WHEN ex.state = 2 THEN 1 WHEN ex.state =1 THEN 1
|
ELSE 0 END) AS stateOrde FROM yeshi_ec_extract_audit_record ar
|
LEFT
|
JOIN yeshi_ec_extract ex ON ar.extractId=ex.id
|
WHERE <![CDATA[1>0]]>
|
<if test="adminId != null">
|
AND ar.aid = ${adminId}
|
</if>
|
|
<if test='key != null and key != ""'>
|
AND ex.uid like '%${key}%'
|
</if>
|
|
<if test="days != null">
|
<![CDATA[ AND DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(ex.extractTime/1000) ]]>
|
</if>
|
|
<if test='state != null'>
|
AND ex.state = #{state}
|
</if>
|
ORDER BY stateOrde,ex.`extractTime` DESC LIMIT ${start},${count}
|
|
</select>
|
|
<select id="getMyAuditedTimeSlotCount" resultType="java.lang.Integer">
|
SELECT count(ar.id) FROM yeshi_ec_extract_audit_record ar
|
LEFT JOIN
|
yeshi_ec_extract ex ON ar.extractId=ex.id
|
WHERE <![CDATA[1>0]]>
|
<if test="adminId != null">
|
AND ar.aid = ${adminId}
|
</if>
|
|
<if test='key != null and key != ""'>
|
AND ex.uid like '%${key}%'
|
</if>
|
|
<if test="days != null">
|
<![CDATA[ AND DATE_SUB(CURDATE(), INTERVAL ${days} DAY) <= FROM_UNIXTIME(ex.extractTime/1000) ]]>
|
</if>
|
|
<if test='state != null'>
|
AND ex.state = #{state}
|
</if>
|
</select>
|
|
<select id="getMyAuditedCountWeek" resultType="java.lang.Integer">
|
SELECT COUNT(id) FROM yeshi_ec_extract_audit_record WHERE aid =
|
${adminId}
|
<![CDATA[
|
AND YEARWEEK(DATE_FORMAT(FROM_UNIXTIME(auditTime/1000),'%Y-%m-%d')) = YEARWEEK(NOW());
|
]]>
|
</select>
|
|
<select id="getMyAuditedCountMonth" resultType="java.lang.Integer">
|
SELECT COUNT(id) FROM yeshi_ec_extract_audit_record WHERE aid =
|
${adminId}
|
<![CDATA[
|
AND DATE_FORMAT(FROM_UNIXTIME(auditTime/1000),'%Y-%m')=DATE_FORMAT(NOW(),'%Y-%m')
|
]]>
|
</select>
|
|
<select id="getMyAuditedCountToday" resultType="java.lang.Integer">
|
SELECT COUNT(id) FROM yeshi_ec_extract_audit_record WHERE aid =
|
${adminId}
|
<![CDATA[
|
AND TO_DAYS(FROM_UNIXTIME(auditTime/1000)) = TO_DAYS(NOW())
|
]]>
|
</select>
|
|
<!-- 查询历史提现申请记录 -->
|
<select id="getByUidList" resultMap="BaseResultMap">
|
SELECT * FROM yeshi_ec_extract_audit_record ar
|
LEFT JOIN
|
yeshi_ec_extract ex ON ar.extractId=ex.id
|
WHERE ex.uid = ${uid}
|
<![CDATA[and ar.auditTime > 0 and ar.auditTime is not null ]]>
|
ORDER BY ex.extractTime DESC LIMIT ${start},${count}
|
</select>
|
|
<select id="getByUidCount" resultType="java.lang.Integer">
|
SELECT COUNT(ar.id) FROM yeshi_ec_extract_audit_record ar
|
LEFT JOIN
|
yeshi_ec_extract ex ON ar.extractId=ex.id
|
WHERE ex.uid = ${uid} <![CDATA[and ar.auditTime > 0 and ar.auditTime is not null ]]>
|
</select>
|
|
|
|
<select id="countAuditTotal" resultType="Long">
|
SELECT COUNT(tr.id) FROM `yeshi_ec_extract_audit_record` tr
|
LEFT JOIN `yeshi_ec_extract` t ON t.`id` = tr.`extractId`
|
WHERE t.`state` = #{state} AND FROM_UNIXTIME(tr.`auditTime`/1000,'%Y-%m-%d') = #{preDay}
|
</select>
|
|
<select id="countApplyExtractMoney" resultType="BigDecimal">
|
SELECT SUM(t.`money`) FROM `yeshi_ec_extract` t
|
WHERE FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') = #{preDay}
|
</select>
|
|
<select id="countApplyNumberByDay" resultType="Long">
|
SELECT COUNT(t.id) FROM `yeshi_ec_extract` t
|
WHERE FROM_UNIXTIME(t.`extractTime`/1000,'%Y-%m-%d') = #{preDay}
|
</select>
|
|
</mapper>
|