PlanManageMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  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.task.dao.PlanManageMapper" >
  4. <resultMap id="BaseResultMap" type="com.huaxu.task.entity.PlanManage" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="plan_id" property="planId" jdbcType="VARCHAR" />
  7. <result column="plan_name" property="planName" jdbcType="VARCHAR" />
  8. <result column="plan_user_id" property="planUserId" jdbcType="VARCHAR" />
  9. <result column="user_id" property="userId" jdbcType="VARCHAR" />
  10. <result column="plan_date" property="planDate" jdbcType="TIMESTAMP" />
  11. <result column="plan_start_date" property="planStartDate" jdbcType="TIMESTAMP" />
  12. <result column="plan_end_date" property="planEndDate" jdbcType="TIMESTAMP" />
  13. <result column="task_content" property="taskContent" jdbcType="VARCHAR" />
  14. <result column="task_area_shape" property="taskAreaShape" jdbcType="VARCHAR" />
  15. <result column="task_area_name" property="taskAreaName" jdbcType="VARCHAR" />
  16. <result column="task_type" property="taskType" jdbcType="INTEGER" />
  17. <result column="plan_status" property="planStatus" jdbcType="INTEGER" />
  18. <result column="tenant_id" property="tenantId" jdbcType="VARCHAR" />
  19. <result column="process_instance_id" property="processInstanceId" jdbcType="VARCHAR" />
  20. <result column="process_def_id" property="processDefId" jdbcType="VARCHAR" />
  21. <result column="current_task_id" property="currentTaskId" jdbcType="VARCHAR" />
  22. <result column="current_users" property="currentUsers" jdbcType="VARCHAR" />
  23. <result column="current_task_name" property="currentTaskName" jdbcType="VARCHAR" />
  24. <result column="create_by" property="createBy" jdbcType="VARCHAR" />
  25. <result column="date_create" property="dateCreate" jdbcType="TIMESTAMP" />
  26. <result column="update_by" property="updateBy" jdbcType="VARCHAR" />
  27. <result column="date_update" property="dateUpdate" jdbcType="TIMESTAMP" />
  28. <result column="company_org_id" property="companyOrgId" jdbcType="VARCHAR" />
  29. <result column="department_org_id" property="departmentOrgId" jdbcType="VARCHAR" />
  30. <result column="task_checked" property="taskChecked" jdbcType="VARCHAR" />
  31. </resultMap>
  32. <sql id="Base_Column_List" >
  33. id, plan_id, plan_name, plan_user_id, user_id, plan_date, plan_start_date, plan_end_date,
  34. task_content, task_area_shape, task_area_name, task_type, plan_status, tenant_id,
  35. process_instance_id, process_def_id, current_task_id, current_users, current_task_name,
  36. create_by, date_create, update_by, date_update, company_org_id, department_org_id,
  37. task_checked
  38. </sql>
  39. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  40. select
  41. <include refid="Base_Column_List" />
  42. from sc_plan_manage
  43. where id = #{id,jdbcType=INTEGER}
  44. </select>
  45. <select id="selectByPlanId" resultMap="BaseResultMap" parameterType="java.lang.String" >
  46. select
  47. <include refid="Base_Column_List" />
  48. from sc_plan_manage
  49. where plan_id = #{planId,jdbcType=VARCHAR}
  50. </select>
  51. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  52. delete from sc_plan_manage
  53. where id = #{id,jdbcType=INTEGER}
  54. </delete>
  55. <insert id="insertSelective" parameterType="com.huaxu.task.entity.PlanManage" >
  56. insert into sc_plan_manage
  57. <trim prefix="(" suffix=")" suffixOverrides="," >
  58. <if test="id != null" >
  59. id,
  60. </if>
  61. <if test="planId != null" >
  62. plan_id,
  63. </if>
  64. <if test="planName != null" >
  65. plan_name,
  66. </if>
  67. <if test="planUserId != null" >
  68. plan_user_id,
  69. </if>
  70. <if test="userId != null" >
  71. user_id,
  72. </if>
  73. <if test="planDate != null" >
  74. plan_date,
  75. </if>
  76. <if test="planStartDate != null" >
  77. plan_start_date,
  78. </if>
  79. <if test="planEndDate != null" >
  80. plan_end_date,
  81. </if>
  82. <if test="taskContent != null" >
  83. task_content,
  84. </if>
  85. <if test="taskAreaShape != null" >
  86. task_area_shape,
  87. </if>
  88. <if test="taskAreaName != null" >
  89. task_area_name,
  90. </if>
  91. <if test="taskType != null" >
  92. task_type,
  93. </if>
  94. <if test="planStatus != null" >
  95. plan_status,
  96. </if>
  97. <if test="tenantId != null" >
  98. tenant_id,
  99. </if>
  100. <if test="processInstanceId != null" >
  101. process_instance_id,
  102. </if>
  103. <if test="processDefId != null" >
  104. process_def_id,
  105. </if>
  106. <if test="currentTaskId != null" >
  107. current_task_id,
  108. </if>
  109. <if test="currentUsers != null" >
  110. current_users,
  111. </if>
  112. <if test="currentTaskName != null" >
  113. current_task_name,
  114. </if>
  115. <if test="createBy != null" >
  116. create_by,
  117. </if>
  118. <if test="dateCreate != null" >
  119. date_create,
  120. </if>
  121. <if test="updateBy != null" >
  122. update_by,
  123. </if>
  124. <if test="dateUpdate != null" >
  125. date_update,
  126. </if>
  127. <if test="companyOrgId != null" >
  128. company_org_id,
  129. </if>
  130. <if test="departmentOrgId != null" >
  131. department_org_id,
  132. </if>
  133. <if test="taskChecked != null" >
  134. task_checked,
  135. </if>
  136. </trim>
  137. <trim prefix="values (" suffix=")" suffixOverrides="," >
  138. <if test="id != null" >
  139. #{id,jdbcType=INTEGER},
  140. </if>
  141. <if test="planId != null" >
  142. #{planId,jdbcType=VARCHAR},
  143. </if>
  144. <if test="planName != null" >
  145. #{planName,jdbcType=VARCHAR},
  146. </if>
  147. <if test="planUserId != null" >
  148. #{planUserId,jdbcType=VARCHAR},
  149. </if>
  150. <if test="userId != null" >
  151. #{userId,jdbcType=VARCHAR},
  152. </if>
  153. <if test="planDate != null" >
  154. #{planDate,jdbcType=TIMESTAMP},
  155. </if>
  156. <if test="planStartDate != null" >
  157. #{planStartDate,jdbcType=DATE},
  158. </if>
  159. <if test="planEndDate != null" >
  160. #{planEndDate,jdbcType=DATE},
  161. </if>
  162. <if test="taskContent != null" >
  163. #{taskContent,jdbcType=VARCHAR},
  164. </if>
  165. <if test="taskAreaShape != null" >
  166. #{taskAreaShape,jdbcType=VARCHAR},
  167. </if>
  168. <if test="taskAreaName != null" >
  169. #{taskAreaName,jdbcType=VARCHAR},
  170. </if>
  171. <if test="taskType != null" >
  172. #{taskType,jdbcType=INTEGER},
  173. </if>
  174. <if test="planStatus != null" >
  175. #{planStatus,jdbcType=INTEGER},
  176. </if>
  177. <if test="tenantId != null" >
  178. #{tenantId,jdbcType=VARCHAR},
  179. </if>
  180. <if test="processInstanceId != null" >
  181. #{processInstanceId,jdbcType=VARCHAR},
  182. </if>
  183. <if test="processDefId != null" >
  184. #{processDefId,jdbcType=VARCHAR},
  185. </if>
  186. <if test="currentTaskId != null" >
  187. #{currentTaskId,jdbcType=VARCHAR},
  188. </if>
  189. <if test="currentUsers != null" >
  190. #{currentUsers,jdbcType=VARCHAR},
  191. </if>
  192. <if test="currentTaskName != null" >
  193. #{currentTaskName,jdbcType=VARCHAR},
  194. </if>
  195. <if test="createBy != null" >
  196. #{createBy,jdbcType=VARCHAR},
  197. </if>
  198. <if test="dateCreate != null" >
  199. #{dateCreate,jdbcType=TIMESTAMP},
  200. </if>
  201. <if test="updateBy != null" >
  202. #{updateBy,jdbcType=VARCHAR},
  203. </if>
  204. <if test="dateUpdate != null" >
  205. #{dateUpdate,jdbcType=TIMESTAMP},
  206. </if>
  207. <if test="companyOrgId != null" >
  208. #{companyOrgId,jdbcType=VARCHAR},
  209. </if>
  210. <if test="departmentOrgId != null" >
  211. #{departmentOrgId,jdbcType=VARCHAR},
  212. </if>
  213. <if test="taskChecked != null" >
  214. #{taskChecked,jdbcType=VARCHAR},
  215. </if>
  216. </trim>
  217. </insert>
  218. <update id="updateByPrimaryKeySelective" parameterType="com.huaxu.task.entity.PlanManage" >
  219. update sc_plan_manage
  220. <set >
  221. <if test="planId != null" >
  222. plan_id = #{planId,jdbcType=VARCHAR},
  223. </if>
  224. <if test="planName != null" >
  225. plan_name = #{planName,jdbcType=VARCHAR},
  226. </if>
  227. <if test="planUserId != null" >
  228. plan_user_id = #{planUserId,jdbcType=VARCHAR},
  229. </if>
  230. <if test="userId != null" >
  231. user_id = #{userId,jdbcType=VARCHAR},
  232. </if>
  233. <if test="planDate != null" >
  234. plan_date = #{planDate,jdbcType=TIMESTAMP},
  235. </if>
  236. <if test="planStartDate != null" >
  237. plan_start_date = #{planStartDate,jdbcType=TIMESTAMP},
  238. </if>
  239. <if test="planEndDate != null" >
  240. plan_end_date = #{planEndDate,jdbcType=TIMESTAMP},
  241. </if>
  242. <if test="taskContent != null" >
  243. task_content = #{taskContent,jdbcType=VARCHAR},
  244. </if>
  245. <if test="taskAreaShape != null" >
  246. task_area_shape = #{taskAreaShape,jdbcType=VARCHAR},
  247. </if>
  248. <if test="taskAreaName != null" >
  249. task_area_name = #{taskAreaName,jdbcType=VARCHAR},
  250. </if>
  251. <if test="taskType != null" >
  252. task_type = #{taskType,jdbcType=INTEGER},
  253. </if>
  254. <if test="planStatus != null" >
  255. plan_status = #{planStatus,jdbcType=INTEGER},
  256. </if>
  257. <if test="tenantId != null" >
  258. tenant_id = #{tenantId,jdbcType=VARCHAR},
  259. </if>
  260. <if test="processInstanceId != null" >
  261. process_instance_id = #{processInstanceId,jdbcType=VARCHAR},
  262. </if>
  263. <if test="processDefId != null" >
  264. process_def_id = #{processDefId,jdbcType=VARCHAR},
  265. </if>
  266. <if test="currentTaskId != null" >
  267. current_task_id = #{currentTaskId,jdbcType=VARCHAR},
  268. </if>
  269. <if test="currentUsers != null" >
  270. current_users = #{currentUsers,jdbcType=VARCHAR},
  271. </if>
  272. <if test="currentTaskName != null" >
  273. current_task_name = #{currentTaskName,jdbcType=VARCHAR},
  274. </if>
  275. <if test="createBy != null" >
  276. create_by = #{createBy,jdbcType=VARCHAR},
  277. </if>
  278. <if test="dateCreate != null" >
  279. date_create = #{dateCreate,jdbcType=TIMESTAMP},
  280. </if>
  281. <if test="updateBy != null" >
  282. update_by = #{updateBy,jdbcType=VARCHAR},
  283. </if>
  284. <if test="dateUpdate != null" >
  285. date_update = #{dateUpdate,jdbcType=TIMESTAMP},
  286. </if>
  287. <if test="companyOrgId != null" >
  288. company_org_id = #{companyOrgId,jdbcType=VARCHAR},
  289. </if>
  290. <if test="departmentOrgId != null" >
  291. department_org_id = #{departmentOrgId,jdbcType=VARCHAR},
  292. </if>
  293. <if test="taskChecked != null" >
  294. task_checked = #{taskChecked,jdbcType=VARCHAR},
  295. </if>
  296. </set>
  297. where id = #{id,jdbcType=INTEGER}
  298. </update>
  299. <update id="updateByPrimaryKey" parameterType="com.huaxu.task.entity.PlanManage" >
  300. update sc_plan_manage
  301. set plan_id = #{planId,jdbcType=VARCHAR},
  302. plan_name = #{planName,jdbcType=VARCHAR},
  303. plan_user_id = #{planUserId,jdbcType=VARCHAR},
  304. user_id = #{userId,jdbcType=VARCHAR},
  305. plan_date = #{planDate,jdbcType=TIMESTAMP},
  306. plan_start_date = #{planStartDate,jdbcType=TIMESTAMP},
  307. plan_end_date = #{planEndDate,jdbcType=TIMESTAMP},
  308. task_content = #{taskContent,jdbcType=VARCHAR},
  309. task_area_shape = #{taskAreaShape,jdbcType=VARCHAR},
  310. task_area_name = #{taskAreaName,jdbcType=VARCHAR},
  311. task_type = #{taskType,jdbcType=INTEGER},
  312. plan_status = #{planStatus,jdbcType=INTEGER},
  313. tenant_id = #{tenantId,jdbcType=VARCHAR},
  314. process_instance_id = #{processInstanceId,jdbcType=VARCHAR},
  315. process_def_id = #{processDefId,jdbcType=VARCHAR},
  316. current_task_id = #{currentTaskId,jdbcType=VARCHAR},
  317. current_users = #{currentUsers,jdbcType=VARCHAR},
  318. current_task_name = #{currentTaskName,jdbcType=VARCHAR},
  319. create_by = #{createBy,jdbcType=VARCHAR},
  320. date_create = #{dateCreate,jdbcType=TIMESTAMP},
  321. update_by = #{updateBy,jdbcType=VARCHAR},
  322. date_update = #{dateUpdate,jdbcType=TIMESTAMP},
  323. company_org_id = #{companyOrgId,jdbcType=VARCHAR},
  324. department_org_id = #{departmentOrgId,jdbcType=VARCHAR},
  325. task_checked = #{taskChecked,jdbcType=VARCHAR}
  326. where id = #{id,jdbcType=INTEGER}
  327. </update>
  328. <select id="findPage" resultMap="BaseResultMap">
  329. select
  330. <include refid="Base_Column_List"/>
  331. from sc_plan_manage t1
  332. <where>
  333. <if test="plan.tenantId != null and plan.tenantId != ''">
  334. and t1.tenant_id = #{plan.tenantId}
  335. </if>
  336. <if test="plan.key != null and plan.key != ''">
  337. and (t1.plan_id like CONCAT('%',#{plan.key},'%') or t1.plan_name like CONCAT('%',#{plan.key},'%'))
  338. </if>
  339. <if test="plan.userType!=null and plan.userType!=-999 and plan.userType!=-9999 and plan.programItems != null and plan.programItems.size() > 0">
  340. <if test="plan.permissonType == 5 or alarm.plan == 2">
  341. and ( t1.DEPT_ORG_ID in
  342. <foreach collection="plan.programItems" item="item" open="(" close=")" separator=",">
  343. #{item.orgId}
  344. </foreach>
  345. or
  346. t1.COMPANY_ORG_ID in
  347. <foreach collection="plan.programItems" item="item" open="(" close=")" separator=",">
  348. #{item.orgId}
  349. </foreach>
  350. )
  351. </if>
  352. <if test="plan.permissonType == 4 or plan.permissonType == 3">
  353. and t1.DEPT_ORG_ID in
  354. <foreach collection="plan.programItems" item="item" open="(" close=")" separator=",">
  355. #{item.orgId}
  356. </foreach>
  357. </if>
  358. <if test="plan.permissonType == 1">
  359. and t1.COMPANY_ORG_ID in
  360. <foreach collection="plan.programItems" item="item" open="(" close=")" separator=",">
  361. #{item.orgId}
  362. </foreach>
  363. and (t1.DEPT_ORG_ID is null or t1.DEPT_ORG_ID =0)
  364. </if>
  365. </if>
  366. <if test="plan.planStatus != null">
  367. and t1.plan_status = #{plan.planStatus,jdbcType=INTEGER}
  368. </if>
  369. <if test="plan.startDate != null and plan.endDate != null">
  370. and t1.date_create &gt;= date_format(#{plan.startDate,jdbcType=VARCHAR},'%Y-%c-%d')
  371. and t1.date_create &lt;= DATE_ADD(date_format(#{plan.endDate,jdbcType=VARCHAR},'%Y-%c-%d'),INTERVAL 1 DAY)
  372. </if>
  373. </where>
  374. order by t1.date_create
  375. </select>
  376. <!--删除-->
  377. <delete id="batchDelete">
  378. delete from sc_plan_manage
  379. where plan_status = 0
  380. and id in
  381. <foreach collection="ids" item="item" open="(" close=")" separator=",">
  382. #{item}
  383. </foreach>
  384. </delete>
  385. </mapper>