123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910 |
- <?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>
- <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-%c-%d')
- and t1.date_create <= DATE_ADD(date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%c-%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-%c-%d')
- and t1.send_time <= DATE_ADD(date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%c-%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-%c-%d')
- and t1.date_create < date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%c-%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>
- </mapper>
|