AjhRectificationInfoMapper.java 6.5 KB
package com.skua.modules.ajh.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.skua.modules.ajh.entity.AjhRectificationInfo;
import com.skua.modules.ajh.vo.RectificationInfoAnalyseVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * 隐患检查
 */
public interface AjhRectificationInfoMapper extends BaseMapper<AjhRectificationInfo> {

    // 隐患统计
    List<Map<String, Object>> yhCensus(@Param("now") String now, @Param("last_month") String last_month, @Param("last_year") String last_year);


    //教育培训
    List<Map<String, Object>> jyCensus(@Param("now") String now, @Param("last_month") String last_month, @Param("last_year") String last_year);


    //应急演练
    List<Map<String, Object>> yjCensus(@Param("now") String now, @Param("last_month") String last_month, @Param("last_year") String last_year);


    //危化资料
    List<Map<String, Object>> whCensus(@Param("now") String now, @Param("last_month") String last_month, @Param("last_year") String last_year);


    //危险废物
    List<Map<String, Object>> wxCensus(@Param("now") String now, @Param("last_month") String last_month, @Param("last_year") String last_year);


    //集团安全文件
    List<Map<String, Object>> jtaqCensus(@Param("now") String now, @Param("last_month") String last_month, @Param("last_year") String last_year);

    //安全管理文件
    List<Map<String, Object>> safeCensus(@Param("now") String now, @Param("last_month") String last_month, @Param("last_year") String last_year);


    /**
     * 柱状图:安全隐患数量
     *
     * @return
     */
    List<RectificationInfoAnalyseVO.Histogram> countHistogramList(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate,
                                                                  @Param("groupByPattern") String groupByPattern, @Param("departId") String departId);

    /**
     * 【安全隐患数量】统计
     *
     * @return
     */
    RectificationInfoAnalyseVO.Histogram countByDate(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate,
                                                     @Param("departId") String departId);

    /**
     * 柱状图:风险等级分布
     *
     * @param startDate
     * @param endDate
     * @return
     */
    List<RectificationInfoAnalyseVO.Histogram> levelHistogramList(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate,
                                                                  @Param("departId") String departId);

    /**
     * 柱状图:安全责任人分布
     *
     * @param startDate
     * @param endDate
     * @return
     */
    List<RectificationInfoAnalyseVO.Histogram> dutyHistogramList(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate,
                                                                 @Param("departId") String departId);

    /**
     * 饼图:安全隐患区域分布
     *
     * @param startDate
     * @param endDate
     * @return
     */
    List<RectificationInfoAnalyseVO.XAndCount> areaList(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate,
                                                        @Param("departId") String departId);

    /**
     * 雷达图:安全隐患伤害类别
     *
     * @param startDate
     * @param endDate
     * @return 所有的伤害类别,以逗号分割
     */
    String classifyList(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate,
                        @Param("departId") String departId);

    /**
     * <pre>
     * 安全隐患地图点位统计
     * </pre>
     *
     * @param null
     * @author Li Yuanyuan,2023/6/14 15:07
     * @Description: TODO(这里描述这个方法的需求变更情况)
     */
    @Select("SELECT\n" +
            "\ta.rec_ord_body,\n" +
            "\ta.rec_ord_level,\n" +
            "\tcount(*) AS num,\n" +
            "\tb.monitor_top,\n" +
            "\tb.monitor_left,\n" +
            "\tb.monitor_width,\n" +
            "\tb.monitor_height\n" +
            "FROM\n" +
            "\tajh_rectification_info a left join ajh_safe_location b on a.rec_ord_body = b.struct_id\n" +
            "\tleft join ajh_safe_manage c on b.manage_id=c.id ${ew.customSqlSegment}")
    List<Map<String, Object>> mapPointStatistics(@Param(Constants.WRAPPER) QueryWrapper qw);

    @Select("select rec_ord_classify,(select item_text from sys_dict_item where dict_id =(select id from sys_dict where dict_code='rectification_info_classify') and item_value=rec_ord_classify) as rec_ord_classify_dictText,count(*) as num from ajh_rectification_info ${ew.customSqlSegment}")
    List<Map<String, Object>> riskPointPieCharts(@Param(Constants.WRAPPER) QueryWrapper qw);

    @Select("select SUBSTR(rec_ord_finish_date,1,7) as rec_ord_finish_date ,count(*) as num from ajh_rectification_info ${ew.customSqlSegment}")
    List<Map<String, Object>> riskPointLineCharts(@Param(Constants.WRAPPER) QueryWrapper qw);

    @Select("SELECT\n" +
            "\t(\n" +
            "\t\tSELECT\n" +
            "\t\t\tstruct_name\n" +
            "\t\tFROM\n" +
            "\t\t\tsys_struct_dict\n" +
            "\t\tWHERE\n" +
            "\t\t\tid = aa.rec_ord_body\n" +
            "\t) rec_ord_body_dictText,\n" +
            "\trec_ord_body,\n" +
            "\tSUM(\n" +
            "\t\tCASE\n" +
            "\t\tWHEN handle_result = '1' THEN\n" +
            "\t\t\tnum\n" +
            "\t\tELSE\n" +
            "\t\t\t0\n" +
            "\t\tEND\n" +
            "\t) AS 'wcl',\n" +
            "\tSUM(\n" +
            "\t\tCASE\n" +
            "\t\tWHEN handle_result = '3' THEN\n" +
            "\t\t\tnum\n" +
            "\t\tELSE\n" +
            "\t\t\t0\n" +
            "\t\tEND\n" +
            "\t) AS 'ycl'\n" +
            "FROM\n" +
            "\t(\n" +
            "\t\tSELECT\n" +
            "\t\t\trec_ord_body,\n" +
            "\t\t\thandle_result,\n" +
            "\t\t\tcount(*) AS num\n" +
            "\t\tFROM\n" +
            "\t\t\tajh_rectification_info\n" +
            " ${ew.customSqlSegment} " +
            "\t) aa\n" +
            "GROUP BY\n" +
            "\trec_ord_body")
    List<Map<String, Object>> getStructNoHandleDetail(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);
}