<?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.ruoyi.project.tr.dataStatistics.mapper.DataStatisticsMapper">
|
<resultMap type="DataStatistics" id="companyMap">
|
<id property="companyId" column="company_id"/>
|
<result property="companyName" column="company_name"/>
|
<result property="companyRegion" column="company_region"/>
|
<result property="companyIndustry" column="company_industry"/>
|
<result property="companySubIndustry" column="company_sub_industry"/>
|
<collection property="dangers" ofType="DangerData" resultMap="dangers"/>
|
<collection property="risks" ofType="RiskData" resultMap="risks"/>
|
</resultMap>
|
|
<resultMap id="dangers" type="DangerData">
|
<id property="checkId" column="check_id"></id>
|
<result property="dangerLevel" column="danger_level"/>
|
<result property="createTime" column="create_time"/>
|
<result property="rectifyStatus" column="rectify_status"/>
|
<result property="whetherDanger" column="whether_danger"/>
|
</resultMap>
|
|
<resultMap id="risks" type="RiskData">
|
<id property="checkPointId" column="check_point_id"></id>
|
<result property="riskColor" column="risk_color"/>
|
<result property="reviewStatus" column="review_status"/>
|
</resultMap>
|
|
<select id="selectCompanyDangers" parameterType="DataStatistics" resultMap="companyMap">
|
SELECT
|
sc.company_id,
|
sc.company_name,
|
sc.company_region,
|
sc.company_industry,
|
sc.company_sub_industry,
|
thdcp.id as check_id,
|
thdcp.danger_level,
|
DATE_FORMAT(thdcp.register_create_time , '%Y-%m') create_time,
|
thdcp.rectify_status,
|
thdcp.whether_danger
|
FROM
|
(select sc.company_id,sc.company_name,sc.company_region,sc.company_industry,sc.company_sub_industry from
|
sys_company sc
|
<where>
|
<if test="companyName != null and companyName != ''">and sc.company_name like concat('%', #{companyName},
|
'%')
|
</if>
|
<if test="companyRegion != null and companyRegion != ''">and sc.company_region = #{companyRegion}</if>
|
<if test="companyId != null and companyId != ''">and sc.company_id = #{companyId}</if>
|
<if test="selectAllCompanyHasRegion != null and selectAllCompanyHasRegion != ''">and (sc.company_region
|
="源汇区"
|
or sc.company_region ="郾城区"
|
or sc.company_region ="召陵区"
|
or sc.company_region ="舞阳县"
|
or sc.company_region ="临颍县"
|
or sc.company_region ="开发区"
|
or sc.company_region = "西城区"
|
or sc.company_region = "市直")
|
</if>
|
<if test="null != companyIdList and companyIdList.size() > 0">
|
and (sc.company_id in
|
<foreach collection="companyIdList" item="companyId" open="(" separator="," close=")">
|
#{companyId}
|
</foreach>)
|
</if>
|
<if test="companyIndustry != null and companyIndustry != ''">and sc.company_industry = #{companyIndustry}
|
</if>
|
<if test="companySubIndustry != null and companySubIndustry != ''">and sc.company_sub_industry =
|
#{companySubIndustry}
|
</if>
|
</where>
|
)sc
|
LEFT JOIN
|
(SELECT `id`, `danger_level`, `register_create_time`, `rectify_status`, `whether_danger`,`company_id`
|
from
|
tr_hidden_danger_check_point
|
where rectify_status is not null)thdcp
|
ON
|
sc.company_id = thdcp.company_id
|
</select>
|
|
<select id="selectCompanyRisks" parameterType="DataStatistics" resultMap="companyMap">
|
SELECT
|
sc.company_id,
|
sc.company_name,
|
sc.company_region,
|
sc.company_industry,
|
sc.company_sub_industry,
|
trcp.check_point_id,
|
trcp.review_status,
|
trcp.evaluation_after_fengxianse risk_color
|
FROM
|
(select sc.company_id,sc.company_name,sc.company_region,sc.company_industry,sc.company_sub_industry from
|
sys_company sc
|
<where>
|
<if test="companyName != null and companyName != ''">and sc.company_name like concat('%', #{companyName},
|
'%')
|
</if>
|
<if test="companyRegion != null and companyRegion != ''">and sc.company_region = #{companyRegion}</if>
|
<if test="companyId != null and companyId != ''">and sc.company_id = #{companyId}</if>
|
<if test="selectAllCompanyHasRegion != null and selectAllCompanyHasRegion != ''">and (sc.company_region
|
="源汇区"
|
or sc.company_region ="郾城区"
|
or sc.company_region ="召陵区"
|
or sc.company_region ="舞阳县"
|
or sc.company_region ="临颍县"
|
or sc.company_region ="开发区"
|
or sc.company_region = "西城区"
|
or sc.company_region = "市直")
|
</if>
|
<if test="null != companyIdList and companyIdList.size() > 0">
|
and (sc.company_id in
|
<foreach collection="companyIdList" item="companyId" open="(" separator="," close=")">
|
#{companyId}
|
</foreach>)
|
</if>
|
<if test="companyIndustry != null and companyIndustry != ''">and sc.company_industry = #{companyIndustry}
|
</if>
|
<if test="companySubIndustry != null and companySubIndustry != ''">and sc.company_sub_industry =
|
#{companySubIndustry}
|
</if>
|
</where>
|
)sc
|
LEFT JOIN
|
tr_risk_check_point trcp
|
ON
|
sc.company_id = trcp.company_id
|
|
</select>
|
|
</mapper>
|