<?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.dsh.competition.mapper.PaymentCompetitionMapper">
|
|
|
<select id="queryMyCompetitionList" resultType="com.dsh.competition.model.CompetitionListVo">
|
select
|
a.id,
|
b.`name`,
|
b.coverDrawing,
|
b.city as cityName,
|
b.registerCondition,
|
b.introduction,
|
b.id as pId,
|
DATE_FORMAT(b.registerEndTime, '%Y-%m-%d %H:%i') as registerEndTime,
|
CONCAT(b.startAge, '-', b.endAge) as age,
|
b.baseNumber as heat,
|
if(a.payStatus = 3, 4, b.status) as status
|
from t_payment_competition a
|
left join t_competition b on (a.competitionId = b.id)
|
where a.state = 1 and a.appUserId = #{uid} and a.payStatus != 1
|
<!--1=未开始,2=进行中,3=已结束,4=已取消-->
|
<if test="null != type and 1 == type">
|
and b.status = 1 and a.payStatus = 2
|
</if>
|
<if test="null != type and 2 == type">
|
and b.status = 2 and a.payStatus = 2
|
</if>
|
<if test="null != type and 3 == type">
|
and b.status = 3 and a.payStatus = 2
|
</if>
|
<if test="null != type and 4 == type">
|
and a.payStatus = 3
|
</if>
|
order by a.insertTime desc limit #{pageNo}, #{pageSize}
|
</select>
|
<select id="queryDatas" resultType="com.dsh.competition.feignclient.model.BillingRequest">
|
SELECT DATE_FORMAT(insertTime, '%m-%d %H:%i')as `time`,
|
amount
|
from t_payment_competition
|
where payStatus in (2,3) and payType in (1,2)
|
<if test="null != monthStart and '' != monthStart and null != monthEnd and '' != monthEnd">
|
and DATE_FORMAT(payTime, '%Y-%m-%d %H:%i:%s') between #{monthStart} and #{monthEnd}
|
</if>
|
<if test="null != appUserId and '' != appUserId ">
|
and appUserId = #{appUserId}
|
</if>
|
</select>
|
<select id="queryCancelDatas" resultType="com.dsh.competition.feignclient.model.BillingRequest">
|
SELECT DATE_FORMAT(refundTime, '%m-%d %H:%i')as `time`,
|
amount
|
from t_payment_competition
|
where payStatus = 3 and payType in (1,2)
|
<if test="null != monthStart and '' != monthStart and null != monthEnd and '' != monthEnd">
|
and DATE_FORMAT(refundTime, '%Y-%m-%d %H:%i:%s') between #{monthStart} and #{monthEnd}
|
</if>
|
<if test="null != appUserId and '' != appUserId ">
|
and appUserId = #{appUserId}
|
</if>
|
</select>
|
<select id="listAll" resultType="com.dsh.competition.entity.PaymentCompetition">
|
select * from t_payment_competition t1
|
<where>
|
<if test="query.amount!=null and query.amount!= ''">
|
and t1.amount <= #{query.amount}
|
</if>
|
<if test="query.userIds != null and query.userIds.size()>0">
|
AND t1.competitionId IN
|
<foreach collection="query.userIds" separator="," item="id" open="(" close=")">
|
#{id}
|
</foreach>
|
</if>
|
<if test="sTime !=null and sTime!= '' and eTime !=null and eTime!= ''">
|
and t1.insertTime between #{sTime} and #{eTime}
|
</if>
|
</where>
|
</select>
|
<select id="queryBycode" resultType="java.lang.Integer">
|
SELECT cp.storeId
|
FROM t_course_package_payment py
|
LEFT JOIN t_course_package cp ON py.coursePackageId = cp.id
|
WHERE py.code = #{code}
|
</select>
|
<select id="counts" resultType="java.lang.Integer">
|
select count(1)
|
from t_user_competition where competitionId = #{id}
|
</select>
|
</mapper>
|