123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <?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.bizmatics.persistence.mapper.DevopsWorkOrderMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.bizmatics.model.DevopsWorkOrder">
- <id column="id" property="id" />
- <result column="work_order" property="workOrder" />
- <result column="site_id" property="siteId" />
- <result column="work_order_type" property="workOrderType" />
- <result column="expected_completion_time" property="expectedCompletionTime" />
- <result column="team_id" property="teamId" />
- <result column="generation_mode" property="generationMode" />
- <result column="work_order_status" property="workOrderStatus" />
- <result column="picture_path_one" property="picturePathOne" />
- <result column="picture_path_two" property="picturePathTwo" />
- <result column="picture_path_three" property="picturePathThree" />
- <result column="picture_path_four" property="picturePathFour" />
- <result column="picture_path_five" property="picturePathFive" />
- <result column="picture_path_six" property="picturePathSix" />
- <result column="creator" property="creator" />
- <result column="create_time" property="createTime" />
- <result column="status" property="status" />
- <result column="inspection_record_id" property="inspectionRecordId" />
- </resultMap>
- <select id="devopsWorkOrderList" resultType="com.bizmatics.model.vo.DevopsWorkOrderListVo">
- SELECT
- a.*,
- c.site_name
- FROM
- devops_work_order AS a
- JOIN site AS c ON a.site_id = c.id
- <where>
- a.status = 1
- <if test="generationMode != null and generationMode != 0">
- AND a.generation_mode = #{generationMode}
- </if>
- <if test="workOrderStatus != null and workOrderStatus != 0">
- AND a.work_order_status = #{siteId}
- </if>
- <if test="siteId != null and siteId !=0">
- AND a.site_id = #{siteId}
- </if>
- <if test="workOrderId != null and workOrderId.size() > 0" >
- AND a.id IN
- <foreach item="item" collection="workOrderId" open="(" separator="," close=")">
- #{item.workOrderId}
- </foreach>
- </if>
- </where>
- ORDER BY
- a.id DESC
- <if test="startCurrent != null and current !=0">
- LIMIT #{startCurrent},
- #{current}
- </if>
- </select>
- <select id="patrolInspectorsVoList" resultType="com.bizmatics.model.vo.PatrolInspectorsVo">
- SELECT
- b.*,a.work_order_id
- FROM
- devops_order_inspectors AS a
- JOIN patrol_inspectors AS b ON a.inspectors_id = b.id
- <where>
- a.status = 1
- <if test="workOrderId != null and workOrderId != 0">
- and a.work_order_id = #{workOrderId}
- </if>
- </where>
- </select>
- <select id="patrolInspectionDeviceList" resultType="com.bizmatics.model.vo.PatrolInspectionDeviceDetailsVo">
- SELECT
- b.*, a.work_order_id
- FROM
- devops_order_device AS a
- JOIN patrol_inspection_device AS b ON a.inspection_device_id = b.id
- <where>
- a.status = 1
- <if test="workOrderId != null and workOrderId != 0">
- and a.work_order_id = #{workOrderId}
- </if>
- </where>
- </select>
- <select id="devopsWorkOrderDetails" resultType="com.bizmatics.model.vo.DevopsWorkOrderDetailsVo">
- SELECT
- a.*, b.team_name,
- c.site_name
- FROM
- devops_work_order AS a
- JOIN patrol_inspection_team AS b ON a.team_id = b.id
- JOIN site AS c ON a.site_id = c.id
- <where>
- a.status = 1
- <if test="id != null and id != 0">
- AND a.id = #{id}
- </if>
- </where>
- </select>
- <select id="patrolRouteContentList" resultType="com.bizmatics.model.vo.PatrolRouteContentListVo">
- SELECT
- a.*, c.inspection_content_name,d.inspection_device_name
- FROM
- patrol_route_content AS a
- JOIN patrol_inspection_route AS b ON a.inspection_route_id = b.id
- JOIN patrol_inspection_content AS c ON a.inspection_content_id = c.id
- join patrol_inspection_device as d on c.inspection_device_id=d.id
- <where>
- a.status = 1
- AND b.status = 1
- <if test="inspectionSchemeId != null and inspectionSchemeId != 0">
- AND b.inspection_scheme_id = #{inspectionSchemeId}
- </if>
- <if test="siteId != null and siteId != 0">
- and b.site_id = #{siteId}
- </if>
- </where>
- </select>
- <select id="patrolInspectorsOneVoList" resultType="com.bizmatics.model.vo.PatrolInspectorsOneVo">
- SELECT
- a.*, b.team_id
- FROM
- patrol_inspectors AS a
- JOIN patrol_team_inspection AS b ON a.id = b.inspectors_id
- </select>
- <select id="SiteList" resultType="com.bizmatics.model.Site">
- select s.id,s.site_name,s.site_address,s.company_code,s.user_name,s.phone,s.station_area_id,s.route_id,
- s.installed_capacity,s.rheological_change,s.longitude,s.latitude,s.region,s.create_time,s.creator,s.enable
- from user_site as us
- inner join site as s
- on us.site_id = s.id
- <where>
- <if test="userId != null and userId != 0">
- and us.user_id = #{userId}
- </if>
- <if test="name != null and name != ''">
- and s.site_name LIKE CONCAT(CONCAT('%', #{name}), '%')
- </if>
- </where>
- </select>
- <select id="workloadStatisticsLits" resultType="com.bizmatics.model.vo.ProcessingTime">
- SELECT
- a.id,
- a.inspectors_name,
- c.work_order_status,
- c.site_id,
- COUNT(c.id) as count,
- SUM(
- IF (
- c.work_order_status = 6,
- timestampdiff(HOUR, c.create_time, now()),
- 0
- )
- ) as processing_time
- FROM
- patrol_inspectors AS a
- JOIN devops_order_inspectors AS b ON a.id = b.inspectors_id
- JOIN devops_work_order AS c ON b.work_order_id = c.id
- <where>
- a.status = 1
- AND b.status = 1
- AND c.status = 1
- <if test="siteId != null and siteId != 0">
- AND c.site_id = #{siteId}
- </if>
- <if test="endTime != null and startTime != null">
- and c.create_time BETWEEN #{startTime} and #{endTime}
- </if>
- </where>
- GROUP BY
- a.id,
- c.site_id,
- c.work_order_status
- </select>
- </mapper>
|