修复安全环保检查loginUserId为空导致mybatis 错误的问题
parent
162b25bb87
commit
0921161d64
|
@ -207,7 +207,10 @@
|
||||||
</if>
|
</if>
|
||||||
GROUP BY se.INSPECTION_ID
|
GROUP BY se.INSPECTION_ID
|
||||||
ORDER BY FIELD(se.INSPECTION_STATUS, '2', '1', '0', '3', '4', '5', '6', '7', '8', '-1', '-2'),
|
ORDER BY FIELD(se.INSPECTION_STATUS, '2', '1', '0', '3', '4', '5', '6', '7', '8', '-1', '-2'),
|
||||||
FIELD(if(se.INSPECTED_SITEUSER_ID = #{pd.loginUserId},se.INSPECTED_SITEUSER_ID,'1'), se.INSPECTED_SITEUSER_ID, '1'),
|
<if test="pd.loginUserId != null and pd.loginUserId != ''">
|
||||||
|
FIELD(if(se.INSPECTED_SITEUSER_ID = #{pd.loginUserId}, se.INSPECTED_SITEUSER_ID, '1'),
|
||||||
|
se.INSPECTED_SITEUSER_ID, '1'),
|
||||||
|
</if>
|
||||||
se.INSPECTION_TIME_START DESC
|
se.INSPECTION_TIME_START DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
@ -122,21 +122,25 @@
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<select id="datalistPage" parameterType="page" resultType="pd">
|
<select id="datalistPage" parameterType="page" resultType="pd">
|
||||||
select
|
select iou.NAME INSPECTION_ORIGINATOR_NAME,
|
||||||
iou.NAME INSPECTION_ORIGINATOR_NAME,
|
|
||||||
iod.NAME INSPECTION_DEPARTMENT_NAME,
|
iod.NAME INSPECTION_DEPARTMENT_NAME,
|
||||||
isd.NAME INSPECTED_DEPARTMENT_NAME,
|
isd.NAME INSPECTED_DEPARTMENT_NAME,
|
||||||
isu.NAME INSPECTED_SITEUSER_NAME,
|
isu.NAME INSPECTED_SITEUSER_NAME,
|
||||||
IFNULL(GROUP_CONCAT(REPLACE(siu.NAME,'/',',')),'') AS INSPECTION_USER_NAME,
|
IFNULL(GROUP_CONCAT(REPLACE(siu.NAME, '/', ',')), '') AS INSPECTION_USER_NAME,
|
||||||
CASE WHEN IFNULL(se.INSPECTION_TYPE_OTHER, '') = '' THEN d.NAME ELSE se.INSPECTION_TYPE_OTHER END INSPECTION_TYPE_NAME,
|
CASE
|
||||||
|
WHEN IFNULL(se.INSPECTION_TYPE_OTHER, '') = '' THEN d.NAME
|
||||||
|
ELSE se.INSPECTION_TYPE_OTHER END INSPECTION_TYPE_NAME,
|
||||||
se.INSPECTION_TIME_START,
|
se.INSPECTION_TIME_START,
|
||||||
se.INSPECTION_TIME_END,
|
se.INSPECTION_TIME_END,
|
||||||
se.INSPECTION_STATUS,
|
se.INSPECTION_STATUS,
|
||||||
se.INSPECTION_SUBJECT,
|
se.INSPECTION_SUBJECT,
|
||||||
se.INSPECTED_DEPARTMENT_ID,
|
se.INSPECTED_DEPARTMENT_ID,
|
||||||
<include refid="Field"></include>
|
<include refid="Field">
|
||||||
|
</include>
|
||||||
from
|
from
|
||||||
<include refid="tableName"></include> f
|
<include refid="tableName">
|
||||||
|
</include>
|
||||||
|
f
|
||||||
INNER JOIN BUS_INSPECTION_SAFETYENVIRONMENTAL se ON se.INSPECTION_ID = f.INSPECTION_ID
|
INNER JOIN BUS_INSPECTION_SAFETYENVIRONMENTAL se ON se.INSPECTION_ID = f.INSPECTION_ID
|
||||||
LEFT JOIN VI_USER_ALL iou ON iou.USER_ID = se.INSPECTION_ORIGINATOR_ID
|
LEFT JOIN VI_USER_ALL iou ON iou.USER_ID = se.INSPECTION_ORIGINATOR_ID
|
||||||
LEFT JOIN VI_DEPARTMENT_ALL iod ON iod.DEPARTMENT_ID = iou.DEPARTMENT_ID
|
LEFT JOIN VI_DEPARTMENT_ALL iod ON iod.DEPARTMENT_ID = iou.DEPARTMENT_ID
|
||||||
|
@ -146,8 +150,10 @@
|
||||||
AND si.ISDELETE = '0'
|
AND si.ISDELETE = '0'
|
||||||
LEFT JOIN vi_user_all siu ON siu.USER_ID = si.INSPECTION_USER_ID
|
LEFT JOIN vi_user_all siu ON siu.USER_ID = si.INSPECTION_USER_ID
|
||||||
LEFT JOIN sys_dictionaries d ON d.BIANMA = se.INSPECTION_TYPE
|
LEFT JOIN sys_dictionaries d ON d.BIANMA = se.INSPECTION_TYPE
|
||||||
where f.ISDELETE = '0' and se.ISDELETE = '0'
|
where f.ISDELETE = '0'
|
||||||
<if test="pd.supDeparIds != null and pd.supDeparIds != ''"><!-- 权限显示 -->
|
and se.ISDELETE = '0'
|
||||||
|
<if test="pd.supDeparIds != null and pd.supDeparIds != ''">
|
||||||
|
<!-- 权限显示 -->
|
||||||
<choose>
|
<choose>
|
||||||
<when test="pd.roleLevel == '0'">
|
<when test="pd.roleLevel == '0'">
|
||||||
</when>
|
</when>
|
||||||
|
@ -155,50 +161,61 @@
|
||||||
and siu.DEPARTMENT_ID in (${pd.supDeparIds})
|
and siu.DEPARTMENT_ID in (${pd.supDeparIds})
|
||||||
</when>
|
</when>
|
||||||
<when test="pd.roleLevel == '3'">
|
<when test="pd.roleLevel == '3'">
|
||||||
-- siu.USER_ID in ( #{pd.loginUserId} )
|
-- siu.USER_ID in ( #{pd.loginUserId} )
|
||||||
</when>
|
</when>
|
||||||
</choose>
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.INSPECTION_USER_ID != null and pd.INSPECTION_USER_ID != ''"><!-- 检查人 -->
|
<if test="pd.INSPECTION_USER_ID != null and pd.INSPECTION_USER_ID != ''">
|
||||||
|
<!-- 检查人 -->
|
||||||
and f.INSPECTION_USER_ID = #{pd.INSPECTION_USER_ID}
|
and f.INSPECTION_USER_ID = #{pd.INSPECTION_USER_ID}
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.INSPECTION_SUBJECT != null and pd.INSPECTION_SUBJECT != ''"><!-- 检查题目 -->
|
<if test="pd.INSPECTION_SUBJECT != null and pd.INSPECTION_SUBJECT != ''">
|
||||||
|
<!-- 检查题目 -->
|
||||||
and se.INSPECTION_SUBJECT = #{pd.INSPECTION_SUBJECT,jdbcType=VARCHAR}
|
and se.INSPECTION_SUBJECT = #{pd.INSPECTION_SUBJECT,jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.INSPECTED_DEPARTMENT_NAME != null and pd.INSPECTED_DEPARTMENT_NAME != ''"><!-- 被检查单位 -->
|
<if test="pd.INSPECTED_DEPARTMENT_NAME != null and pd.INSPECTED_DEPARTMENT_NAME != ''">
|
||||||
and isd.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTED_DEPARTMENT_NAME}),'%')
|
<!-- 被检查单位 -->
|
||||||
|
and isd.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTED_DEPARTMENT_NAME}), '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.INSPECTION_DEPARTMENT_NAME != null and pd.INSPECTION_DEPARTMENT_NAME != ''"><!-- 检查部门 -->
|
<if test="pd.INSPECTION_DEPARTMENT_NAME != null and pd.INSPECTION_DEPARTMENT_NAME != ''">
|
||||||
and iod.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_DEPARTMENT_NAME}),'%')
|
<!-- 检查部门 -->
|
||||||
|
and iod.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_DEPARTMENT_NAME}), '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.INSPECTION_ORIGINATOR_NAME != null and pd.INSPECTION_ORIGINATOR_NAME != ''"><!-- 检查发起人 -->
|
<if test="pd.INSPECTION_ORIGINATOR_NAME != null and pd.INSPECTION_ORIGINATOR_NAME != ''">
|
||||||
and iou.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_ORIGINATOR_NAME}),'%')
|
<!-- 检查发起人 -->
|
||||||
|
and iou.NAME LIKE CONCAT(CONCAT('%', #{pd.INSPECTION_ORIGINATOR_NAME}), '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.INSPECTION_TYPE != null and pd.INSPECTION_TYPE != ''"><!-- 检查类型 -->
|
<if test="pd.INSPECTION_TYPE != null and pd.INSPECTION_TYPE != ''">
|
||||||
|
<!-- 检查类型 -->
|
||||||
and se.INSPECTION_TYPE = #{pd.INSPECTION_TYPE}
|
and se.INSPECTION_TYPE = #{pd.INSPECTION_TYPE}
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.INSPECTION_TIME_START != null and pd.INSPECTION_TIME_START != ''"><!-- 检查时间 -->
|
<if test="pd.INSPECTION_TIME_START != null and pd.INSPECTION_TIME_START != ''">
|
||||||
|
<!-- 检查时间 -->
|
||||||
and se.INSPECTION_TIME_START >= CONCAT(#{pd.INSPECTION_TIME_START}, ' 00:00')
|
and se.INSPECTION_TIME_START >= CONCAT(#{pd.INSPECTION_TIME_START}, ' 00:00')
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.INSPECTION_TIME_END != null and pd.INSPECTION_TIME_END != ''"><!-- 检查时间 -->
|
<if test="pd.INSPECTION_TIME_END != null and pd.INSPECTION_TIME_END != ''">
|
||||||
|
<!-- 检查时间 -->
|
||||||
and se.INSPECTION_TIME_END <= CONCAT(#{pd.INSPECTION_TIME_END}, ' 23:59')
|
and se.INSPECTION_TIME_END <= CONCAT(#{pd.INSPECTION_TIME_END}, ' 23:59')
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.INSPECTION_STATUS != null and pd.INSPECTION_STATUS != ''"><!-- 检查状态 -->
|
<if test="pd.INSPECTION_STATUS != null and pd.INSPECTION_STATUS != ''">
|
||||||
|
<!-- 检查状态 -->
|
||||||
and se.INSPECTION_STATUS = #{pd.INSPECTION_STATUS}
|
and se.INSPECTION_STATUS = #{pd.INSPECTION_STATUS}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 被检查单位 -->
|
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''">
|
||||||
|
<!-- 被检查单位 -->
|
||||||
and (
|
and (
|
||||||
isd.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
isd.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}), '%')
|
||||||
OR iod.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
OR iod.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}), '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
GROUP BY f.INSPECTION_ID
|
GROUP BY f.INSPECTION_ID
|
||||||
ORDER BY
|
ORDER BY FIELD(if(f.INSPECTION_USER_SIGN_TIME is not null, '2', '1'), '1', '2'),
|
||||||
FIELD(if(f.INSPECTION_USER_SIGN_TIME is not null,'2','1'), '1','2'),
|
<if test="pd.loginUserId != null and pd.loginUserId != ''">
|
||||||
FIELD(if(se.INSPECTED_SITEUSER_ID = #{pd.loginUserId},#{pd.loginUserId},'1'), #{pd.loginUserId}, '1'),
|
FIELD(if(se.INSPECTED_SITEUSER_ID = #{pd.loginUserId}, #{pd.loginUserId}, '1'), #{pd.loginUserId}, '1'),
|
||||||
FIELD (se.INSPECTION_STATUS , '0','1','2','3','4','5','6','7','8','-1','-2') ,
|
</if>
|
||||||
se.INSPECTION_TIME_START DESC , se.INSPECTION_TIME_END DESC
|
FIELD(se.INSPECTION_STATUS, '0', '1', '2', '3', '4', '5', '6', '7', '8', '-1', '-2'),
|
||||||
|
se.INSPECTION_TIME_START DESC, se.INSPECTION_TIME_END DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 列表(全部) -->
|
<!-- 列表(全部) -->
|
||||||
|
|
|
@ -665,6 +665,7 @@
|
||||||
ON si.INSPECTION_ID = f.INSPECTION_ID and si.ISDELETE = '0'
|
ON si.INSPECTION_ID = f.INSPECTION_ID and si.ISDELETE = '0'
|
||||||
LEFT JOIN vi_user_all siu ON siu.USER_ID = si.INSPECTION_USER_ID
|
LEFT JOIN vi_user_all siu ON siu.USER_ID = si.INSPECTION_USER_ID
|
||||||
LEFT JOIN sys_dictionaries d ON d.BIANMA = f.INSPECTION_TYPE
|
LEFT JOIN sys_dictionaries d ON d.BIANMA = f.INSPECTION_TYPE
|
||||||
|
<if test="pd.loginUserId != null and pd.loginUserId != ''">
|
||||||
LEFT JOIN (select h.FOREIGN_ID, count(h.HIDDEN_ID) as `count`
|
LEFT JOIN (select h.FOREIGN_ID, count(h.HIDDEN_ID) as `count`
|
||||||
from BUS_HIDDEN h
|
from BUS_HIDDEN h
|
||||||
where h.ISDELETE = 0
|
where h.ISDELETE = 0
|
||||||
|
@ -672,6 +673,7 @@
|
||||||
and h.STATE in ('4', '8')
|
and h.STATE in ('4', '8')
|
||||||
and (h.FINAL_CHECK is null or h.FINAL_CHECK = '2')
|
and (h.FINAL_CHECK is null or h.FINAL_CHECK = '2')
|
||||||
group by h.FOREIGN_ID) h on h.FOREIGN_ID = f.INSPECTION_ID AND f.INSPECTION_STATUS in ('5', '6')
|
group by h.FOREIGN_ID) h on h.FOREIGN_ID = f.INSPECTION_ID AND f.INSPECTION_STATUS in ('5', '6')
|
||||||
|
</if>
|
||||||
where f.ISDELETE = '0'
|
where f.ISDELETE = '0'
|
||||||
<if test="pd.INSPECTION_ORIGINATOR_ID != null and pd.INSPECTION_ORIGINATOR_ID != ''">
|
<if test="pd.INSPECTION_ORIGINATOR_ID != null and pd.INSPECTION_ORIGINATOR_ID != ''">
|
||||||
<!-- 检查发起人 -->
|
<!-- 检查发起人 -->
|
||||||
|
@ -736,11 +738,14 @@
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
GROUP BY f.INSPECTION_ID
|
GROUP BY f.INSPECTION_ID
|
||||||
ORDER BY CASE
|
ORDER BY
|
||||||
|
<if test="pd.loginUserId != null and pd.loginUserId != ''">
|
||||||
|
CASE
|
||||||
WHEN f.INSPECTION_STATUS IN ('3', '4') AND f.INSPECTED_SITEUSER_ID = #{pd.loginUserId} THEN 1
|
WHEN f.INSPECTION_STATUS IN ('3', '4') AND f.INSPECTED_SITEUSER_ID = #{pd.loginUserId} THEN 1
|
||||||
WHEN f.INSPECTION_STATUS IN ('5', '6', '7') AND checkout = 1 THEN 2
|
WHEN f.INSPECTION_STATUS IN ('5', '6', '7') AND checkout = 1 THEN 2
|
||||||
ELSE 3
|
ELSE 3
|
||||||
END,
|
END,
|
||||||
|
</if>
|
||||||
field(f.INSPECTION_STATUS, '3', '6', '4', '7', '5', '0', '1', '2', '8', '-1', '-2'),
|
field(f.INSPECTION_STATUS, '3', '6', '4', '7', '5', '0', '1', '2', '8', '-1', '-2'),
|
||||||
f.INSPECTION_TIME_END DESC
|
f.INSPECTION_TIME_END DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
Loading…
Reference in New Issue