解决查询正在执行的服务指令不正确问题
This commit is contained in:
parent
bd598c81b5
commit
e305181bda
|
|
@ -33,6 +33,8 @@ public interface DirectiveOrderMapper extends BaseMapper<DirectiveOrder> {
|
||||||
|
|
||||||
int queryTodayFinishedTotal(@Param("type") String type, @Param("nuId") String nuId, @Param("elderId") String elderId);
|
int queryTodayFinishedTotal(@Param("type") String type, @Param("nuId") String nuId, @Param("elderId") String elderId);
|
||||||
|
|
||||||
List<DirectiveOrderEntity> queryOrderByTimeType(@Param("dto") CareDirectiveEntity dto);
|
List<DirectiveOrderEntity> queryHistory(@Param("dto") CareDirectiveEntity dto);
|
||||||
|
|
||||||
|
List<DirectiveOrderEntity> queryCurrent(@Param("dto") CareDirectiveEntity dto);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -259,71 +259,155 @@
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryOrderByTimeType" resultMap="DirectiveOrderMap">
|
|
||||||
SELECT
|
<sql id="baseSelect">
|
||||||
o.id, o.order_no, o.order_type, o.opt_type, o.pool_id, o.biz_id, o.biz_type,
|
SELECT o.id,
|
||||||
o.nu_id, o.nu_name, o.elder_id, o.elder_name, o.employee_id, o.employee_name,
|
o.order_no,
|
||||||
o.directive_id, o.directive_name, o.cycle_type_id, o.cycle_type, o.cycle_value,
|
o.order_type,
|
||||||
o.preview_file, o.net_preview_file, o.preview_file_small, o.net_preview_file_small,
|
o.opt_type,
|
||||||
o.mp3_file, o.net_mp3_file, o.mp4_file, o.net_mp4_file, o.service_duration,
|
o.pool_id,
|
||||||
o.service_content, o.package_id, o.package_name, o.iz_package, o.toll_price,
|
o.biz_id,
|
||||||
o.com_price, o.real_com_price, o.start_time, o.end_time, o.begin_emp, o.begin_time,
|
o.biz_type,
|
||||||
o.finish_emp, o.finish_time, o.iz_start, o.iz_finish, o.initiator_id, o.initiator_name,
|
o.nu_id,
|
||||||
o.create_emp, o.create_time, o.update_emp, o.update_time, o.del_flag, o.remarks,
|
o.nu_name,
|
||||||
s.id as sub_id, s.order_type as sub_order_type, s.main_id as sub_main_id,
|
o.elder_id,
|
||||||
s.pool_sub_id as sub_pool_sub_id, s.nu_id as sub_nu_id, s.nu_name as sub_nu_name,
|
o.elder_name,
|
||||||
s.elder_id as sub_elder_id, s.elder_name as sub_elder_name, s.employee_id as sub_employee_id,
|
o.employee_id,
|
||||||
s.employee_name as sub_employee_name, s.instruction_tag_id as sub_instruction_tag_id,
|
o.employee_name,
|
||||||
s.instruction_tag_name as sub_instruction_tag_name, s.category_id as sub_category_id,
|
o.directive_id,
|
||||||
s.category_name as sub_category_name, s.type_id as sub_type_id, s.type_name as sub_type_name,
|
o.directive_name,
|
||||||
s.directive_id as sub_directive_id, s.directive_name as sub_directive_name,
|
o.cycle_type_id,
|
||||||
s.cycle_type_id as sub_cycle_type_id, s.cycle_type as sub_cycle_type,
|
o.cycle_type,
|
||||||
s.cycle_value as sub_cycle_value, s.preview_file as sub_preview_file,
|
o.cycle_value,
|
||||||
s.net_preview_file as sub_net_preview_file, s.preview_file_small as sub_preview_file_small,
|
o.preview_file,
|
||||||
s.net_preview_file_small as sub_net_preview_file_small, s.mp3_file as sub_mp3_file,
|
o.net_preview_file,
|
||||||
s.net_mp3_file as sub_net_mp3_file, s.mp4_file as sub_mp4_file, s.net_mp4_file as sub_net_mp4_file,
|
o.preview_file_small,
|
||||||
s.service_duration as sub_service_duration, s.service_content as sub_service_content,
|
o.net_preview_file_small,
|
||||||
s.toll_price as sub_toll_price, s.com_price as sub_com_price, s.real_com_price as sub_real_com_price,
|
o.mp3_file,
|
||||||
s.package_id as sub_package_id, s.package_name as sub_package_name, s.iz_package as sub_iz_package,
|
o.net_mp3_file,
|
||||||
s.start_time as sub_start_time, s.end_time as sub_end_time, s.begin_time as sub_begin_time,
|
o.mp4_file,
|
||||||
s.finish_time as sub_finish_time, s.iz_start as sub_iz_start, s.iz_finish as sub_iz_finish,
|
o.net_mp4_file,
|
||||||
s.create_by as sub_create_by, s.create_time as sub_create_time, s.update_by as sub_update_by,
|
o.service_duration,
|
||||||
s.update_time as sub_update_time, s.del_flag as sub_del_flag, s.tplink_path as sub_tplink_path,
|
o.service_content,
|
||||||
s.manually_pic_path as sub_manually_pic_path, s.manually_mp4_path as sub_manually_mp4_path
|
o.package_id,
|
||||||
|
o.package_name,
|
||||||
|
o.iz_package,
|
||||||
|
o.toll_price,
|
||||||
|
o.com_price,
|
||||||
|
o.real_com_price,
|
||||||
|
o.start_time,
|
||||||
|
o.end_time,
|
||||||
|
o.begin_emp,
|
||||||
|
o.begin_time,
|
||||||
|
o.finish_emp,
|
||||||
|
o.finish_time,
|
||||||
|
o.iz_start,
|
||||||
|
o.iz_finish,
|
||||||
|
o.initiator_id,
|
||||||
|
o.initiator_name,
|
||||||
|
o.create_emp,
|
||||||
|
o.create_time,
|
||||||
|
o.update_emp,
|
||||||
|
o.update_time,
|
||||||
|
o.del_flag,
|
||||||
|
o.remarks,
|
||||||
|
s.id as sub_id,
|
||||||
|
s.order_type as sub_order_type,
|
||||||
|
s.main_id as sub_main_id,
|
||||||
|
s.pool_sub_id as sub_pool_sub_id,
|
||||||
|
s.nu_id as sub_nu_id,
|
||||||
|
s.nu_name as sub_nu_name,
|
||||||
|
s.elder_id as sub_elder_id,
|
||||||
|
s.elder_name as sub_elder_name,
|
||||||
|
s.employee_id as sub_employee_id,
|
||||||
|
s.employee_name as sub_employee_name,
|
||||||
|
s.instruction_tag_id as sub_instruction_tag_id,
|
||||||
|
s.instruction_tag_name as sub_instruction_tag_name,
|
||||||
|
s.category_id as sub_category_id,
|
||||||
|
s.category_name as sub_category_name,
|
||||||
|
s.type_id as sub_type_id,
|
||||||
|
s.type_name as sub_type_name,
|
||||||
|
s.directive_id as sub_directive_id,
|
||||||
|
s.directive_name as sub_directive_name,
|
||||||
|
s.cycle_type_id as sub_cycle_type_id,
|
||||||
|
s.cycle_type as sub_cycle_type,
|
||||||
|
s.cycle_value as sub_cycle_value,
|
||||||
|
s.preview_file as sub_preview_file,
|
||||||
|
s.net_preview_file as sub_net_preview_file,
|
||||||
|
s.preview_file_small as sub_preview_file_small,
|
||||||
|
s.net_preview_file_small as sub_net_preview_file_small,
|
||||||
|
s.mp3_file as sub_mp3_file,
|
||||||
|
s.net_mp3_file as sub_net_mp3_file,
|
||||||
|
s.mp4_file as sub_mp4_file,
|
||||||
|
s.net_mp4_file as sub_net_mp4_file,
|
||||||
|
s.service_duration as sub_service_duration,
|
||||||
|
s.service_content as sub_service_content,
|
||||||
|
s.toll_price as sub_toll_price,
|
||||||
|
s.com_price as sub_com_price,
|
||||||
|
s.real_com_price as sub_real_com_price,
|
||||||
|
s.package_id as sub_package_id,
|
||||||
|
s.package_name as sub_package_name,
|
||||||
|
s.iz_package as sub_iz_package,
|
||||||
|
s.start_time as sub_start_time,
|
||||||
|
s.end_time as sub_end_time,
|
||||||
|
s.begin_time as sub_begin_time,
|
||||||
|
s.finish_time as sub_finish_time,
|
||||||
|
s.iz_start as sub_iz_start,
|
||||||
|
s.iz_finish as sub_iz_finish,
|
||||||
|
s.create_by as sub_create_by,
|
||||||
|
s.create_time as sub_create_time,
|
||||||
|
s.update_by as sub_update_by,
|
||||||
|
s.update_time as sub_update_time,
|
||||||
|
s.del_flag as sub_del_flag,
|
||||||
|
s.tplink_path as sub_tplink_path,
|
||||||
|
s.manually_pic_path as sub_manually_pic_path,
|
||||||
|
s.manually_mp4_path as sub_manually_mp4_path
|
||||||
FROM nu_biz_nu_directive_order o
|
FROM nu_biz_nu_directive_order o
|
||||||
LEFT JOIN nu_biz_nu_directive_order_sub s ON o.id = s.main_id
|
LEFT JOIN nu_biz_nu_directive_order_sub s ON o.id = s.main_id
|
||||||
WHERE o.order_type = '1'
|
WHERE o.order_type = '1'
|
||||||
<if test="dto.orderTimeType != null and dto.orderTimeType != ''">
|
</sql>
|
||||||
<if test="dto.orderTimeType == 'history'">
|
|
||||||
<choose>
|
<sql id="commonConditions">
|
||||||
<when test="@cn.hutool.core.date.DateUtil@isSameDay(dto.queryDate, new java.util.Date())">
|
|
||||||
<![CDATA[
|
|
||||||
AND (
|
|
||||||
(DATE(o.start_time) = DATE(#{dto.queryDate}) AND o.end_time < NOW())
|
|
||||||
OR
|
|
||||||
(DATE(o.start_time) = DATE(#{dto.queryDate}) AND o.start_time < NOW() AND o.iz_finish = 'Y')
|
|
||||||
)
|
|
||||||
]]>
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
<![CDATA[
|
|
||||||
AND DATE(o.start_time) = DATE(#{dto.queryDate})
|
|
||||||
]]>
|
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
</if>
|
|
||||||
<if test="dto.orderTimeType == 'current'">
|
|
||||||
<![CDATA[
|
|
||||||
AND (DATE(o.start_time) = DATE(#{dto.queryDate}) AND o.start_time <= #{dto.queryDate} AND #{dto.queryDate} <= o.end_time AND o.iz_finish = 'N')
|
|
||||||
]]>
|
|
||||||
</if>
|
|
||||||
</if>
|
|
||||||
<if test="dto.nuId != null and dto.nuId != ''">
|
<if test="dto.nuId != null and dto.nuId != ''">
|
||||||
AND o.nu_id = #{dto.nuId}
|
AND o.nu_id = #{dto.nuId}
|
||||||
</if>
|
</if>
|
||||||
<if test="dto.elderId != null and dto.elderId != ''">
|
<if test="dto.elderId != null and dto.elderId != ''">
|
||||||
AND o.elder_id = #{dto.elderId}
|
AND o.elder_id = #{dto.elderId}
|
||||||
</if>
|
</if>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="queryHistory" resultMap="DirectiveOrderMap">
|
||||||
|
<include refid="baseSelect"/>
|
||||||
|
|
||||||
|
<choose>
|
||||||
|
<when test="@cn.hutool.core.date.DateUtil@isSameDay(dto.queryDate, new java.util.Date())">
|
||||||
|
<![CDATA[
|
||||||
|
AND (
|
||||||
|
(DATE(o.start_time) = DATE(#{dto.queryDate}) AND o.end_time < NOW())
|
||||||
|
OR
|
||||||
|
(DATE(o.start_time) = DATE(#{dto.queryDate}) AND o.start_time < NOW() AND o.iz_finish = 'Y')
|
||||||
|
)
|
||||||
|
]]>
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
<![CDATA[
|
||||||
|
AND DATE(o.start_time) = DATE(#{dto.queryDate})
|
||||||
|
]]>
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
|
||||||
|
<include refid="commonConditions"/>
|
||||||
|
ORDER BY o.start_time, s.start_time
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="queryCurrent" resultMap="DirectiveOrderMap">
|
||||||
|
<include refid="baseSelect"/>
|
||||||
|
|
||||||
|
<![CDATA[
|
||||||
|
AND (DATE(o.start_time) = DATE(now()) AND o.start_time <= now() AND now() <= o.end_time AND o.iz_finish = 'N')
|
||||||
|
]]>
|
||||||
|
|
||||||
|
<include refid="commonConditions"/>
|
||||||
ORDER BY o.start_time, s.start_time
|
ORDER BY o.start_time, s.start_time
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -180,14 +180,12 @@ public class DirectiveOrderPadServiceImpl extends ServiceImpl<DirectiveOrderMapp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DirectiveOrderEntity> queryHistory(CareDirectiveEntity dto) {
|
public List<DirectiveOrderEntity> queryHistory(CareDirectiveEntity dto) {
|
||||||
dto.setOrderTimeType("history");
|
return baseMapper.queryHistory(dto);
|
||||||
return baseMapper.queryOrderByTimeType(dto);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DirectiveOrderEntity> queryCurrent(CareDirectiveEntity dto) {
|
public List<DirectiveOrderEntity> queryCurrent(CareDirectiveEntity dto) {
|
||||||
dto.setOrderTimeType("current");
|
return baseMapper.queryCurrent(dto);
|
||||||
return baseMapper.queryOrderByTimeType(dto);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue