1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201 |
- <?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.huaxu.order.dao.WorkOrderManageMapper" >
- <resultMap id="BaseResultMap" type="com.huaxu.order.dto.WorkOrderManageDto" >
- <id column="id" property="id" jdbcType="INTEGER" />
- <result column="task_no" property="taskNo" jdbcType="VARCHAR" />
- <result column="task_desc" property="taskDesc" jdbcType="VARCHAR" />
- <result column="order_user_id" property="orderUserId" jdbcType="VARCHAR" />
- <result column="send_time" property="sendTime" jdbcType="TIMESTAMP" />
- <result column="send_by" property="sendBy" jdbcType="VARCHAR" />
- <result column="plan_finish_date" property="planFinishDate" jdbcType="TIMESTAMP" />
- <result column="finish_date" property="finishDate" jdbcType="TIMESTAMP" />
- <result column="date_limit" property="dateLimit" jdbcType="VARCHAR" />
- <result column="urgency" property="urgency" jdbcType="VARCHAR" />
- <result column="address" property="address" jdbcType="VARCHAR" />
- <result column="contact_user" property="contactUser" jdbcType="VARCHAR" />
- <result column="contact_phone" property="contactPhone" jdbcType="VARCHAR" />
- <result column="order_time" property="orderTime" jdbcType="VARCHAR" />
- <result column="company_org_id" property="companyOrgId" jdbcType="VARCHAR" />
- <result column="department_org_id" property="departmentOrgId" jdbcType="VARCHAR" />
- <result column="order_status" property="orderStatus" jdbcType="INTEGER" />
- <result column="event_type" property="eventType" jdbcType="INTEGER" />
- <result column="event_type_name" property="eventTypeName" jdbcType="VARCHAR" />
- <result column="order_type_id" property="orderTypeId" jdbcType="INTEGER" />
- <result column="order_pid" property="orderPid" jdbcType="VARCHAR" />
- <result column="tenant_id" property="tenantId" jdbcType="VARCHAR" />
- <result column="process_instance_id" property="processInstanceId" jdbcType="VARCHAR" />
- <result column="process_def_id" property="processDefId" jdbcType="VARCHAR" />
- <result column="current_task_id" property="currentTaskId" jdbcType="VARCHAR" />
- <result column="current_users" property="currentUsers" jdbcType="VARCHAR" />
- <result column="current_task_name" property="currentTaskName" jdbcType="VARCHAR" />
- <result column="create_by" property="createBy" jdbcType="VARCHAR" />
- <result column="date_create" property="dateCreate" jdbcType="TIMESTAMP" />
- <result column="update_by" property="updateBy" jdbcType="VARCHAR" />
- <result column="date_update" property="dateUpdate" jdbcType="TIMESTAMP" />
- <result column="geo" property="geo" jdbcType="VARCHAR" />
- <result column="videos" property="videos" jdbcType="VARCHAR" />
- <result column="pictures" property="pictures" jdbcType="VARCHAR" />
- <result column="flow_detail" property="flowDetail" jdbcType="VARCHAR" />
- <result column="device_id" property="deviceId" jdbcType="INTEGER" />
- <result column="scenes_id" property="scenesId" jdbcType="INTEGER" />
- <result column="device_name" property="deviceName" jdbcType="VARCHAR" />
- <result column="scenes_name" property="scenesName" jdbcType="VARCHAR" />
- <result column="order_status_name" property="orderStatusName" jdbcType="VARCHAR" />
- <result column="order_count" property="orderCount" jdbcType="VARCHAR" />
- <result column="in_process_status" property="inProcessStatus" jdbcType="INTEGER" />
- </resultMap>
- <resultMap id="workFlowLogResultMap" type="com.huaxu.order.entity.WorkFlowLog">
- <id column="id" property="id" jdbcType="INTEGER" />
- <result column="flow_id" property="flowId" jdbcType="INTEGER" />
- <result column="log_process_instance_id" property="processInstanceId" jdbcType="VARCHAR" />
- <result column="task_id" property="taskId" jdbcType="VARCHAR" />
- <result column="handle_user_id" property="handleUserId" jdbcType="VARCHAR" />
- <result column="handle_user_name" property="handleUserName" jdbcType="VARCHAR" />
- <result column="flow_type" property="flowType" jdbcType="INTEGER" />
- <result column="flow_result" property="flowResult" jdbcType="VARCHAR" />
- <result column="log_create_by" property="createBy" jdbcType="VARCHAR" />
- <result column="log_date_create" property="dateCreate" jdbcType="TIMESTAMP" />
- <result column="log_update_by" property="updateBy" jdbcType="VARCHAR" />
- <result column="log_date_update" property="dateUpdate" jdbcType="TIMESTAMP" />
- </resultMap>
- <resultMap id="OrderResultMap" type="com.huaxu.order.dto.WorkOrderManageDto" extends="BaseResultMap">
- <association property="workFlowDetail" javaType="com.huaxu.order.entity.WorkFlowDetail">
- <id column="id" property="id" jdbcType="INTEGER" />
- <result column="flow_id" property="flowId" jdbcType="INTEGER" />
- <result column="flow_type" property="flowType" jdbcType="INTEGER" />
- <result column="flow_detail" property="flowDetail" jdbcType="VARCHAR" />
- <result column="detail_create_by" property="createBy" jdbcType="VARCHAR" />
- <result column="detail_date_create" property="dateCreate" jdbcType="TIMESTAMP" />
- <result column="detail_update_by" property="updateBy" jdbcType="VARCHAR" />
- <result column="detail_date_update" property="dateUpdate" jdbcType="TIMESTAMP" />
- </association>
- <collection property="workFlowLogList" ofType="com.huaxu.order.entity.WorkFlowLog" javaType="java.util.List" select="getWorkFlowLog" column="{flowId=id}">
- <id column="id" property="id" jdbcType="INTEGER" />
- <result column="flow_id" property="flowId" jdbcType="INTEGER" />
- <result column="log_process_instance_id" property="processInstanceId" jdbcType="VARCHAR" />
- <result column="task_id" property="taskId" jdbcType="VARCHAR" />
- <result column="handle_user_id" property="handleUserId" jdbcType="VARCHAR" />
- <result column="handle_user_name" property="handleUserName" jdbcType="VARCHAR" />
- <result column="flow_type" property="flowType" jdbcType="INTEGER" />
- <result column="flow_result" property="flowResult" jdbcType="VARCHAR" />
- <result column="log_create_by" property="createBy" jdbcType="VARCHAR" />
- <result column="log_date_create" property="dateCreate" jdbcType="TIMESTAMP" />
- <result column="log_update_by" property="updateBy" jdbcType="VARCHAR" />
- <result column="log_date_update" property="dateUpdate" jdbcType="TIMESTAMP" />
- </collection>
- </resultMap>
- <resultMap id="StatisticsMap" type="com.huaxu.order.dto.StatisticsDto" >
- <result column="statistics_name" property="statisticsName" jdbcType="VARCHAR" />
- <result column="statistics_value" property="statisticsValue" jdbcType="VARCHAR" />
- </resultMap>
- <sql id="Base_Column_List" >
- id, task_no, task_desc, order_user_id, send_time, send_by, plan_finish_date, finish_date,
- date_limit, urgency, address, contact_user, contact_phone, order_time, company_org_id,
- department_org_id, order_status, event_type, order_type_id, order_pid, tenant_id,
- process_instance_id, process_def_id, current_task_id, current_users, current_task_name,
- create_by, date_create, update_by, date_update, geo,videos, pictures, device_id, scenes_id,
- device_name, scenes_name,in_process_status
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
- select
- <include refid="Base_Column_List" />
- from sc_work_order_manage
- where id = #{id,jdbcType=INTEGER}
- </select>
- <select id="getWorkFlowLog" resultMap="workFlowLogResultMap" parameterType="map">
- select t3.process_instance_id log_process_instance_id,t3.task_id,t3.handle_user_id,t3.handle_user_name,t3.flow_result,t3.create_by log_create_by,
- t3.date_create log_date_create,t3.update_by log_update_by,t3.date_update log_date_update
- from sc_work_flow_log t3
- where t3.flow_id= #{flowId,jdbcType=INTEGER} and t3.flow_type=2
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
- delete from sc_work_order_manage
- where id = #{id,jdbcType=INTEGER}
- </delete>
- <insert id="insert" parameterType="com.huaxu.order.entity.WorkOrderManage" >
- insert into sc_work_order_manage (id, task_no, task_desc,
- order_user_id, send_time, send_by,
- plan_finish_date, finish_date, date_limit,
- urgency, address, contact_user,
- contact_phone, order_time, company_org_id,
- department_org_id, order_status, event_type,
- order_type_id, order_pid, tenant_id,
- process_instance_id, process_def_id, current_task_id,
- current_users, current_task_name, create_by,
- date_create, update_by, date_update,
- geo,videos,pictures)
- values (#{id,jdbcType=INTEGER}, #{taskNo,jdbcType=VARCHAR}, #{taskDesc,jdbcType=VARCHAR},
- #{orderUserId,jdbcType=VARCHAR}, #{sendTime,jdbcType=TIMESTAMP}, #{sendBy,jdbcType=VARCHAR},
- #{planFinishDate,jdbcType=TIMESTAMP}, #{finishDate,jdbcType=TIMESTAMP}, #{dateLimit,jdbcType=VARCHAR},
- #{urgency,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, #{contactUser,jdbcType=VARCHAR},
- #{contactPhone,jdbcType=VARCHAR}, #{orderTime,jdbcType=VARCHAR}, #{companyOrgId,jdbcType=VARCHAR},
- #{departmentOrgId,jdbcType=VARCHAR}, #{orderStatus,jdbcType=INTEGER}, #{eventType,jdbcType=INTEGER},
- #{orderTypeId,jdbcType=INTEGER}, #{orderPid,jdbcType=VARCHAR}, #{tenantId,jdbcType=VARCHAR},
- #{processInstanceId,jdbcType=VARCHAR}, #{processDefId,jdbcType=VARCHAR}, #{currentTaskId,jdbcType=VARCHAR},
- #{currentUsers,jdbcType=VARCHAR}, #{currentTaskName,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
- #{dateCreate,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{dateUpdate,jdbcType=TIMESTAMP},
- #{geo,jdbcType=VARCHAR},#{videos,jdbcType=VARCHAR},#{pictures,jdbcType=VARCHAR})
- </insert>
- <insert id="insertSelective" parameterType="com.huaxu.order.entity.WorkOrderManage" keyProperty="id" useGeneratedKeys="true">
- insert into sc_work_order_manage
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- id,
- </if>
- <if test="taskNo != null" >
- task_no,
- </if>
- <if test="taskDesc != null" >
- task_desc,
- </if>
- <if test="orderUserId != null" >
- order_user_id,
- </if>
- <if test="sendTime != null" >
- send_time,
- </if>
- <if test="sendBy != null" >
- send_by,
- </if>
- <if test="planFinishDate != null" >
- plan_finish_date,
- </if>
- <if test="finishDate != null" >
- finish_date,
- </if>
- <if test="dateLimit != null" >
- date_limit,
- </if>
- <if test="urgency != null" >
- urgency,
- </if>
- <if test="address != null" >
- address,
- </if>
- <if test="contactUser != null" >
- contact_user,
- </if>
- <if test="contactPhone != null" >
- contact_phone,
- </if>
- <if test="orderTime != null" >
- order_time,
- </if>
- <if test="companyOrgId != null" >
- company_org_id,
- </if>
- <if test="departmentOrgId != null" >
- department_org_id,
- </if>
- <if test="orderStatus != null" >
- order_status,
- </if>
- <if test="eventType != null" >
- event_type,
- </if>
- <if test="orderTypeId != null" >
- order_type_id,
- </if>
- <if test="orderPid != null" >
- order_pid,
- </if>
- <if test="tenantId != null" >
- tenant_id,
- </if>
- <if test="processInstanceId != null" >
- process_instance_id,
- </if>
- <if test="processDefId != null" >
- process_def_id,
- </if>
- <if test="currentTaskId != null" >
- current_task_id,
- </if>
- <if test="currentUsers != null" >
- current_users,
- </if>
- <if test="currentTaskName != null" >
- current_task_name,
- </if>
- <if test="createBy != null" >
- create_by,
- </if>
- <if test="dateCreate != null" >
- date_create,
- </if>
- <if test="updateBy != null" >
- update_by,
- </if>
- <if test="dateUpdate != null" >
- date_update,
- </if>
- <if test="geo != null" >
- geo,
- </if>
- <if test="videos != null" >
- videos,
- </if>
- <if test="pictures != null" >
- pictures,
- </if>
- <if test="deviceId != null" >
- device_id,
- </if>
- <if test="scenesId != null" >
- scenes_id,
- </if>
- <if test="deviceName != null" >
- device_name,
- </if>
- <if test="scenesName != null" >
- scenes_name,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- #{id,jdbcType=INTEGER},
- </if>
- <if test="taskNo != null" >
- #{taskNo,jdbcType=VARCHAR},
- </if>
- <if test="taskDesc != null" >
- #{taskDesc,jdbcType=VARCHAR},
- </if>
- <if test="orderUserId != null" >
- #{orderUserId,jdbcType=VARCHAR},
- </if>
- <if test="sendTime != null" >
- #{sendTime,jdbcType=TIMESTAMP},
- </if>
- <if test="sendBy != null" >
- #{sendBy,jdbcType=VARCHAR},
- </if>
- <if test="planFinishDate != null" >
- #{planFinishDate,jdbcType=TIMESTAMP},
- </if>
- <if test="finishDate != null" >
- #{finishDate,jdbcType=TIMESTAMP},
- </if>
- <if test="dateLimit != null" >
- #{dateLimit,jdbcType=VARCHAR},
- </if>
- <if test="urgency != null" >
- #{urgency,jdbcType=VARCHAR},
- </if>
- <if test="address != null" >
- #{address,jdbcType=VARCHAR},
- </if>
- <if test="contactUser != null" >
- #{contactUser,jdbcType=VARCHAR},
- </if>
- <if test="contactPhone != null" >
- #{contactPhone,jdbcType=VARCHAR},
- </if>
- <if test="orderTime != null" >
- #{orderTime,jdbcType=VARCHAR},
- </if>
- <if test="companyOrgId != null" >
- #{companyOrgId,jdbcType=VARCHAR},
- </if>
- <if test="departmentOrgId != null" >
- #{departmentOrgId,jdbcType=VARCHAR},
- </if>
- <if test="orderStatus != null" >
- #{orderStatus,jdbcType=INTEGER},
- </if>
- <if test="eventType != null" >
- #{eventType,jdbcType=INTEGER},
- </if>
- <if test="orderTypeId != null" >
- #{orderTypeId,jdbcType=INTEGER},
- </if>
- <if test="orderPid != null" >
- #{orderPid,jdbcType=VARCHAR},
- </if>
- <if test="tenantId != null" >
- #{tenantId,jdbcType=VARCHAR},
- </if>
- <if test="processInstanceId != null" >
- #{processInstanceId,jdbcType=VARCHAR},
- </if>
- <if test="processDefId != null" >
- #{processDefId,jdbcType=VARCHAR},
- </if>
- <if test="currentTaskId != null" >
- #{currentTaskId,jdbcType=VARCHAR},
- </if>
- <if test="currentUsers != null" >
- #{currentUsers,jdbcType=VARCHAR},
- </if>
- <if test="currentTaskName != null" >
- #{currentTaskName,jdbcType=VARCHAR},
- </if>
- <if test="createBy != null" >
- #{createBy,jdbcType=VARCHAR},
- </if>
- <if test="dateCreate != null" >
- #{dateCreate,jdbcType=TIMESTAMP},
- </if>
- <if test="updateBy != null" >
- #{updateBy,jdbcType=VARCHAR},
- </if>
- <if test="dateUpdate != null" >
- #{dateUpdate,jdbcType=TIMESTAMP},
- </if>
- <if test="geo != null" >
- #{geo,jdbcType=VARCHAR},
- </if>
- <if test="videos != null" >
- #{videos,jdbcType=VARCHAR},
- </if>
- <if test="pictures != null" >
- #{pictures,jdbcType=VARCHAR},
- </if>
- <if test="deviceId != null" >
- #{deviceId,jdbcType=INTEGER},
- </if>
- <if test="scenesId != null" >
- #{scenesId,jdbcType=INTEGER},
- </if>
- <if test="deviceName != null" >
- #{deviceName,jdbcType=VARCHAR},
- </if>
- <if test="scenesName != null" >
- #{scenesName,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.huaxu.order.entity.WorkOrderManage" >
- update sc_work_order_manage
- <set >
- <if test="taskNo != null" >
- task_no = #{taskNo,jdbcType=VARCHAR},
- </if>
- <if test="taskDesc != null" >
- task_desc = #{taskDesc,jdbcType=VARCHAR},
- </if>
- <if test="orderUserId != null" >
- order_user_id = #{orderUserId,jdbcType=VARCHAR},
- </if>
- <if test="sendTime != null" >
- send_time = #{sendTime,jdbcType=TIMESTAMP},
- </if>
- <if test="sendBy != null" >
- send_by = #{sendBy,jdbcType=VARCHAR},
- </if>
- <if test="planFinishDate != null" >
- plan_finish_date = #{planFinishDate,jdbcType=TIMESTAMP},
- </if>
- <if test="finishDate != null" >
- finish_date = #{finishDate,jdbcType=TIMESTAMP},
- </if>
- <if test="dateLimit != null" >
- date_limit = #{dateLimit,jdbcType=VARCHAR},
- </if>
- <if test="urgency != null" >
- urgency = #{urgency,jdbcType=VARCHAR},
- </if>
- <if test="address != null" >
- address = #{address,jdbcType=VARCHAR},
- </if>
- <if test="contactUser != null" >
- contact_user = #{contactUser,jdbcType=VARCHAR},
- </if>
- <if test="contactPhone != null" >
- contact_phone = #{contactPhone,jdbcType=VARCHAR},
- </if>
- <if test="orderTime != null" >
- order_time = #{orderTime,jdbcType=VARCHAR},
- </if>
- <if test="companyOrgId != null" >
- company_org_id = #{companyOrgId,jdbcType=VARCHAR},
- </if>
- <if test="departmentOrgId != null" >
- department_org_id = #{departmentOrgId,jdbcType=VARCHAR},
- </if>
- <if test="orderStatus != null" >
- order_status = #{orderStatus,jdbcType=INTEGER},
- </if>
- <if test="eventType != null" >
- event_type = #{eventType,jdbcType=INTEGER},
- </if>
- <if test="orderTypeId != null" >
- order_type_id = #{orderTypeId,jdbcType=INTEGER},
- </if>
- <if test="orderPid != null" >
- order_pid = #{orderPid,jdbcType=VARCHAR},
- </if>
- <if test="tenantId != null" >
- tenant_id = #{tenantId,jdbcType=VARCHAR},
- </if>
- <if test="processInstanceId != null" >
- process_instance_id = #{processInstanceId,jdbcType=VARCHAR},
- </if>
- <if test="processDefId != null" >
- process_def_id = #{processDefId,jdbcType=VARCHAR},
- </if>
- <if test="currentTaskId != null" >
- current_task_id = #{currentTaskId,jdbcType=VARCHAR},
- </if>
- <if test="currentUsers != null" >
- current_users = #{currentUsers,jdbcType=VARCHAR},
- </if>
- <if test="currentTaskName != null" >
- current_task_name = #{currentTaskName,jdbcType=VARCHAR},
- </if>
- <if test="createBy != null" >
- create_by = #{createBy,jdbcType=VARCHAR},
- </if>
- <if test="dateCreate != null" >
- date_create = #{dateCreate,jdbcType=TIMESTAMP},
- </if>
- <if test="updateBy != null" >
- update_by = #{updateBy,jdbcType=VARCHAR},
- </if>
- <if test="dateUpdate != null" >
- date_update = #{dateUpdate,jdbcType=TIMESTAMP},
- </if>
- <if test="geo != null" >
- geo = #{geo,jdbcType=VARCHAR},
- </if>
- <if test="videos != null" >
- videos=#{videos,jdbcType=VARCHAR},
- </if>
- <if test="pictures != null" >
- pictures=#{pictures,jdbcType=VARCHAR},
- </if>
- <if test="inProcessStatus != null" >
- in_process_status=#{inProcessStatus,jdbcType=INTEGER},
- </if>
- </set>
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.huaxu.order.entity.WorkOrderManage" >
- update sc_work_order_manage
- set task_no = #{taskNo,jdbcType=VARCHAR},
- task_desc = #{taskDesc,jdbcType=VARCHAR},
- order_user_id = #{orderUserId,jdbcType=VARCHAR},
- send_time = #{sendTime,jdbcType=TIMESTAMP},
- send_by = #{sendBy,jdbcType=VARCHAR},
- plan_finish_date = #{planFinishDate,jdbcType=TIMESTAMP},
- finish_date = #{finishDate,jdbcType=TIMESTAMP},
- date_limit = #{dateLimit,jdbcType=VARCHAR},
- urgency = #{urgency,jdbcType=VARCHAR},
- address = #{address,jdbcType=VARCHAR},
- contact_user = #{contactUser,jdbcType=VARCHAR},
- contact_phone = #{contactPhone,jdbcType=VARCHAR},
- order_time = #{orderTime,jdbcType=VARCHAR},
- company_org_id = #{companyOrgId,jdbcType=VARCHAR},
- department_org_id = #{departmentOrgId,jdbcType=VARCHAR},
- order_status = #{orderStatus,jdbcType=INTEGER},
- event_type = #{eventType,jdbcType=INTEGER},
- order_type_id = #{orderTypeId,jdbcType=INTEGER},
- order_pid = #{orderPid,jdbcType=VARCHAR},
- tenant_id = #{tenantId,jdbcType=VARCHAR},
- process_instance_id = #{processInstanceId,jdbcType=VARCHAR},
- process_def_id = #{processDefId,jdbcType=VARCHAR},
- current_task_id = #{currentTaskId,jdbcType=VARCHAR},
- current_users = #{currentUsers,jdbcType=VARCHAR},
- current_task_name = #{currentTaskName,jdbcType=VARCHAR},
- create_by = #{createBy,jdbcType=VARCHAR},
- date_create = #{dateCreate,jdbcType=TIMESTAMP},
- update_by = #{updateBy,jdbcType=VARCHAR},
- date_update = #{dateUpdate,jdbcType=TIMESTAMP},
- geo = #{geo,jdbcType=VARCHAR},
- videos = #{videos,jdbcType=VARCHAR},
- pictures = #{pictures,jdbcType=VARCHAR},
- in_process_status=#{inProcessStatus,jdbcType=INTEGER}
- where id = #{id,jdbcType=INTEGER}
- </update>
- <select id="selectAppTodo" resultMap="BaseResultMap">
- select id,task_no,send_time,address,order_type_id,create_by,update_by,task_desc,order_status,current_task_name,in_process_status
- from sc_work_order_manage
- where find_in_set(#{userId},current_users) and tenant_id = #{tenantId}
- union
- select id,plan_id,plan_date,task_area_name,task_type,create_by,update_by,task_content,plan_status,current_task_name,in_process_status
- from sc_plan_manage
- where find_in_set(#{userId},current_users) and tenant_id = #{tenantId}
- order by send_time desc
- </select>
- <select id="selectAppAll" resultMap="BaseResultMap">
- select distinct t1.id,task_no,send_time,address,order_type_id,current_task_name,t1.create_by,t1.update_by,task_desc,order_status,in_process_status
- from sc_work_order_manage t1
- left join sc_work_flow_log t2 ON t1.id=t2.flow_id and flow_type=2 and find_in_set(#{userId},handle_user_id) and left(flow_result,2)='拒单'
- where (find_in_set(#{userId},current_users)
- or t1.id in(select flow_id from sc_work_flow_log where flow_type=2 and find_in_set(#{userId},handle_user_id)))
- and tenant_id = #{tenantId}
- and (t2.id is null or t1.order_user_id=t2.handle_user_id)
- union
- select id,plan_id,plan_date,task_area_name,task_type,current_task_name,create_by,update_by,task_content,plan_status,in_process_status
- from sc_plan_manage
- where (find_in_set(#{userId},current_users)
- or id in(select flow_id from sc_work_flow_log where flow_type=1 and find_in_set(#{userId},handle_user_id)))
- and tenant_id = #{tenantId}
- order by send_time desc
- </select>
- <select id="selectOrderDetail" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
- select t1.*,t2.flow_detail
- from sc_work_order_manage t1
- left join sc_work_flow_detail t2 on t1.id=t2.flow_id and t2.flow_type=2
- where t1.id = #{id,jdbcType=INTEGER} or t1.order_pid = #{orderPid,jdbcType=INTEGER}
- order by t1.order_pid
- </select>
- <insert id="batchInsertByAlarms" >
- insert into sc_work_order_manage( task_no, task_desc, address, order_time, company_org_id, department_org_id, order_status, event_type, order_pid, tenant_id, current_task_name, date_create, date_update, geo,scenes_id,scenes_name,device_id,device_name)
- values
- <foreach collection="workOrderManages" item="item" index="index" separator=",">
- (#{item.taskNo} , #{item.taskDesc}, #{item.address}, #{item.orderTime}, #{item.companyOrgId}, #{item.departmentOrgId}, 0, 3, 0, #{item.tenantId}, '设备报警工单', now(), now(), #{item.geo}, #{item.parentSceneId}, #{item.parentSceneName}, #{item.deviceId}, #{item.deviceName})
- </foreach>
- </insert>
- <delete id="batchDeleteByAlarms" >
- delete from sc_work_order_manage
- where order_status = 0 and device_id in
- <foreach collection="deviceIds" item="item" open="(" close=")" index="index" separator=",">
- #{item}
- </foreach>
- </delete>
- <select id="findWorkOrderByDeviceIds" resultType="com.huaxu.order.dto.WorkOrderManageByAlarmDto">
- select
- id
- ,device_id as "deviceId"
- , task_desc as "taskDesc"
- , order_status as "orderStatus"
- from sc_work_order_manage
- where (order_status = 0 or order_status = 1)
- and device_id in
- <foreach collection="deviceIds" item="item" open="(" close=")" index="index" separator=",">
- #{item}
- </foreach>
- </select>
- <update id="updateByAlarms">
- update sc_work_order_manage set task_desc =#{workOrderManage.taskDesc} ,date_update = now() where id=#{workOrderManage.id}
- </update>
- <select id="findByNo" resultMap="OrderResultMap">
- select
- t1.id, t1.task_no, t1.task_desc, t1.order_user_id, t1.send_time, t1.send_by, t1.plan_finish_date, t1.finish_date,
- t1.date_limit, t1.urgency, t1.address, t1.contact_user, t1.contact_phone, t1.order_time, t1.company_org_id,
- t1.department_org_id, t1.order_status, t1.event_type,case when t1.event_type=1 then '运维上报' when t1.event_type=2 then '用户上报' when t1.event_type=3 then '设备告警' end event_type_name,
- t1.order_type_id, t1.order_pid, t1.tenant_id,
- t1.process_instance_id, t1.process_def_id, t1.current_task_id, t1.current_users, t1.current_task_name,
- t1.create_by, t1.date_create, t1.update_by, t1.date_update, t1.geo,t1.videos,t1.pictures,
- t1.device_id, t1.scenes_id, t1.device_name, t1.scenes_name,
- t2.flow_detail,t2.create_by detail_create_by,t2.date_create detail_date_create,t2.update_by detail_update_by,t2.date_update detail_date_update
- from sc_work_order_manage t1 left join sc_work_flow_detail t2
- on t1.id = t2.flow_id and t2.flow_type=2
- <where>
- <if test="order.taskNo != null and order.taskNo != ''">
- and t1.task_no = #{order.taskNo}
- </if>
- </where>
- </select>
- <!--分页查询-->
- <select id="findPage" resultMap="OrderResultMap">
- select
- t1.id, t1.task_no, t1.task_desc, t1.order_user_id, t1.send_time, t1.send_by, t1.plan_finish_date, t1.finish_date,
- t1.date_limit, t1.urgency, t1.address, t1.contact_user, t1.contact_phone, t1.order_time, t1.company_org_id,
- t1.department_org_id, t1.order_status, t1.event_type,case when t1.event_type=1 then '运维上报' when t1.event_type=2 then '用户上报' when t1.event_type=3 then '设备告警' end event_type_name,
- t1.order_type_id, t1.order_pid, t1.tenant_id,
- t1.process_instance_id, t1.process_def_id, t1.current_task_id, t1.current_users, t1.current_task_name,
- t1.create_by, t1.date_create, t1.update_by, t1.date_update, t1.geo,t1.videos,t1.pictures,
- t1.device_id, t1.scenes_id, t1.device_name, t1.scenes_name,
- t2.flow_detail,t2.create_by detail_create_by,t2.date_create detail_date_create,t2.update_by detail_update_by,t2.date_update detail_date_update
- from sc_work_order_manage t1 left join sc_work_flow_detail t2
- on t1.id = t2.flow_id and t2.flow_type=2
- <where>
- <if test="order.tenantId != null and order.tenantId != ''">
- and t1.tenant_id = #{order.tenantId}
- </if>
- <if test="order.taskNo != null and order.taskNo != ''">
- and t1.task_no like CONCAT('%',#{order.taskNo},'%')
- </if>
- <if test="order.orderPid != null">
- and t1.order_pid = #{order.orderPid,jdbcType=INTEGER}
- </if>
- <if test="order.userType!=null and order.userType!=-999 and order.userType!=-9999 and order.programItems != null and order.programItems.size() > 0">
- <if test="order.permissonType == 5 or order.permissonType == 2">
- and ( t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- or
- t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- )
- </if>
- <if test="order.permissonType == 4 or order.permissonType == 3">
- and t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- </if>
- <if test="order.permissonType == 1">
- and t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- and (t1.department_org_id is null or t1.department_org_id =0)
- </if>
- </if>
- <if test="order.orderStatus != null">
- and t1.order_status = #{order.orderStatus,jdbcType=INTEGER}
- </if>
- <if test="order.orderStatus == null">
- and t1.order_status != 0
- </if>
- <if test="order.orderTypeId != null">
- and t1.order_type_id = #{order.orderTypeId,jdbcType=INTEGER}
- </if>
- <if test="order.eventType != null">
- and t1.event_type = #{order.eventType,jdbcType=INTEGER}
- </if>
- <if test="order.currentUsers != null">
- and FIND_IN_SET(#{order.currentUsers,jdbcType=VARCHAR},t1.current_users)
- </if>
- <if test="order.startDate != null and order.endDate != null">
- <if test="order.orderStatus == 0">
- and t1.date_create >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%m-%d')
- and t1.date_create <= DATE_ADD(date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%m-%d'),INTERVAL 1 DAY)
- order by t1.date_create desc
- </if>
- <if test="order.orderStatus != 0">
- and t1.send_time >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%m-%d')
- and t1.send_time <= DATE_ADD(date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%m-%d'),INTERVAL 1 DAY)
- order by t1.send_time desc
- </if>
- </if>
- <if test="order.startDate == null and order.endDate == null">
- order by t1.send_time desc
- </if>
- </where>
- </select>
- <!--删除-->
- <delete id="batchDelete">
- delete from sc_work_order_manage
- where order_status = 0
- and id in
- <foreach collection="ids" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </delete>
- <!--根据orderPid 查询工单-->
- <select id="selectByPId" parameterType="map" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List"></include>
- from sc_work_order_manage
- where order_pid = #{orderPid,jdbcType=VARCHAR}
- </select>
- <!--查询工单派单时的用户状态-->
- <select id="selectOrderUserStatus" parameterType="java.lang.String" resultType="map">
- SELECT DISTINCT X, Y,
- CASE WHEN S IS NULL THEN '空闲' WHEN S='0' THEN '空闲' ELSE '执行中' END S ,
- CASE WHEN offlinetime IS NULL THEN '离线' WHEN offlinetime>10 THEN '离线' WHEN offlinetime <= 10 THEN '在线' END L
- FROM
- (
- select order_user_id,longtitude X, latitude Y, TIMESTAMPDIFF(second,upload_date, now()) offlinetime from sc_work_order_manage t1 left join sc_gps_data t2
- on t1.order_user_id = t2.user_id
- group by order_user_id,longtitude, latitude,upload_date
- ) a
- left join
- (
- select count(*) S,order_user_id from sc_work_order_manage
- where order_status = 1
- group by order_user_id
- ) b
- on a.order_user_id=b.order_user_id
- where a.order_user_id= #{userId,jdbcType=INTEGER}
- </select>
- <!--查询任务单派单时的用户状态-->
- <select id="selectPlanUserStatus" parameterType="java.lang.String" resultType="map">
- SELECT
- CASE WHEN S IS NULL THEN '空闲' WHEN S='0' THEN '空闲' ELSE '执行中' END S
- FROM (
- select count(*) S,user_id from sc_plan_manage
- where plan_status = 1
- group by user_id
- ) a
- where a.user_id= #{userId,jdbcType=INTEGER}
- </select>
- <!--查询维修列表的用户状态-->
- <select id="selectMaintainUserStatus" parameterType="java.lang.String" resultType="map">
- select distinct X, Y,
- case when offlinetime is null then '离线' when offlinetime>10 then '离线' when offlinetime <= 10 THEN '在线' END L
- from (
- select longtitude X, latitude Y, TIMESTAMPDIFF(second,upload_date, now()) offlinetime from sc_gps_data
- where user_id= #{userId,jdbcType=INTEGER}
- ) a
- </select>
- <!--待处理权限-->
- <select id="selectPendingPower" resultType="java.lang.Integer" parameterType="map">
- select count(1) from sc_work_order_manage
- where id = #{id,jdbcType=INTEGER} and FIND_IN_SET(#{currentUsers,jdbcType=VARCHAR},current_users)
- </select>
- <!--综合展示-查询工单执行情况-->
- <select id="selectOrderStatus" resultMap="BaseResultMap" >
- select order_status_name,sum(order_count) order_count
- from(
- select order_status,count(1) order_count ,
- case when order_status=0 then '未派单' when order_status=1 or order_status=4 then '处理中' else '已完结' end order_status_name
- from sc_work_order_manage t1
- where
- <if test="statsType == null or statsType == 0">
- t1.date_create>=date_format(curdate(), '%Y-%m' )
- </if>
- <if test="statsType == 1">
- t1.date_create>=date_format(curdate(), '%Y-1-1' )
- </if>
- <if test="statsType == 2">
- t1.date_create>=date_sub(date_format(curdate(), '%Y-%m-1' ), interval 11 month)
- </if>
- <if test="tenantId != null and tenantId != ''">
- and t1.tenant_id=#{tenantId}
- </if>
- <if test="companyOrgId != null and companyOrgId !=''">
- and t1.company_org_id=#{companyOrgId}
- </if>
- <if test="userType!=null and userType!=-999 and userType!=-9999 and programItems != null and programItems.size() > 0">
- <if test="permissonType == 5 or permissonType == 2">
- and ( t1.department_org_id in
- <foreach collection="programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- or
- t1.COMPANY_ORG_ID in
- <foreach collection="programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- )
- </if>
- <if test="permissonType == 4 or permissonType == 3">
- and t1.department_org_id in
- <foreach collection="programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- </if>
- <if test="permissonType == 1">
- and t1.COMPANY_ORG_ID in
- <foreach collection="programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- and (t1.department_org_id is null or t1.department_org_id =0)
- </if>
- </if>
- group by order_status
- )tab1
- group by order_status_name
- </select>
- <!--维修列表-工单情况(未派单,处理中)-->
- <select id="selectMaintainOrder" resultMap="BaseResultMap" >
- select t1.id ,t1.task_no, t1.address, t1.task_desc, t1.plan_finish_date, t1.date_create, t1.order_user_id, t2.flow_detail,
- case when t1.order_status=0 then '未派单' when t1.order_status =1 or t1.order_status=4 then '处理中' end order_status_name,
- case when t1.event_type=1 then '运维上报' when t1.event_type=2 then '用户上报' when t1.event_type=3 then '设备告警' end event_type_name,
- geo
- from sc_work_order_manage t1 left join sc_work_flow_detail t2 on t1.id=t2.flow_id and t2.flow_type=2
- <where>
- t1.order_status !=2 and t1.order_status !=3
- <if test="order.tenantId != null and order.tenantId != ''">
- and t1.tenant_id = #{order.tenantId}
- </if>
- <if test="order.userType!=null and order.userType!=-999 and order.userType!=-9999 and order.programItems != null and order.programItems.size() > 0">
- <if test="order.permissonType == 5 or order.permissonType == 2">
- and ( t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- or
- t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- )
- </if>
- <if test="order.permissonType == 4 or order.permissonType == 3">
- and t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- </if>
- <if test="order.permissonType == 1">
- and t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- and (t1.department_org_id is null or t1.department_org_id =0)
- </if>
- </if>
- </where>
- order by t1.date_create desc
- </select>
- <!--App事件列表-->
- <select id="findEventListPage" resultMap="OrderResultMap">
- select
- t1.id, t1.task_no, t1.task_desc, t1.order_user_id, t1.send_time, t1.send_by, t1.plan_finish_date, t1.finish_date,
- t1.date_limit, t1.urgency, t1.address, t1.contact_user, t1.contact_phone, t1.order_time, t1.company_org_id,
- t1.department_org_id, t1.order_status, t1.event_type,case when t1.event_type=1 then '运维上报' when t1.event_type=2 then '用户上报' when t1.event_type=3 then '设备告警' end event_type_name,
- t1.order_type_id, t1.order_pid, t1.tenant_id,
- t1.process_instance_id, t1.process_def_id, t1.current_task_id, t1.current_users, t1.current_task_name,
- t1.create_by, t1.date_create, t1.update_by, t1.date_update, t1.geo,t1.videos,t1.pictures,
- t1.device_id, t1.scenes_id, t1.device_name, t1.scenes_name,
- t2.flow_detail,t2.create_by detail_create_by,t2.date_create detail_date_create,t2.update_by detail_update_by,t2.date_update detail_date_update
- from sc_work_order_manage t1 left join sc_work_flow_detail t2
- on t1.id = t2.flow_id and t2.flow_type=2
- <where>
- t1.event_type = 1 and t1.create_by = #{order.createBy}
- <if test="order.tenantId != null and order.tenantId != ''">
- and t1.tenant_id = #{order.tenantId}
- </if>
- <if test="order.departmentOrgId != null and order.departmentOrgId != ''">
- and t1.department_org_id = #{order.departmentOrgId}
- </if>
- order by t1.date_create desc
- </where>
- </select>
- <!--工单完成情况统计-->
- <select id="workOrderStatistics" resultType="map">
- select total 工单总数, finished 工单完成数, finished/total 工单完成率 from
- (
- select count(1) total,sum(case when order_status=2 then 1 when order_status =3 then 1 else 0 end) finished
- from sc_work_order_manage t1
- <where>
- t1.order_status != 0
- and t1.date_create >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%m-%d')
- and t1.date_create < date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%m-%d')
- <if test="order.tenantId != null and order.tenantId != ''">
- and t1.tenant_id = #{order.tenantId}
- </if>
- <if test="order.userType!=null and order.userType!=-999 and order.userType!=-9999 and order.programItems != null and order.programItems.size() > 0">
- <if test="order.permissonType == 5 or order.permissonType == 2">
- and ( t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- or
- t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- )
- </if>
- <if test="order.permissonType == 4 or order.permissonType == 3">
- and t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- </if>
- <if test="order.permissonType == 1">
- and t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- and (t1.department_org_id is null or t1.department_org_id =0)
- </if>
- </if>
- </where>
- ) a
- </select>
- <!--事件数据月统计-->
- <select id="eventMonthStatistics" resultType="map">
- select count(1) 数量,date_format(date_create,'%Y-%m-%d') 日期
- from sc_work_order_manage t1
- <where>
- t1.date_create >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%m-%d')
- and t1.date_create < date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%m-%d')
- <if test="order.tenantId != null and order.tenantId != ''">
- and t1.tenant_id = #{order.tenantId}
- </if>
- <if test="order.userType!=null and order.userType!=-999 and order.userType!=-9999 and order.programItems != null and order.programItems.size() > 0">
- <if test="order.permissonType == 5 or order.permissonType == 2">
- and ( t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- or
- t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- )
- </if>
- <if test="order.permissonType == 4 or order.permissonType == 3">
- and t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- </if>
- <if test="order.permissonType == 1">
- and t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- and (t1.department_org_id is null or t1.department_org_id =0)
- </if>
- </if>
- </where>
- group by date_format(date_create,'%Y-%m-%d')
- order by date_format(date_create,'%Y-%m-%d')
- </select>
- <!--事件数据年统计-->
- <select id="eventYearStatistics" resultType="map">
- select count(1) 数量,date_format(date_create,'%Y-%m') 日期
- from sc_work_order_manage t1
- <where>
- t1.date_create >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%m-%d')
- and t1.date_create < date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%m-%d')
- <if test="order.tenantId != null and order.tenantId != ''">
- and t1.tenant_id = #{order.tenantId}
- </if>
- <if test="order.userType!=null and order.userType!=-999 and order.userType!=-9999 and order.programItems != null and order.programItems.size() > 0">
- <if test="order.permissonType == 5 or order.permissonType == 2">
- and ( t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- or
- t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- )
- </if>
- <if test="order.permissonType == 4 or order.permissonType == 3">
- and t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- </if>
- <if test="order.permissonType == 1">
- and t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- and (t1.department_org_id is null or t1.department_org_id =0)
- </if>
- </if>
- </where>
- group by date_format(date_create,'%Y-%m')
- order by date_format(date_create,'%Y-%m')
- </select>
- <!--上报类型统计-->
- <select id="reportStatistics" resultMap="StatisticsMap">
- select case when t1.event_type=1 then '运维上报' when t1.event_type=2 then '用户上报' when t1.event_type=3 then '设备告警' end statistics_name,
- count(*) statistics_value
- from sc_work_order_manage t1
- <where>
- t1.date_create >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%m-%d')
- and t1.date_create < date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%m-%d')
- <if test="order.tenantId != null and order.tenantId != ''">
- and t1.tenant_id = #{order.tenantId}
- </if>
- <if test="order.userType!=null and order.userType!=-999 and order.userType!=-9999 and order.programItems != null and order.programItems.size() > 0">
- <if test="order.permissonType == 5 or order.permissonType == 2">
- and ( t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- or
- t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- )
- </if>
- <if test="order.permissonType == 4 or order.permissonType == 3">
- and t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- </if>
- <if test="order.permissonType == 1">
- and t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- and (t1.department_org_id is null or t1.department_org_id =0)
- </if>
- </if>
- </where>
- group by t1.event_type
- </select>
- <!--工单状态统计-->
- <select id="orderStatusStatistics" resultMap="StatisticsMap">
- select 工单状态 statistics_name,sum(数量) statistics_value from
- (
- select case when t1.order_status=0 then '未派单' when t1.order_status=1 or t1.order_status=4 then '处理中'
- when t1.order_status=2 then '已完成' when t1.order_status=3 then '终止' end 工单状态,count(*) 数量
- from sc_work_order_manage t1
- <where>
- t1.date_create >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%m-%d')
- and t1.date_create < date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%m-%d')
- <if test="order.tenantId != null and order.tenantId != ''">
- and t1.tenant_id = #{order.tenantId}
- </if>
- <if test="order.userType!=null and order.userType!=-999 and order.userType!=-9999 and order.programItems != null and order.programItems.size() > 0">
- <if test="order.permissonType == 5 or order.permissonType == 2">
- and ( t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- or
- t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- )
- </if>
- <if test="order.permissonType == 4 or order.permissonType == 3">
- and t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- </if>
- <if test="order.permissonType == 1">
- and t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- and (t1.department_org_id is null or t1.department_org_id =0)
- </if>
- </if>
- </where>
- group by t1.order_status
- ) a
- group by 工单状态
- </select>
- <!--工单类型统计-->
- <select id="orderTypeStatistics" resultMap="StatisticsMap">
- select case when t1.order_type_id=1 then '表务工单' when t1.order_type_id=2 then '停通水工单'
- when t1.order_type_id=3 then '抢修工单' when t1.order_type_id=4 then '漏点定位工单'
- when t1.order_type_id=5 then '测漏工单' when t1.order_type_id=6 then '违章跑水工单'
- when t1.order_type_id=10 then '压力调度工单' end statistics_name,
- count(*) statistics_value
- from sc_work_order_manage t1
- <where>
- t1.order_type_id>=1
- and t1.date_create >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%m-%d')
- and t1.date_create < date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%m-%d')
- <if test="order.tenantId != null and order.tenantId != ''">
- and t1.tenant_id = #{order.tenantId}
- </if>
- <if test="order.userType!=null and order.userType!=-999 and order.userType!=-9999 and order.programItems != null and order.programItems.size() > 0">
- <if test="order.permissonType == 5 or order.permissonType == 2">
- and ( t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- or
- t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- )
- </if>
- <if test="order.permissonType == 4 or order.permissonType == 3">
- and t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- </if>
- <if test="order.permissonType == 1">
- and t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- and (t1.department_org_id is null or t1.department_org_id =0)
- </if>
- </if>
- </where>
- group by t1.order_type_id
- </select>
- <!--工单时长统计-->
- <select id="orderDurationStatistics" resultMap="StatisticsMap">
- select count(*) statistics_value,duration statistics_name from(
- select case when duration<=1 then 1 when duration>1 and duration<=2 then 2
- when duration>2 and duration<=3 then 3 when duration>3 and duration<=4 then 4
- else 5 end duration
- from
- (
- select TIMESTAMPDIFF(DAY,date_create,finish_date) duration
- from sc_work_order_manage t1
- <where>
- (t1.order_status=2 or t1.order_status=3)
- and t1.date_create >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%m-%d')
- and t1.date_create < date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%m-%d')
- <if test="order.tenantId != null and order.tenantId != ''">
- and t1.tenant_id = #{order.tenantId}
- </if>
- <if test="order.userType!=null and order.userType!=-999 and order.userType!=-9999 and order.programItems != null and order.programItems.size() > 0">
- <if test="order.permissonType == 5 or order.permissonType == 2">
- and ( t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- or
- t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- )
- </if>
- <if test="order.permissonType == 4 or order.permissonType == 3">
- and t1.department_org_id in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- </if>
- <if test="order.permissonType == 1">
- and t1.COMPANY_ORG_ID in
- <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- and (t1.department_org_id is null or t1.department_org_id =0)
- </if>
- </if>
- </where>
- )a ) b
- group by duration
- </select>
- <select id="selectByTime" resultMap="BaseResultMap">
- select distinct t1.id,task_no,send_time,address,order_type_id,current_task_name,t1.create_by,t1.update_by,task_desc,order_status,in_process_status,t1.plan_finish_date,t1.finish_date,t1.date_create,t1.date_limit
- from sc_work_order_manage t1
- left join sc_work_flow_log t2 ON t1.id=t2.flow_id and flow_type=2 and find_in_set(#{userId},handle_user_id) and left(flow_result,2)='拒单'
- where (find_in_set(#{userId},current_users)
- or t1.id in(select flow_id from sc_work_flow_log where flow_type=2 and find_in_set(#{userId},handle_user_id)))
- and tenant_id = #{tenantId}
- and (t2.id is null or t1.order_user_id=t2.handle_user_id)
- and t1.date_create between #{startTime} and #{endTime}
- union
- select id,plan_id,plan_date,task_area_name,task_type,current_task_name,create_by,update_by,task_content,plan_status,in_process_status,plan_end_date,finish_date,date_create,"0"
- from sc_plan_manage
- where (find_in_set(#{userId},current_users)
- or id in(select flow_id from sc_work_flow_log where flow_type=1 and find_in_set(#{userId},handle_user_id)))
- and tenant_id = #{tenantId}
- and date_create between #{startTime} and #{endTime}
- order by send_time desc
- </select>
- </mapper>
|