修改查询顺序

This commit is contained in:
aoli.qu 2023-10-25 15:15:17 +08:00
parent 6cbb40b1dd
commit 295327fcd7
1 changed files with 16 additions and 16 deletions

View File

@ -220,21 +220,7 @@ public interface DataMapper extends BaseMapper<BcPersonSupport> {
// 房源入住情况 // 房源入住情况
@Select("select '房间' as name, " + @Select("select '床位' as name, " +
" (select count(1) " +
" from bc_room " +
" where is_delete = 0 " +
" and room_type = 1) as value, " +
" (select count(distinct a.id) " +
" from bc_room a " +
" left join bc_hospital_record b on a.id = b.room_id " +
" where a.is_delete = 0 " +
" and b.is_delete = 0 " +
" and b.check_out_time is null) as value2 " +
"union " +
"select '床位' as name, " +
" (select count(1) " + " (select count(1) " +
" from bc_room_bed a " + " from bc_room_bed a " +
" left join bc_room b on a.room_id = b.id " + " left join bc_room b on a.room_id = b.id " +
@ -246,6 +232,20 @@ public interface DataMapper extends BaseMapper<BcPersonSupport> {
" left join bc_hospital_record b on a.id = b.bed_id " + " left join bc_hospital_record b on a.id = b.bed_id " +
" where a.is_delete = 0 " + " where a.is_delete = 0 " +
" and b.is_delete = 0 " + " and b.is_delete = 0 " +
" and b.check_out_time is null) as value2 " +
"union " +
"select '房间' as name, " +
" (select count(1) " +
" from bc_room " +
" where is_delete = 0 " +
" and room_type = 1) as value, " +
" (select count(distinct a.id) " +
" from bc_room a " +
" left join bc_hospital_record b on a.id = b.room_id " +
" where a.is_delete = 0 " +
" and b.is_delete = 0 " +
" and b.check_out_time is null) as value2 ") " and b.check_out_time is null) as value2 ")
List<DataStatisticsItem> listRoomCount(); List<DataStatisticsItem> listRoomCount();