| | |
| | | LEFT JOIN ba_user us ON FIND_IN_SET(us.id,w.assistants) GROUP BY w.id |
| | | ) sawl ON ps.id = sawl.station_id |
| | | </select> |
| | | <select id="queryAttendUser" resultType="cn.hutool.json.JSONObject"> |
| | | WITH total AS ( |
| | | SELECT DISTINCT user_id,dt AS login_time FROM sta_assembly_work_last |
| | | union |
| | | SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(a.assistants, ',', b.help_topic_id + 1 ), ',', - 1 ) AS user_id ,login_time |
| | | FROM |
| | | (SELECT assistants ,dt AS login_time FROM sta_assembly_work_last) a |
| | | JOIN mysql.help_topic AS b ON b.help_topic_id <![CDATA[ < ]]> ( LENGTH( a.assistants ) - LENGTH( REPLACE ( a.assistants, ',', '' ) ) + 1 ) |
| | | union |
| | | SELECT DISTINCT user_id ,end_time AS login_time FROM sta_assembly_work_history WHERE end_time BETWEEN #{startTime,jdbcType=TIMESTAMP} AND #{endTime,jdbcType=TIMESTAMP} |
| | | union |
| | | SELECT DISTINCT SUBSTRING_INDEX(SUBSTRING_INDEX(c.assistants, ',', d.help_topic_id + 1 ), ',', - 1 ) AS user_id ,login_time |
| | | FROM |
| | | (SELECT assistants,end_time AS login_time FROM sta_assembly_work_history WHERE end_time BETWEEN #{startTime,jdbcType=TIMESTAMP} AND #{endTime,jdbcType=TIMESTAMP}) c |
| | | JOIN mysql.help_topic AS d ON d.help_topic_id <![CDATA[ < ]]> ( LENGTH( c.assistants ) - LENGTH( REPLACE ( c.assistants, ',', '' ) ) + 1 )) |
| | | SELECT MAX(CASE record.title WHEN 'require_attend' THEN record.count_user ELSE 0 END) require_attend, |
| | | MAX(CASE record.title WHEN 'actual_attend' THEN record.count_user ELSE 0 END) actual_attend |
| | | FROM |
| | | (SELECT COUNT(DISTINCT user_id) AS count_user,'require_attend' AS title FROM total WHERE user_id !='' |
| | | UNION |
| | | SELECT COUNT(DISTINCT user_id) AS count_user,'actual_attend' AS title FROM total WHERE user_id !='' AND login_time <![CDATA[ > ]]> #{todayDt,jdbcType=TIMESTAMP}) record |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
| | | delete |