61 lines
2.1 KiB
XML
61 lines
2.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.aircraft.modules.system.mapper.EmScenicMapper">
|
||
|
||
<select id="findByAreaIdAndName" resultType="com.aircraft.modules.system.domain.EmScenic">
|
||
SELECT id,
|
||
area_id,
|
||
name,
|
||
people_num,
|
||
remark,
|
||
create_by,
|
||
create_time,
|
||
update_by,
|
||
update_time,
|
||
del_flag
|
||
FROM em_scenic
|
||
WHERE area_id = #{areaId}
|
||
AND name = #{name}
|
||
AND del_flag = 0
|
||
</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
|
||
where del_flag = 0
|
||
group by area_id
|
||
</select>
|
||
<select id="getScenicNameMap" resultType="java.util.HashMap">
|
||
SELECT
|
||
id AS "scenicId", -- 更明确的别名
|
||
name AS "scenicName"
|
||
FROM em_scenic
|
||
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>
|
||
</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>
|
||
</select>
|
||
</mapper>
|