system-card/src/main/resources/mybatis/mapper/cardcharge/card-charge-mapper.xml

613 lines
23 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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">
<cache/>
<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"/>
<result column="card_charge_order_out_time" property="cardChargeOrderOutTime"/>
<result column="card_template_id" property="cardTemplateId"/>
<result column="card_charge_role" property="cardChargeRole"/>
<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>
<!-- 查询今日的充值记录-->
<select id="getToDayList" parameterType="map" resultMap="cardChargeDTO" useCache="true">
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_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')
ORDER BY
t1.card_charge_order_time DESC
</select>
<!-- 查询我所有的未付款订单 -->
<select id="getNotPayList" parameterType="map" resultMap="cardChargeDTO" useCache="true">
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>
<!-- 通过微信预支付订单号查询 -->
<select id="getChargeByOrderNumber" parameterType="java.lang.String" resultMap="cardChargeDTO" useCache="true">
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>
<update id="updateOrderStatus" parameterType="map" flushCache="true">
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>
<!-- 查询未核对的缴费单 -->
<select id="listNotCheckOrder" parameterType="map" resultMap="cardChargeDTO" useCache="true">
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>
<!-- 判断我的名片使用权限是否到期-->
<select id="getLastEngTime" parameterType="map" resultMap="cardChargeDTO" useCache="true">
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_user_id = #{cardChargeUserId}
AND DATE_FORMAT( t1.card_charge_end , '%Y-%m-%d %H:%i:%s') > DATE_FORMAT( NOW() , '%Y-%m-%d %H:%i:%s' )
<if test="cardChargeOrderStatus != null and cardChargeOrderStatus != '' ">
AND card_charge_order_status = #{cardChargeOrderStatus}
</if>
ORDER BY
t1.card_charge_end DESC
LIMIT 1
</select>
<!-- 新增CBC名片收费记录表 -->
<insert id="save" parameterType="map" flushCache="true">
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,
card_charge_order_out_time,
card_template_id,
card_charge_role,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{cardChargeId},
#{cardChargePrice},
#{cardChargeEnd},
#{cardChargeMode},
#{cardChargeCompanyId},
#{cardChargeCompanyNumber},
#{cardChargeStatus},
#{cardChargeRemark},
#{cardChargeUserId},
#{cardChargeInvitationUserId},
#{cardChargeOrderNumber},
#{cardChargeOrderStatus},
#{cardChargeOrderTime},
#{cardChargeOrderOutTime},
#{cardTemplateId},
#{cardChargeRole},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除CBC名片收费记录表 -->
<update id="remove" parameterType="map" flushCache="true">
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名片收费记录表物理 -->
<update id="delete" parameterType="map" flushCache="true">
DELETE FROM
e_card_charge
WHERE
card_charge_id IN
<foreach collection="cardChargeIds" index="index" open="(" separator="," close=")">
#{cardChargeIds[${index}]}
</foreach>
</update>
<!-- 修改CBC名片收费记录表 -->
<update id="update" parameterType="map" flushCache="true">
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名片收费记录表详情 -->
<select id="get" parameterType="map" resultMap="cardChargeDTO" useCache="true">
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="cardChargeOrderNumber != null and cardChargeOrderNumber != ''">
AND
t1.card_charge_order_number = #{cardChargeOrderNumber}
</if>
<if test="cardChargeId != null and cardChargeId != ''">
AND
t1.card_charge_id = #{cardChargeId}
</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,
t1.card_charge_order_status,
t1.card_charge_order_time,
t1.card_charge_status,
t1.card_charge_remark,
t1.card_charge_user_id,
t1.card_charge_order_out_time,
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名片收费记录表列表 -->
<select id="list" parameterType="map" resultMap="cardChargeDTO" useCache="true">
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,
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
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="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>
<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>