|
|
@@ -0,0 +1,228 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
+<!DOCTYPE mapper
|
|
|
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+<mapper namespace="com.ruoyi.invest.mapper.TerminationMapper">
|
|
|
+
|
|
|
+ <resultMap type="TProjectTermination" id="TProjectTerminationResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="procInstId" column="proc_inst_id"/>
|
|
|
+ <result property="projectPoolId" column="project_pool_id" />
|
|
|
+ <result property="reason" column="reason" />
|
|
|
+ <result property="delFlag" column="del_flag" />
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ </resultMap>
|
|
|
+ <resultMap type="ProjectTerminationVo" id="ProjectTerminationVoResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="procInstId" column="proc_inst_id"/>
|
|
|
+ <result property="projectPoolId" column="project_pool_id" />
|
|
|
+ <result property="reason" column="reason" />
|
|
|
+ <result property="delFlag" column="del_flag" />
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+
|
|
|
+ <result property="projectName" column="project_name" />
|
|
|
+ <result property="industry" column="industry" />
|
|
|
+ <result property="investHead" column="invest_head" />
|
|
|
+ <result property="projectStage" column="project_stage" />
|
|
|
+ <result property="projectState" column="project_state" />
|
|
|
+
|
|
|
+ <result property="taskName" column="taskName"/>
|
|
|
+ <result property="taskId" column="taskId"/>
|
|
|
+ <result property="taskCreateTiem" column="taskCreateTiem"/>
|
|
|
+ <result property="assignee" column="assignee"/>
|
|
|
+ <result property="assigneeName" column="assigneeName"/>
|
|
|
+ <result property="taskDefKey" column="taskDefKey"/>
|
|
|
+ <result property="procDefId" column="procDefId"/>
|
|
|
+ <result property="procInstId" column="procInstId"/>
|
|
|
+ <result property="startUserId" column="startUserId"/>
|
|
|
+ <result property="startUserName" column="startUserName"/>
|
|
|
+ <result property="startDeptName" column="startDeptName"/>
|
|
|
+ <result property="executionId" column="executionId"/>
|
|
|
+ <result property="deployId" column="deployId"/>
|
|
|
+ </resultMap>
|
|
|
+ <sql id="selectTProjectTerminationVo">
|
|
|
+ select id,proc_inst_id, project_pool_id, reason, del_flag, create_by, create_time, update_by, update_time from t_project_termination
|
|
|
+ </sql>
|
|
|
+ <sql id="where_sql">
|
|
|
+ <if test="projectTermination.projectPoolId != null and projectTermination.projectPoolId != ''"> and a.project_pool_id = #{projectTermination.projectPoolId}</if>
|
|
|
+ <if test="projectTermination.reason != null and projectTermination.reason != ''"> and a.reason = #{projectTermination.reason}</if>
|
|
|
+ </sql>
|
|
|
+ <insert id="insertTProjectTermination" parameterType="TProjectTermination">
|
|
|
+ insert into t_project_termination
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">id,</if>
|
|
|
+ <if test="procInstId != null">proc_inst_id,</if>
|
|
|
+ <if test="projectPoolId != null">project_pool_id,</if>
|
|
|
+ <if test="reason != null">reason,</if>
|
|
|
+ <if test="delFlag != null">del_flag,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">#{id},</if>
|
|
|
+ <if test="procInstId != null">#{procInstId},</if>
|
|
|
+ <if test="projectPoolId != null">#{projectPoolId},</if>
|
|
|
+ <if test="reason != null">#{reason},</if>
|
|
|
+ <if test="delFlag != null">#{delFlag},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateTProjectTermination" parameterType="TProjectTermination">
|
|
|
+ update t_project_termination
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="projectPoolId != null">project_pool_id = #{projectPoolId},</if>
|
|
|
+ <if test="reason != null">reason = #{reason},</if>
|
|
|
+ <if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
|
+ <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+ <select id="getMyTaskList" resultMap="ProjectTerminationVoResult">
|
|
|
+ select a.id,a.proc_inst_id, a.project_pool_id,tp.project_name, tp.industry,tp.project_stage,
|
|
|
+ tp.project_state,tp.invest_head,a.reason,
|
|
|
+ a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time ,
|
|
|
+ p.PROC_INST_ID_ as 'procInsId',
|
|
|
+ p.PROC_DEF_ID_ as 'procDefId',
|
|
|
+ date_format(p.START_TIME_, '%Y-%m-%d %H:%i:%s') as 'applyTime',
|
|
|
+ date_format(p.END_TIME_, '%Y-%m-%d %H:%i:%s') as 'endTime',
|
|
|
+ p.START_USER_ID_ AS 'startUserId',
|
|
|
+ uu.nick_name AS 'startUserName',
|
|
|
+ dd.dept_name AS 'startDeptName',
|
|
|
+ t.NAME_ as 'taskName',
|
|
|
+ t.TASK_DEF_KEY_ as 'taskDefKey',
|
|
|
+ DATE_FORMAT(t.CREATE_TIME_ ,'%Y-%m-%d %H:%i') as 'taskCreateTiem',
|
|
|
+ t.ASSIGNEE_ AS 'assignee',
|
|
|
+ ui.nick_name AS 'assigneeName',
|
|
|
+ t.ID_ as 'taskId',
|
|
|
+ t.EXECUTION_ID_ AS 'executionId',
|
|
|
+ rp.DEPLOYMENT_ID_ AS 'deployId'
|
|
|
+ from t_project_termination a
|
|
|
+ left join t_project_pool tp on tp.id=a.project_pool_id
|
|
|
+ left join ACT_HI_PROCINST p on a.proc_inst_id = p.PROC_INST_ID_
|
|
|
+ LEFT JOIN (SELECT * FROM sys_user LIMIT 100000) uu ON p.START_USER_ID_ = uu.user_id
|
|
|
+ LEFT JOIN (SELECT * FROM sys_dept LIMIT 100000) dd ON uu.dept_id = dd.dept_id
|
|
|
+ left join ACT_RU_TASK t on a.proc_inst_id = t.PROC_INST_ID_
|
|
|
+ left join (select * from sys_user limit 100000) ui on t.ASSIGNEE_ = ui.user_id
|
|
|
+ left join ACT_RU_IDENTITYLINK ru on ru.TASK_ID_ = t.ID_
|
|
|
+ left join ACT_ID_MEMBERSHIP m on m.GROUP_ID_ = ru.GROUP_ID_ and m.USER_ID_ = #{userId}
|
|
|
+ LEFT JOIN act_re_procdef rp ON t.PROC_DEF_ID_ = rp.ID_
|
|
|
+ where
|
|
|
+ (t.ASSIGNEE_ = #{userId}
|
|
|
+ or (t.ASSIGNEE_ is null AND ru.TYPE_ = 'candidate'
|
|
|
+ AND (ru.USER_ID_ = #{userId}
|
|
|
+ OR ru.GROUP_ID_ IN (
|
|
|
+ select g.ID_ from ACT_ID_GROUP g, ACT_ID_MEMBERSHIP membership where g.ID_ = membership.GROUP_ID_ AND
|
|
|
+ membership.USER_ID_ = #{userId} )
|
|
|
+ )
|
|
|
+ )
|
|
|
+ )
|
|
|
+ and a.del_flag="0"
|
|
|
+ <include refid="where_sql"></include>
|
|
|
+ </select>
|
|
|
+ <select id="getMyDoneTaskList" resultMap="ProjectTerminationVoResult">
|
|
|
+ select a.id,a.proc_inst_id, a.project_pool_id,tp.project_name, tp.industry,tp.project_stage,
|
|
|
+ tp.project_state,tp.invest_head,a.reason,
|
|
|
+ a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time ,
|
|
|
+ p.PROC_INST_ID_ as 'procInsId',
|
|
|
+ p.PROC_DEF_ID_ as 'procDefId',
|
|
|
+ date_format(p.START_TIME_, '%Y-%m-%d %H:%i:%s') as 'applyTime',
|
|
|
+ date_format(p.END_TIME_, '%Y-%m-%d %H:%i:%s') as 'endTime',
|
|
|
+ p.START_USER_ID_ AS 'startUserId',
|
|
|
+ uu.nick_name AS 'startUserName',
|
|
|
+ dd.dept_name AS 'startDeptName',
|
|
|
+ ht.ID_ AS 'taskId',
|
|
|
+ ht.NAME_ AS 'taskName',
|
|
|
+ ht.ASSIGNEE_ AS 'assignee',
|
|
|
+ ui.nick_name AS 'assigneeName',
|
|
|
+ rp.DEPLOYMENT_ID_ AS 'deployId'
|
|
|
+ from t_project_termination a
|
|
|
+ left join t_project_pool tp on tp.id=a.project_pool_id
|
|
|
+ left join ACT_HI_TASKINST ht on a.proc_inst_id = ht.PROC_INST_ID_
|
|
|
+ left join ACT_HI_PROCINST p on a.proc_inst_id = p.PROC_INST_ID_
|
|
|
+ LEFT JOIN (SELECT * FROM sys_user LIMIT 100000) uu ON p.START_USER_ID_ = uu.user_id
|
|
|
+ LEFT JOIN (SELECT * FROM sys_dept LIMIT 100000) dd ON uu.dept_id = dd.dept_id
|
|
|
+ left join (select * from sys_user limit 100000) ui on ht.ASSIGNEE_ = ui.user_id
|
|
|
+ left join ACT_RU_TASK t on a.proc_inst_id = t.PROC_INST_ID_
|
|
|
+ left join act_re_procdef rp ON t.PROC_DEF_ID_ = rp.ID_
|
|
|
+ where
|
|
|
+ ht.ASSIGNEE_ = #{userId}
|
|
|
+ AND ht.END_TIME_ IS NOT NULL
|
|
|
+ and a.del_flag="0"
|
|
|
+ <include refid="where_sql"></include>
|
|
|
+ GROUP BY a.id
|
|
|
+ ORDER BY ht.END_TIME_ DESC;
|
|
|
+ </select>
|
|
|
+ <select id="getMyList" resultMap="ProjectTerminationVoResult">
|
|
|
+ select a.id,a.proc_inst_id, a.project_pool_id,tp.project_name, tp.industry,tp.project_stage,
|
|
|
+ tp.project_state,tp.invest_head,a.reason,
|
|
|
+ a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time ,
|
|
|
+ u.nick_name as 'applyUserName',
|
|
|
+ p.PROC_INST_ID_ as 'procInsId',
|
|
|
+ p.PROC_DEF_ID_ as 'procDefId',
|
|
|
+ date_format(p.START_TIME_, '%Y-%m-%d %H:%i:%s') as 'applyTime',
|
|
|
+ date_format(p.END_TIME_, '%Y-%m-%d %H:%i:%s') as 'endTime',
|
|
|
+ p.START_USER_ID_ AS 'startUserId',
|
|
|
+ uu.nick_name AS 'startUserName',
|
|
|
+ dd.dept_name AS 'startDeptName',
|
|
|
+ t.NAME_ as 'taskName',
|
|
|
+ t.TASK_DEF_KEY_ as 'taskDefKey',
|
|
|
+ DATE_FORMAT(t.CREATE_TIME_ ,'%Y-%m-%d %H:%i') as 'taskCreateTiem',
|
|
|
+ t.ASSIGNEE_ as 'assignee',
|
|
|
+ GROUP_CONCAT(DISTINCT ui.nick_name SEPARATOR '\r\n') as 'assigneeName',
|
|
|
+ t.ID_ as 'taskId',
|
|
|
+ t.EXECUTION_ID_ AS 'executionId',
|
|
|
+ rp.DEPLOYMENT_ID_ AS 'deployId'
|
|
|
+ from t_project_termination a
|
|
|
+ left join t_project_pool tp on tp.id=a.project_pool_id
|
|
|
+ left join ACT_HI_PROCINST p on a.proc_inst_id = p.PROC_INST_ID_
|
|
|
+ LEFT JOIN (SELECT * FROM sys_user LIMIT 100000) uu ON p.START_USER_ID_ = uu.user_id
|
|
|
+ LEFT JOIN (SELECT * FROM sys_dept LIMIT 100000) dd ON uu.dept_id = dd.dept_id
|
|
|
+ left join sys_user u on a.create_by = u.user_id
|
|
|
+ left join ACT_RU_TASK t on a.proc_inst_id = t.PROC_INST_ID_
|
|
|
+ left join (select * from sys_user limit 100000) ui on t.ASSIGNEE_ = ui.user_id
|
|
|
+ left join ACT_RU_IDENTITYLINK ru on ru.TASK_ID_ = t.ID_
|
|
|
+ left join ACT_ID_MEMBERSHIP m on m.GROUP_ID_ = ru.GROUP_ID_ and m.USER_ID_ = #{userId}
|
|
|
+ left join act_re_procdef rp ON t.PROC_DEF_ID_ = rp.ID_
|
|
|
+ where a.create_by = #{userId} and a.proc_inst_id is not null and a.proc_inst_id != ''
|
|
|
+ and a.del_flag="0"
|
|
|
+ <include refid="where_sql"></include>
|
|
|
+ GROUP BY a.id
|
|
|
+ </select>
|
|
|
+ <!--<select id="selectTProjectPoolById" parameterType="String" resultMap="TProjectPoolResult">
|
|
|
+ <include refid="selectTProjectPoolVo"/>
|
|
|
+ where a.id = #{id}
|
|
|
+ </select>-->
|
|
|
+ <select id="selectTProjectTerminationByProcInstId" parameterType="java.lang.String" resultMap="TProjectTerminationResult">
|
|
|
+ select a.id,a.proc_inst_id, a.project_pool_id, a.reason,
|
|
|
+ a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time ,
|
|
|
+ t.TASK_DEF_KEY_ as 'taskDefKey'
|
|
|
+ from t_project_termination a
|
|
|
+ left join ACT_RU_TASK t on a.proc_inst_id = t.PROC_INST_ID_
|
|
|
+ left join (select * from sys_user limit 100000) ui on t.ASSIGNEE_ = ui.user_id
|
|
|
+ left join sys_user u on a.create_by = u.user_id
|
|
|
+ where a.proc_inst_id = #{procInstId,jdbcType=VARCHAR}
|
|
|
+ GROUP BY a.id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="listProjectPoolIdNew" parameterType="String" resultMap="TProjectTerminationResult">
|
|
|
+ <include refid="selectTProjectTerminationVo"/>
|
|
|
+ where project_pool_id = #{projectPoolId} and del_flag = 0
|
|
|
+ ORDER BY create_time DESC LIMIT 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|