WorkOrderManageMapper.xml 27 KB

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