You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
151 lines
5.1 KiB
151 lines
5.1 KiB
<?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.kms.yg.df.mapper.BsSgcDfFzrMapper">
|
|
|
|
<sql id="info">
|
|
select sj.dike_name,
|
|
sf.*
|
|
from bs_sgc_df_fzr sf
|
|
left join att_dike_base sj on sf.dike_code = sj.dike_code
|
|
</sql>
|
|
|
|
|
|
<sql id="getHistogram">
|
|
select sx.name,
|
|
count(1) num,
|
|
sf.type
|
|
from bs_sgc_df_fzr sf
|
|
left join att_dike_base sj on sf.dike_code = sj.dike_code
|
|
left join sys_xzqh sx on LEFT(sj.adcd,6)=LEFT(sx.xzqhdm,6)
|
|
AND RIGHT(sx.xzqhdm, 6) = '000000'
|
|
</sql>
|
|
|
|
|
|
<resultMap type="pieDto" id="pieDto">
|
|
<result property="name" column="name"/>
|
|
<result property="num" column="num"/>
|
|
<result property="type" column="type"/>
|
|
</resultMap>
|
|
|
|
|
|
<resultMap type="BsSgcDfFzr" id="BsSgcDfFzr">
|
|
<id property="id" column="id" />
|
|
<result property="dikeName" column="dike_name"/>
|
|
<result property="name" column="name"/>
|
|
<result property="unit" column="unit"/>
|
|
<result property="duties" column="duties"/>
|
|
<result property="phone" column="phone"/>
|
|
<result property="type" column="type"/>
|
|
<result property="competentDepartment" column="competent_department"/>
|
|
<result property="competentDepartmentDuties" column="competent_department_duties"/>
|
|
<result property="effectiveDate" column="effective_date"/>
|
|
<result property="createTime" column="create_time"/>
|
|
</resultMap>
|
|
|
|
<!--<select id="selectList1" resultMap="Result">
|
|
<bind name="pageNum" value="(pageNum-1)*pageSize"></bind>
|
|
SELECT sluice_name, adcd, COUNT(1) number,sluice_code
|
|
FROM bs_sgc_sz_bzbp
|
|
<where>
|
|
<if test="sluiceName != null and sluiceName != ''">
|
|
sluice_name like concat('%', #{sluiceName}, '%')
|
|
</if>
|
|
<if test="adcd != null and adcd != ''">
|
|
and adcd like concat(#{adcd},'%')
|
|
</if>
|
|
</where>
|
|
GROUP BY sluice_code
|
|
ORDER BY create_time DESC
|
|
LIMIT #{pageNum}, #{pageSize}
|
|
</select>-->
|
|
|
|
<select id="getList" resultMap="BsSgcDfFzr">
|
|
<bind name="pageNum" value="(pageNum-1)*pageSize"></bind>
|
|
<include refid="info"></include>
|
|
<where>
|
|
<if test="dikeName!=null and dikeName!=''">
|
|
and sj.dike_NAME like concat('%',#{dikeName},'%')
|
|
</if>
|
|
<if test="dikeCode != null and dikeCode != ''">
|
|
and sj.dike_CODE =#{dikeCode}
|
|
</if>
|
|
<include refid="com.kms.system.mapper.SysXzqhMapper.xzqhCondition"></include>
|
|
</where>
|
|
order by ${orderBy} desc LIMIT #{pageNum},#{pageSize};
|
|
</select>
|
|
|
|
<select id="getPercent" resultType="java.util.Map">
|
|
SELECT
|
|
xzqh.NAME as name ,
|
|
SUM(score) AS score
|
|
FROM (
|
|
SELECT
|
|
db.adcd,
|
|
db.dike_code,
|
|
COUNT(DISTINCT person_responsible_type)*33.3 AS score
|
|
FROM
|
|
bs_sgc_df_fzr fzr
|
|
LEFT JOIN
|
|
att_dike_base db ON fzr.dike_code = db.dike_code
|
|
WHERE
|
|
fzr.type = '0'
|
|
GROUP BY
|
|
db.adcd, dike_code
|
|
) AS subquery
|
|
LEFT JOIN
|
|
sys_xzqh xzqh ON LEFT(xzqh.XZQHDM, 6) = subquery.adcd and RIGHT(xzqh.XZQHDM, 6)='000000'
|
|
GROUP BY
|
|
xzqh.NAME;
|
|
</select>
|
|
|
|
|
|
<select id="getType1" resultMap="pieDto">
|
|
<include refid="getHistogram"></include>
|
|
<if test="layer==5">
|
|
WHERE
|
|
sj.adcd LIKE concat(#{adcd},'%') and sf.type='0' GROUP BY LEFT(sj.adcd,4)
|
|
</if>
|
|
<if test="layer==4">
|
|
WHERE
|
|
sj.adcd LIKE concat(#{adcd},'%') and sf.type='0' GROUP BY sj.adcd
|
|
</if>
|
|
<if test="layer==3">
|
|
WHERE
|
|
sj.adcd = #{adcd} and sf.type='0'
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getType2" resultMap="pieDto">
|
|
<include refid="getHistogram"></include>
|
|
<if test="layer==5">
|
|
WHERE
|
|
sj.adcd LIKE concat(#{adcd},'%') and sf.type='1' GROUP BY LEFT(sj.adcd,4)
|
|
</if>
|
|
<if test="layer==4">
|
|
WHERE
|
|
sj.adcd LIKE concat(#{adcd},'%') and sf.type='1' GROUP BY sj.adcd
|
|
</if>
|
|
<if test="layer==3">
|
|
WHERE
|
|
sj.adcd = #{adcd} and sf.type='1'
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getType3" resultMap="pieDto">
|
|
<include refid="getHistogram"></include>
|
|
<if test="layer==5">
|
|
WHERE
|
|
sj.adcd LIKE concat(#{adcd},'%') and sf.type='2' GROUP BY LEFT(sj.adcd,4)
|
|
</if>
|
|
<if test="layer==4">
|
|
WHERE
|
|
sj.adcd LIKE concat(#{adcd},'%') and sf.type='2' GROUP BY sj.adcd
|
|
</if>
|
|
<if test="layer==3">
|
|
WHERE
|
|
sj.adcd = #{adcd} and sf.type='2'
|
|
</if>
|
|
</select>
|
|
</mapper>
|
|
|