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

98 lines
4.2 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.fuel.mapper.FuelTruckMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.hshh.nation.fuel.entity.FuelTruck">
<id column="id" property="id"/>
<result column="truck_img" property="truckImg"/>
<result column="belong_organize_id" property="belongOrganizeId"/>
<result column="truck_cab_seat" property="truckCabSeat"/>
<result column="truck_model_name" property="truckModelName"/>
<result column="truck_weight" property="truckWeight"/>
<result column="truck_fuel_jar" property="truckFuelJar"/>
<result column="truck_fuel_box" property="truckFuelBox"/>
<result column="truck_odometer" property="truckOdometer"/>
<result column="truck_length" property="truckLength"/>
<result column="truck_width" property="truckWidth"/>
<result column="truck_height" property="truckHeight"/>
<result column="truck_max_speed" property="truckMaxSpeed"/>
<result column="truck_status" property="truckStatus"/>
<result column="truck_store_type" property="truckStoreType"/>
<result column="truck_ability" property="truckAbility"/>
<result column="truck_drive" property="truckDrive"/>
<result column="truck_memo" property="truckMemo"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id
, truck_img, belong_organize_id, truck_cab_seat, truck_model_name, truck_weight, truck_fuel_jar, truck_fuel_box, truck_odometer, truck_length, truck_width, truck_height, truck_max_speed, truck_status, truck_store_type, truck_ability, truck_drive, truck_memo
</sql>
<select id="list" resultType="com.hshh.nation.fuel.entity.FuelTruck"
parameterType="com.hshh.nation.fuel.entity.FuelTruck">
SELECT
@rownum := @rownum + 1 AS seq,
t.*
FROM (
SELECT * FROM defence_fuel_truck
<where>
<if test="model.truckModelName != null">
truck_model_name = #{model.truckModelName}
</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.fuel.entity.FuelTruck"
parameterType="com.hshh.nation.fuel.entity.FuelTruck" databaseId="dm">
SELECT
t.seq,
t.*
FROM (
SELECT
ROW_NUMBER() OVER (ORDER BY id ASC) AS seq,
a.*
FROM defence_fuel_truck a
<where>
<if test="model.truckModelName != null">
truck_model_name like '%'||#{model.truckModelName}||'%'
</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_fuel_truck
<where>
<if test="model.truckModelName != null">
truck_model_name = #{model.truckModelName}
</if>
</where>
</select>
<select id="selectAllResource" resultType="com.hshh.nation.fuel.bean.EquipResource">
SELECT
t1.id,
t1.truck_no as eNo,
t1.truck_fuel_box as capacity,
t1.truck_ability as fillingSpeed,
t1.current_capacity as currentCapacity,
t1.truck_max_speed as speed,
t1.truck_model_name as equipName,
3 as resourceType
FROM
defence_fuel_truck t1 UNION
( select t2.id,t2.boat_no as eNo,t2.boat_load_ability as capacity,t2.boat_filing_speed as fillingSpeed,t2.current_capacity as currentCapacity,t2.boat_max_speed as speed,t2.boat_name as equipName, 4 as resourceType from defence_fuel_boat t2 ) UNION
(select t3.id,t3.plane_no as eNo,t3.plane_load_fuel as capacity,t3.plane_fuel_speed as fillingSpeed,t3.current_capacity as currentCapacity,t3.plane_max_speed as speed, t3.plane_name as equipName, 5 as resourceType from defence_fuel_plane t3 )
</select>
</mapper>