123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?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.idea.customerManagement.mapper.CustomerManagementExtendMapper">
- <select id="listByModel" resultType="com.idea.customerManagement.dto.CustomerManagementDto">
- select customer_management.*,
- concat(park_info.group_name,park_floor_disc.name) groupDiscName,
- intentional_deposit.status intentional_deposit_status,
- (select count(1) from room_selection_info where customer_management_id = customer_management.id and status !=1) room_selection_count
- from customer_management
- left join intentional_deposit on intentional_deposit.customer_management_id = customer_management.id
- left join park_info on park_info.id = customer_management.group_id
- left join park_floor_disc on park_floor_disc.id = customer_management.disc_id
- <where>
- <if test="buyerName != null and buyerName != ''">
- and customer_management.buyer_name like concat ('%',#{buyerName},'%')
- </if>
- <if test="status != null and status != ''">
- and customer_management.status = #{status}
- </if>
- <if test="statusStr != null and statusStr != ''">
- and customer_management.status in (${statusStr})
- </if>
- <if test="buyerIdentityCard != null and buyerIdentityCard != ''">
- and customer_management.buyer_identity_card like concat('%',#{buyerIdentityCard},'%')
- </if>
- <if test="houseName != null and houseName != ''">
- and customer_management.house_name like concat ('%',#{houseName},'%')
- </if>
- <if test="batchNumber != null and batchNumber != ''">
- and customer_management.batch_number like concat ('%',#{batchNumber},'%')
- </if>
- <if test="roomSelectionNumber != null and roomSelectionNumber != ''">
- and customer_management.room_selection_number like concat ('%',#{roomSelectionNumber},'%')
- </if>
- <if test="groupIdList != null">
- and customer_management.group_id in
- <foreach collection="groupIdList" item="groupId" open="(" close=")" separator="," >
- #{groupId}
- </foreach>
- </if>
- <if test="discIdList != null">
- and disc_id in
- <foreach collection="discIdList" item="groupId" open="(" close=")" separator="," >
- #{groupId}
- </foreach>
- </if>
- <if test="roomSelectionDateFrom != null and roomSelectionDateFrom != ''">
- and date_format(customer_management.room_selection_date,'%Y-%m-%d') >= #{roomSelectionDateFrom}
- </if>
- <if test="roomSelectionDateTo != null and roomSelectionDateTo != ''">
- and date_format(customer_management.room_selection_date,'%Y-%m-%d') <= #{roomSelectionDateTo}
- </if>
- </where>
- order by batch_number + 0 desc,room_selection_number + 0
- </select>
- <select id="selectNeedSendList" resultType="com.idea.customerManagement.dto.CustomerManagementDto">
- select * from customer_management
- where id in (
- select customer_management_id from buyer
- ) and ifnull(ncid,'') = ''
- </select>
- <select id="getByNum" resultType="com.idea.customerManagement.model.CustomerManagement">
- select * from customer_management where old_room_selection_number = #{num}
- </select>
- <select id="getByBuildHouseName" resultType="com.idea.buildManage.model.ParkRoom">
- SELECT
- r.*
- FROM
- park_room r
- LEFT JOIN mnp_building b ON b.id = r.build_id
- LEFT JOIN park_floor_disc d ON d.id = r.disc_id
- LEFT JOIN park_info p ON p.id = r.group_id
- WHERE
- p.group_name = '惠景家园'
- AND d.NAME = '二期'
- AND build_num = #{buildName}
- AND room_no = #{roomNo}
- </select>
- <select id="reportList" resultType="com.idea.customerManagement.dto.CustomerManagementDto">
- select p.group_name,p.group_id,f.id discId, f.name disc_name,
- (select count(1) from mnp_building where disc_id = f.id) buildCount,
- (select count(1) from park_room where disc_id = f.id) roomCount,
- (select count(1) from customer_management where disc_id = f.id and status = 2 ) waitSigningCount,
- (select count(1) from customer_management where disc_id = f.id and status = 3 ) signingCount,
- (select count(1) from customer_management where disc_id = f.id and status = 4 ) enteredCount,
- (select count(1) from contract_manage where collection_status = 2 and house_id in (
- select id from park_room where disc_id = f.id
- ) ) settledCount
- from park_floor_disc f
- left join park_info p on p.id = f.group_id
- left join park_room r on r.disc_id = f.id
- <where>
- <if test="groupId !=null and groupId != ''">
- and p.id = #{groupId}
- </if>
- <if test="discId !=null and discId != ''">
- and f.id = #{discId}
- </if>
- <if test="roomNo !=null and roomNo != ''">
- and r.room_no like concat('%',#{roomNo},'%')
- </if>
- </where>
- group by f.id
- </select>
- </mapper>
|