<?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.stylefeng.guns.modular.system.dao.TTaxiCardPaymentMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TTaxiCardPayment">
|
<id column="id" property="id" />
|
<result column="userId" property="userId" />
|
<result column="taxiCardId" property="taxiCardId" />
|
<result column="payType" property="payType" />
|
<result column="payStatus" property="payStatus" />
|
<result column="payTime" property="payTime" />
|
<result column="payMoney" property="payMoney" />
|
<result column="orderNo" property="orderNo" />
|
<result column="createTime" property="createTime" />
|
<result column="type" property="type" />
|
<result column="companyCityId" property="companyCityId" />
|
<result column="content" property="content" />
|
<result column="companyId" property="companyId" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, userId, taxiCardId, payType, payStatus, payTime, payMoney, orderNo, createTime, type, companyCityId, content, companyId
|
</sql>
|
<select id="getList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
|
select
|
p.id,
|
p.createTime,
|
u.nickName,
|
u.phone,
|
c.name cardName,
|
p.payMoney,p.payType,
|
CASE WHEN p.type=1 THEN '打折次数卡' WHEN
|
p.type=1 THEN '优惠卡' WHEN
|
p.type=1 THEN '次数卡' WHEN
|
p.type=1 THEN '打折天数卡' WHEN
|
p.type=1 THEN '物流打折卡' ELSE '物流优惠包' END typeName
|
from t_taxi_card_payment p
|
left join t_user u
|
on p.userId = u.id
|
left join t_taxi_card c
|
on p.taxiCardId = c.id
|
<where>
|
1=1 and p.payStatus=2 and p.companyId=#{companyId}
|
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
|
AND (p.createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
|
</if>
|
<if test="userId != null and userId != ''">
|
and find_in_set(p.userId, #{userId})
|
</if>
|
<if test="type != null and type != ''">
|
and p.type=#{type}
|
</if>
|
<if test="phone != null and phone != ''">
|
and u.phone LIKE CONCAT('%',#{phone},'%')
|
</if>
|
<if test="name != null and name != ''">
|
and u.nickName LIKE CONCAT('%',#{name},'%')
|
</if>
|
<if test="id != null and id != ''">
|
and p.id LIKE CONCAT('%',#{id},'%')
|
</if>
|
<if test="cardName != null and cardName != ''">
|
and c.name LIKE CONCAT('%',#{cardName},'%')
|
</if>
|
</where>
|
ORDER BY p.createTime DESC
|
</select>
|
<select id="getListEx" resultType="map">
|
select
|
p.id,
|
p.createTime,
|
u.nickName,
|
u.phone,
|
c.name cardName,
|
p.payMoney,p.payType,
|
CASE WHEN p.type=1 THEN '打折次数卡' WHEN
|
p.type=1 THEN '优惠卡' WHEN
|
p.type=1 THEN '次数卡' WHEN
|
p.type=1 THEN '打折天数卡' WHEN
|
p.type=1 THEN '物流打折卡' ELSE '物流优惠包' END typeName
|
from t_taxi_card_payment p
|
left join t_user u
|
on p.userId = u.id
|
left join t_taxi_card c
|
on p.taxiCardId = c.id
|
<where>
|
1=1 and p.payStatus=2 and p.companyId=#{companyId}
|
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
|
AND (p.createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
|
</if>
|
<if test="userId != null and userId != ''">
|
and find_in_set(p.userId, #{userId})
|
</if>
|
<if test="type != null and type != ''">
|
and p.type=#{type}
|
</if>
|
<if test="phone != null and phone != ''">
|
and u.phone LIKE CONCAT('%',#{phone},'%')
|
</if>
|
<if test="name != null and name != ''">
|
and u.nickName LIKE CONCAT('%',#{name},'%')
|
</if>
|
<if test="id != null and id != ''">
|
and p.id LIKE CONCAT('%',#{id},'%')
|
</if>
|
<if test="cardName != null and cardName != ''">
|
and c.name LIKE CONCAT('%',#{cardName},'%')
|
</if>
|
</where>
|
</select>
|
<select id="getSumMoney" resultType="java.lang.Double">
|
SELECT SUM(payMoney) FROM t_taxi_card_payment p
|
left join t_user u
|
on p.userId = u.id
|
left join t_taxi_card c
|
on p.taxiCardId = c.id
|
<where>
|
1=1 and p.payStatus=2 and p.companyId=#{companyId}
|
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
|
AND (p.createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
|
</if>
|
<if test="userId != null and userId != ''">
|
and find_in_set(p.userId, #{userId})
|
</if>
|
<if test="type != null and type != ''">
|
and p.type=#{type}
|
</if>
|
<if test="phone != null and phone != ''">
|
and u.phone LIKE CONCAT('%',#{phone},'%')
|
</if>
|
<if test="name != null and name != ''">
|
and u.nickName LIKE CONCAT('%',#{name},'%')
|
</if>
|
<if test="id != null and id != ''">
|
and p.id LIKE CONCAT('%',#{id},'%')
|
</if>
|
<if test="cardName != null and cardName != ''">
|
and c.name LIKE CONCAT('%',#{cardName},'%')
|
</if>
|
</where>
|
</select>
|
</mapper>
|