<?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.yeejoin.amos.fas.business.dao.mapper.WaterResourceMapper">


<!--	<select id="queryOne" resultType="java.util.Map">-->

<!--		select -->
<!--		fs.id,-->
<!--		fs.name,-->
<!--		fs.code,-->
<!--		fs.type,-->
<!--		fs.production_area AS productionArea,-->
<!--		fs.floor3d,-->
<!--		fs.room,-->
<!--		fs.address,-->
<!--		fs.position3d,-->
<!--		fs.area,-->
<!--		fs.max_level  maxLevel,-->
<!--		fs.alarm_level alarmLevel,-->
<!--		fs.is_indoor as isIndoor,-->
<!--        fs.org_code AS orgCode,-->
<!--        fs.risk_source_id as riskSourceId-->
<!--		from f_water_resource fs  where fs.id = ${id}-->
<!--	</select>-->

<!--	<select id="queryCountForPage" resultType="long">-->

<!--		SELECT-->
<!--		COUNT(1)-->
<!--		FROM-->
<!--		f_water_resource fs-->
<!--		WHERE-->
<!--		fs.org_code = #{orgCode}-->
<!--		<if test="name!=null">-->
<!--			AND (fs.name LIKE '%${name}%' or fs.`code` LIKE '%${name}%')-->
<!--		</if>-->
<!--		<if test="code!=null">-->
<!--			AND fs.`code` LIKE '%${code}%'-->
<!--		</if>-->
<!--		<if test="type!=null">-->
<!--			AND fs.`type` LIKE '%${type}%'-->
<!--		</if>-->
<!--	</select>-->
<!--	<select id="queryForPage" resultType="java.util.Map">-->
<!--		SELECT-->
<!--		fs.id,-->
<!--		fs.name,-->
<!--		fs.code,-->
<!--		fs.type,-->
<!--		fs.production_area AS productionArea,-->
<!--		fs.floor3d,-->
<!--		fs.room,-->
<!--		fs.address,-->
<!--		fs.position3d,-->
<!--		fs.area,-->
<!--		fs.max_level maxLevel,-->
<!--		fs.alarm_level alarmLevel,-->
<!--		fs.is_indoor as isIndoor,-->
<!--		frs.name riskSourceName-->
<!--		FROM-->
<!--		f_water_resource fs-->
<!--		left join f_risk_source frs on frs.id = fs.risk_source_id-->
<!--		WHERE-->
<!--		fs.org_code = #{orgCode}-->
<!--		<if test="name!=null">-->
<!--			AND (fs.name LIKE '%${name}%' or fs.`code` LIKE '%${name}%')-->
<!--		</if>-->
<!--		<if test="code!=null">-->
<!--			AND fs.`code` LIKE '%${code}%'-->
<!--		</if>-->
<!--		<if test="type!=null">-->
<!--			AND fs.`type` LIKE '%${type}%'-->
<!--		</if>-->
<!--		LIMIT ${start},${length} ;-->

<!--	</select>-->

<!--	<select id="queryCountForBindFireEqumntPage" resultType="long">-->
<!--		SELECT-->
<!--				count(1)-->
<!--			FROM-->
<!--				f_water_resource_equipment fs-->
<!--			JOIN f_fire_equipment f ON fs.fire_equipment_id = f.id-->
<!--			WHERE-->
<!--				fs.water_resource_id = ${waterResourceId}-->
<!--	</select>-->
<!--	<select id="queryForBindFireEqumntPage" resultType="java.util.Map">-->
<!--			SELECT-->
<!--				fs.water_resource_id,-->
<!--				fs.number numberInStation,-->
<!--				fs.unit unitInStation,-->
<!--				f.*,-->
<!--				frs.name riskSourceName-->
<!--			FROM-->
<!--				f_water_resource_equipment fs-->
<!--			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-->
<!--			WHERE-->
<!--				fs.water_resource_id = ${waterResourceId}-->
<!--				and f.id is not null-->
<!--			LIMIT ${start}, ${length};-->
<!--	</select>-->

<!--	<select id="listByCodes" resultType="com.yeejoin.amos.fas.dao.entity.WaterResource">-->
<!--		select-->
<!--		id,-->
<!--		code,-->
<!--		name-->
<!--		from-->
<!--		f_water_resource-->
<!--		where-->
<!--		code in-->
<!--		<foreach collection="codes" item="item" index="index" open="(" separator="," close=")">-->
<!--			#{item}-->
<!--		</foreach>-->
<!--	</select>-->

<!--	<insert id="saveBatch" keyColumn="id" keyProperty="id"-->
<!--			parameterType="com.yeejoin.amos.fas.business.param.WaterResourceParam"-->
<!--			useGeneratedKeys="true">-->
<!--		insert into f_water_resource-->
<!--		(-->
<!--		`name`,-->
<!--		`code`,-->
<!--		`type`,-->
<!--		`floor3d`,-->
<!--		`room`,-->
<!--		`address`,-->
<!--		`position3d`,-->
<!--		`org_code`,-->
<!--		`is_indoor`,-->
<!--		`risk_source_id`-->
<!--		)-->
<!--		values-->
<!--		<foreach collection="list" item="item" index="index" separator=",">-->
<!--			(-->
<!--			#{item.name},-->
<!--			#{item.code},-->
<!--			#{item.type},-->
<!--			#{item.floor3d},-->
<!--			#{item.room},-->
<!--			#{item.address},-->
<!--			#{item.position3d},-->
<!--			#{item.orgCode},-->
<!--			#{item.isIndoor},-->
<!--			#{item.riskSourceId}-->
<!--			)-->
<!--		</foreach>-->
<!--	</insert>-->

<!--	<update id="updateBatch">-->
<!--		<foreach collection="list" item="item" index="index" separator=";">-->
<!--			update f_water_resource-->
<!--			<set>-->
<!--				<if test="item.orgCode != null">-->
<!--					org_code = #{item.orgCode},-->
<!--				</if>-->
<!--				<if test="item.code != null">-->
<!--					code = #{item.code},-->
<!--				</if>-->
<!--				<if test="item.type != null">-->
<!--					type = #{item.type},-->
<!--				</if>-->
<!--				<if test="item.position3d != null">-->
<!--					position3d = #{item.position3d},-->
<!--				</if>-->
<!--				<if test="item.floor3d != null">-->
<!--					floor3d = #{item.floor3d},-->
<!--				</if>-->
<!--				<if test="item.isIndoor != null">-->
<!--					is_indoor = #{item.isIndoor},-->
<!--				</if>-->
<!--				<if test="item.name != null">-->
<!--					name = #{item.name},-->
<!--				</if>-->
<!--				<if test="item.room != null">-->
<!--					room = #{item.room},-->
<!--				</if>-->
<!--				<if test="item.address != null">-->
<!--					address = #{item.address},-->
<!--				</if>-->
<!--				<if test="item.riskSourceId != null">-->
<!--					risk_source_id = #{item.riskSourceId},-->
<!--				</if>-->
<!--			</set>-->
<!--			where id = #{item.id}-->
<!--		</foreach>-->
<!--	</update>-->
</mapper>