<?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.zehong.system.mapper.THiddenDangerStandingBookMapper"> <resultMap type="THiddenDangerStandingBook" id="THiddenDangerStandingBookResult"> <result property="hiddenId" column="hidden_id" /> <result property="hiddenTitle" column="hidden_title" /> <result property="hiddenContent" column="hidden_content" /> <result property="hiddenLocation" column="hidden_location" /> <result property="longitude" column="longitude" /> <result property="latitude" column="latitude" /> <result property="hiddenType" column="hidden_type" /> <result property="hiddenFindPeople" column="hidden_find_people" /> <result property="hiddenFindDate" column="hidden_find_date" /> <result property="dealPlan" column="deal_plan" /> <result property="dealPlanUrl" column="deal_plan_url" /> <result property="remediation" column="remediation" /> <result property="createBy" column="create_by" /> <result property="createTime" column="create_time" /> <result property="updateBy" column="update_by" /> <result property="updateTime" column="update_time" /> <result property="isDel" column="is_del" /> <result property="remarks" column="remarks" /> </resultMap> <sql id="selectTHiddenDangerStandingBookVo"> select hidden_id, hidden_title, hidden_content, hidden_location, longitude, latitude, hidden_type, hidden_find_people, hidden_find_date, deal_plan, deal_plan_url, remediation, create_by, create_time, update_by, update_time, is_del, remarks from t_hidden_danger_standing_book </sql> <select id="selectTHiddenDangerStandingBookList" parameterType="THiddenDangerStandingBookForm" resultMap="THiddenDangerStandingBookResult"> <include refid="selectTHiddenDangerStandingBookVo"/> <where> is_del = '0' <if test="hiddenTitle != null and hiddenTitle != ''"> and hidden_title like concat('%', #{hiddenTitle}, '%')</if> <if test="hiddenType != null and hiddenType != ''"> and hidden_type = #{hiddenType}</if> <if test="remediation != null and remediation != ''"> and remediation = #{remediation}</if> <if test="hiddenFindDateStart != null "> and hidden_find_date >= #{hiddenFindDateStart}</if> <if test="hiddenFindDateEnd != null "> and hidden_find_date <= #{hiddenFindDateEnd}</if> </where> order by create_time desc </select> <select id="selectTHiddenDangerStandingBookStatistic" resultType="THiddenDangerStandingBookVo"> select COUNT(t.hidden_id) AS hiddenTotal, SUM(CASE t.hidden_type WHEN '1' THEN 1 ELSE 0 END) AS oneLevelTotal, SUM(CASE t.hidden_type WHEN '2' THEN 1 ELSE 0 END) AS twoLevelTotal, SUM(CASE t.hidden_type WHEN '3' THEN 1 ELSE 0 END) AS threeLevelTotal, SUM(CASE t.remediation WHEN '1' THEN 1 ELSE 0 END) AS completedTotal, SUM(CASE t.remediation WHEN '2' THEN 1 ELSE 0 END) AS incompleteTotal from (select * from t_hidden_danger_standing_book where is_del = '0') t </select> <select id="selectTHiddenDangerStandingBookById" parameterType="Long" resultMap="THiddenDangerStandingBookResult"> <include refid="selectTHiddenDangerStandingBookVo"/> where hidden_id = #{hiddenId} </select> <insert id="insertTHiddenDangerStandingBook" parameterType="THiddenDangerStandingBook" useGeneratedKeys="true" keyProperty="hiddenId"> insert into t_hidden_danger_standing_book <trim prefix="(" suffix=")" suffixOverrides=","> <if test="hiddenTitle != null">hidden_title,</if> <if test="hiddenContent != null">hidden_content,</if> <if test="hiddenLocation != null">hidden_location,</if> <if test="longitude != null">longitude,</if> <if test="latitude != null">latitude,</if> <if test="hiddenType != null">hidden_type,</if> <if test="hiddenFindPeople != null">hidden_find_people,</if> <if test="hiddenFindDate != null">hidden_find_date,</if> <if test="dealPlan != null">deal_plan,</if> <if test="dealPlanUrl != null">deal_plan_url,</if> <if test="remediation != null">remediation,</if> <if test="createBy != null">create_by,</if> <if test="createTime != null">create_time,</if> <if test="updateBy != null">update_by,</if> <if test="updateTime != null">update_time,</if> <if test="isDel != null">is_del,</if> <if test="remarks != null">remarks,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="hiddenTitle != null">#{hiddenTitle},</if> <if test="hiddenContent != null">#{hiddenContent},</if> <if test="hiddenLocation != null">#{hiddenLocation},</if> <if test="longitude != null">#{longitude},</if> <if test="latitude != null">#{latitude},</if> <if test="hiddenType != null">#{hiddenType},</if> <if test="hiddenFindPeople != null">#{hiddenFindPeople},</if> <if test="hiddenFindDate != null">#{hiddenFindDate},</if> <if test="dealPlan != null">#{dealPlan},</if> <if test="dealPlanUrl != null">#{dealPlanUrl},</if> <if test="remediation != null">#{remediation},</if> <if test="createBy != null">#{createBy},</if> <if test="createTime != null">#{createTime},</if> <if test="updateBy != null">#{updateBy},</if> <if test="updateTime != null">#{updateTime},</if> <if test="isDel != null">#{isDel},</if> <if test="remarks != null">#{remarks},</if> </trim> </insert> <update id="updateTHiddenDangerStandingBook" parameterType="THiddenDangerStandingBook"> update t_hidden_danger_standing_book <trim prefix="SET" suffixOverrides=","> <if test="hiddenTitle != null">hidden_title = #{hiddenTitle},</if> <if test="hiddenContent != null">hidden_content = #{hiddenContent},</if> <if test="hiddenLocation != null">hidden_location = #{hiddenLocation},</if> <if test="longitude != null">longitude = #{longitude},</if> <if test="latitude != null">latitude = #{latitude},</if> <if test="hiddenType != null">hidden_type = #{hiddenType},</if> <if test="hiddenFindPeople != null">hidden_find_people = #{hiddenFindPeople},</if> <if test="hiddenFindDate != null">hidden_find_date = #{hiddenFindDate},</if> <if test="dealPlan != null">deal_plan = #{dealPlan},</if> <if test="dealPlanUrl != null">deal_plan_url = #{dealPlanUrl},</if> <if test="remediation != null">remediation = #{remediation},</if> <if test="createBy != null">create_by = #{createBy},</if> <if test="createTime != null">create_time = #{createTime},</if> <if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateTime != null">update_time = #{updateTime},</if> <if test="isDel != null">is_del = #{isDel},</if> <if test="remarks != null">remarks = #{remarks},</if> </trim> where hidden_id = #{hiddenId} </update> <delete id="deleteTHiddenDangerStandingBookById" parameterType="Long"> delete from t_hidden_danger_standing_book where hidden_id = #{hiddenId} </delete> <delete id="deleteTHiddenDangerStandingBookByIds" parameterType="String"> delete from t_hidden_danger_standing_book where hidden_id in <foreach item="hiddenId" collection="array" open="(" separator="," close=")"> #{hiddenId} </foreach> </delete> </mapper>