xml中接收结果:
1.封装实体类
package org.skyviewpacs.model.pojo.localMaster;
public class QueueCountVo {
private int resCount;//登记人数
private int queueCount;//排队人数
private String room;//房间名
public int getResCount() {
return resCount;
}
public void setResCount(int resCount) {
this.resCount = resCount;
}
public int getQueueCount() {
return queueCount;
}
public void setQueueCount(int queueCount) {
this.queueCount = queueCount;
}
public String getRoom() {
return room;
}
public void setRoom(String room) {
this.room = room;
}
}
- 添加如下配置
<resultMap id="QueueCountVo" type="org.skyviewpacs.model.pojo.localMaster.QueueCountVo">
<id property="resCount" column="resCount" /> //为实体类中属性
<id property="queueCount" column="queueCount" />
<id property="room" column="room" />
</resultMap>
3.结果集接收:(1)resultMap=“QueueCountVo”
(2) RI_RoomName as room, COUNT(DISTINCT R_Number) as resCount
<select id="getResCount" resultMap="QueueCountVo">
select RI_RoomName as room, COUNT(DISTINCT R_Number) as resCount from VUSAllFlat
where R_SPSSD >= #{start} and R_SPSSD <= #{end} and R_Delete_Flag=0 and R_Arrival_State=1 and R_Modality=#{modality}
<if test="rNoonType !=null and rNoonType !=''">
and R_Noon_Type in (${rNoonType} )
</if>
<if test="riRoomname !=null and riRoomname !=''">
and RI_RoomName in (${riRoomname} )
</if>
GROUP BY RI_RoomName
</select>