Commit 387fa00f authored by 李秀明's avatar 李秀明

消防员出勤接口

parent f632bbad
...@@ -30,5 +30,23 @@ public interface SignMapper extends BaseMapper<Sign> { ...@@ -30,5 +30,23 @@ public interface SignMapper extends BaseMapper<Sign> {
int queryPersonNum(String bizOgrCode); int queryPersonNum(String bizOgrCode);
// Map<String, Object> getSignStatistic(@Param("bizOrgCode") String bizOgrCode, @Param("userId") String userId); List<Map<String, Object>> selectCenterSignStats(
@Param("bizOrgCode") String bizOrgCode,
@Param("date") String date,
@Param("targetPassNum") Integer targetPassNum,
@Param("stationType") String stationType
);
List<Map<String, Object>> selectStationSignStats(@Param("bizOrgCode") String bizOrgCode);
IPage<Map<String, Object>> selectStationAttendanceStatsPage(
@Param("page") IPage<?> page,
@Param("date") String date,
@Param("stationType") String stationType,
@Param("bizOrgCode") String bizOrgCode,
@Param("attendanceStatus") String attendanceStatus,
@Param("targetPassNum") Integer targetPassNum,
@Param("sortField") String sortField,
@Param("sortOrder") String sortOrder
);
} }
package com.yeejoin.amos.boot.module.jcs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
public interface StationInfoMapper extends BaseMapper {
Long count(@Param("stationType") String stationType);
}
...@@ -148,7 +148,93 @@ ...@@ -148,7 +148,93 @@
GROUP BY biz_org_code GROUP BY biz_org_code
</select> </select>
<!-- <select id="getSignStatistic" resultType="Map">--> <select id="selectCenterSignStats" resultType="Map">
SELECT
t.BIZ_ORG_CODE AS bizOrgCode,
t.BIZ_ORG_NAME AS bizOrgName,
COUNT(DISTINCT t.user_id) AS num,
IF(COUNT(DISTINCT t.user_id) >= #{targetPassNum}, 'pass', 'fail') AS status
FROM
cb_sign t
RIGHT JOIN idx_biz_station_info s ON s.biz_ORG_CODE = t.biz_ORG_CODE
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND t.BIZ_ORG_CODE LIKE CONCAT(#{bizOrgCode}, '%')
</if>
<if test="date != null and date != ''">
AND t.DATE = #{date}
</if>
<if test="stationType != null and stationType != ''">
AND s.STATION_TYPE = #{stationType}
</if>
</where>
GROUP BY
t.BIZ_ORG_CODE
</select>
<select id="selectStationSignStats" resultType="Map">
SELECT
t.DATE AS date,
IFNULL(COUNT(DISTINCT t.user_id), 0) AS num
FROM
cb_sign t
WHERE
t.BIZ_ORG_CODE LIKE CONCAT(#{bizOrgCode}, '%')
AND t.DATE &gt;= DATE_SUB(CURDATE(), INTERVAL 7 DAY)
GROUP BY
t.DATE
</select>
<!-- </select>--> <select id="selectStationAttendanceStatsPage" resultType="Map">
SELECT
t2.BIZ_ORG_CODE AS bizOrgCode,
t2.NAME AS bizOrgName,
CONCAT(t2.STATION_TYPE, '换流站') AS stationType,
#{date} AS date,
IFNULL(t1.num, 0) AS signNum,
(SELECT COUNT(1) FROM cb_firefighters t WHERE t.BIZ_ORG_CODE LIKE CONCAT(t2.BIZ_ORG_CODE, '%') AND t.PEOPLE_TYPE = 1601 AND t.IS_DELETE = false) AS firefighterNum,
ROUND(ROUND(IFNULL(t1.num, 0) / (SELECT COUNT(1) FROM cb_firefighters t WHERE t.BIZ_ORG_CODE LIKE CONCAT(t2.BIZ_ORG_CODE, '%') AND t.PEOPLE_TYPE = 1601 AND t.IS_DELETE = false), 4) * 100, 2) AS attendanceRate,
IF(IFNULL(t1.num, 0) >= #{targetPassNum}, '合格', '不合格') AS attendanceStatus
FROM (
SELECT
t.BIZ_ORG_CODE AS bizOrgCode,
COUNT( DISTINCT t.user_id ) AS num
FROM
cb_sign t
<where>
t.DATE = #{date}
<if test="bizOrgCode != null and bizOrgCode != ''">
AND t.BIZ_ORG_CODE LIKE CONCAT(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
t.BIZ_ORG_CODE
) t1
RIGHT JOIN idx_biz_station_info t2 ON t2.BIZ_ORG_CODE = t1.bizOrgCode
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND t2.BIZ_ORG_CODE LIKE CONCAT(#{bizOrgCode}, '%')
</if>
<if test="stationType != null and stationType != ''">
AND t2.STATION_TYPE = #{stationType}
</if>
<if test="attendanceStatus != null and attendanceStatus != ''">
AND IF(IFNULL(t1.num, 0) >= #{targetPassNum}, 'pass', 'fail') = #{attendanceStatus}
</if>
</where>
ORDER BY
<if test="sortField != null and sortField != ''">
<choose>
<when test="sortOrder == 'ascend'">
${sortField} ASC
</when>
<otherwise>
${sortField} DESC
</otherwise>
</choose>
</if>
<if test="sortField == null or sortField == ''">
signNum DESC
</if>
</select>
</mapper> </mapper>
<?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.yeejoin.amos.boot.module.jcs.api.mapper.StationInfoMapper">
<select id="count" resultType="long">
SELECT
COUNT(1)
FROM idx_biz_station_info t
<where>
<if test="stationType != null and stationType != ''">
AND t.STATION_TYPE = #{stationType}
</if>
</where>
</select>
</mapper>
...@@ -3971,15 +3971,27 @@ ...@@ -3971,15 +3971,27 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="tw" id="20240801"> <changeSet author="ky" id="20240801">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="idx_biz_station_info" columnName="warehouse_id"/> <columnExists tableName="idx_biz_station_info" columnName="station_type"/>
</not> </not>
</preConditions> </preConditions>
<comment>新增属性字段 warehouse_id</comment> <comment>新增属性字段 station_type</comment>
<sql> <sql>
alter table `idx_biz_station_info` add column `station_type` varchar(20) DEFAULT NULL COMMENT '换流站类型'; alter table `idx_biz_station_info` add column `station_type` varchar(20) DEFAULT NULL COMMENT '换流站类型';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="lixm" id="20240801">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="idx_biz_station_info" columnName="biz_org_code"/>
</not>
</preConditions>
<comment>新增属性字段 biz_org_code</comment>
<sql>
alter table `idx_biz_station_info` add column `biz_org_code` varchar(50) DEFAULT NULL COMMENT 'BIZ_ORG_CODE';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment