金币系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.8 KiB

<?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.example.demo.mapperPay.PayMapper">
<select id="getPay" resultType="com.example.demo.domain.dou.Pay">
SELECT gps.`name` as payStyle,go.jwcode,mi.name,mi.deptName,mi.shopName,go.type,go.order_no,go.price,go.count,gps.`name`,go.success_time from g_order as go
LEFT JOIN member_info as mi on go.jwcode = mi.jwcode
LEFT JOIN g_pay_style gps on go.pay_style=gps.id
<where>
<if test="jwcode != null">
and go.jwcode = #{jwcode}
</if>
<if test="orderNo != null and orderNo.length > 0">
and go.order_no = #{orderNo}
</if>
<if test="type != null and type.length > 0">
and go.type = #{type}
</if>
<if test="payStyle != null and payStyle.length > 0">
and gps.`name` = #{payStyle}
</if>
<if test="deptName !=null and deptName.length > 0">
and mi.deptName = #{deptName}
</if>
<if test="startTime != null and endTime != null">
and FROM_UNIXTIME(go.success_time) BETWEEN #{startTime} AND #{endTime}
</if>
</where>
<choose>
<when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
ORDER BY ${sortField} ${sortOrder}
</when>
</choose>
</select>
<select id="getPayIp" resultType="java.lang.String">
SELECT DISTINCT deptName FROM member_info
</select>
<select id="getStyle" resultType="java.lang.String">
SELECT DISTINCT `name` FROM g_pay_style
</select>
<select id="getRechargeTotal" resultType="com.example.demo.domain.dou.RechargeTotal">
SELECT
sum(price) as priceTotal,
sum(count) as countTotal
FROM g_order as go
LEFT JOIN g_pay_style gps on go.pay_style=gps.id
<where>
<if test="jwcode != null">
and go.jwcode = #{jwcode}
</if>
<if test="orderNo != null and orderNo.length > 0">
and go.order_no = #{orderNo}
</if>
<if test="type != null and type.length > 0">
and go.type = #{type}
</if>
<if test="payStyle != null and payStyle.length > 0">
and gps.`name` = #{payStyle}
</if>
<if test="deptName !=null and deptName.length > 0">
and mi.deptName = #{deptName}
</if>
<if test="startTime != null and endTime != null">
and FROM_UNIXTIME(go.success_time) BETWEEN #{startTime} AND #{endTime}
</if>
</where>
</select>
</mapper>