12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226 |
- <?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
- when duration>4 and duration<=5 then 5 else 6 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>
- <!--派单次数月统计-->
- <select id="dispatchTimesMonthStatistics" resultType="map">
- select count(1) 数量, DATE_FORMAT(send_time,'%Y-%m-%d') 日期
- from sc_work_order_manage t1
- where t1.send_time >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%m-%d')
- and t1.send_time < date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%m-%d')
- and device_id in
- <foreach collection="idList" item="item" open="(" close=")" separator=",">
- #{item,jdbcType=INTEGER}
- </foreach>
- group by DATE_FORMAT(send_time,'%Y-%m-%d')
- </select>
- <!--派单次数年统计-->
- <select id="dispatchTimesYearStatistics" resultType="map">
- select count(1) 数量, DATE_FORMAT(send_time,'%Y-%m') 日期
- from sc_work_order_manage t1
- where t1.send_time >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%m-%d')
- and t1.send_time < date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%m-%d')
- and device_id in
- <foreach collection="idList" item="item" open="(" close=")" separator=",">
- #{item,jdbcType=INTEGER}
- </foreach>
- group by DATE_FORMAT(send_time,'%Y-%m')
- </select>
- </mapper>
|