sql 报错

This commit is contained in:
GYJ
2024-12-30 18:16:59 +08:00
parent 7498922675
commit 5e06231aaa
2 changed files with 6 additions and 28 deletions

View File

@@ -23,28 +23,6 @@
update pay_details set `state`=#{state},pay_time=#{time},trade_no=#{tradeNo} where id=#{id}
</update>
<select id=" selectPayDetails" resultType="Map">
select s.id,s.classify,s.order_id as orderId,s.money,s.user_id as userId,
s.state,s.create_time as createTime,s.pay_time as payTime,u.user_name as userName,u.phone
from pay_details s
left join tb_user u on u.user_id=s.user_id
where 1=1
<if test="startTime!=null and startTime!=''and endTime!=null and endTime!='' ">
and str_to_date(s.create_time, '%Y-%m-%d') between str_to_date(#{startTime}, '%Y-%m-%d') AND str_to_date(#{endTime}, '%Y-%m-%d')
</if>
<if test="userId!=null">
and u.user_id=#{userId}
</if>
<if test="state!=null and state!=-1">
and s.state=#{state}
</if>
<if test="state==null or state==-1">
and s.state!=-1
</if>
group by s.id
order by s.create_time desc
</select>
<select id="selectPayDetails" resultType="Map">
select s.id,s.classify,s.order_id as orderId,s.money,s.user_id as userId,s.pay_diamond as payDiamond,s.diamond,
s.state,s.create_time as createTime,s.pay_time as payTime,u.user_name as userName,u.phone
@@ -52,8 +30,7 @@
left join tb_user u on u.user_id=s.user_id
where 1=1
<if test="startTime!=null and startTime!=''and endTime!=null and endTime!='' ">
and str_to_date(s.create_time, '%Y-%m-%d') between str_to_date(#{startTime}, '%Y-%m-%d') AND
str_to_date(#{endTime}, '%Y-%m-%d')
and s.create_time between #{startTime} AND #{endTime}
</if>
<if test="userName!=null and userName!=''">
and u.user_name like concat("%",#{userName},"%")
@@ -77,7 +54,7 @@
<select id="selectSumPay" resultType="Double">
select sum(money) from pay_details
where str_to_date(create_time, '%Y-%m-%d') BETWEEN str_to_date(#{createTime}, '%Y-%m-%d') AND str_to_date(#{endTime}, '%Y-%m-%d')
where create_time BETWEEN #{createTime} AND #{endTime}
<if test="userId!=null">
and user_id=#{userId}
</if>