defence_strong_enemy/target/classes/mapper/MedicalPlaneMapper.xml
2025-07-23 16:29:53 +08:00

102 lines
3.6 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hshh.nation.medical.mapper.MedicalPlaneMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.hshh.nation.medical.entity.MedicalPlane">
<id column="id" property="id"/>
<result column="plane_no" property="planeNo"/>
<result column="plane_name" property="planeName"/>
<result column="plane_model" property="planeModel"/>
<result column="plane_count" property="planeCount"/>
<result column="belong_unit" property="belongUnit"/>
<result column="doctor_count" property="doctorCount"/>
<result column="nurse_count" property="nurseCount"/>
<result column="soldier_count" property="soldierCount"/>
<result column="plane_location" property="planeLocation"/>
<result column="plane_status" property="planeStatus"/>
<result column="flight_speed" property="flightSpeed"/>
<result column="server_time" property="serverTime"/>
<result column="engineer_system" property="engineerSystem"/>
<result column="bed_count" property="bedCount"/>
<result column="transport_ability" property="transportAbility"/>
<result column="secure_ability" property="secureAbility"/>
<result column="jar_meno" property="jarMeno"/>
</resultMap>
<select id="list" resultType="com.hshh.nation.medical.entity.MedicalPlane"
parameterType="com.hshh.nation.medical.entity.MedicalPlane">
SELECT
@rownum := @rownum + 1 AS seq,
t.*
FROM (
SELECT * FROM defence_medical_plane
<where>
<if test="model.planeName != null and model.planeName !=''">
plane_name like concat('%',#{model.planeName},'%')
</if>
</where>
order by id asc ) t, ( SELECT @rownum := #{model.start} ) r limit
#{model.start},#{model.pageSize}
</select>
<select id="list" resultType="com.hshh.nation.medical.entity.MedicalPlane"
parameterType="com.hshh.nation.medical.entity.MedicalPlane" databaseId="dm">
SELECT
t.seq,
t.*
FROM (
SELECT
ROW_NUMBER() OVER (ORDER BY id ASC) AS seq,
a.*
FROM defence_medical_plane a
<where>
<if test="model.planeName != null and model.planeName !=''">
plane_name like '%'||#{model.planeName}||'%'
</if>
</where>)t
WHERE t.seq > #{model.start} AND t.seq &lt;= (#{model.start} + #{model.pageSize})
</select>
<select id="count" resultType="java.lang.Long">
select count(id) from defence_medical_plane
<where>
<if test="model.planeName != null and model.planeName !=''">
plane_name like concat('%',#{model.planeName},'%')
</if>
</where>
</select>
<select id="selectMedicalTransport"
resultType="com.hshh.nation.medical.bean.MedicalTransportResource">
SELECT t1.id,
t1.plane_name AS name,
t1.plane_no AS no,
t1.plane_location AS location,
t1.secure_ability AS ability,
t1.flight_speed AS speed,
t1.payload as payload,
'plane' AS typeCode,
'卫生飞机' as typeName
FROM defence_medical_plane t1
UNION
(SELECT t2.id,
t2.boat_name as name,
t2.boat_no as no,
t2.plane_location as location,
t2.secure_ability as ability,
t2.cruising_speed as speed,
t2.payload as payload,
'boat' as typeCode,
'医院船' as typeName
FROM defence_medical_boat t2)
</select>
</mapper>