| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <?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.welampiot.dao.RepairProjectDao">
- <insert id="addRepairProjectData" parameterType="RepairProjectDTO" useGeneratedKeys="true" keyProperty="id">
- insert into repair_project(sectionId,work_id,com_time,type,`desc`,user_id,create_time)
- values (#{sectionId},#{workId},#{comTime},#{type},#{desc},#{userid},#{createTime})
- </insert>
- <update id="updateRepairProjectData" parameterType="RepairProjectDTO">
- update repair_project r
- set
- r.sectionId = #{sectionId},
- r.work_id = #{workId},
- r.com_time = #{comTime},
- r.type = #{type},
- r.`desc` = #{desc}
- where r.id = #{id}
- </update>
- <select id="getRepairProjectList" resultType="RepairProjectDTO">
- select r.id,r.number,r.type,r.com_time comTime,r.work_name workName,r.`desc`,r.status
- from repair_project r
- left join section s on r.sectionId = s.id
- left join global_location gl on s.pid = gl.id
- left join global_location gl1 on gl.pid = gl1.id
- left join global_location gl2 on gl1.pid = gl2.id
- where 1=1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and r.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <choose>
- <when test="type == 0">
- and r.type = 0
- </when>
- <when test="type == 1">
- and r.type = 1
- </when>
- <when test="type == 2">
- and r.type = 2
- </when>
- </choose>
- <if test="keyword != null and keyword != ''">
- and r.number like '%${keyword}%'
- </if>
- <if test="areaId != null and areaId != 0">
- and gl.id = #{areaId}
- </if>
- <if test="sectionId != null and sectionId != 0">
- and r.sectionId = #{sectionId}
- </if>
- <if test="cityId != null and cityId != 0">
- and gl1.id = #{cityId}
- </if>
- <if test="provinceId != null and provinceId != 0">
- and gl2.id = #{provinceId}
- </if>
- <if test="page >= 0 and count > 0">
- limit #{page},#{count}
- </if>
- </select>
- <select id="getRepairProjectTotal" resultType="Integer">
- select count(r.id)
- from repair_project r
- <if test="sectionList != null and !sectionList.isEmpty()">
- where r.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="getRepairProjectTotal2" resultType="Integer">
- select count(r.id)
- from repair_project r
- where r.type = 0
- <if test="sectionList != null and !sectionList.isEmpty()">
- and r.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="getRepairProjectTotal3" resultType="Integer">
- select count(r.id)
- from repair_project r
- where r.type = 1
- <if test="sectionList != null and !sectionList.isEmpty()">
- and r.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="getRepairProjectTotal4" resultType="Integer">
- select count(r.id)
- from repair_project r
- where r.type = 2
- <if test="sectionList != null and !sectionList.isEmpty()">
- and r.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <update id="updateRepairProjectStatus" parameterType="RepairProjectDTO">
- update repair_project r
- set
- r.status = #{status}
- where r.id = #{id}
- </update>
- <!-- 运维概览项目维修数 -->
- <select id="getRepairProjectCount" resultType="Integer">
- select count(r.id)
- from repair_project r
- where date(r.create_time) <![CDATA[ <= ]]> #{endDate}
- <if test="startDate != null and startDate != ''">
- and date(r.create_time) <![CDATA[ >= ]]> #{startDate}
- </if>
- <if test="sectionList != null and !sectionList.isEmpty()">
- and r.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <!-- 运维概览维修项目数,前30天内的数据数量 -->
- <select id="getRepairProjectCountOnMonth" resultType="RepairProjectDTO">
- select count(*) as dayCount,date(r.create_time) as createTime
- from repair_project r
- where r.create_time <![CDATA[ >= ]]> curdate() - interval 30 day
- and r.create_time <![CDATA[ <= ]]> now()
- <if test="sectionList != null and !sectionList.isEmpty()">
- and r.sectionId in
- <foreach collection="sectionList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- group by date(r.create_time)
- order by date(r.create_time) desc
- </select>
- </mapper>
|