| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- <?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="reportCommunityServiceDaoImpl">
- <!-- 查询房屋个数 add by wuxw 2018-07-03 -->
- <select id="getRoomCount" parameterType="com.java110.dto.report.ReportRoomDto" resultType="Map">
- select count(1) count
- from building_room t
- where t.status_cd = '0'
- <if test="state !=null and state != ''">
- and t.state= #{state}
- </if>
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
- </if>
- </select>
- <!-- 查询 房屋 楼栋 单元 业主 -->
- <select id="getRoomFloorUnitAndOwner" parameterType="com.java110.dto.report.ReportRoomDto"
- resultType="com.java110.dto.report.ReportRoomDto">
- select t.apartment,t.built_up_area builtUpArea,t.community_id communityId,t.create_time createTime,
- t.fee_coefficient feeCoefficient,t.layer,t.room_id roomId,t.room_num roomNum,t.section,
- t.state,bu.unit_id unitId,bu.unit_num unitNum,ff.floor_id floorId,ff.floor_num floorNum,
- bo.age,bo.id_card idCard,bo.link,bo.member_id memberId,bo.`name`,bo.`name` ownerName,bo.owner_id ownerId,t.room_type roomType,
- t.room_sub_type roomSubType,t.room_rent roomRent,t.room_area roomArea
- from building_room t
- INNER JOIN building_unit bu on t.unit_id = bu.unit_id and bu.status_cd = '0'
- inner join f_floor ff on bu.floor_id = ff.floor_id and ff.status_cd = '0'
- LEFT JOIN building_owner_room_rel borr on t.room_id = borr.room_id and borr.status_cd = '0'
- left join building_owner bo on borr.owner_id = bo.member_id and bo.status_cd = '0'
- where t.status_cd = '0'
- <if test="state !=null and state != ''">
- and t.state= #{state}
- </if>
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
- </if>
- <if test="page != -1 and page != null ">
- limit #{page}, #{row}
- </if>
- </select>
- <select id="queryRoomStructures" parameterType="Map" resultType="Map">
- select t.apartment,t.built_up_area builtUpArea,t.community_id communityId,t.create_time createTime,
- t.fee_coefficient feeCoefficient,t.layer,t.room_id roomId,t.room_num roomNum,t.section,
- t.state,bu.unit_id unitId,bu.unit_num unitNum,ff.floor_id floorId,ff.floor_num floorNum,
- bo.age,bo.id_card idCard,bo.link,bo.member_id memberId,bo.`name`,bo.`name` ownerName,bo.owner_id ownerId,t.room_type roomType,
- t.room_sub_type roomSubType,t.room_rent roomRent,t.room_area roomArea,td.name stateName,
- (
- select if (SUM(rof.amount_owed)!='',SUM(rof.amount_owed),0) from report_owe_fee rof where rof.payer_obj_id = t.room_id and rof.payer_obj_type = '3333'
- ) oweAmount
- from building_room t
- INNER JOIN building_unit bu on t.unit_id = bu.unit_id and bu.status_cd = '0'
- inner join f_floor ff on bu.floor_id = ff.floor_id and ff.status_cd = '0'
- LEFT JOIN building_owner_room_rel borr on t.room_id = borr.room_id and borr.status_cd = '0'
- left join building_owner bo on borr.owner_id = bo.member_id and bo.status_cd = '0'
- left join t_dict td on t.state = td.status_cd and td.table_name = 'building_room' and td.table_columns = 'state'
- where t.status_cd = '0'
- and t.community_id = #{communityId}
- and bu.unit_id = #{unitId}
- order by CONVERT(t.layer,SIGNED),CONVERT(t.room_num,SIGNED) asc
- </select>
- <select id="queryCarStructures" parameterType="Map" resultType="Map">
- select pa.num areaNum,ps.num,t.car_num carNum,br.room_id roomId,br.room_num roomNum,br.section,
- br.state,bu.unit_id unitId,bu.unit_num unitNum,ff.floor_id floorId,ff.floor_num floorNum,
- bo.age,bo.id_card idCard,bo.link,bo.member_id memberId,bo.`name`,bo.`name` ownerName,bo.owner_id ownerId,
- (
- select if (SUM(rof.amount_owed)!='',SUM(rof.amount_owed),0) from report_owe_fee rof where rof.payer_obj_id = t.car_id and rof.payer_obj_type = '6666'
- ) oweAmount
- from owner_car t
- INNER join building_owner bo on t.owner_id = bo.member_id and bo.status_cd = '0'
- INNER JOIN building_owner_room_rel borr on bo.owner_id = borr.owner_id and borr.status_cd = '0'
- INNER join building_room br on borr.room_id = br.room_id and br.status_cd = '0'
- INNER JOIN building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
- inner join f_floor ff on bu.floor_id = ff.floor_id and ff.status_cd = '0'
- LEFT JOIN parking_space ps on t.ps_id = ps.ps_id and ps.status_cd = '0'
- LEFT JOIN parking_area pa on ps.pa_id = pa.pa_id and pa.status_cd = '0'
- where t.status_cd = '0'
- and t.community_id = #{communityId}
- and bu.unit_id = #{unitId}
- order by t.car_num
- </select>
- <!-- 查询房屋个数 add by wuxw 2018-07-03 -->
- <select id="getCarCount" parameterType="com.java110.dto.report.ReportCarDto" resultType="Map">
- select count(1) count
- from owner_car t
- where t.status_cd = '0'
- <if test="state !=null and state != ''">
- and t.state= #{state}
- </if>
- <if test="leaseTypes !=null ">
- and t.lease_type in
- <foreach collection="leaseTypes" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
- </if>
- </select>
- <!-- 查询 房屋 楼栋 单元 业主 -->
- <select id="getCarParkingSpace" parameterType="com.java110.dto.report.ReportCarDto"
- resultType="com.java110.dto.report.ReportCarDto">
- select t.car_brand carBrand,t.car_color carColor,t.car_id carId,t.car_num carNum,t.car_type carType,
- t.community_id communityId,bo.`name` ownerName,bo.id_card idCard,bo.link,bo.owner_id ownerId,ps.ps_id psId,
- ps.num,pa.pa_id paId,pa.num areaNum,ps.state,t.start_time startTime,t.end_time endTime
- from owner_car t
- INNER JOIN building_owner bo on t.owner_id = bo.member_id and t.status_cd = '0'
- left join parking_space ps on t.ps_id = ps.ps_id and ps.status_cd = '0'
- left join parking_area pa on ps.pa_id = pa.pa_id and pa.status_cd = '0'
- where t.status_cd = '0'
- <if test="state !=null and state != ''">
- and t.state= #{state}
- </if>
- <if test="leaseTypes !=null ">
- and t.lease_type in
- <foreach collection="leaseTypes" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
- </if>
- <if test="page != -1 and page != null ">
- limit #{page}, #{row}
- </if>
- </select>
- <!-- 查询小区信息 add by wuxw 2018-07-03 -->
- <select id="getCommunitys" parameterType="Map" resultType="Map">
- select t.address,t.nearby_landmarks,t.nearby_landmarks nearbyLandmarks,
- t.city_code,t.city_code cityCode,t.name,t.status_cd,t.status_cd statusCd,t.tel,
- t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.map_y,t.map_y mapY,
- t.map_x,t.map_x mapX,t.state,ca.area_code areaCode,ca.area_name areaName,
- ca.parent_area_code parentAreaCode,ca.parent_area_name parentAreaName,
- t.community_area communityArea
- from s_community t,city_area ca
- where t.status_cd = '0'
- and t.city_code = ca.area_code
- and ca.status_cd = '0'
- <if test="address !=null and address != ''">
- and t.address= #{address}
- </if>
- <if test="nearbyLandmarks !=null and nearbyLandmarks != ''">
- and t.nearby_landmarks= #{nearbyLandmarks}
- </if>
- <if test="cityCode !=null and cityCode != ''">
- and t.city_code= #{cityCode}
- </if>
- <if test="name !=null and name != ''">
- and t.name like concat('%',#{name},'%')
- </if>
- <if test="statusCd !=null and statusCd != ''">
- and t.status_cd= #{statusCd}
- </if>
- <if test="communityId !=null and communityId != ''">
- and t.community_id= #{communityId}
- </if>
- <if test="communityIds !=null">
- and t.community_id in
- <foreach collection="communityIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="bId !=null and bId != ''">
- and t.b_id= #{bId}
- </if>
- <if test="mapY !=null and mapY != ''">
- and t.map_y= #{mapY}
- </if>
- <if test="mapX !=null and mapX != ''">
- and t.map_x= #{mapX}
- </if>
- <if test="state !=null and state != ''">
- and t.state= #{state}
- </if>
- order by t.create_time ASC
- <if test="page != -1 and page != null ">
- limit #{page}, #{row}
- </if>
- </select>
- <!-- 查询无效费用 add by wuxw 2018-07-03 -->
- <select id="queryInvalidFeeMonthStatistics" parameterType="Map" resultType="Map">
- select t.fee_id feeId from pay_fee t
- inner join pay_fee_config pfc on t.config_id = pfc.config_id
- inner join report_fee_year_collection rfyc on t.fee_id = rfyc.fee_id and rfyc.status_cd = '0'
- where (t.status_cd = '1' or pfc.status_cd = '1')
- and t.community_id= #{communityId}
- </select>
- <!--清理报表 无效数据-->
- <update id="deleteInvalidFee" parameterType="Map">
- delete from report_fee_year_collection where fee_id in
- <foreach collection="feeIds" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- and community_id = #{communityId}
- </update>
- <!-- 查询无效费用 add by wuxw 2018-07-03 -->
- <select id="queryRoomsTree" parameterType="Map" resultType="Map">
- SELECT t.room_id,t.room_id roomId,t.layer,t.room_num,
- t.room_num roomNum,t.unit_id,u.`unit_num` unitNum,
- u.unit_id unitId,f.floor_id floorId,f.floor_num floorNum,t.`community_id` communityId,bo.owner_id ownerId ,bo.`name` ownerName ,bo.link link
- FROM building_room t
- inner join building_unit u on t.`unit_id` = u.`unit_id` and u.`status_cd` = '0'
- inner JOIN f_floor f on u.`floor_id` = f.`floor_id` AND f.`community_id` = t.`community_id` AND f.`status_cd` =
- '0'
- left join building_owner_room_rel borr on t.room_id = borr.room_id and borr.status_cd = '0'
- left join building_owner bo on borr.owner_id = bo.member_id and bo.status_cd = '0'
- WHERE 1 =1
- and t.status_cd = '0'
- and u.unit_id = #{unitId}
- and t.community_id= #{communityId}
- order by CONVERT(t.layer,SIGNED),CONVERT(t.room_num,SIGNED)
- </select>
- <select id="queryHisOwnerCarCount" parameterType="Map" resultType="Map">
- select count(1) count
- from business_owner_car t
- left join c_business cb on t.b_id = cb.b_id
- left join c_orders co on cb.o_id = co.o_id
- left join u_user uu on co.user_id = uu.user_id
- left join t_dict t1 on t.car_type=t1.status_cd and t1.table_name='owner_car' and t1.table_columns = 'car_type'
- left join t_dict t2 on t.state=t2.status_cd and t2.table_name='owner_car' and t2.table_columns = 'state'
- left join t_dict t3 on t.lease_type = t3.status_cd and t3.table_name = 'owner_car' and t3.table_columns = 'lease_type'
- left join t_dict t4 on t.car_type_cd=t4.status_cd and t4.table_name='owner_car' and t4.table_columns = 'car_type_cd'
- left join building_owner bo on t.owner_id = bo.member_id and bo.status_cd = '0'
- where 1=1
- and t.car_num = #{carNum}
- and t.community_id= #{communityId}
- </select>
- <select id="queryHisOwnerCars" parameterType="Map" resultType="Map">
- select t.car_color carColor,t.car_brand carBrand,t.car_type carType,t1.name
- carTypeName,
- t.car_num carNum,t.ps_id psId,t.remark,
- t.owner_id ownerId,t.b_id bId,t.user_id userId,t.car_id carId ,t.create_time
- createTime,t.community_id communityId,t2.name stateName,
- t.start_time startTime,t.end_time endTime,t.state,
- t.car_type_cd carTypeCd,t.member_id memberId,t.lease_type leaseType,
- t3.name leaseTypeName,t4.name carTypeCdName,t.operate,uu.`name` userName,bo.`name` ownerName,bo.link
- from business_owner_car t
- left join c_business cb on t.b_id = cb.b_id
- left join c_orders co on cb.o_id = co.o_id
- left join u_user uu on co.user_id = uu.user_id
- left join t_dict t1 on t.car_type=t1.status_cd and t1.table_name='owner_car' and t1.table_columns = 'car_type'
- left join t_dict t2 on t.state=t2.status_cd and t2.table_name='owner_car' and t2.table_columns = 'state'
- left join t_dict t3 on t.lease_type = t3.status_cd and t3.table_name = 'owner_car' and t3.table_columns = 'lease_type'
- left join t_dict t4 on t.car_type_cd=t4.status_cd and t4.table_name='owner_car' and t4.table_columns = 'car_type_cd'
- left join building_owner bo on t.owner_id = bo.member_id and bo.status_cd = '0'
- where 1=1
- and t.car_num = #{carNum}
- and t.community_id= #{communityId}
- order by t.create_time desc,t.operate
- <if test="page != -1 and page != null ">
- limit #{page}, #{row}
- </if>
- </select>
- <select id="queryHisOwnerCount" parameterType="Map" resultType="Map">
- select count(1) count
- from business_building_owner t
- left join c_business cb on t.b_id = cb.b_id
- left join c_orders co on cb.o_id = co.o_id
- left join u_user uu on co.user_id = uu.user_id
- where 1=1
- and t.member_id = #{memberId}
- and t.community_id = #{communityId}
- </select>
- <select id="queryHisOwners" parameterType="Map" resultType="Map">
- select t.operate,t.sex,t.name,t.link,t.remark,t.owner_id ownerId,t.b_id bId,
- t.age,t.member_id memberId,
- t.owner_type_cd ownerTypeCd,t.community_id communityId,t.owner_flag ownerFlag,
- t.id_card idCard,t.state,t.address,t.create_time createTime,uu.`name` userName
- from business_building_owner t
- left join c_business cb on t.b_id = cb.b_id
- left join c_orders co on cb.o_id = co.o_id
- left join u_user uu on co.user_id = uu.user_id
- where 1=1
- and t.member_id = #{memberId}
- and t.community_id = #{communityId}
- order by t.create_time desc,t.operate
- <if test="page != -1 and page != null ">
- limit #{page}, #{row}
- </if>
- </select>
- </mapper>
|