|
|
|
<?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.programManagement.mapper.BAdministrativeMapper">
|
|
|
|
|
|
|
|
<resultMap type="BAdministrative" id="BAdministrativeResult">
|
|
|
|
<result property="id" column="id"/>
|
|
|
|
<result property="region" column="region"/>
|
|
|
|
<result property="province" column="province"/>
|
|
|
|
<result property="city" column="city"/>
|
|
|
|
<result property="county" column="county"/>
|
|
|
|
<result property="subdistrict" column="subdistrict"/>
|
|
|
|
<result property="institutionName" column="institution_name"/>
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectBAdministrativeVo">
|
|
|
|
select id, region, province, city, county, subdistrict, institution_name
|
|
|
|
from b_administrative
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectBAdministrativeList" parameterType="BAdministrative" resultMap="BAdministrativeResult">
|
|
|
|
<include refid="selectBAdministrativeVo"/>
|
|
|
|
<where>
|
|
|
|
<if test="region != null and region != ''">and region = #{region}</if>
|
|
|
|
<if test="province != null and province != ''">and province = #{province}</if>
|
|
|
|
<if test="city != null and city != ''">and city = #{city}</if>
|
|
|
|
<if test="county != null and county != ''">and county = #{county}</if>
|
|
|
|
<if test="subdistrict != null and subdistrict != ''">and subdistrict = #{subdistrict}</if>
|
|
|
|
<if test="institutionName != null and institutionName != ''">and institution_name like concat('%',
|
|
|
|
#{institutionName}, '%')
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectBAdministrativeById" parameterType="Long" resultMap="BAdministrativeResult">
|
|
|
|
<include refid="selectBAdministrativeVo"/>
|
|
|
|
where id = #{id}
|
|
|
|
</select>
|
|
|
|
<select id="selectBAdministrativeTreeRequestList"
|
|
|
|
resultType="com.ruoyi.programManagement.entity.request.BAdministrativeTreeRequest">
|
|
|
|
select county, subdistrict, institution_name as institutionName
|
|
|
|
from b_administrative
|
|
|
|
where institution_name!='苏州市'
|
|
|
|
group by county
|
|
|
|
</select>
|
|
|
|
<select id="selectcascadingSelectDataList"
|
|
|
|
resultType="com.ruoyi.programManagement.entity.request.BAdministrativeTreeRequest">
|
|
|
|
select county, subdistrict, institution_name as institutionName
|
|
|
|
from b_administrative
|
|
|
|
</select>
|
|
|
|
<select id="selectBPlanEnterPriseTreeRequestRequestList"
|
|
|
|
resultType="com.ruoyi.programManagement.entity.request.BPlanEnterPriseTreeResponse">
|
|
|
|
|
|
|
|
-- SELECT a.subdistrict AS subdistrict,a.county,c.id,a.institution_name as institutionName,
|
|
|
|
-- COUNT(b.subdistrict) AS enterpriseCount,
|
|
|
|
-- COUNT(DISTINCT k.ent_code) - COUNT(DISTINCT c.enterprise_id) AS remainingKeyEnterpriseCount,
|
|
|
|
-- COUNT(DISTINCT c.enterprise_id) AS plannedEnterpriseCount,
|
|
|
|
-- COUNT(DISTINCT CASE WHEN k.ent_code IS NOT NULL THEN c.enterprise_id END) AS planneKeyEnterpriseCount
|
|
|
|
-- FROM b_administrative a
|
|
|
|
-- LEFT JOIN sz_ent_basic_info b ON a.subdistrict = LPAD(b.subdistrict, LENGTH(a.subdistrict), '0')
|
|
|
|
-- LEFT JOIN b_key_enterprise k ON a.subdistrict = k.district
|
|
|
|
-- LEFT JOIN b_plan_enterprise c ON k.ent_code = c.enterprise_id
|
|
|
|
-- WHERE a.SUBDISTRICT LIKE '%13205%'
|
|
|
|
select s.institutionName ,s.plannedEnterpriseCount,s.checkEnterpriseCount,s.pt from (SELECT
|
|
|
|
a. institution_name AS institutionName,
|
|
|
|
COUNT(DISTINCT b.enterprise_id) AS plannedEnterpriseCount,
|
|
|
|
COUNT(DISTINCT c.USC_CODE) AS checkEnterpriseCount,
|
|
|
|
COUNT(DISTINCT c.USC_CODE) / COUNT(DISTINCT b.enterprise_id) AS pt
|
|
|
|
FROM
|
|
|
|
b_administrative a
|
|
|
|
LEFT JOIN b_plan_enterprise b ON SUBSTRING(a.county, 1, 8) = SUBSTRING(b.district, 1, 8)
|
|
|
|
LEFT JOIN sz_enfor_examine c ON b.enterprise_id = c.USC_CODE
|
|
|
|
<where>
|
|
|
|
<if test="req.plannedYear!=null and req.plannedYear!=''">
|
|
|
|
b.planned_year=#{req.plannedYear}
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
GROUP BY SUBSTRING(a.county, 1, 8) )s
|
|
|
|
where s.institutionName!='苏州市'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<insert id="insertBAdministrative" parameterType="BAdministrative" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
insert into b_administrative
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="region != null">region,</if>
|
|
|
|
<if test="province != null">province,</if>
|
|
|
|
<if test="city != null">city,</if>
|
|
|
|
<if test="county != null">county,</if>
|
|
|
|
<if test="subdistrict != null">subdistrict,</if>
|
|
|
|
<if test="institutionName != null">institution_name,</if>
|
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="region != null">#{region},</if>
|
|
|
|
<if test="province != null">#{province},</if>
|
|
|
|
<if test="city != null">#{city},</if>
|
|
|
|
<if test="county != null">#{county},</if>
|
|
|
|
<if test="subdistrict != null">#{subdistrict},</if>
|
|
|
|
<if test="institutionName != null">#{institutionName},</if>
|
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateBAdministrative" parameterType="BAdministrative">
|
|
|
|
update b_administrative
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="region != null">region = #{region},</if>
|
|
|
|
<if test="province != null">province = #{province},</if>
|
|
|
|
<if test="city != null">city = #{city},</if>
|
|
|
|
<if test="county != null">county = #{county},</if>
|
|
|
|
<if test="subdistrict != null">subdistrict = #{subdistrict},</if>
|
|
|
|
<if test="institutionName != null">institution_name = #{institutionName},</if>
|
|
|
|
</trim>
|
|
|
|
where id = #{id}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<delete id="deleteBAdministrativeById" parameterType="Long">
|
|
|
|
delete
|
|
|
|
from b_administrative
|
|
|
|
where id = #{id}
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="deleteBAdministrativeByIds" parameterType="String">
|
|
|
|
delete from b_administrative where id in
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
</mapper>
|