|
@@ -88,11 +88,113 @@
|
|
SELECT
|
|
SELECT
|
|
<include refid="workProjectNotifyColumns"/>
|
|
<include refid="workProjectNotifyColumns"/>
|
|
,a.wap_begin_date AS "wapCreateDate"
|
|
,a.wap_begin_date AS "wapCreateDate"
|
|
- ,(select user.id from work_activity_process wap left join sys_user user on wap.create_by = user.id where wap.process_instance_id = a.process_instance_id order by wap.create_date asc limit 1) as 'initiator'
|
|
|
|
- ,(select p.user_id from work_activity_process wap
|
|
|
|
|
|
+ ,(select user.id from work_activity_process wap left join sys_user user on wap.create_by = user.id where wap.count != 0 and (case when a.process_instance_id is null then wap.process_instance_id = (select waps.process_instance_id
|
|
|
|
+ FROM work_project_notify waps
|
|
|
|
+ WHERE waps.notify_id = a.notify_id and waps.process_instance_id is not null order by waps.notify_id desc
|
|
|
|
+ LIMIT 1) else wap.process_instance_id = a.process_instance_id end) and wap.is_approval = '0' order by wap.count asc limit 1) as 'initiator'
|
|
|
|
+ /*,(select p.user_id from work_activity_process wap
|
|
left join work_activity_process_user p on wap.process_instance_id = p.process_id and p.count = wap.count
|
|
left join work_activity_process_user p on wap.process_instance_id = p.process_id and p.count = wap.count
|
|
left join sys_user u on u.id = p.user_id
|
|
left join sys_user u on u.id = p.user_id
|
|
- where wap.process_instance_id = 'b4b984e916114f1ca1f188e682465926' and wap.is_approval = '0' order by wap.count asc limit 1) as 'auditor'
|
|
|
|
|
|
+ where (case when a.process_instance_id is null then wap.process_instance_id = (select waps.process_instance_id
|
|
|
|
+ FROM work_project_notify waps
|
|
|
|
+ WHERE waps.notify_id = a.notify_id and waps.process_instance_id is not null order by waps.notify_id desc
|
|
|
|
+ LIMIT 1) else wap.process_instance_id = a.process_instance_id end) and wap.is_approval = '0' order by wap.count asc limit 1) as 'auditor'*/
|
|
|
|
+ FROM work_project_notify a
|
|
|
|
+ left join sys_user su on a.create_by = su.id
|
|
|
|
+ LEFT JOIN sys_user u ON u.id = a.create_by
|
|
|
|
+ <include refid="workProjectNotifyJoins"/>
|
|
|
|
+ <where>
|
|
|
|
+ a.del_flag = #{DEL_FLAG_NORMAL}
|
|
|
|
+ <if test="title != null and title != ''">
|
|
|
|
+ AND a.title LIKE
|
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
|
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{title}+'%'</if>
|
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{title},'%')</if>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="content != null and content != ''">
|
|
|
|
+ AND a.content LIKE
|
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{content}||'%'</if>
|
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{content}+'%'</if>
|
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{content},'%')</if>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="user != null and user.id != null and user.id != ''">
|
|
|
|
+ AND a.notify_user = #{user.id}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="userName != null and userName != ''">
|
|
|
|
+ AND u.name LIKE
|
|
|
|
+ <if test="dbName == 'oracle'">'%'||#{userName}||'%'</if>
|
|
|
|
+ <if test="dbName == 'mssql'">'%'+#{userName}+'%'</if>
|
|
|
|
+ <if test="dbName == 'mysql'">concat('%',#{userName},'%')</if>
|
|
|
|
+ </if>
|
|
|
|
+
|
|
|
|
+ <if test="companyId != null and companyId != ''">
|
|
|
|
+ AND a.company_id = #{companyId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="type != null and type != ''">
|
|
|
|
+ AND a.type = #{type}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="types != null and types != ''">
|
|
|
|
+ AND a.type in (${types})
|
|
|
|
+ </if>
|
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
|
+ AND a.create_date >= #{startDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
|
+ AND a.create_date <= #{endDate}
|
|
|
|
+ </if>
|
|
|
|
+
|
|
|
|
+ <if test="startBeginDate != null and startBeginDate != ''">
|
|
|
|
+ AND a.wap_begin_date >= #{startBeginDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endBeginDate != null and endBeginDate != ''">
|
|
|
|
+ AND a.wap_begin_date <= #{endBeginDate}
|
|
|
|
+ </if>
|
|
|
|
+
|
|
|
|
+ <if test="(createUserId != null and createUserId != '') or (createUserName != null and createUserName != '')">
|
|
|
|
+ AND (a.create_by = #{createUserId} or su.name like concat('%',#{createUserName},'%'))
|
|
|
|
+ </if>
|
|
|
|
+ <choose>
|
|
|
|
+ <when test="status !=null and status != '' and status == '-1'">
|
|
|
|
+ </when>
|
|
|
|
+ <when test="status !=null and status != '' ">
|
|
|
|
+ AND a.status = #{status}
|
|
|
|
+ </when>
|
|
|
|
+ <otherwise>
|
|
|
|
+ AND a.status != '1'
|
|
|
|
+ </otherwise>
|
|
|
|
+ </choose>
|
|
|
|
+ <choose>
|
|
|
|
+ <when test="remarks !=null and remarks != '' and remarks == '待通知'">
|
|
|
|
+ AND a.remarks = #{remarks}
|
|
|
|
+ </when>
|
|
|
|
+ <otherwise>
|
|
|
|
+ AND a.remarks != '待通知'
|
|
|
|
+ </otherwise>
|
|
|
|
+ </choose>
|
|
|
|
+ </where>
|
|
|
|
+
|
|
|
|
+ ORDER BY a.update_date DESC, a.exigency desc
|
|
|
|
+ <choose>
|
|
|
|
+ <!--<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
|
+ ORDER BY ${page.orderBy}
|
|
|
|
+ </when>
|
|
|
|
+ <otherwise>
|
|
|
|
+ ORDER BY a.create_date DESC,a.id
|
|
|
|
+ </otherwise>-->
|
|
|
|
+ <when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
|
+ ,${page.orderBy}
|
|
|
|
+ </when>
|
|
|
|
+ <!--<otherwise>
|
|
|
|
+ ,a.create_date DESC,a.id
|
|
|
|
+ </otherwise>-->
|
|
|
|
+ </choose>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="notifyFindList" resultType="WorkProjectNotify" >
|
|
|
|
+ SELECT
|
|
|
|
+ <include refid="workProjectNotifyColumns"/>
|
|
|
|
+ ,a.wap_begin_date AS "wapCreateDate"
|
|
|
|
+ ,(select user.id from work_activity_process wap left join sys_user user on wap.create_by = user.id where wap.process_instance_id = a.process_instance_id order by wap.create_date asc limit 1) as 'initiator'
|
|
FROM work_project_notify a
|
|
FROM work_project_notify a
|
|
left join sys_user su on a.create_by = su.id
|
|
left join sys_user su on a.create_by = su.id
|
|
LEFT JOIN sys_user u ON u.id = a.create_by
|
|
LEFT JOIN sys_user u ON u.id = a.create_by
|