|
@@ -0,0 +1,253 @@
|
|
|
+<?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="zhsq_qk.system.mapper.QkPeopleAppealMapper">
|
|
|
+
|
|
|
+ <resultMap type="QkPeopleAppeal" id="QkPeopleAppealResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="appealName" column="appeal_name"/>
|
|
|
+ <result property="appealDescribe" column="appeal_describe"/>
|
|
|
+ <result property="appearTime" column="appear_time"/>
|
|
|
+ <result property="appearUserId" column="appear_user_id"/>
|
|
|
+ <result property="appearUserName" column="appear_user_name"/>
|
|
|
+ <result property="appearPhone" column="appear_phone"/>
|
|
|
+ <result property="appearAddress" column="appear_address"/>
|
|
|
+ <result property="evenType" column="even_type"/>
|
|
|
+ <result property="status" column="status"/>
|
|
|
+ <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="remark" column="remark"/>
|
|
|
+ <result property="evenTypeName" column="even_type_name"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap type="QkPeopleAppealCountVO" id="QkPeopleAppealCountResult">
|
|
|
+ <result property="countReport" column="count_report"/>
|
|
|
+ <result property="countHandle" column="count_handle"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectQkPeopleAppealVo">
|
|
|
+ select id,
|
|
|
+ appeal_name,
|
|
|
+ appeal_describe,
|
|
|
+ appear_time,
|
|
|
+ appear_user_id,
|
|
|
+ appear_user_name,
|
|
|
+ appear_phone,
|
|
|
+ appear_address,
|
|
|
+ even_type,
|
|
|
+ status,
|
|
|
+ create_by,
|
|
|
+ create_time,
|
|
|
+ update_by,
|
|
|
+ update_time,
|
|
|
+ remark
|
|
|
+ from qk_people_appeal
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectQkPeopleAppealList" parameterType="QkPeopleAppeal" resultMap="QkPeopleAppealResult">
|
|
|
+ select pa.id,
|
|
|
+ appeal_name,
|
|
|
+ appeal_describe,
|
|
|
+ appear_time,
|
|
|
+ appear_user_id,
|
|
|
+ appear_user_name,
|
|
|
+ appear_phone,
|
|
|
+ appear_address,
|
|
|
+ even_type,
|
|
|
+ case
|
|
|
+ when even_type = 1 then '电梯安全'
|
|
|
+ end as even_type_name,
|
|
|
+ status,
|
|
|
+ remark,
|
|
|
+ GROUP_CONCAT(pai.img_url) as appearImages
|
|
|
+ from qk_people_appeal pa
|
|
|
+ left join qk_people_appeal_img pai on pa.id = pai.appeal_id
|
|
|
+ <where>
|
|
|
+ <if test="appealName != null and appealName != ''">
|
|
|
+ and pa.appeal_name like concat('%', #{appealName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="appealDescribe != null and appealDescribe != ''">
|
|
|
+ and pa.appeal_describe = #{appealDescribe}
|
|
|
+ </if>
|
|
|
+ <if test="appearTime != null ">
|
|
|
+ and pa.appear_time = #{appearTime}
|
|
|
+ </if>
|
|
|
+ <if test="appearUserId != null and appearUserId != ''">
|
|
|
+ and pa.appear_user_id = #{appearUserId}
|
|
|
+ </if>
|
|
|
+ <if test="appearUserName != null and appearUserName != ''">
|
|
|
+ and pa.appear_user_name like concat('%', #{appearUserName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="appearPhone != null and appearPhone != ''">
|
|
|
+ and pa.appear_phone = #{appearPhone}
|
|
|
+ </if>
|
|
|
+ <if test="appearAddress != null and appearAddress != ''">
|
|
|
+ and pa.appear_address = #{appearAddress}
|
|
|
+ </if>
|
|
|
+ <if test="evenType != null and evenType != ''">
|
|
|
+ and pa.even_type = #{evenType}
|
|
|
+ </if>
|
|
|
+ <if test="status != null and status != ''">
|
|
|
+ and pa.status = #{status}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY pa.id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectQkPeopleAppealById" parameterType="Long"
|
|
|
+ resultMap="QkPeopleAppealResult">
|
|
|
+ select pa.id,
|
|
|
+ appeal_name,
|
|
|
+ appeal_describe,
|
|
|
+ appear_time,
|
|
|
+ appear_user_id,
|
|
|
+ appear_user_name,
|
|
|
+ appear_phone,
|
|
|
+ appear_address,
|
|
|
+ even_type,
|
|
|
+ status,
|
|
|
+ remark,
|
|
|
+ GROUP_CONCAT(pai.img_url) as appearImages
|
|
|
+ from qk_people_appeal pa
|
|
|
+ left join qk_people_appeal_img pai on pa.id = pai.appeal_id
|
|
|
+ where pa.id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertQkPeopleAppeal" parameterType="QkPeopleAppeal" useGeneratedKeys="true"
|
|
|
+ keyProperty="id">
|
|
|
+ insert into qk_people_appeal
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="appealName != null">appeal_name,
|
|
|
+ </if>
|
|
|
+ <if test="appealDescribe != null">appeal_describe,
|
|
|
+ </if>
|
|
|
+ <if test="appearTime != null">appear_time,
|
|
|
+ </if>
|
|
|
+ <if test="appearUserId != null">appear_user_id,
|
|
|
+ </if>
|
|
|
+ <if test="appearUserName != null">appear_user_name,
|
|
|
+ </if>
|
|
|
+ <if test="appearPhone != null">appear_phone,
|
|
|
+ </if>
|
|
|
+ <if test="appearAddress != null">appear_address,
|
|
|
+ </if>
|
|
|
+ <if test="evenType != null">even_type,
|
|
|
+ </if>
|
|
|
+ <if test="status != null">status,
|
|
|
+ </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="remark != null">remark,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="appealName != null">#{appealName},
|
|
|
+ </if>
|
|
|
+ <if test="appealDescribe != null">#{appealDescribe},
|
|
|
+ </if>
|
|
|
+ <if test="appearTime != null">#{appearTime},
|
|
|
+ </if>
|
|
|
+ <if test="appearUserId != null">#{appearUserId},
|
|
|
+ </if>
|
|
|
+ <if test="appearUserName != null">#{appearUserName},
|
|
|
+ </if>
|
|
|
+ <if test="appearPhone != null">#{appearPhone},
|
|
|
+ </if>
|
|
|
+ <if test="appearAddress != null">#{appearAddress},
|
|
|
+ </if>
|
|
|
+ <if test="evenType != null">#{evenType},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">#{status},
|
|
|
+ </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="remark != null">#{remark},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateQkPeopleAppeal" parameterType="QkPeopleAppeal">
|
|
|
+ update qk_people_appeal
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="appealName != null">appeal_name =
|
|
|
+ #{appealName},
|
|
|
+ </if>
|
|
|
+ <if test="appealDescribe != null">appeal_describe =
|
|
|
+ #{appealDescribe},
|
|
|
+ </if>
|
|
|
+ <if test="appearTime != null">appear_time =
|
|
|
+ #{appearTime},
|
|
|
+ </if>
|
|
|
+ <if test="appearUserId != null">appear_user_id =
|
|
|
+ #{appearUserId},
|
|
|
+ </if>
|
|
|
+ <if test="appearUserName != null">appear_user_name =
|
|
|
+ #{appearUserName},
|
|
|
+ </if>
|
|
|
+ <if test="appearPhone != null">appear_phone =
|
|
|
+ #{appearPhone},
|
|
|
+ </if>
|
|
|
+ <if test="appearAddress != null">appear_address =
|
|
|
+ #{appearAddress},
|
|
|
+ </if>
|
|
|
+ <if test="evenType != null">even_type =
|
|
|
+ #{evenType},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">status =
|
|
|
+ #{status},
|
|
|
+ </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="remark != null">remark =
|
|
|
+ #{remark},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteQkPeopleAppealById" parameterType="Long">
|
|
|
+ delete
|
|
|
+ from qk_people_appeal
|
|
|
+ where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteQkPeopleAppealByIds" parameterType="String">
|
|
|
+ delete from qk_people_appeal where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <select id="selectPeopleAppealCount" parameterType="QkPeopleAppealCountVO" resultMap="QkPeopleAppealCountResult">
|
|
|
+ SELECT
|
|
|
+ SUM( CASE WHEN STATUS = 0 THEN 1 ELSE 0 END ) AS count_report,
|
|
|
+ SUM( CASE WHEN STATUS = 1 THEN 1 ELSE 0 END ) AS count_handle
|
|
|
+ FROM
|
|
|
+ qk_people_appeal
|
|
|
+ </select>
|
|
|
+</mapper>
|