aircraft-server/aircraft-system/src/main/resources/mapper/EmScenicMapper.xml

61 lines
2.1 KiB
XML
Raw Normal View History

2025-07-11 19:51:30 +08:00
<?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.aircraft.modules.system.mapper.EmScenicMapper">
<select id="findByAreaIdAndName" resultType="com.aircraft.modules.system.domain.EmScenic">
SELECT id,
area_id,
name,
people_num,
remark,
2025-07-16 10:55:15 +08:00
create_by,
2025-07-11 19:51:30 +08:00
create_time,
2025-07-16 10:55:15 +08:00
update_by,
2025-07-11 19:51:30 +08:00
update_time,
2025-07-16 10:55:15 +08:00
del_flag
2025-07-11 19:51:30 +08:00
FROM em_scenic
2025-07-18 09:35:38 +08:00
WHERE area_id = #{areaId}
2025-07-11 19:51:30 +08:00
AND name = #{name}
2025-07-16 10:55:15 +08:00
AND del_flag = 0
2025-07-11 19:51:30 +08:00
</select>
<select id="countByAreaId" parameterType="com.aircraft.modules.system.domain.vo.AreaNumStatisVo"
resultType="com.aircraft.modules.system.domain.vo.AreaNumStatisVo">
select area_id, count(id) as scenicNum
from em_scenic
2025-07-16 10:55:15 +08:00
where del_flag = 0
2025-07-11 19:51:30 +08:00
group by area_id
</select>
2025-07-15 12:48:55 +08:00
<select id="getScenicNameMap" resultType="java.util.HashMap">
SELECT
id AS "scenicId", -- 更明确的别名
name AS "scenicName"
2025-07-15 12:48:55 +08:00
FROM em_scenic
2025-07-16 22:35:44 +08:00
WHERE del_flag = 0
<!-- 确保参数正确传递并且当scenicIds为空时的处理逻辑 -->
<if test="scenicIds != null">
<if test="scenicIds.size() > 0">
AND id IN
<foreach collection="scenicIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="scenicIds.size() == 0">
<!-- 当传入空列表时,确保不返回任何结果 -->
AND 1 = 0
</if>
2025-07-16 22:35:44 +08:00
</if>
<if test="scenicIds == null">
AND 1 = 0
</if>
</select>
<select id="listByIds" resultType="com.aircraft.modules.system.domain.EmScenic">
SELECT * FROM em_scenic
WHERE id IN
<foreach collection="list" item="id" open="(" separator="," close=")">
#{id}
</foreach>
2025-07-15 12:48:55 +08:00
</select>
2025-07-11 19:51:30 +08:00
</mapper>