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

82 lines
3.1 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.FuelArmyMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.hshh.nation.fuel.entity.FuelArmy">
<id column="id" property="id"/>
<result column="army_name" property="armyName"/>
<result column="unit_amount" property="unitAmount"/>
<result column="team_equip_count" property="teamEquipCount"/>
<result column="team_store_count" property="teamStoreCount"/>
<result column="parent_id" property="parentId"/>
<result column="express_hour" property="expressHour"/>
<result column="take_back_hour" property="takeBackHour"/>
<result column="team_location" property="teamLocation"/>
<result column="store_amount" property="storeAmount"/>
<result column="driving_avg_speed" property="drivingAvgSpeed"/>
<result column="driving_max_speed" property="drivingMaxSpeed"/>
<result column="store_up_limit" property="storeUpLimit"/>
<result column="load_up_limit" property="loadUpLimit"/>
<result column="army_memo" property="armyMemo"/>
</resultMap>
<select id="list" resultType="com.hshh.nation.fuel.entity.FuelArmy"
parameterType="com.hshh.nation.fuel.entity.FuelArmy">
SELECT
@rownum := @rownum + 1 AS seq,
t.*
FROM (
SELECT * FROM defence_fuel_army
<where>
<if test="model.armyName != null and model.armyName!=''">
army_name like concat('%',#{model.armyName},'%')
</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.FuelArmy"
parameterType="com.hshh.nation.fuel.entity.FuelArmy" databaseId="dm">
SELECT
t.seq,
t.*
FROM (
SELECT
ROW_NUMBER() OVER (ORDER BY id ASC) AS seq,
a.*
FROM defence_fuel_army a
<where>
<if test="model.armyName != null and model.armyName!=''">
army_name like '%'||#{model.armyName}||'%'
</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_army
<where>
<if test="model.armyName != null and model.armyName!=''">
army_name like concat('%',#{model.armyName},'%')
</if>
</where>
</select>
<select id="selectOrganizeResource" resultType="com.hshh.nation.fuel.bean.OrganizeResource">
SELECT t1.id,
'army' as code,
t1.army_name AS organizeName,
t1.team_location AS location
FROM defence_fuel_army t1
UNION
(SELECT t2.id, 'base' as code, t2.base_name AS organizeName, t2.base_coordinate AS location
FROM defence_fuel_base_strong t2)
</select>
</mapper>