update会员计费模板

This commit is contained in:
2024-02-02 17:01:07 +08:00
parent d90498520d
commit 04705ed0bf
11 changed files with 243 additions and 12 deletions

View File

@@ -199,7 +199,7 @@
and t1.merchant_id = #{merchantId,jdbcType=VARCHAR}
</select>
<select id="queryMemberDiscountV2" resultType="com.jsowell.pile.vo.web.MemberDiscountVO">
<select id="queryByGroupCodeAndMemberId" resultType="com.jsowell.pile.vo.web.MemberGroupVO">
SELECT
t1.group_code AS groupCode,
t1.group_type AS groupType,
@@ -214,4 +214,17 @@
and t1.group_code = #{groupCode,jdbcType=VARCHAR}
and t2.member_id = #{memberId,jdbcType=VARCHAR}
</select>
<select id="queryMemberGroupCode" resultType="java.lang.String">
SELECT
t1.group_code AS groupCode
FROM
member_group t1
JOIN member_group_relation t2 ON t2.group_code = t1.group_code AND t2.del_flag = '0'
WHERE
t1.del_flag = '0'
and t2.member_id = #{memberId,jdbcType=VARCHAR}
and t1.merchant_id = #{merchantId,jdbcType=VARCHAR}
and find_in_set(#{stationId,jdbcType=VARCHAR}, t1.station_id)
</select>
</mapper>

View File

@@ -505,8 +505,8 @@
left JOIN pile_billing_detail t4 ON t4.template_code = t2.template_code AND t4.time_type = '2'
left JOIN pile_billing_detail t5 ON t5.template_code = t2.template_code AND t5.time_type = '3'
left JOIN pile_billing_detail t6 ON t6.template_code = t2.template_code AND t6.time_type = '4'
WHERE
t2.station_id = #{stationId,jdbcType=VARCHAR}
WHERE t2.del_flag = '0'
and t2.station_id = #{stationId,jdbcType=VARCHAR}
order by t2.publish_time DESC
limit 1
</select>
@@ -596,4 +596,35 @@
set status = #{status,jdbcType=VARCHAR}
where id = #{templateId,jdbcType=VARCHAR}
</update>
<select id="queryPreferentialBillingTemplate" resultType="com.jsowell.pile.vo.web.BillingTemplateVO">
SELECT
t2.id as templateId,
t2.template_code AS templateCode,
t2.`name` AS templateName,
t3.electricity_price AS sharpElectricityPrice,
t3.service_price AS sharpServicePrice,
t3.apply_time AS sharpApplyDate,
t4.electricity_price AS peakElectricityPrice,
t4.service_price AS peakServicePrice,
t4.apply_time AS peakApplyDate,
t5.electricity_price AS flatElectricityPrice,
t5.service_price AS flatServicePrice,
t5.apply_time AS flatApplyDate,
t6.electricity_price AS valleyElectricityPrice,
t6.service_price AS valleyServicePrice,
t6.apply_time AS valleyApplyDate
FROM
pile_billing_template t2
left JOIN pile_billing_detail t3 ON t3.template_code = t2.template_code AND t3.time_type = '1'
left JOIN pile_billing_detail t4 ON t4.template_code = t2.template_code AND t4.time_type = '2'
left JOIN pile_billing_detail t5 ON t5.template_code = t2.template_code AND t5.time_type = '3'
left JOIN pile_billing_detail t6 ON t6.template_code = t2.template_code AND t6.time_type = '4'
WHERE t2.del_flag = '0'
and t2.station_id = #{stationId,jdbcType=VARCHAR}
and t2.public_flag = '0'
and t2.member_flag = '1'
order by t2.update_time DESC, t2.create_time DESC
limit 1
</select>
</mapper>