btyjj-inspection/src/main/resources/mybatis/mapper/publicareareport/publicareareport-mapper.xml
2020-04-29 19:27:55 +08:00

167 lines
5.6 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.cm.inspection.dao.publicareareport.IPublicAreaReportDao">
<resultMap id="publicAreaReportDTO" type="com.cm.inspection.pojo.dtos.publicareareport.PublicAreaReportDTO">
<id column="public_area_report_id" property="publicAreaReportId"/>
<result column="check_address" property="checkAddress"/>
<result column="check_date" property="checkDate"/>
<result column="check_content" property="checkContent"/>
<result column="check_photos" property="checkPhotos"/>
<result column="check_type" property="checkType"/>
<result column="check_lng" property="checkLng"/>
<result column="check_lat" property="checkLat"/>
<result column="check_user_name" property="checkUserName"/>
</resultMap>
<!-- 新增公共区域上报 -->
<insert id="savePublicAreaReport" parameterType="map">
INSERT INTO gen_public_area_report(
public_area_report_id,
check_address,
check_date,
check_content,
check_photos,
check_type,
check_lng,
check_lat,
check_user_name,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{publicAreaReportId},
#{checkAddress},
#{checkDate},
#{checkContent},
#{checkPhotos},
#{checkType},
#{checkLng},
#{checkLat},
#{checkUserName},
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除公共区域上报 -->
<update id="removePublicAreaReport" parameterType="map">
UPDATE
gen_public_area_report
SET
is_delete = 1,
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
public_area_report_id IN
<foreach collection="publicAreaReportIds" index="index" open="(" separator="," close=")">
#{publicAreaReportIds[${index}]}
</foreach>
</update>
<!-- 修改公共区域上报 -->
<update id="updatePublicAreaReport" parameterType="map">
UPDATE
gen_public_area_report
SET
<if test="checkAddress != null and checkAddress != ''">
check_address = #{checkAddress},
</if>
<if test="checkDate != null and checkDate != ''">
check_date = #{checkDate},
</if>
<if test="checkContent != null and checkContent != ''">
check_content = #{checkContent},
</if>
<if test="checkPhotos != null and checkPhotos != ''">
check_photos = #{checkPhotos},
</if>
<if test="checkType != null">
check_type = #{checkType},
</if>
<if test="checkLng != null and checkLng != ''">
check_lng = #{checkLng},
</if>
<if test="checkLat != null and checkLat != ''">
check_lat = #{checkLat},
</if>
<if test="checkUserName != null and checkUserName != ''">
check_user_name = #{checkUserName},
</if>
modifier = #{modifier},
gmt_modified = #{gmtModified}
WHERE
public_area_report_id = #{publicAreaReportId}
</update>
<!-- 公共区域上报详情 -->
<select id="getPublicAreaReport" parameterType="map" resultMap="publicAreaReportDTO">
SELECT
t1.check_address,
t1.check_date,
t1.check_content,
t1.check_photos,
t1.check_type,
t1.check_lng,
t1.check_lat,
t1.public_area_report_id
FROM
gen_public_area_report t1
WHERE
t1.is_delete = 0
<if test="publicAreaReportId != null and publicAreaReportId != ''">
AND
t1.public_area_report_id = #{publicAreaReportId}
</if>
</select>
<!-- 公共区域上报列表 -->
<select id="listPublicAreaReport" parameterType="map" resultMap="publicAreaReportDTO">
SELECT
t1.check_address,
t1.check_date,
t1.check_content,
t1.check_photos,
t1.check_type,
t1.check_lng,
t1.check_lat,
t1.check_user_name,
t1.public_area_report_id
FROM
gen_public_area_report t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
t1.check_address LIKE CONCAT('%', #{keywords}, '%')
OR
t1.check_content LIKE CONCAT('%', #{keywords}, '%')
)
</if>
<if test="startTime != null and startTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
</if>
<if test="publicAreaReportIds != null and publicAreaReportIds.size > 0">
AND
t1.public_area_report_id IN
<foreach collection="publicAreaReportIds" index="index" open="(" separator="," close=")">
#{publicAreaReportIds[${index}]}
</foreach>
</if>
<if test="creator != null and creator != ''">
AND
t1.creator = #{creator}
</if>
</select>
</mapper>