WorkOrderManageMapper.xml 25 KB

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