服务指令-缩减无用冗余字段

This commit is contained in:
曹磊 2026-01-16 15:15:53 +08:00
parent c5efcf1b70
commit 31e2879715
1 changed files with 34 additions and 58 deletions

View File

@ -4,45 +4,23 @@
<select id="queryPlanList" resultType="com.nu.modules.biz.datapool.entity.DirectiveDataPool">
select
id as bizId,
nu_id as nuId,
nu_name as nuName,
elder_id as elderId,
elder_name as elderName,
(case when iz_package = 'Y' then '' else directive_id end) as directiveId,
(case when iz_package = 'Y' then '' else directive_name end) as directiveName,
(case when iz_package = 'Y' then directive_id else '' end) as packageId,
(case when iz_package = 'Y' then directive_name else '' end) as packageName,
iz_package as izPackage,
CONCAT(CURDATE(), ' ',STR_TO_DATE(start_time, '%H:%i')) as startTime,
CONCAT(CURDATE(), ' ',STR_TO_DATE(end_time, '%H:%i')) as endTime,
cycle_type_id as cycleTypeId,
cycle_type as cycleType,
cycle_value as cycleValue,
preview_file as previewFile,
net_preview_file as netPreviewFile,
preview_file_small as previewFileSmall,
net_preview_file_small as netPreviewFileSmall,
mp3_file as mp3File,
net_mp3_file as netMp3File,
mp4_file as mp4File,
net_mp4_file as netMp4File,
service_duration as serviceDuration,
service_content as serviceContent
from nu_biz_nu_care_directive_plan
a.id as bizId,
a.nu_id as nuId,
a.directive_id as directiveId,
a.iz_package as izPackage,
CONCAT(CURDATE(), ' ',STR_TO_DATE(a.start_time, '%H:%i')) as startTime,
a.cycle_type_id as cycleTypeId,
a.cycle_value as cycleValue,
a.opt_time as optTime,
a.opt_count as optCount
from nu_biz_nu_care_directive_plan a
<where>
<if test="nuId != null and nuId != ''">
AND nu_id = #{nuId}
</if>
<if test="elderId != null and elderId != ''">
AND elder_id = #{elderId}
</if>
<if test="directiveId != null and directiveId != ''">
AND directive_id = #{directiveId}
</if>
<if test="packageId != null and packageId != ''">
AND package_id = #{packageId}
</if>
<if test="startTime != null">
AND CONCAT(CURDATE(), ' ',STR_TO_DATE(start_time, '%H:%i')) >= #{startTime}
</if>
@ -54,33 +32,31 @@
<select id="queryPlanById" resultType="com.nu.modules.biz.datapool.entity.DirectiveDataPool">
select
id as bizId,
nu_id as nuId,
nu_name as nuName,
elder_id as elderId,
elder_name as elderName,
(case when iz_package = 'Y' then '' else directive_id end) as directiveId,
(case when iz_package = 'Y' then '' else directive_name end) as directiveName,
(case when iz_package = 'Y' then directive_id else '' end) as packageId,
(case when iz_package = 'Y' then directive_name else '' end) as packageName,
iz_package as izPackage,
CONCAT(CURDATE(), ' ',STR_TO_DATE(start_time, '%H:%i')) as startTime,
CONCAT(CURDATE(), ' ',STR_TO_DATE(end_time, '%H:%i')) as endTime,
cycle_type_id as cycleTypeId,
cycle_type as cycleType,
cycle_value as cycleValue,
preview_file as previewFile,
net_preview_file as netPreviewFile,
preview_file_small as previewFileSmall,
net_preview_file_small as netPreviewFileSmall,
mp3_file as mp3File,
net_mp3_file as netMp3File,
mp4_file as mp4File,
net_mp4_file as netMp4File,
service_duration as serviceDuration,
service_content as serviceContent
from nu_biz_nu_care_directive_plan
a.id as bizId,
a.nu_id as nuId,
a.directive_id as directiveId,
a.iz_package as izPackage,
CONCAT(CURDATE(), ' ',STR_TO_DATE(a.start_time, '%H:%i')) as startTime,
a.cycle_type_id as cycleTypeId,
a.cycle_value as cycleValue,
a.opt_time as optTime,
a.opt_count as optCount
from nu_biz_nu_care_directive_plan a
where id = #{id}
</select>
<select id="getOrderOptCount" resultType="int">
select count(*)
from nu_biz_nu_directive_order
where nu_id = #{nuId}
and elder_id = #{elderId}
and start_time >= #{optTime}
<if test="directiveId != null and directiveId != ''">
AND directive_id = #{directiveId}
</if>
<if test="packageId != null and packageId != ''">
AND package_id = #{packageId}
</if>
</select>
</mapper>