WorkOrderManageMapper.xml 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.huaxu.order.dao.WorkOrderManageMapper" >
  4. <resultMap id="BaseResultMap" type="com.huaxu.order.dto.WorkOrderManageDto" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="task_no" property="taskNo" jdbcType="VARCHAR" />
  7. <result column="task_desc" property="taskDesc" jdbcType="VARCHAR" />
  8. <result column="order_user_id" property="orderUserId" jdbcType="VARCHAR" />
  9. <result column="send_time" property="sendTime" jdbcType="TIMESTAMP" />
  10. <result column="send_by" property="sendBy" jdbcType="VARCHAR" />
  11. <result column="plan_finish_date" property="planFinishDate" jdbcType="TIMESTAMP" />
  12. <result column="finish_date" property="finishDate" jdbcType="TIMESTAMP" />
  13. <result column="date_limit" property="dateLimit" jdbcType="VARCHAR" />
  14. <result column="urgency" property="urgency" jdbcType="VARCHAR" />
  15. <result column="address" property="address" jdbcType="VARCHAR" />
  16. <result column="contact_user" property="contactUser" jdbcType="VARCHAR" />
  17. <result column="contact_phone" property="contactPhone" jdbcType="VARCHAR" />
  18. <result column="order_time" property="orderTime" jdbcType="VARCHAR" />
  19. <result column="company_org_id" property="companyOrgId" jdbcType="VARCHAR" />
  20. <result column="department_org_id" property="departmentOrgId" jdbcType="VARCHAR" />
  21. <result column="order_status" property="orderStatus" jdbcType="INTEGER" />
  22. <result column="event_type" property="eventType" jdbcType="INTEGER" />
  23. <result column="event_type_name" property="eventTypeName" jdbcType="VARCHAR" />
  24. <result column="order_type_id" property="orderTypeId" jdbcType="INTEGER" />
  25. <result column="order_pid" property="orderPid" jdbcType="VARCHAR" />
  26. <result column="tenant_id" property="tenantId" jdbcType="VARCHAR" />
  27. <result column="process_instance_id" property="processInstanceId" jdbcType="VARCHAR" />
  28. <result column="process_def_id" property="processDefId" jdbcType="VARCHAR" />
  29. <result column="current_task_id" property="currentTaskId" jdbcType="VARCHAR" />
  30. <result column="current_users" property="currentUsers" jdbcType="VARCHAR" />
  31. <result column="current_task_name" property="currentTaskName" jdbcType="VARCHAR" />
  32. <result column="create_by" property="createBy" jdbcType="VARCHAR" />
  33. <result column="date_create" property="dateCreate" jdbcType="TIMESTAMP" />
  34. <result column="update_by" property="updateBy" jdbcType="VARCHAR" />
  35. <result column="date_update" property="dateUpdate" jdbcType="TIMESTAMP" />
  36. <result column="geo" property="geo" jdbcType="VARCHAR" />
  37. <result column="videos" property="videos" jdbcType="VARCHAR" />
  38. <result column="pictures" property="pictures" jdbcType="VARCHAR" />
  39. <result column="flow_detail" property="flowDetail" jdbcType="VARCHAR" />
  40. <result column="device_id" property="deviceId" jdbcType="INTEGER" />
  41. <result column="scenes_id" property="scenesId" jdbcType="INTEGER" />
  42. <result column="device_name" property="deviceName" jdbcType="VARCHAR" />
  43. <result column="scenes_name" property="scenesName" jdbcType="VARCHAR" />
  44. <result column="order_status_name" property="orderStatusName" jdbcType="VARCHAR" />
  45. <result column="order_count" property="orderCount" jdbcType="VARCHAR" />
  46. </resultMap>
  47. <resultMap id="workFlowLogResultMap" type="com.huaxu.order.entity.WorkFlowLog">
  48. <id column="id" property="id" jdbcType="INTEGER" />
  49. <result column="flow_id" property="flowId" jdbcType="INTEGER" />
  50. <result column="log_process_instance_id" property="processInstanceId" jdbcType="VARCHAR" />
  51. <result column="task_id" property="taskId" jdbcType="VARCHAR" />
  52. <result column="handle_user_id" property="handleUserId" jdbcType="VARCHAR" />
  53. <result column="handle_user_name" property="handleUserName" jdbcType="VARCHAR" />
  54. <result column="flow_type" property="flowType" jdbcType="INTEGER" />
  55. <result column="flow_result" property="flowResult" jdbcType="VARCHAR" />
  56. <result column="log_create_by" property="createBy" jdbcType="VARCHAR" />
  57. <result column="log_date_create" property="dateCreate" jdbcType="TIMESTAMP" />
  58. <result column="log_update_by" property="updateBy" jdbcType="VARCHAR" />
  59. <result column="log_date_update" property="dateUpdate" jdbcType="TIMESTAMP" />
  60. </resultMap>
  61. <resultMap id="OrderResultMap" type="com.huaxu.order.dto.WorkOrderManageDto" extends="BaseResultMap">
  62. <association property="workFlowDetail" javaType="com.huaxu.order.entity.WorkFlowDetail">
  63. <id column="id" property="id" jdbcType="INTEGER" />
  64. <result column="flow_id" property="flowId" jdbcType="INTEGER" />
  65. <result column="flow_type" property="flowType" jdbcType="INTEGER" />
  66. <result column="flow_detail" property="flowDetail" jdbcType="VARCHAR" />
  67. <result column="detail_create_by" property="createBy" jdbcType="VARCHAR" />
  68. <result column="detail_date_create" property="dateCreate" jdbcType="TIMESTAMP" />
  69. <result column="detail_update_by" property="updateBy" jdbcType="VARCHAR" />
  70. <result column="detail_date_update" property="dateUpdate" jdbcType="TIMESTAMP" />
  71. </association>
  72. <collection property="workFlowLogList" ofType="com.huaxu.order.entity.WorkFlowLog" javaType="java.util.List" select="getWorkFlowLog" column="{flowId=id}">
  73. <id column="id" property="id" jdbcType="INTEGER" />
  74. <result column="flow_id" property="flowId" jdbcType="INTEGER" />
  75. <result column="log_process_instance_id" property="processInstanceId" jdbcType="VARCHAR" />
  76. <result column="task_id" property="taskId" jdbcType="VARCHAR" />
  77. <result column="handle_user_id" property="handleUserId" jdbcType="VARCHAR" />
  78. <result column="handle_user_name" property="handleUserName" jdbcType="VARCHAR" />
  79. <result column="flow_type" property="flowType" jdbcType="INTEGER" />
  80. <result column="flow_result" property="flowResult" jdbcType="VARCHAR" />
  81. <result column="log_create_by" property="createBy" jdbcType="VARCHAR" />
  82. <result column="log_date_create" property="dateCreate" jdbcType="TIMESTAMP" />
  83. <result column="log_update_by" property="updateBy" jdbcType="VARCHAR" />
  84. <result column="log_date_update" property="dateUpdate" jdbcType="TIMESTAMP" />
  85. </collection>
  86. </resultMap>
  87. <sql id="Base_Column_List" >
  88. id, task_no, task_desc, order_user_id, send_time, send_by, plan_finish_date, finish_date,
  89. date_limit, urgency, address, contact_user, contact_phone, order_time, company_org_id,
  90. department_org_id, order_status, event_type, order_type_id, order_pid, tenant_id,
  91. process_instance_id, process_def_id, current_task_id, current_users, current_task_name,
  92. create_by, date_create, update_by, date_update, geo,videos, pictures, device_id, scenes_id,
  93. device_name, scenes_name
  94. </sql>
  95. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  96. select
  97. <include refid="Base_Column_List" />
  98. from sc_work_order_manage
  99. where id = #{id,jdbcType=INTEGER}
  100. </select>
  101. <select id="getWorkFlowLog" resultMap="workFlowLogResultMap" parameterType="map">
  102. 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,
  103. t3.date_create log_date_create,t3.update_by log_update_by,t3.date_update log_date_update
  104. from sc_work_flow_log t3
  105. where t3.flow_id= #{flowId,jdbcType=INTEGER} and t3.flow_type=2
  106. </select>
  107. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  108. delete from sc_work_order_manage
  109. where id = #{id,jdbcType=INTEGER}
  110. </delete>
  111. <insert id="insert" parameterType="com.huaxu.order.entity.WorkOrderManage" >
  112. insert into sc_work_order_manage (id, task_no, task_desc,
  113. order_user_id, send_time, send_by,
  114. plan_finish_date, finish_date, date_limit,
  115. urgency, address, contact_user,
  116. contact_phone, order_time, company_org_id,
  117. department_org_id, order_status, event_type,
  118. order_type_id, order_pid, tenant_id,
  119. process_instance_id, process_def_id, current_task_id,
  120. current_users, current_task_name, create_by,
  121. date_create, update_by, date_update,
  122. geo,videos,pictures)
  123. values (#{id,jdbcType=INTEGER}, #{taskNo,jdbcType=VARCHAR}, #{taskDesc,jdbcType=VARCHAR},
  124. #{orderUserId,jdbcType=VARCHAR}, #{sendTime,jdbcType=TIMESTAMP}, #{sendBy,jdbcType=VARCHAR},
  125. #{planFinishDate,jdbcType=TIMESTAMP}, #{finishDate,jdbcType=TIMESTAMP}, #{dateLimit,jdbcType=VARCHAR},
  126. #{urgency,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, #{contactUser,jdbcType=VARCHAR},
  127. #{contactPhone,jdbcType=VARCHAR}, #{orderTime,jdbcType=VARCHAR}, #{companyOrgId,jdbcType=VARCHAR},
  128. #{departmentOrgId,jdbcType=VARCHAR}, #{orderStatus,jdbcType=INTEGER}, #{eventType,jdbcType=INTEGER},
  129. #{orderTypeId,jdbcType=INTEGER}, #{orderPid,jdbcType=VARCHAR}, #{tenantId,jdbcType=VARCHAR},
  130. #{processInstanceId,jdbcType=VARCHAR}, #{processDefId,jdbcType=VARCHAR}, #{currentTaskId,jdbcType=VARCHAR},
  131. #{currentUsers,jdbcType=VARCHAR}, #{currentTaskName,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
  132. #{dateCreate,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, #{dateUpdate,jdbcType=TIMESTAMP},
  133. #{geo,jdbcType=VARCHAR},#{videos,jdbcType=VARCHAR},#{pictures,jdbcType=VARCHAR})
  134. </insert>
  135. <insert id="insertSelective" parameterType="com.huaxu.order.entity.WorkOrderManage" keyProperty="id" useGeneratedKeys="true">
  136. insert into sc_work_order_manage
  137. <trim prefix="(" suffix=")" suffixOverrides="," >
  138. <if test="id != null" >
  139. id,
  140. </if>
  141. <if test="taskNo != null" >
  142. task_no,
  143. </if>
  144. <if test="taskDesc != null" >
  145. task_desc,
  146. </if>
  147. <if test="orderUserId != null" >
  148. order_user_id,
  149. </if>
  150. <if test="sendTime != null" >
  151. send_time,
  152. </if>
  153. <if test="sendBy != null" >
  154. send_by,
  155. </if>
  156. <if test="planFinishDate != null" >
  157. plan_finish_date,
  158. </if>
  159. <if test="finishDate != null" >
  160. finish_date,
  161. </if>
  162. <if test="dateLimit != null" >
  163. date_limit,
  164. </if>
  165. <if test="urgency != null" >
  166. urgency,
  167. </if>
  168. <if test="address != null" >
  169. address,
  170. </if>
  171. <if test="contactUser != null" >
  172. contact_user,
  173. </if>
  174. <if test="contactPhone != null" >
  175. contact_phone,
  176. </if>
  177. <if test="orderTime != null" >
  178. order_time,
  179. </if>
  180. <if test="companyOrgId != null" >
  181. company_org_id,
  182. </if>
  183. <if test="departmentOrgId != null" >
  184. department_org_id,
  185. </if>
  186. <if test="orderStatus != null" >
  187. order_status,
  188. </if>
  189. <if test="eventType != null" >
  190. event_type,
  191. </if>
  192. <if test="orderTypeId != null" >
  193. order_type_id,
  194. </if>
  195. <if test="orderPid != null" >
  196. order_pid,
  197. </if>
  198. <if test="tenantId != null" >
  199. tenant_id,
  200. </if>
  201. <if test="processInstanceId != null" >
  202. process_instance_id,
  203. </if>
  204. <if test="processDefId != null" >
  205. process_def_id,
  206. </if>
  207. <if test="currentTaskId != null" >
  208. current_task_id,
  209. </if>
  210. <if test="currentUsers != null" >
  211. current_users,
  212. </if>
  213. <if test="currentTaskName != null" >
  214. current_task_name,
  215. </if>
  216. <if test="createBy != null" >
  217. create_by,
  218. </if>
  219. <if test="dateCreate != null" >
  220. date_create,
  221. </if>
  222. <if test="updateBy != null" >
  223. update_by,
  224. </if>
  225. <if test="dateUpdate != null" >
  226. date_update,
  227. </if>
  228. <if test="geo != null" >
  229. geo,
  230. </if>
  231. <if test="videos != null" >
  232. videos,
  233. </if>
  234. <if test="pictures != null" >
  235. pictures,
  236. </if>
  237. <if test="deviceId != null" >
  238. device_id,
  239. </if>
  240. <if test="scenesId != null" >
  241. scenes_id,
  242. </if>
  243. <if test="deviceName != null" >
  244. device_name,
  245. </if>
  246. <if test="scenesName != null" >
  247. scenes_name,
  248. </if>
  249. </trim>
  250. <trim prefix="values (" suffix=")" suffixOverrides="," >
  251. <if test="id != null" >
  252. #{id,jdbcType=INTEGER},
  253. </if>
  254. <if test="taskNo != null" >
  255. #{taskNo,jdbcType=VARCHAR},
  256. </if>
  257. <if test="taskDesc != null" >
  258. #{taskDesc,jdbcType=VARCHAR},
  259. </if>
  260. <if test="orderUserId != null" >
  261. #{orderUserId,jdbcType=VARCHAR},
  262. </if>
  263. <if test="sendTime != null" >
  264. #{sendTime,jdbcType=TIMESTAMP},
  265. </if>
  266. <if test="sendBy != null" >
  267. #{sendBy,jdbcType=VARCHAR},
  268. </if>
  269. <if test="planFinishDate != null" >
  270. #{planFinishDate,jdbcType=TIMESTAMP},
  271. </if>
  272. <if test="finishDate != null" >
  273. #{finishDate,jdbcType=TIMESTAMP},
  274. </if>
  275. <if test="dateLimit != null" >
  276. #{dateLimit,jdbcType=VARCHAR},
  277. </if>
  278. <if test="urgency != null" >
  279. #{urgency,jdbcType=VARCHAR},
  280. </if>
  281. <if test="address != null" >
  282. #{address,jdbcType=VARCHAR},
  283. </if>
  284. <if test="contactUser != null" >
  285. #{contactUser,jdbcType=VARCHAR},
  286. </if>
  287. <if test="contactPhone != null" >
  288. #{contactPhone,jdbcType=VARCHAR},
  289. </if>
  290. <if test="orderTime != null" >
  291. #{orderTime,jdbcType=VARCHAR},
  292. </if>
  293. <if test="companyOrgId != null" >
  294. #{companyOrgId,jdbcType=VARCHAR},
  295. </if>
  296. <if test="departmentOrgId != null" >
  297. #{departmentOrgId,jdbcType=VARCHAR},
  298. </if>
  299. <if test="orderStatus != null" >
  300. #{orderStatus,jdbcType=INTEGER},
  301. </if>
  302. <if test="eventType != null" >
  303. #{eventType,jdbcType=INTEGER},
  304. </if>
  305. <if test="orderTypeId != null" >
  306. #{orderTypeId,jdbcType=INTEGER},
  307. </if>
  308. <if test="orderPid != null" >
  309. #{orderPid,jdbcType=VARCHAR},
  310. </if>
  311. <if test="tenantId != null" >
  312. #{tenantId,jdbcType=VARCHAR},
  313. </if>
  314. <if test="processInstanceId != null" >
  315. #{processInstanceId,jdbcType=VARCHAR},
  316. </if>
  317. <if test="processDefId != null" >
  318. #{processDefId,jdbcType=VARCHAR},
  319. </if>
  320. <if test="currentTaskId != null" >
  321. #{currentTaskId,jdbcType=VARCHAR},
  322. </if>
  323. <if test="currentUsers != null" >
  324. #{currentUsers,jdbcType=VARCHAR},
  325. </if>
  326. <if test="currentTaskName != null" >
  327. #{currentTaskName,jdbcType=VARCHAR},
  328. </if>
  329. <if test="createBy != null" >
  330. #{createBy,jdbcType=VARCHAR},
  331. </if>
  332. <if test="dateCreate != null" >
  333. #{dateCreate,jdbcType=TIMESTAMP},
  334. </if>
  335. <if test="updateBy != null" >
  336. #{updateBy,jdbcType=VARCHAR},
  337. </if>
  338. <if test="dateUpdate != null" >
  339. #{dateUpdate,jdbcType=TIMESTAMP},
  340. </if>
  341. <if test="geo != null" >
  342. #{geo,jdbcType=VARCHAR},
  343. </if>
  344. <if test="videos != null" >
  345. #{videos,jdbcType=VARCHAR},
  346. </if>
  347. <if test="pictures != null" >
  348. #{pictures,jdbcType=VARCHAR},
  349. </if>
  350. <if test="deviceId != null" >
  351. #{deviceId,jdbcType=INTEGER},
  352. </if>
  353. <if test="scenesId != null" >
  354. #{scenesId,jdbcType=INTEGER},
  355. </if>
  356. <if test="deviceName != null" >
  357. #{deviceName,jdbcType=VARCHAR},
  358. </if>
  359. <if test="scenesName != null" >
  360. #{scenesName,jdbcType=VARCHAR},
  361. </if>
  362. </trim>
  363. </insert>
  364. <update id="updateByPrimaryKeySelective" parameterType="com.huaxu.order.entity.WorkOrderManage" >
  365. update sc_work_order_manage
  366. <set >
  367. <if test="taskNo != null" >
  368. task_no = #{taskNo,jdbcType=VARCHAR},
  369. </if>
  370. <if test="taskDesc != null" >
  371. task_desc = #{taskDesc,jdbcType=VARCHAR},
  372. </if>
  373. <if test="orderUserId != null" >
  374. order_user_id = #{orderUserId,jdbcType=VARCHAR},
  375. </if>
  376. <if test="sendTime != null" >
  377. send_time = #{sendTime,jdbcType=TIMESTAMP},
  378. </if>
  379. <if test="sendBy != null" >
  380. send_by = #{sendBy,jdbcType=VARCHAR},
  381. </if>
  382. <if test="planFinishDate != null" >
  383. plan_finish_date = #{planFinishDate,jdbcType=TIMESTAMP},
  384. </if>
  385. <if test="finishDate != null" >
  386. finish_date = #{finishDate,jdbcType=TIMESTAMP},
  387. </if>
  388. <if test="dateLimit != null" >
  389. date_limit = #{dateLimit,jdbcType=VARCHAR},
  390. </if>
  391. <if test="urgency != null" >
  392. urgency = #{urgency,jdbcType=VARCHAR},
  393. </if>
  394. <if test="address != null" >
  395. address = #{address,jdbcType=VARCHAR},
  396. </if>
  397. <if test="contactUser != null" >
  398. contact_user = #{contactUser,jdbcType=VARCHAR},
  399. </if>
  400. <if test="contactPhone != null" >
  401. contact_phone = #{contactPhone,jdbcType=VARCHAR},
  402. </if>
  403. <if test="orderTime != null" >
  404. order_time = #{orderTime,jdbcType=VARCHAR},
  405. </if>
  406. <if test="companyOrgId != null" >
  407. company_org_id = #{companyOrgId,jdbcType=VARCHAR},
  408. </if>
  409. <if test="departmentOrgId != null" >
  410. department_org_id = #{departmentOrgId,jdbcType=VARCHAR},
  411. </if>
  412. <if test="orderStatus != null" >
  413. order_status = #{orderStatus,jdbcType=INTEGER},
  414. </if>
  415. <if test="eventType != null" >
  416. event_type = #{eventType,jdbcType=INTEGER},
  417. </if>
  418. <if test="orderTypeId != null" >
  419. order_type_id = #{orderTypeId,jdbcType=INTEGER},
  420. </if>
  421. <if test="orderPid != null" >
  422. order_pid = #{orderPid,jdbcType=VARCHAR},
  423. </if>
  424. <if test="tenantId != null" >
  425. tenant_id = #{tenantId,jdbcType=VARCHAR},
  426. </if>
  427. <if test="processInstanceId != null" >
  428. process_instance_id = #{processInstanceId,jdbcType=VARCHAR},
  429. </if>
  430. <if test="processDefId != null" >
  431. process_def_id = #{processDefId,jdbcType=VARCHAR},
  432. </if>
  433. <if test="currentTaskId != null" >
  434. current_task_id = #{currentTaskId,jdbcType=VARCHAR},
  435. </if>
  436. <if test="currentUsers != null" >
  437. current_users = #{currentUsers,jdbcType=VARCHAR},
  438. </if>
  439. <if test="currentTaskName != null" >
  440. current_task_name = #{currentTaskName,jdbcType=VARCHAR},
  441. </if>
  442. <if test="createBy != null" >
  443. create_by = #{createBy,jdbcType=VARCHAR},
  444. </if>
  445. <if test="dateCreate != null" >
  446. date_create = #{dateCreate,jdbcType=TIMESTAMP},
  447. </if>
  448. <if test="updateBy != null" >
  449. update_by = #{updateBy,jdbcType=VARCHAR},
  450. </if>
  451. <if test="dateUpdate != null" >
  452. date_update = #{dateUpdate,jdbcType=TIMESTAMP},
  453. </if>
  454. <if test="geo != null" >
  455. geo = #{geo,jdbcType=VARCHAR},
  456. </if>
  457. <if test="videos != null" >
  458. videos=#{videos,jdbcType=VARCHAR},
  459. </if>
  460. <if test="pictures != null" >
  461. pictures=#{pictures,jdbcType=VARCHAR},
  462. </if>
  463. </set>
  464. where id = #{id,jdbcType=INTEGER}
  465. </update>
  466. <update id="updateByPrimaryKey" parameterType="com.huaxu.order.entity.WorkOrderManage" >
  467. update sc_work_order_manage
  468. set task_no = #{taskNo,jdbcType=VARCHAR},
  469. task_desc = #{taskDesc,jdbcType=VARCHAR},
  470. order_user_id = #{orderUserId,jdbcType=VARCHAR},
  471. send_time = #{sendTime,jdbcType=TIMESTAMP},
  472. send_by = #{sendBy,jdbcType=VARCHAR},
  473. plan_finish_date = #{planFinishDate,jdbcType=TIMESTAMP},
  474. finish_date = #{finishDate,jdbcType=TIMESTAMP},
  475. date_limit = #{dateLimit,jdbcType=VARCHAR},
  476. urgency = #{urgency,jdbcType=VARCHAR},
  477. address = #{address,jdbcType=VARCHAR},
  478. contact_user = #{contactUser,jdbcType=VARCHAR},
  479. contact_phone = #{contactPhone,jdbcType=VARCHAR},
  480. order_time = #{orderTime,jdbcType=VARCHAR},
  481. company_org_id = #{companyOrgId,jdbcType=VARCHAR},
  482. department_org_id = #{departmentOrgId,jdbcType=VARCHAR},
  483. order_status = #{orderStatus,jdbcType=INTEGER},
  484. event_type = #{eventType,jdbcType=INTEGER},
  485. order_type_id = #{orderTypeId,jdbcType=INTEGER},
  486. order_pid = #{orderPid,jdbcType=VARCHAR},
  487. tenant_id = #{tenantId,jdbcType=VARCHAR},
  488. process_instance_id = #{processInstanceId,jdbcType=VARCHAR},
  489. process_def_id = #{processDefId,jdbcType=VARCHAR},
  490. current_task_id = #{currentTaskId,jdbcType=VARCHAR},
  491. current_users = #{currentUsers,jdbcType=VARCHAR},
  492. current_task_name = #{currentTaskName,jdbcType=VARCHAR},
  493. create_by = #{createBy,jdbcType=VARCHAR},
  494. date_create = #{dateCreate,jdbcType=TIMESTAMP},
  495. update_by = #{updateBy,jdbcType=VARCHAR},
  496. date_update = #{dateUpdate,jdbcType=TIMESTAMP},
  497. geo = #{geo,jdbcType=VARCHAR},
  498. videos = #{videos,jdbcType=VARCHAR},
  499. pictures = #{pictures,jdbcType=VARCHAR}
  500. where id = #{id,jdbcType=INTEGER}
  501. </update>
  502. <select id="selectAppTodo" resultMap="BaseResultMap">
  503. select id,task_no,send_time,address,order_type_id,create_by,update_by,task_desc,order_status,current_task_name
  504. from sc_work_order_manage
  505. where find_in_set(#{userId},current_users) and tenant_id = #{tenantId}
  506. union
  507. select id,plan_id,plan_date,task_area_name,task_type,create_by,update_by,task_content,plan_status,current_task_name
  508. from sc_plan_manage
  509. where find_in_set(#{userId},current_users) and tenant_id = #{tenantId}
  510. order by send_time desc
  511. </select>
  512. <select id="selectAppAll" resultMap="BaseResultMap">
  513. select id,task_no,send_time,address,order_type_id,current_task_name,create_by,update_by,task_desc,order_status
  514. from sc_work_order_manage
  515. where (find_in_set(#{userId},current_users)
  516. or id in(select flow_id from sc_work_flow_log where flow_type=2 and find_in_set(#{userId},handle_user_id)))
  517. and tenant_id = #{tenantId}
  518. union
  519. select id,plan_id,plan_date,task_area_name,task_type,current_task_name,create_by,update_by,task_content,plan_status
  520. from sc_plan_manage
  521. where (find_in_set(#{userId},current_users)
  522. or id in(select flow_id from sc_work_flow_log where flow_type=1 and find_in_set(#{userId},handle_user_id)))
  523. and tenant_id = #{tenantId}
  524. order by send_time desc
  525. </select>
  526. <select id="selectOrderDetail" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  527. select t1.*,t2.flow_detail
  528. from sc_work_order_manage t1
  529. left join sc_work_flow_detail t2 on t1.id=t2.flow_id and t2.flow_type=2
  530. where t1.id = #{id,jdbcType=INTEGER} or t1.order_pid = #{orderPid,jdbcType=INTEGER}
  531. order by t1.order_pid
  532. </select>
  533. <insert id="batchInsertByAlarms" >
  534. 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)
  535. values
  536. <foreach collection="workOrderManages" item="item" index="index" separator=",">
  537. (#{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})
  538. </foreach>
  539. </insert>
  540. <delete id="batchDeleteByAlarms" >
  541. delete from sc_work_order_manage
  542. where order_status = 0 and device_id in
  543. <foreach collection="deviceIds" item="item" open="(" close=")" index="index" separator=",">
  544. #{item}
  545. </foreach>
  546. </delete>
  547. <select id="findWorkOrderByDeviceIds" resultType="com.huaxu.order.dto.WorkOrderManageByAlarmDto">
  548. select
  549. id
  550. ,device_id as "deviceId"
  551. , task_desc as "taskDesc"
  552. , order_status as "orderStatus"
  553. from sc_work_order_manage
  554. where (order_status = 0 or order_status = 1)
  555. and device_id in
  556. <foreach collection="deviceIds" item="item" open="(" close=")" index="index" separator=",">
  557. #{item}
  558. </foreach>
  559. </select>
  560. <update id="updateByAlarms">
  561. update sc_work_order_manage set task_desc =#{workOrderManage.taskDesc} ,date_update = now() where id=#{workOrderManage.id}
  562. </update>
  563. <!--分页查询-->
  564. <select id="findPage" resultMap="OrderResultMap">
  565. select
  566. 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,
  567. t1.date_limit, t1.urgency, t1.address, t1.contact_user, t1.contact_phone, t1.order_time, t1.company_org_id,
  568. 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,
  569. t1.order_type_id, t1.order_pid, t1.tenant_id,
  570. t1.process_instance_id, t1.process_def_id, t1.current_task_id, t1.current_users, t1.current_task_name,
  571. t1.create_by, t1.date_create, t1.update_by, t1.date_update, t1.geo,t1.videos,t1.pictures,
  572. t1.device_id, t1.scenes_id, t1.device_name, t1.scenes_name,
  573. 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
  574. from sc_work_order_manage t1 left join sc_work_flow_detail t2
  575. on t1.id = t2.flow_id and t2.flow_type=2
  576. <where>
  577. <if test="order.tenantId != null and order.tenantId != ''">
  578. and t1.tenant_id = #{order.tenantId}
  579. </if>
  580. <if test="order.taskNo != null and order.taskNo != ''">
  581. and t1.task_no like CONCAT('%',#{order.taskNo},'%')
  582. </if>
  583. <if test="order.orderPid != null">
  584. and t1.order_pid = #{order.orderPid,jdbcType=INTEGER}
  585. </if>
  586. <if test="order.userType!=null and order.userType!=-999 and order.userType!=-9999 and order.programItems != null and order.programItems.size() > 0">
  587. <if test="order.permissonType == 5 or order.permissonType == 2">
  588. and ( t1.department_org_id in
  589. <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
  590. #{item.orgId}
  591. </foreach>
  592. or
  593. t1.COMPANY_ORG_ID in
  594. <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
  595. #{item.orgId}
  596. </foreach>
  597. )
  598. </if>
  599. <if test="order.permissonType == 4 or order.permissonType == 3">
  600. and t1.department_org_id in
  601. <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
  602. #{item.orgId}
  603. </foreach>
  604. </if>
  605. <if test="order.permissonType == 1">
  606. and t1.COMPANY_ORG_ID in
  607. <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
  608. #{item.orgId}
  609. </foreach>
  610. and (t1.department_org_id is null or t1.department_org_id =0)
  611. </if>
  612. </if>
  613. <if test="order.orderStatus != null">
  614. and t1.order_status = #{order.orderStatus,jdbcType=INTEGER}
  615. </if>
  616. <if test="order.orderStatus == null">
  617. and t1.order_status != 0
  618. </if>
  619. <if test="order.orderTypeId != null">
  620. and t1.order_type_id = #{order.orderTypeId,jdbcType=INTEGER}
  621. </if>
  622. <if test="order.eventType != null">
  623. and t1.event_type = #{order.eventType,jdbcType=INTEGER}
  624. </if>
  625. <if test="order.currentUsers != null">
  626. and FIND_IN_SET(#{order.currentUsers,jdbcType=VARCHAR},t1.current_users)
  627. </if>
  628. <if test="order.startDate != null and order.endDate != null">
  629. <if test="order.orderStatus == 0">
  630. and t1.date_create &gt;= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%c-%d')
  631. and t1.date_create &lt;= DATE_ADD(date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%c-%d'),INTERVAL 1 DAY)
  632. order by t1.date_create desc
  633. </if>
  634. <if test="order.orderStatus != 0">
  635. and t1.send_time &gt;= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%c-%d')
  636. and t1.send_time &lt;= DATE_ADD(date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%c-%d'),INTERVAL 1 DAY)
  637. order by t1.send_time desc
  638. </if>
  639. </if>
  640. </where>
  641. </select>
  642. <!--删除-->
  643. <delete id="batchDelete">
  644. delete from sc_work_order_manage
  645. where order_status = 0
  646. and id in
  647. <foreach collection="ids" item="item" open="(" close=")" separator=",">
  648. #{item}
  649. </foreach>
  650. </delete>
  651. <!--根据orderPid 查询工单-->
  652. <select id="selectByPId" parameterType="map" resultMap="BaseResultMap">
  653. select
  654. <include refid="Base_Column_List"></include>
  655. from sc_work_order_manage
  656. where order_pid = #{orderPid,jdbcType=VARCHAR}
  657. </select>
  658. <!--查询派单时的用户状态-->
  659. <select id="selectOrderUserStatus" parameterType="java.lang.String" resultType="map">
  660. select X, Y, CASE WHEN S IS NULL THEN '空闲' WHEN S='0' THEN '空闲' ELSE '执行中' END S FROM
  661. (select order_user_id,longtitude X, latitude Y from sc_work_order_manage t1 left join sc_gps_data t2
  662. on t1.order_user_id = t2.user_id
  663. group by order_user_id,longtitude, latitude) a
  664. left JOIN
  665. (
  666. select count(*) S,order_user_id from sc_work_order_manage
  667. where order_status = 1
  668. group by order_user_id
  669. ) b
  670. on a.order_user_id=b.order_user_id
  671. where a.order_user_id= #{userId,jdbcType=INTEGER}
  672. </select>
  673. <!--待处理权限-->
  674. <select id="selectPendingPower" resultType="java.lang.Integer" parameterType="map">
  675. select count(1) from sc_work_order_manage
  676. where id = #{id,jdbcType=INTEGER} and FIND_IN_SET(#{currentUsers,jdbcType=VARCHAR},current_users)
  677. </select>
  678. <!--综合展示-查询工单执行情况-->
  679. <select id="selectOrderStatus" resultMap="BaseResultMap" >
  680. select order_status_name,sum(order_count) order_count
  681. from(
  682. select order_status,count(1) order_count ,
  683. case when order_status=0 then '未派单' when order_status=1 or order_status=4 then '处理中' else '已完结' end order_status_name
  684. from sc_work_order_manage t1
  685. where t1.date_create>=date_format(curdate(), '%Y-%m' )
  686. <if test="tenantId != null and tenantId != ''">
  687. and t1.tenant_id=#{tenantId}
  688. </if>
  689. <if test="companyOrgId != null and companyOrgId !=''">
  690. and t1.company_org_id=#{companyOrgId}
  691. </if>
  692. <if test="userType!=null and userType!=-999 and userType!=-9999 and programItems != null and programItems.size() > 0">
  693. <if test="permissonType == 5 or permissonType == 2">
  694. and ( t1.department_org_id in
  695. <foreach collection="programItems" item="item" open="(" close=")" separator=",">
  696. #{item.orgId}
  697. </foreach>
  698. or
  699. t1.COMPANY_ORG_ID in
  700. <foreach collection="programItems" item="item" open="(" close=")" separator=",">
  701. #{item.orgId}
  702. </foreach>
  703. )
  704. </if>
  705. <if test="permissonType == 4 or permissonType == 3">
  706. and t1.department_org_id in
  707. <foreach collection="programItems" item="item" open="(" close=")" separator=",">
  708. #{item.orgId}
  709. </foreach>
  710. </if>
  711. <if test="permissonType == 1">
  712. and t1.COMPANY_ORG_ID in
  713. <foreach collection="programItems" item="item" open="(" close=")" separator=",">
  714. #{item.orgId}
  715. </foreach>
  716. and (t1.department_org_id is null or t1.department_org_id =0)
  717. </if>
  718. </if>
  719. group by order_status
  720. )tab1
  721. group by order_status_name
  722. </select>
  723. </mapper>