123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- <?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.yiqi.mapper.YqGAreaMapper">
- <resultMap type="com.ruoyi.yiqi.entity.YqGArea" id="GAreaResult">
- <result property="id" column="id"/>
- <result property="name" column="name"/>
- <result property="userId" column="user_id"/>
- <result property="releaseIs" column="release_is"/>
- <result property="releaseBy" column="release_by"/>
- <result property="delFlag" column="del_flag"/>
- <result property="createBy" column="create_by"/>
- <result property="createTime" column="create_time"/>
- <result property="updateBy" column="update_by"/>
- <result property="updateTime" column="update_time"/>
- <result property="district" column="district"/>
- <result property="calculateDistrictId" column="calculate_district_id"/>
- <result property="calculateDistrictName" column="calculate_district_name"/>
- <result property="areaSize" column="area_size"/>
- <result property="affiliatedPackage" column="affiliated_package"/>
- </resultMap>
- <select id="getList" resultType="com.ruoyi.yiqi.entity.YqGArea">
- select a.id as id,
- a.name as name,
- (select b.name from yq_g_user b where b.id = a.user_id) as userName,
- a.release_is as releaseIs,
- a.calculate_district_id as calculateDistrictId,
- a.calculate_district_name as calculateDistrictName,
- a.area_size as areaSize,
- a.affiliated_package as affiliatedPackage,
- a.district as district
- from yq_g_area a
- <where>
- a.del_flag = '0'
- <if test="p.name != null and p.name != ''">
- and a.name LIKE CONCAT('%',#{p.name},'%')
- </if>
- <if test="p.userId != null and p.userId != ''">
- and a.user_id = #{p.userId}
- </if>
- <if test="p.district != null and p.district != ''">
- and a.district = #{p.district}
- </if>
- <if test="p.calculateDistrictId != null and p.calculateDistrictId != ''">
- and a.calculate_district_id = #{p.calculateDistrictId}
- </if>
- </where>
- </select>
- <select id="getArea" resultType="com.ruoyi.yiqi.entity.YqGArea">
- select id as id,
- name as name
- from yq_g_area
- where del_flag = '0'
- </select>
- <select id="getHouse" resultType="java.lang.Integer">
- select count(a.id)
- from yq_g_house a
- left join yq_g_unit b on (a.unit_id = b.id and b.del_flag = '0')
- left join yq_g_building c on (b.building_id = c.id and c.del_flag = '0')
- left join yq_g_area d on (c.area_id = d.id and d.del_flag = '0')
- where
- a.del_flag = '0' and d.id = #{id}
- </select>
- <select id="getExamineArea" resultType="com.ruoyi.yiqi.entity.GCensusVo">
- select count( o.house_id) as value,
- o.examine_status as name
- from yq_g_order o
- left join yq_g_house a on (o.house_id = a.id and a.del_flag = '0')
- left join yq_g_unit b on (a.unit_id = b.id and b.del_flag = '0')
- left join yq_g_building c on (b.building_id = c.id and c.del_flag = '0')
- left join yq_g_area d on (c.area_id = d.id and d.del_flag = '0')
- where o.order_status = '002'
- and o.service_type = '002'
- and o.del_flag = '0'
- <if test="areaId != null and areaId != ''">
- and d.id = #{areaId}
- </if>
- group by name
- </select>
- <select id="getExamineServe" resultType="com.ruoyi.yiqi.entity.GCensusVo">
- select count( o.id) as value,
- o.service_type as name
- from yq_g_order o
- left join yq_g_house a on (o.house_id = a.id and a.del_flag = '0')
- left join yq_g_unit b on (a.unit_id = b.id and b.del_flag = '0')
- left join yq_g_building c on (b.building_id = c.id and c.del_flag = '0')
- left join yq_g_area d on (c.area_id = d.id and d.del_flag = '0')
- where o.del_flag = '0'
- and o.service_type = ''
- or o.service_type = '001'
- or o.service_type = '002'
- or o.service_type = '003'
- <if test="id != null and id != ''">
- and d.id = #{id}
- </if>
- group by o.service_type
- </select>
- <select id="getExportList" resultType="com.ruoyi.yiqi.entity.GExportVo">
- select a.id as id,
- d.name as areaName,
- c.name as buildName,
- b.name as unitName,
- d.calculate_district_name as calculateDistrictName,
- d.area_size as areaSize,
- d.affiliated_package as affiliatedPackage,
- a.name as houseName
- from yq_g_area d
- left join yq_g_building c on (d.id = c.area_id and c.del_flag = '0')
- left join yq_g_unit b on (c.id = b.building_id and b.del_flag = '0')
- left join yq_g_house a on (b.id = a.unit_id and a.del_flag = '0')
- where d.del_flag = '0'
- </select>
- <select id="getExport" resultType="com.ruoyi.yiqi.entity.GExportsVo">
- SELECT a.name AS areaName,
- a.district AS district,
- a.calculate_district_id AS calculateDistrictName,
- a.area_size AS areaSize,
- a.affiliated_package AS affiliatedPackage,
- COUNT(b.area_id) AS count
- FROM yq_g_area a
- LEFT JOIN yq_g_order b ON (b.area_id = a.id AND b.del_flag = '0')
- WHERE a.del_flag = '0'
- AND a.calculate_district_id = #{calculateDistrictId}
- AND a.affiliated_package = #{affiliatedPackage}
- GROUP BY b.area_id
- </select>
- <select id="getDictNameOfAffiliatedPackage" resultType="string">
- SELECT
- CONCAT(a.dict_label,'-工程任务单(',b.dict_label,')') AS name
- FROM `yq_sys_dict_data` a
- LEFT JOIN yq_sys_dict_data b ON (b.dict_type = 'affiliated_package' AND b.dict_value = #{affiliatedPackage})
- WHERE a.dict_type = 'district' AND a.dict_value = #{calculateDistrictId}
- </select>
- <select id="getByName" resultType="com.ruoyi.yiqi.entity.YqGArea">
- select * from yq_g_area
- where name = #{name}
- and del_flag = '0'
- </select>
- <select id="getConform" resultType="com.ruoyi.yiqi.entity.GCensusVo">
- select count( o.house_id) as value,
- o.service_type as name
- from yq_g_order o
- left join yq_g_house a on (o.house_id = a.id and a.del_flag = '0')
- left join yq_g_unit b on (a.unit_id = b.id and b.del_flag = '0')
- left join yq_g_building c on (b.building_id = c.id and c.del_flag = '0')
- left join yq_g_area d on (c.area_id = d.id and d.del_flag = '0')
- where o.del_flag = '0'
- and o.service_type = '002' or o.service_type = '003' or o.service_type = ''
- <if test="areaId != null and areaId != ''">
- and d.id = #{areaId}
- </if>
- group by name
- </select>
- <select id="getInConform" resultType="java.lang.Integer">
- select count( o.house_id)
- from yq_g_order o
- left join yq_g_house a on (o.house_id = a.id and a.del_flag = '0')
- left join yq_g_unit b on (a.unit_id = b.id and b.del_flag = '0')
- left join yq_g_building c on (b.building_id = c.id and c.del_flag = '0')
- left join yq_g_area d on (c.area_id = d.id and d.del_flag = '0')
- where o.service_type = '003'
- and o.del_flag = '0'
- <if test="areaId != null and areaId != ''">
- and d.id = #{areaId}
- </if>
- </select>
- <select id="getHouseCount" resultType="java.lang.Integer">
- select count( a.id)
- from yq_g_house a
- left join yq_g_unit b on (a.unit_id = b.id and b.del_flag = '0')
- left join yq_g_building c on (b.building_id = c.id and c.del_flag = '0')
- left join yq_g_area d on (c.area_id = d.id and d.del_flag = '0')
- where a.del_flag = '0'
- <if test="areaId != null and areaId != ''">
- and d.id = #{areaId}
- </if>
- </select>
- <select id="getForName" resultType="com.ruoyi.yiqi.entity.YqGArea">
- select * from yq_g_area
- where name = #{name}
- and del_flag = '0'
- <if test="id != null and id!= ''">
- and id != #{id}
- </if>
- limit 1
- </select>
- <select id="getPhoto" resultType="java.lang.String">
- select a.pic_url
- from yq_g_order_photo a
- left join yq_g_order b on (a.order_id = b.id and b.service_type = '002' and b.examine_status = '001')
- left join yq_g_house c on b.house_id = c.id
- left join yq_g_unit d on c.unit_id = d.id
- left join yq_g_building e on d.building_id=e.id
- left join yq_g_area f on e.area_id = f.id
- where f.id = #{id}
- </select>
- <select id="getAllHouse" resultType="com.ruoyi.yiqi.entity.GAreaExportVo">
- select b.id as id,
- CONCAT(e.name,'-',d.name,'-',c.name,'-',b.name) as houseName
- FROM
- yq_g_house b
- LEFT JOIN yq_g_unit c ON b.unit_id = c.id
- LEFT JOIN yq_g_building d ON c.building_id = d.id
- LEFT JOIN yq_g_area e ON d.area_id = e.id
- WHERE
- b.del_flag = '0'
- AND c.del_flag = '0'
- AND d.del_flag = '0'
- AND e.del_flag = '0'
- AND e.id = #{areaId}
- </select>
- <select id="getOrderHouse" resultType="com.ruoyi.yiqi.entity.GAreaExportVo">
- select a.house_id as id,
- CONCAT(e.name,'-',d.name,'-',c.name,'-',b.name) as houseName
- from yq_g_order a
- left join yq_g_house b on (a.house_id = b.id and b.del_flag = '0')
- left join yq_g_unit c on (b.unit_id = c.id and c.del_flag = '0')
- left join yq_g_building d on (c.building_id = d.id and d.del_flag = '0')
- left join yq_g_area e on (d.area_id = e.id and e.del_flag = '0')
- where
- a.del_flag = '0'
- and a.service_type = '002'
- and a.examine_status = '001'
- and e.id = #{areaId}
- </select>
- <select id="checkDataList" resultType="java.lang.Long">
- select IFNULL(count(d.id) ,0) AS OrderAverage
- from yq_g_area d
- where
- d.del_flag = '0'
- and d.name = #{p.name}
- </select>
- </mapper>
|