Commit dabef013 authored by zhengjiawei's avatar zhengjiawei

bug

parent 0465b044
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.FireStationMapper"> <mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.FireStationMapper">
<select id="queryOne" resultType="java.util.Map"> <select id="queryOne" resultType="java.util.Map">
SELECT SELECT
fs.id, fs.id,
fs.name, fs.name,
fs.code, fs.code,
fs.type, fs.type,
fs.address, fs.address,
fs.floor3d, fs.floor3d,
fs.position3d, fs.position3d,
fs.is_indoor AS isIndoor, fs.is_indoor AS isIndoor,
fs.picture, fs.picture,
fs.risk_source_id as riskSourceId fs.risk_source_id as riskSourceId
FROM FROM
f_fire_station fs f_fire_station fs
WHERE WHERE
fs.id = ${id} fs.id = ${id}
</select> </select>
<select id="queryCountForFireEqumntPage" resultType="long"> <select id="queryCountForFireEqumntPage" resultType="long">
SELECT SELECT
count(1) count(1)
FROM FROM
f_fire_station_equipment fs f_fire_station_equipment fs
JOIN f_fire_equipment f ON fs.fire_equipment_id = f.id JOIN f_fire_equipment f ON fs.fire_equipment_id = f.id
WHERE WHERE
fs.fire_station_id = ${fireStationId} fs.fire_station_id = ${fireStationId}
</select> </select>
<select id="queryForFireEqumntPage" resultType="java.util.Map"> <select id="queryForFireEqumntPage" resultType="java.util.Map">
SELECT SELECT
fs.fire_station_id, fs.fire_station_id,
fs.number numberInStation, fs.number numberInStation,
fs.unit unitInStation, fs.unit unitInStation,
f.*, f.*,
frs.name riskSourceName frs.name riskSourceName
FROM FROM
f_fire_station_equipment fs f_fire_station_equipment fs
left join f_fire_equipment f ON fs.fire_equipment_id = f.id left join f_fire_equipment f ON fs.fire_equipment_id = f.id
left join f_risk_source frs on frs.id = f.risk_source_id left join f_risk_source frs on frs.id = f.risk_source_id
WHERE WHERE
fs.fire_station_id = ${fireStationId} fs.fire_station_id = ${fireStationId}
and f.id is not null and f.id is not null
LIMIT ${start}, ${length}; LIMIT ${start}, ${length};
</select> </select>
<select id="queryCountForPage" resultType="long"> <select id="queryCountForPage" resultType="long">
SELECT SELECT
COUNT(1) COUNT(1)
FROM FROM
f_fire_station fs f_fire_station fs
WHERE WHERE
1=1 1=1
<if test="name!=null"> <if test="name!=null">
AND (fs.name LIKE '%${name}%' or fs.`code` LIKE '%${name}%') AND (fs.name LIKE '%${name}%' or fs.`code` LIKE '%${name}%')
</if> </if>
<if test="code!=null"> <if test="code!=null">
AND fs.`code` LIKE '%${code}%' AND fs.`code` LIKE '%${code}%'
</if> </if>
<if test="type!=null"> <if test="type!=null">
AND fs.`type` LIKE '%${type}%'; AND fs.`type` LIKE '%${type}%';
</if> </if>
</select> </select>
<select id="queryForPage" resultType="java.util.Map"> <select id="queryForPage" resultType="java.util.Map">
SELECT SELECT
fs.id, fs.id,
fs.name, fs.name,
fs.code, fs.code,
fs.type, fs.type,
fs.address, fs.address,
fs.floor3d, fs.floor3d,
fs.position3d, fs.position3d,
fs.is_indoor as isIndoor, fs.is_indoor as isIndoor,
frs.name riskSourceName frs.name riskSourceName
FROM FROM
f_fire_station fs f_fire_station fs
left join f_risk_source frs on frs.id = fs.risk_source_id left join f_risk_source frs on frs.id = fs.risk_source_id
WHERE WHERE
1=1 1=1
<if test="name!=null"> <if test="name!=null">
AND (fs.name LIKE '%${name}%' or fs.`code` LIKE '%${name}%') AND (fs.name LIKE '%${name}%' or fs.`code` LIKE '%${name}%')
</if> </if>
<if test="code!=null"> <if test="code!=null">
AND fs.`code` LIKE '%${code}%' AND fs.`code` LIKE '%${code}%'
</if> </if>
<if test="type!=null"> <if test="type!=null">
AND fs.`type` LIKE '%${type}%' AND fs.`type` LIKE '%${type}%'
</if> </if>
LIMIT ${start},${length} ; LIMIT ${start},${length} ;
</select> </select>
<select id="queryForList" resultType="java.util.Map"> <select id="queryForList" resultType="java.util.Map">
select
bu.id,
SELECT bu .name,
* '1' as type
FROM from
f_fire_station fs wl_building as bu
WHERE left join wl_equipment_category as cat on bu.equipment_code = cat.id
1=1 where substr(cat.code ,1,4) = '9301'
<if test="name!=null">
<if test="name!=null"> AND fs.name LIKE '%${name}%'
AND fs.name LIKE '%${name}%' </if>
</if> <if test="code!=null">
<if test="code!=null"> AND fs.`code` LIKE '%${code}%'
AND fs.`code` LIKE '%${code}%' </if>
</if>
<if test="type!=null">
<if test="type!=null"> AND fs.`type` LIKE '%${type}%';
AND fs.`type` LIKE '%${type}%'; </if>
</if>
</select>
</select>
<select id="queryEquipCountById" resultType="java.util.Map">
<select id="queryEquipCountById" resultType="java.util.Map">
SELECT
SELECT fe.`name`,
fe.`name`, SUM(fse.number) count,
SUM(fse.number) count, fe.unit
fe.unit FROM
FROM `f_fire_station_equipment` fse
`f_fire_station_equipment` fse LEFT JOIN f_fire_equipment fe ON fe.id = fse.fire_equipment_id
LEFT JOIN f_fire_equipment fe ON fe.id = fse.fire_equipment_id WHERE
WHERE fire_station_id = #{id}
fire_station_id = #{id} GROUP BY
GROUP BY fe.`name`,fe.unit
fe.`name`,fe.unit </select>
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment