2021-08-26 11:20:54 +08:00
<?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= "cn.com.tenlion.systemcard.dao.cardcharge.ICardChargeDao" >
2021-09-16 16:06:33 +08:00
<cache />
2021-08-26 11:20:54 +08:00
<resultMap id= "cardChargeDTO" type= "cn.com.tenlion.systemcard.pojo.dtos.cardcharge.CardChargeDTO" >
<result column= "card_charge_id" property= "cardChargeId" />
<result column= "card_charge_price" property= "cardChargePrice" />
<result column= "card_charge_end" property= "cardChargeEnd" />
<result column= "card_charge_mode" property= "cardChargeMode" />
<result column= "card_charge_company_id" property= "cardChargeCompanyId" />
<result column= "card_charge_company_number" property= "cardChargeCompanyNumber" />
<result column= "card_charge_status" property= "cardChargeStatus" />
<result column= "card_charge_remark" property= "cardChargeRemark" />
<result column= "card_charge_user_id" property= "cardChargeUserId" />
<result column= "card_charge_invitation_user_id" property= "cardChargeInvitationUserId" />
<result column= "user_username" property= "cardChargeUserUsername" />
<result column= "card_charge_order_number" property= "cardChargeOrderNumber" />
<result column= "card_charge_order_status" property= "cardChargeOrderStatus" />
<result column= "card_charge_order_time" property= "cardChargeOrderTime" />
2021-09-02 10:33:27 +08:00
<result column= "card_charge_order_out_time" property= "cardChargeOrderOutTime" />
2021-08-26 11:20:54 +08:00
<result column= "card_template_id" property= "cardTemplateId" />
2021-09-02 10:33:27 +08:00
<result column= "card_charge_role" property= "cardChargeRole" />
2021-08-26 11:20:54 +08:00
<result column= "creator" property= "creator" />
<result column= "gmt_create" property= "gmtCreate" />
<result column= "modifier" property= "modifier" />
<result column= "gmt_modified" property= "gmtModified" />
<result column= "is_delete" property= "isDelete" />
</resultMap>
<resultMap id= "cardChargeBO" type= "cn.com.tenlion.systemcard.pojo.bos.cardcharge.CardChargeBO" >
<result column= "card_charge_id" property= "cardChargeId" />
<result column= "card_charge_price" property= "cardChargePrice" />
<result column= "card_charge_end" property= "cardChargeEnd" />
<result column= "card_charge_mode" property= "cardChargeMode" />
<result column= "card_charge_company_id" property= "cardChargeCompanyId" />
<result column= "card_charge_company_number" property= "cardChargeCompanyNumber" />
<result column= "card_charge_status" property= "cardChargeStatus" />
<result column= "card_charge_remark" property= "cardChargeRemark" />
<result column= "creator" property= "creator" />
<result column= "gmt_create" property= "gmtCreate" />
<result column= "modifier" property= "modifier" />
<result column= "gmt_modified" property= "gmtModified" />
<result column= "is_delete" property= "isDelete" />
</resultMap>
<resultMap id= "cardChargePO" type= "cn.com.tenlion.systemcard.pojo.pos.cardcharge.CardChargePO" >
<result column= "card_charge_id" property= "cardChargeId" />
<result column= "card_charge_price" property= "cardChargePrice" />
<result column= "card_charge_end" property= "cardChargeEnd" />
<result column= "card_charge_mode" property= "cardChargeMode" />
<result column= "card_charge_company_id" property= "cardChargeCompanyId" />
<result column= "card_charge_company_number" property= "cardChargeCompanyNumber" />
<result column= "card_charge_status" property= "cardChargeStatus" />
<result column= "card_charge_remark" property= "cardChargeRemark" />
<result column= "creator" property= "creator" />
<result column= "gmt_create" property= "gmtCreate" />
<result column= "modifier" property= "modifier" />
<result column= "gmt_modified" property= "gmtModified" />
<result column= "is_delete" property= "isDelete" />
</resultMap>
2021-09-08 16:57:56 +08:00
<!-- 查询今日的充值记录 -->
2021-09-16 16:06:33 +08:00
<select id= "getToDayList" parameterType= "map" resultMap= "cardChargeDTO" useCache= "true" >
2021-09-08 16:57:56 +08:00
SELECT
t1.card_charge_price,
t1.card_charge_end,
t1.card_charge_mode,
t1.card_charge_company_id,
t1.card_charge_company_number,
t1.card_charge_status,
t1.card_charge_remark,
t1.card_charge_id,
t1.card_charge_user_id,
t1.card_charge_invitation_user_id,
t1.card_charge_order_number,
t1.card_charge_order_status,
t1.card_charge_order_time,
t1.card_template_id,
t1.card_charge_order_out_time,
t1.card_charge_role
FROM
e_card_charge t1
WHERE
2021-09-09 11:56:42 +08:00
t1.is_delete = 0 AND t1.card_charge_order_status = '2' AND t1.card_charge_order_time != '' AND t1.card_charge_order_time IS NOT NULL
<if test= "queryMode != null and queryMode != '' and queryMode == '本日' " >
AND TO_DAYS(t1.card_charge_order_time) = TO_DAYS(NOW())
</if>
<if test= "queryMode != null and queryMode != '' and queryMode == '本月' " >
AND DATE_FORMAT(t1.card_charge_order_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
</if>
<if test= "queryMode != null and queryMode != '' and queryMode == '本年' " >
AND YEAR(t1.card_charge_order_time) = YEAR(NOW())
</if>
AND (t1.card_charge_mode = '1' OR t1.card_charge_mode = '2' OR t1.card_charge_mode = '3')
2021-09-08 16:57:56 +08:00
ORDER BY
t1.card_charge_order_time DESC
</select>
2021-09-02 10:33:27 +08:00
<!-- 查询我所有的未付款订单 -->
2021-09-16 16:06:33 +08:00
<select id= "getNotPayList" parameterType= "map" resultMap= "cardChargeDTO" useCache= "true" >
2021-09-02 10:33:27 +08:00
SELECT
t1.card_charge_price,
t1.card_charge_end,
t1.card_charge_mode,
t1.card_charge_company_id,
t1.card_charge_company_number,
t1.card_charge_status,
t1.card_charge_remark,
t1.card_charge_id,
t1.card_charge_user_id,
t1.card_charge_invitation_user_id,
t1.card_charge_order_number,
t1.card_charge_order_status,
t1.card_charge_order_time,
t1.card_template_id,
t1.card_charge_order_out_time,
t1.card_charge_role
FROM
e_card_charge t1
WHERE
t1.is_delete = 0
<if test= "userId != null and userId != '' and userId != 'deleteOutTime' " >
AND t1.card_charge_user_id = #{userId}
</if>
<if test= "userId != null and userId != '' and userId == 'deleteOutTime' " >
AND DATE_FORMAT( NOW() , '%Y-%m-%d %H:%i:%s' ) > DATE_FORMAT( t1.card_charge_order_out_time , '%Y-%m-%d %H:%i:%s')
</if>
AND t1.card_charge_order_status = '0'
</select>
<!-- 通过微信预支付订单号查询 -->
2021-09-16 16:06:33 +08:00
<select id= "getChargeByOrderNumber" parameterType= "java.lang.String" resultMap= "cardChargeDTO" useCache= "true" >
2021-09-02 10:33:27 +08:00
SELECT
t1.card_charge_price,
t1.card_charge_end,
t1.card_charge_mode,
t1.card_charge_company_id,
t1.card_charge_company_number,
t1.card_charge_status,
t1.card_charge_remark,
t1.card_charge_id,
t1.card_charge_user_id,
t1.card_charge_invitation_user_id,
t1.card_charge_order_number,
t1.card_charge_order_status,
t1.card_charge_order_time,
t1.card_template_id,
t1.card_charge_order_out_time,
t1.card_charge_role
FROM
e_card_charge t1
WHERE
t1.is_delete = 0 AND t1.card_charge_order_number = #{cardChargeOrderNumber}
</select>
2021-09-16 16:06:33 +08:00
<update id= "updateOrderStatus" parameterType= "map" flushCache= "true" >
2021-09-02 10:33:27 +08:00
UPDATE
e_card_charge
SET
card_charge_order_status = '1',
card_charge_order_time = #{cardChargeOrderTime},
card_charge_order_status = #{cardChargeOrderStatus}
WHERE
is_delete = 0 AND card_charge_id = #{cardChargeId}
</update>
<!-- 查询未核对的缴费单 -->
2021-09-16 16:06:33 +08:00
<select id= "listNotCheckOrder" parameterType= "map" resultMap= "cardChargeDTO" useCache= "true" >
2021-09-02 10:33:27 +08:00
SELECT
t1.card_charge_price,
t1.card_charge_end,
t1.card_charge_mode,
t1.card_charge_company_id,
t1.card_charge_company_number,
t1.card_charge_status,
t1.card_charge_remark,
t1.card_charge_id,
t1.card_charge_user_id,
t1.card_charge_invitation_user_id,
t1.card_charge_order_number,
t1.card_charge_order_status,
t1.card_charge_order_time,
t1.card_template_id,
t1.card_charge_order_out_time,
t1.card_charge_role
FROM
e_card_charge t1
WHERE
t1.is_delete = 0 AND t1.card_charge_order_status != '2' AND t1.card_charge_order_number IS NOT NULL AND t1.card_charge_order_number != '' AND t1.card_charge_order_out_time != ''
AND DATE_FORMAT( t1.card_charge_order_out_time , '%Y-%m-%d %H:%i:%s') > DATE_FORMAT( NOW() , '%Y-%m-%d %H:%i:%s' )
ORDER BY
t1.gmt_create DESC
</select>
2021-08-26 11:20:54 +08:00
<!-- 判断我的名片使用权限是否到期 -->
2021-09-16 16:06:33 +08:00
<select id= "getLastEngTime" parameterType= "map" resultMap= "cardChargeDTO" useCache= "true" >
2021-08-26 11:20:54 +08:00
SELECT
t1.card_charge_price,
t1.card_charge_end,
t1.card_charge_mode,
t1.card_charge_company_id,
t1.card_charge_company_number,
t1.card_charge_status,
t1.card_charge_remark,
t1.card_charge_id,
t1.card_charge_user_id,
t1.card_charge_invitation_user_id,
t1.card_charge_order_number,
2021-09-02 10:33:27 +08:00
t1.card_charge_order_status,
t1.card_charge_order_time,
t1.card_template_id,
t1.card_charge_order_out_time,
t1.card_charge_role
2021-08-26 11:20:54 +08:00
FROM
e_card_charge t1
WHERE
2021-09-02 10:33:27 +08:00
t1.is_delete = 0 AND t1.card_charge_user_id = #{cardChargeUserId}
2021-08-26 11:20:54 +08:00
AND DATE_FORMAT( t1.card_charge_end , '%Y-%m-%d %H:%i:%s') > DATE_FORMAT( NOW() , '%Y-%m-%d %H:%i:%s' )
2021-09-02 10:33:27 +08:00
<if test= "cardChargeOrderStatus != null and cardChargeOrderStatus != '' " >
AND card_charge_order_status = #{cardChargeOrderStatus}
</if>
2021-08-26 11:20:54 +08:00
ORDER BY
t1.card_charge_end DESC
LIMIT 1
</select>
<!-- 新增CBC名片收费记录表 -->
2021-09-16 16:06:33 +08:00
<insert id= "save" parameterType= "map" flushCache= "true" >
2021-08-26 11:20:54 +08:00
INSERT INTO e_card_charge(
card_charge_id,
card_charge_price,
card_charge_end,
card_charge_mode,
card_charge_company_id,
card_charge_company_number,
card_charge_status,
card_charge_remark,
card_charge_user_id,
card_charge_invitation_user_id,
card_charge_order_number,
card_charge_order_status,
card_charge_order_time,
2021-09-02 10:33:27 +08:00
card_charge_order_out_time,
2021-08-26 11:20:54 +08:00
card_template_id,
2021-09-02 10:33:27 +08:00
card_charge_role,
2021-08-26 11:20:54 +08:00
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{cardChargeId},
#{cardChargePrice},
#{cardChargeEnd},
#{cardChargeMode},
#{cardChargeCompanyId},
#{cardChargeCompanyNumber},
#{cardChargeStatus},
#{cardChargeRemark},
#{cardChargeUserId},
#{cardChargeInvitationUserId},
#{cardChargeOrderNumber},
#{cardChargeOrderStatus},
#{cardChargeOrderTime},
2021-09-02 10:33:27 +08:00
#{cardChargeOrderOutTime},
2021-08-26 11:20:54 +08:00
#{cardTemplateId},
2021-09-02 10:33:27 +08:00
#{cardChargeRole},
2021-08-26 11:20:54 +08:00
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除CBC名片收费记录表 -->
2021-09-16 16:06:33 +08:00
<update id= "remove" parameterType= "map" flushCache= "true" >
2021-08-26 11:20:54 +08:00
UPDATE
e_card_charge
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
card_charge_id IN
<foreach collection= "cardChargeIds" index= "index" open= "(" separator= "," close= ")" >
#{cardChargeIds[${index}]}
</foreach>
</update>
<!-- 删除CBC名片收费记录表( 物理) -->
2021-09-16 16:06:33 +08:00
<update id= "delete" parameterType= "map" flushCache= "true" >
2021-08-26 11:20:54 +08:00
DELETE FROM
e_card_charge
WHERE
card_charge_id IN
<foreach collection= "cardChargeIds" index= "index" open= "(" separator= "," close= ")" >
#{cardChargeIds[${index}]}
</foreach>
</update>
<!-- 修改CBC名片收费记录表 -->
2021-09-16 16:06:33 +08:00
<update id= "update" parameterType= "map" flushCache= "true" >
2021-08-26 11:20:54 +08:00
UPDATE
e_card_charge
SET
<if test= "cardChargePrice != null" >
card_charge_price = #{cardChargePrice},
</if>
<if test= "cardChargeEnd != null and cardChargeEnd != ''" >
card_charge_end = #{cardChargeEnd},
</if>
<if test= "cardChargeMode != null and cardChargeMode != ''" >
card_charge_mode = #{cardChargeMode},
</if>
<if test= "cardChargeCompanyId != null and cardChargeCompanyId != ''" >
card_charge_company_id = #{cardChargeCompanyId},
</if>
<if test= "cardChargeCompanyNumber != null" >
card_charge_company_number = #{cardChargeCompanyNumber},
</if>
<if test= "cardChargeStatus != null and cardChargeStatus != ''" >
card_charge_status = #{cardChargeStatus},
</if>
<if test= "cardChargeRemark != null and cardChargeRemark != ''" >
card_charge_remark = #{cardChargeRemark},
</if>
<if test= "cardChargeUserId != null and cardChargeUserId != ''" >
card_charge_user_id = #{cardChargeUserId},
</if>
<if test= "cardChargeInvitationUserId != null and cardChargeInvitationUserId != ''" >
card_charge_invitation_user_id = #{cardChargeInvitationUserId},
</if>
<if test= "cardChargeOrderNumber != null and cardChargeOrderNumber != ''" >
card_charge_order_number = #{cardChargeOrderNumber},
</if>
<if test= "cardTemplateId != null and cardTemplateId != ''" >
card_template_id = #{cardTemplateId},
</if>
gmt_modified = #{gmtModified},
modifier = #{modifier},
card_charge_id = card_charge_id
WHERE
card_charge_id = #{cardChargeId}
</update>
<!-- CBC名片收费记录表详情 -->
2021-09-16 16:06:33 +08:00
<select id= "get" parameterType= "map" resultMap= "cardChargeDTO" useCache= "true" >
2021-08-26 11:20:54 +08:00
SELECT
t1.card_charge_price,
t1.card_charge_end,
t1.card_charge_mode,
t1.card_charge_company_id,
t1.card_charge_company_number,
t1.card_charge_status,
t1.card_charge_remark,
t1.card_charge_id,
t1.card_charge_user_id,
t1.card_charge_invitation_user_id,
t1.card_charge_order_number,
t1.card_charge_order_status,
t1.card_charge_order_time,
2021-09-02 10:33:27 +08:00
t1.card_template_id,
t1.card_charge_order_out_time,
t1.card_charge_role
2021-08-26 11:20:54 +08:00
FROM
e_card_charge t1
WHERE
t1.is_delete = 0
2021-09-02 10:33:27 +08:00
<if test= "cardChargeOrderNumber != null and cardChargeOrderNumber != ''" >
AND
t1.card_charge_order_number = #{cardChargeOrderNumber}
</if>
2021-08-26 11:20:54 +08:00
<if test= "cardChargeId != null and cardChargeId != ''" >
2021-09-02 10:33:27 +08:00
AND
t1.card_charge_id = #{cardChargeId}
2021-08-26 11:20:54 +08:00
</if>
</select>
<!-- CBC名片收费记录表详情 -->
<select id= "getBO" parameterType= "map" resultMap= "cardChargeBO" >
SELECT
t1.card_charge_id,
t1.card_charge_price,
t1.card_charge_end,
t1.card_charge_mode,
t1.card_charge_company_id,
t1.card_charge_company_number,
2021-09-02 10:33:27 +08:00
t1.card_charge_order_status,
t1.card_charge_order_time,
2021-08-26 11:20:54 +08:00
t1.card_charge_status,
t1.card_charge_remark,
t1.card_charge_user_id,
2021-09-02 10:33:27 +08:00
t1.card_charge_order_out_time,
2021-08-26 11:20:54 +08:00
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
e_card_charge t1
WHERE
t1.is_delete = 0
<if test= "cardChargeId != null and cardChargeId != ''" >
AND
t1.card_charge_id = #{cardChargeId}
</if>
</select>
<!-- CBC名片收费记录表详情 -->
<select id= "getPO" parameterType= "map" resultMap= "cardChargePO" >
SELECT
t1.card_charge_id,
t1.card_charge_price,
t1.card_charge_end,
t1.card_charge_mode,
t1.card_charge_company_id,
t1.card_charge_company_number,
t1.card_charge_status,
t1.card_charge_remark,
t1.card_charge_user_id,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
e_card_charge t1
WHERE
t1.is_delete = 0
<if test= "cardChargeId != null and cardChargeId != ''" >
AND
t1.card_charge_id = #{cardChargeId}
</if>
</select>
<!-- CBC名片收费记录表列表 -->
2021-09-16 16:06:33 +08:00
<select id= "list" parameterType= "map" resultMap= "cardChargeDTO" useCache= "true" >
2021-08-26 11:20:54 +08:00
SELECT
t1.card_charge_id,
t1.card_charge_price,
t1.card_charge_end,
t1.card_charge_mode,
t1.card_charge_company_id,
t1.card_charge_company_number,
t1.card_charge_status,
t1.card_charge_remark,
t1.card_charge_user_id,
t2.user_username,
t1.card_charge_invitation_user_id,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete,
t1.card_charge_order_number,
2021-09-02 10:33:27 +08:00
t1.card_charge_order_status,
t1.card_charge_order_time,
t1.card_template_id,
t1.card_charge_order_out_time,
t1.card_charge_role
2021-08-26 11:20:54 +08:00
FROM
e_card_charge t1
LEFT JOIN
sys_user t2
ON
t1.card_charge_user_id = t2.user_id
WHERE
t1.is_delete = 0
<if test= "keywords != null and keywords != ''" >
AND (
<!-- 这里添加其他条件 -->
t2.user_username LIKE CONCAT('%', #{keywords}, '%')
OR
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
2021-09-02 10:33:27 +08:00
<if test= "userId != null and userId != ''" >
AND t1.creator = #{userId}
</if>
<if test= "cardChargeUserId != null and cardChargeUserId != ''" >
AND t1.card_charge_user_id = #{cardChargeUserId}
</if>
<if test= "cardChargeMode != null and cardChargeMode != ''" >
AND t1.card_charge_mode = #{cardChargeMode}
</if>
2021-08-26 11:20:54 +08:00
<if test= "startTime != null and startTime != ''" >
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test= "endTime != null and endTime != ''" >
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test= "cardChargeIds != null and cardChargeIds.size > 0" >
AND
t1.card_charge_id IN
<foreach collection= "cardChargeIds" index= "index" open= "(" separator= "," close= ")" >
#{cardChargeIds[${index}]}
</foreach>
</if>
ORDER BY t1.gmt_create DESC
</select>
<!-- CBC名片收费记录表列表 -->
<select id= "listBO" parameterType= "map" resultMap= "cardChargeBO" >
SELECT
t1.card_charge_id,
t1.card_charge_price,
t1.card_charge_end,
t1.card_charge_mode,
t1.card_charge_company_id,
t1.card_charge_company_number,
t1.card_charge_status,
t1.card_charge_remark,
t1.card_charge_user_id,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete,
t1.card_template_id
FROM
e_card_charge t1
WHERE
t1.is_delete = 0
<if test= "keywords != null and keywords != ''" >
AND (
<!-- 这里添加其他条件 -->
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test= "startTime != null and startTime != ''" >
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test= "endTime != null and endTime != ''" >
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test= "cardChargeIds != null and cardChargeIds.size > 0" >
AND
t1.card_charge_id IN
<foreach collection= "cardChargeIds" index= "index" open= "(" separator= "," close= ")" >
#{cardChargeIds[${index}]}
</foreach>
</if>
</select>
<!-- CBC名片收费记录表列表 -->
<select id= "listPO" parameterType= "map" resultMap= "cardChargePO" >
SELECT
t1.card_charge_id,
t1.card_charge_price,
t1.card_charge_end,
t1.card_charge_mode,
t1.card_charge_company_id,
t1.card_charge_company_number,
t1.card_charge_status,
t1.card_charge_remark,
t1.card_charge_user_id,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete,
t1.card_template_id
FROM
e_card_charge t1,
LEFT JOIN
sys_user t2
ON
t1.card_charge_user_id = t2.user_id
WHERE
t1.is_delete = 0
<if test= "keywords != null and keywords != ''" >
AND (
<!-- 这里添加其他条件 -->
t2.user_username LIKE CONCAT('%', #{keywords}, '%')
OR
t1.id LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test= "startTime != null and startTime != ''" >
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test= "endTime != null and endTime != ''" >
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test= "cardChargeIds != null and cardChargeIds.size > 0" >
AND
t1.card_charge_id IN
<foreach collection= "cardChargeIds" index= "index" open= "(" separator= "," close= ")" >
#{cardChargeIds[${index}]}
</foreach>
</if>
</select>
<!-- CBC名片收费记录表统计 -->
<select id= "count" parameterType= "map" resultType= "Integer" >
SELECT
COUNT(*)
FROM
e_card_charge t1
WHERE
t1.is_delete = 0
</select>
</mapper>