SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,createTime AS deductTime,1 AS checkType FROM mortals_xhx_check_attend_record WHERE 1=1
<iftest="checkStatus != null and !checkStatus!=''"> AND checkStatus = #{checkStatus} </if>
<iftest="staffId != null and !staffId!=''"> AND staffId = #{staffId} </if>
<iftest="createTimeStart != null and !createTimeStart!=''"> AND createTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{createTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<iftest="createTimeEnd != null and !createTimeEnd!=''"> AND createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
<iftest="createUserId != null and !createUserId!=''"> AND createUserId = #{createUserId} </if>
UNION
SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,2 AS subAddType,score,subMethod,checkTime,createTime AS deductTime,2 AS checkType FROM mortals_xhx_check_effect_record WHERE 1=1
<iftest="checkStatus != null and !checkStatus!=''"> AND checkStatus = #{checkStatus} </if>
<iftest="staffId != null and !staffId!=''"> AND staffId = #{staffId} </if>
<iftest="createTimeStart != null and !createTimeStart!=''"> AND createTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{createTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<iftest="createTimeEnd != null and !createTimeEnd!=''"> AND createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
<iftest="createUserId != null and !createUserId!=''"> AND createUserId = #{createUserId} </if>
UNION
SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,2 AS subAddType,score,subMethod,checkTime,createTime AS deductTime,3 AS checkType FROM mortals_xhx_check_complain_record WHERE 1=1
<iftest="checkStatus != null and !checkStatus!=''"> AND checkStatus = #{checkStatus} </if>
<iftest="staffId != null and !staffId!=''"> AND staffId = #{staffId} </if>
<iftest="createTimeStart != null and !createTimeStart!=''"> AND createTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{createTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<iftest="createTimeEnd != null and !createTimeEnd!=''"> AND createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
<iftest="createUserId != null and !createUserId!=''"> AND createUserId = #{createUserId} </if>
UNION
SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,2 AS subAddType,score,subMethod,checkTime,createTime AS deductTime,4 AS checkType FROM mortals_xhx_check_gowork_record WHERE 1=1
<iftest="checkStatus != null and !checkStatus!=''"> AND checkStatus = #{checkStatus} </if>
<iftest="staffId != null and !staffId!=''"> AND staffId = #{staffId} </if>
<iftest="createTimeStart != null and !createTimeStart!=''"> AND createTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{createTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<iftest="createTimeEnd != null and !createTimeEnd!=''"> AND createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
<iftest="createUserId != null and !createUserId!=''"> AND createUserId = #{createUserId} </if>
UNION
SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,2 AS subAddType,score,subMethod,checkTime,createTime AS deductTime,5 AS checkType FROM mortals_xhx_check_review_record WHERE 1=1
<iftest="checkStatus != null and !checkStatus!=''"> AND checkStatus = #{checkStatus} </if>
<iftest="staffId != null and !staffId!=''"> AND staffId = #{staffId} </if>
<iftest="createTimeStart != null and !createTimeStart!=''"> AND createTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{createTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<iftest="createTimeEnd != null and !createTimeEnd!=''"> AND createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
<iftest="createUserId != null and !createUserId!=''"> AND createUserId = #{createUserId} </if>
UNION
SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,2 AS subAddType,score,subMethod,checkTime,createTime AS deductTime,6 AS checkType FROM mortals_xhx_check_other_record WHERE 1=1
<iftest="checkStatus != null and !checkStatus!=''"> AND checkStatus = #{checkStatus} </if>
<iftest="staffId != null and !staffId!=''"> AND staffId = #{staffId} </if>
<iftest="createTimeStart != null and !createTimeStart!=''"> AND createTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{createTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<iftest="createTimeEnd != null and !createTimeEnd!=''"> AND createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
<iftest="createUserId != null and !createUserId!=''"> AND createUserId = #{createUserId} </if>