ProcessDefinitionMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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.process.dao.ProcessDefinitionMapper">
  4. <!-- 结果集 -->
  5. <resultMap type="com.huaxu.process.entity.ProcessDefinition" id="ProcessDefinitionMap">
  6. <result property="id" column="id" jdbcType="INTEGER"/>
  7. <result property="processName" column="process_name" jdbcType="VARCHAR"/>
  8. <result property="processKey" column="process_key" jdbcType="VARCHAR"/>
  9. <result property="processDesc" column="process_desc" jdbcType="VARCHAR"/>
  10. <result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/>
  11. <result property="taskType" column="task_type" jdbcType="INTEGER"/>
  12. <result property="companyOrgId" column="company_org_id" jdbcType="INTEGER"/>
  13. <result property="businessType" column="business_type" jdbcType="INTEGER"/>
  14. <result property="actDefId" column="act_def_id" jdbcType="VARCHAR"/>
  15. <result property="actModelId" column="act_model_id" jdbcType="VARCHAR"/>
  16. <result property="actDeployId" column="act_deploy_id" jdbcType="VARCHAR"/>
  17. <result property="version" column="version" jdbcType="INTEGER"/>
  18. <result property="runningVersion" column="running_version" jdbcType="INTEGER"/>
  19. <result property="processStatus" column="process_status" jdbcType="VARCHAR"/>
  20. <result property="isMain" column="is_main" jdbcType="VARCHAR"/>
  21. <result property="bpmnIcon" column="bpmn_icon" jdbcType="VARCHAR"/>
  22. <result property="bpmnContent" column="bpmn_content" jdbcType="VARCHAR"/>
  23. <result property="status" column="status" jdbcType="INTEGER"/>
  24. <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
  25. <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
  26. <result property="dateCreate" column="date_create" jdbcType="TIMESTAMP"/>
  27. <result property="dateUpdate" column="date_update" jdbcType="TIMESTAMP"/>
  28. </resultMap>
  29. <!-- 基本字段 -->
  30. <sql id="Base_Column_List">
  31. id, process_name, process_key, process_desc, tenant_id, task_type, company_org_id, business_type, act_def_id, act_model_id, act_deploy_id, version, running_version, process_status, is_main, bpmn_icon, bpmn_content, status, create_by, update_by, date_create, date_update </sql>
  32. <!-- 查询单个 -->
  33. <select id="selectById" resultMap="ProcessDefinitionMap">
  34. select
  35. <include refid="Base_Column_List"/>
  36. from sc_process_definition
  37. where id = #{id}
  38. </select>
  39. <!-- 查询全部 -->
  40. <select id="selectAll" resultMap="ProcessDefinitionMap">
  41. select
  42. <include refid="Base_Column_List"/>
  43. from sc_process_definition
  44. </select>
  45. <!--通过实体作为筛选条件查询-->
  46. <select id="selectList" resultMap="ProcessDefinitionMap">
  47. select
  48. <include refid="Base_Column_List"/>
  49. from sc_process_definition
  50. <where>
  51. <if test="id != null">
  52. and id = #{id}
  53. </if>
  54. <if test="processName != null and processName != ''">
  55. and process_name = #{processName}
  56. </if>
  57. <if test="processKey != null and processKey != ''">
  58. and process_key = #{processKey}
  59. </if>
  60. <if test="processDesc != null and processDesc != ''">
  61. and process_desc = #{processDesc}
  62. </if>
  63. <if test="tenantId != null and tenantId != ''">
  64. and tenant_id = #{tenantId}
  65. </if>
  66. <if test="taskType != null">
  67. and task_type = #{taskType}
  68. </if>
  69. <if test="companyOrgId != null">
  70. and company_org_id = #{companyOrgId}
  71. </if>
  72. <if test="businessType != null">
  73. and business_type = #{businessType}
  74. </if>
  75. <if test="actDefId != null and actDefId != ''">
  76. and act_def_id = #{actDefId}
  77. </if>
  78. <if test="actModelId != null and actModelId != ''">
  79. and act_model_id = #{actModelId}
  80. </if>
  81. <if test="actDeployId != null and actDeployId != ''">
  82. and act_deploy_id = #{actDeployId}
  83. </if>
  84. <if test="version != null">
  85. and version = #{version}
  86. </if>
  87. <if test="runningVersion != null">
  88. and running_version = #{runningVersion}
  89. </if>
  90. <if test="processStatus != null and processStatus != ''">
  91. and process_status = #{processStatus}
  92. </if>
  93. <if test="isMain != null and isMain != ''">
  94. and is_main = #{isMain}
  95. </if>
  96. <if test="bpmnIcon != null and bpmnIcon != ''">
  97. and bpmn_icon = #{bpmnIcon}
  98. </if>
  99. <if test="bpmnContent != null and bpmnContent != ''">
  100. and bpmn_content = #{bpmnContent}
  101. </if>
  102. <if test="status != null">
  103. and status = #{status}
  104. </if>
  105. <if test="createBy != null and createBy != ''">
  106. and create_by = #{createBy}
  107. </if>
  108. <if test="updateBy != null and updateBy != ''">
  109. and update_by = #{updateBy}
  110. </if>
  111. <if test="dateCreate != null">
  112. and date_create = #{dateCreate}
  113. </if>
  114. <if test="dateUpdate != null">
  115. and date_update = #{dateUpdate}
  116. </if>
  117. </where>
  118. </select>
  119. <!-- 新增所有列 -->
  120. <insert id="insert" keyProperty="id" useGeneratedKeys="true">
  121. insert into sc_process_definition(id, process_name, process_key, process_desc, tenant_id, task_type,
  122. company_org_id, business_type, act_def_id, act_model_id, act_deploy_id,
  123. version, running_version, process_status, is_main, bpmn_icon, bpmn_content,
  124. status, create_by, update_by, date_create, date_update)
  125. values (#{id}, #{processName}, #{processKey}, #{processDesc}, #{tenantId}, #{taskType}, #{companyOrgId},
  126. #{businessType}, #{actDefId}, #{actModelId}, #{actDeployId}, #{version}, #{runningVersion},
  127. #{processStatus}, #{isMain}, #{bpmnIcon}, #{bpmnContent}, #{status}, #{createBy}, #{updateBy},
  128. #{dateCreate}, #{dateUpdate})
  129. </insert>
  130. <!-- 批量新增 -->
  131. <insert id="batchInsert">
  132. insert into sc_process_definition(id, process_name, process_key, process_desc, tenant_id, task_type,
  133. company_org_id, business_type, act_def_id, act_model_id, act_deploy_id, version, running_version,
  134. process_status, is_main, bpmn_icon, bpmn_content, status, create_by, update_by, date_create, date_update)
  135. values
  136. <foreach collection="processDefinitions" item="item" index="index" separator=",">
  137. (
  138. #{item.id}, #{item.processName}, #{item.processKey}, #{item.processDesc}, #{item.tenantId},
  139. #{item.taskType}, #{item.companyOrgId}, #{item.businessType}, #{item.actDefId}, #{item.actModelId},
  140. #{item.actDeployId}, #{item.version}, #{item.runningVersion}, #{item.processStatus}, #{item.isMain},
  141. #{item.bpmnIcon}, #{item.bpmnContent}, #{item.status}, #{item.createBy}, #{item.updateBy},
  142. #{item.dateCreate}, #{item.dateUpdate} )
  143. </foreach>
  144. </insert>
  145. <insert id="insertSelective">
  146. </insert>
  147. <!-- 通过主键修改数据 -->
  148. <update id="update">
  149. update sc_process_definition
  150. <set>
  151. <if test="processName != null and processName != ''">
  152. process_name = #{processName},
  153. </if>
  154. <if test="processKey != null and processKey != ''">
  155. process_key = #{processKey},
  156. </if>
  157. <if test="processDesc != null and processDesc != ''">
  158. process_desc = #{processDesc},
  159. </if>
  160. <if test="tenantId != null and tenantId != ''">
  161. tenant_id = #{tenantId},
  162. </if>
  163. <if test="taskType != null">
  164. task_type = #{taskType},
  165. </if>
  166. <if test="companyOrgId != null">
  167. company_org_id = #{companyOrgId},
  168. </if>
  169. <if test="businessType != null">
  170. business_type = #{businessType},
  171. </if>
  172. <if test="actDefId != null and actDefId != ''">
  173. act_def_id = #{actDefId},
  174. </if>
  175. <if test="actModelId != null and actModelId != ''">
  176. act_model_id = #{actModelId},
  177. </if>
  178. <if test="actDeployId != null and actDeployId != ''">
  179. act_deploy_id = #{actDeployId},
  180. </if>
  181. <if test="version != null">
  182. version = #{version},
  183. </if>
  184. <if test="runningVersion != null">
  185. running_version = #{runningVersion},
  186. </if>
  187. <if test="processStatus != null and processStatus != ''">
  188. process_status = #{processStatus},
  189. </if>
  190. <if test="isMain != null and isMain != ''">
  191. is_main = #{isMain},
  192. </if>
  193. <if test="bpmnIcon != null and bpmnIcon != ''">
  194. bpmn_icon = #{bpmnIcon},
  195. </if>
  196. <if test="bpmnContent != null and bpmnContent != ''">
  197. bpmn_content = #{bpmnContent},
  198. </if>
  199. <if test="status != null">
  200. status = #{status},
  201. </if>
  202. <if test="createBy != null and createBy != ''">
  203. create_by = #{createBy},
  204. </if>
  205. <if test="updateBy != null and updateBy != ''">
  206. update_by = #{updateBy},
  207. </if>
  208. <if test="dateCreate != null">
  209. date_create = #{dateCreate},
  210. </if>
  211. <if test="dateUpdate != null">
  212. date_update = #{dateUpdate},
  213. </if>
  214. </set>
  215. where id = #{id}
  216. </update>
  217. <!--通过主键删除-->
  218. <delete id="deleteById">
  219. delete
  220. from sc_process_definition
  221. where id = #{id}
  222. </delete>
  223. <!-- 总数 -->
  224. <select id="count" resultType="int">
  225. select count(*)
  226. from sc_process_definition
  227. </select>
  228. <select id="selectPage" resultMap="ProcessDefinitionMap">
  229. select
  230. <include refid="Base_Column_List"/>
  231. from sc_process_definition
  232. <where>
  233. status =1
  234. <if test="processDefinition.id != null">
  235. and id = #{processDefinition.id}
  236. </if>
  237. <if test="processDefinition.processName != null and processDefinition.processName != ''">
  238. and process_name = #{processDefinition.processName}
  239. </if>
  240. <if test="processDefinition.processKey != null and processDefinition.processKey != ''">
  241. and process_key = #{processDefinition.processKey}
  242. </if>
  243. <if test="processDefinition.processDesc != null and processDefinition.processDesc != ''">
  244. and process_desc = #{processDefinition.processDesc}
  245. </if>
  246. <if test="processDefinition.tenantId != null and processDefinition.tenantId != ''">
  247. and tenant_id = #{processDefinition.tenantId}
  248. </if>
  249. <if test="processDefinition.taskType != null">
  250. and task_type = #{processDefinition.taskType}
  251. </if>
  252. <if test="processDefinition.companyOrgId != null">
  253. and company_org_id = #{processDefinition.companyOrgId}
  254. </if>
  255. <if test="processDefinition.businessType != null">
  256. and business_type = #{processDefinition.businessType}
  257. </if>
  258. <if test="processDefinition.actDefId != null and processDefinition.actDefId != ''">
  259. and act_def_id = #{processDefinition.actDefId}
  260. </if>
  261. <if test="processDefinition.actModelId != null and processDefinition.actModelId != ''">
  262. and act_model_id = #{processDefinition.actModelId}
  263. </if>
  264. <if test="processDefinition.actDeployId != null and processDefinition.actDeployId != ''">
  265. and act_deploy_id = #{processDefinition.actDeployId}
  266. </if>
  267. <if test="processDefinition.version != null">
  268. and version = #{processDefinition.version}
  269. </if>
  270. <if test="processDefinition.runningVersion != null">
  271. and running_version = #{processDefinition.runningVersion}
  272. </if>
  273. <if test="processDefinition.processStatus != null and processDefinition.processStatus != ''">
  274. and process_status = #{processDefinition.processStatus}
  275. </if>
  276. <if test="processDefinition.isMain != null and processDefinition.isMain != ''">
  277. and is_main = #{processDefinition.isMain}
  278. </if>
  279. <if test="processDefinition.bpmnIcon != null and processDefinition.bpmnIcon != ''">
  280. and bpmn_icon = #{processDefinition.bpmnIcon}
  281. </if>
  282. <if test="processDefinition.bpmnContent != null and processDefinition.bpmnContent != ''">
  283. and bpmn_content = #{processDefinition.bpmnContent}
  284. </if>
  285. <if test="processDefinition.status != null">
  286. and status = #{processDefinition.status}
  287. </if>
  288. <if test="processDefinition.createBy != null and processDefinition.createBy != ''">
  289. and create_by = #{processDefinition.createBy}
  290. </if>
  291. <if test="processDefinition.updateBy != null and processDefinition.updateBy != ''">
  292. and update_by = #{processDefinition.updateBy}
  293. </if>
  294. <if test="processDefinition.dateCreate != null">
  295. and date_create = #{processDefinition.dateCreate}
  296. </if>
  297. <if test="processDefinition.dateUpdate != null">
  298. and date_update = #{processDefinition.dateUpdate}
  299. </if>
  300. </where>
  301. </select>
  302. <select id="checkProcessUnique" resultType="java.lang.Integer">
  303. select count(*) from sc_process_definition
  304. <where>
  305. status=1
  306. <if test="tenantId != null and tenantId != ''">
  307. and tenant_id = #{tenantId}
  308. </if>
  309. <if test="taskType != null">
  310. and task_type = #{taskType}
  311. </if>
  312. <if test="companyOrgId != null">
  313. and company_org_id = #{companyOrgId}
  314. </if>
  315. </where>
  316. </select>
  317. <select id="getBpmnContent" resultType="java.lang.String">
  318. select bpmn_content from sc_process_def where status = 1 and id = #{id}
  319. </select>
  320. </mapper>