123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- <?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.huiju.estateagents.mapper.TaRaiseRecordMapper">
-
- <select id="listHousingRaiseByCondition" resultType="com.huiju.estateagents.po.TaHousingResourcesPO">
- SELECT
- t.*,
- t4.apartment_name,
- t2.raise_record_id,
- t5.user_name updateName
- FROM
- ta_housing_resources t
- LEFT JOIN ta_raise_house t2 ON t.house_id = t2.house_id
- LEFT JOIN ta_raise_record t3 ON t2.raise_record_id = t3.raise_record_id
- LEFT JOIN ta_building_apartment t4 ON t.apartment_id = t4.apartment_id
- LEFT JOIN ta_user t5 ON t5.user_id = t.update_user
- WHERE
- t.org_id = #{bo.orgId}
- AND t.`status` != - 1
- <if test="bo.salesBatchId != null and bo.salesBatchId != ''">
- AND t.sales_batch_id = #{bo.salesBatchId}
- </if>
- <if test="bo.termName != null and bo.termName != ''">
- AND t.term_name like CONCAT('%',#{bo.termName}, '%')
- </if>
- <if test="bo.blockName != null and bo.blockName != ''">
- AND t.block_name like CONCAT('%',#{bo.blockName}, '%')
- </if>
- <if test="bo.unitName != null and bo.unitName != ''">
- AND t.unit_name like CONCAT('%',#{bo.unitName}, '%')
- </if>
- <if test="bo.floorName != null and bo.floorName != ''">
- AND t.floor_name like CONCAT('%',#{bo.floorName}, '%')
- </if>
- <if test="bo.roomName != null and bo.roomName != ''">
- AND t.room_name like CONCAT('%',#{bo.roomName}, '%')
- </if>
- <if test="bo.status != null">
- AND t.`status` = #{bo.status}
- </if>
- <if test="bo.lockingStatus != null">
- AND t.house_locking_status = #{bo.lockingStatus}
- </if>
- <if test="bo.apartmentId != null and bo.apartmentId != ''">
- AND t.apartment_id = #{bo.apartmentId}
- </if>
- <if test="bo.houseId != null">
- AND t.house_id = #{bo.houseId}
- </if>
- GROUP BY
- t.house_id
- ORDER BY
- t.raise_real_heat DESC
- </select>
-
- <select id="listRaiseRecordByCondition" resultType="com.huiju.estateagents.entity.TaRaiseRecord">
- SELECT
- t.*,
- t3.house_id,
- t3.term_name,
- t3.block_name,
- t3.unit_name,
- t3.floor_name,
- t3.room_name,
- t3.apartment_id,
- t4.apartment_name,
- t5.tel personTel,
- t5.nickname,
- t5.avatarurl
- FROM
- ta_raise_record t
- LEFT JOIN ta_raise_house t2 ON t.raise_record_id = t2.raise_record_id
- LEFT JOIN ta_housing_resources t3 ON t2.house_id = t3.house_id
- LEFT JOIN ta_building_apartment t4 ON t3.apartment_id = t4.apartment_id
- LEFT JOIN ta_person t5 ON t.person_id = t5.person_id
- WHERE
- t.org_id = #{bo.orgId}
- AND t.`status` != - 1
- AND t3.`status` != - 1
- <if test="bo.raiseId != null and bo.raiseId != ''">
- AND t.raise_id =#{bo.raiseId}
- </if>
- <if test="bo.houseId != null and bo.houseId != ''">
- AND t3.house_id = =#{bo.houseId}
- </if>
- <if test="bo.raiseRecordId != null and bo.raiseRecordId != ''">
- AND t.raise_record_id = #{bo.raiseRecordId}
- </if>
- <if test="bo.termName != null and bo.termName != ''">
- AND t3.term_name like CONCAT('%',#{bo.termName}, '%')
- </if>
- <if test="bo.blockName != null and bo.blockName != ''">
- AND t3.block_name like CONCAT('%',#{bo.blockName}, '%')
- </if>
- <if test="bo.unitName != null and bo.unitName != ''">
- AND t3.unit_name like CONCAT('%',#{bo.unitName}, '%')
- </if>
- <if test="bo.floorName != null and bo.floorName != ''">
- AND t3.floor_name like CONCAT('%',#{bo.floorName}, '%')
- </if>
- <if test="bo.roomName != null and bo.roomName != ''">
- AND t3.room_name like CONCAT('%',#{bo.roomName}, '%')
- </if>
- <if test="bo.status != null">
- AND t.status = #{bo.status}
- </if>
- <if test="bo.lockingStatus != null and bo.lockingStatus != ''">
- AND t.house_locking_status = #{bo.lockingStatus}
- </if>
- <if test="bo.tel != null and bo.tel != ''">
- AND t.tel like CONCAT('%',#{bo.tel} , '%')
- </if>
- <if test="bo.personTel != null and bo.personTel != ''">
- AND t5.tel like CONCAT('%',#{bo.personTel} , '%')
- </if>
- <if test="bo.payStatus != null and bo.payStatus != ''">
- AND t.pay_status = #{bo.payStatus}
- </if>
- <if test="bo.payType != null and bo.payType != ''">
- AND t.pay_type = #{bo.payType}
- </if>
- <if test = "bo.startTime != null and bo.startTime != ''">
- AND t.create_date >= STR_TO_DATE(#{bo.startTime}, '%Y-%m-%d %H:%i:%s')
- </if>
- <if test = "bo.endTime != null and bo.endTime != ''">
- AND t.create_date <= STR_TO_DATE(#{bo.endTime}, '%Y-%m-%d %H:%i:%s')
- </if>
- GROUP BY
- t2.raise_record_id
- ORDER BY
- t.create_date DESC
- </select>
-
- <select id ="listRaiseOrderByCondition" resultType="com.huiju.estateagents.entity.TaRaiseRecord">
- SELECT
- t.*,
- t2.order_id,
- t2.pay_time,
- t2.trade_no,
- t2.transaction_id,
- t2.refund_no,
- t2.total_fee
- FROM
- ta_raise_record t
- INNER JOIN ta_order t2 ON t.order_id = t2.order_id
- LEFT JOIN ta_person t3 ON t2.person_id = t3.person_id
- WHERE
- t.org_id = #{bo.orgId}
- AND t.`status` != - 1
- <if test = "bo.raiseId != null and bo.raiseId != ''">
- AND t.raise_id = #{bo.raiseId}
- </if>
- <if test = "bo.orderId != null and bo.orderId != ''">
- AND t2.order_id = #{bo.orderId}
- </if>
- <if test = "bo.raiseRecordId != null and bo.raiseRecordId != ''">
- AND t.raise_record_id = #{bo.raiseRecordId}
- </if>
- <if test = "bo.tel != null and bo.tel != ''">
- AND t.tel like CONCAT('%',#{bo.tel} , '%')
- </if>
- <if test = "bo.personTel != null and bo.personTel != ''">
- AND t3.tel like CONCAT('%',#{bo.personTel} , '%')
- </if>
- <if test = "bo.transactionId != null and bo.transactionId != ''">
- AND t2.transaction_id = #{bo.transactionId}
- </if>
- <if test = "bo.refundNo != null and bo.refundNo != ''">
- AND t2.refund_no = #{bo.refundNo}
- </if>
- <if test = "bo.payStatus != null and bo.payStatus != ''">
- AND t.pay_status = #{bo.payStatus}
- </if>
- <if test = "bo.payStartTime != null and bo.payStartTime != ''">
- AND t2.pay_time >= STR_TO_DATE(#{bo.payStartTime}, '%Y-%m-%d %H:%i:%s')
- </if>
- <if test = "bo.payEndTime != null and bo.payEndTime != ''">
- AND t2.pay_time <= STR_TO_DATE(#{bo.payEndTime}, '%Y-%m-%d %H:%i:%s')
- </if>
- ORDER BY
- t.create_date DESC
- </select>
-
- <select id="getUserInfo" resultType="com.huiju.estateagents.entity.TaRaiseRecord">
- select a.nickname as nickname, a.`name` as name, a.phone as personTel, t.tel, t.idcard from ta_raise_record t
- left join ta_person a on t.person_id = a.person_id
- where
- t.raise_record_id = #{raiseRecordId} and t.org_id = #{orgId}
- </select>
-
- <update id="addHouseNum">
- UPDATE ta_raise_record t
- SET t.house_num = IFNULL ( t.house_num, 0 ) + 1,
- t.update_date = now( ),
- t.update_user_name = #{updateUserName}
- WHERE
- t.raise_record_id = #{raiseRecordId}
- AND t.org_id = #{orgId}
- AND t.`status` != -1
- </update>
-
- </mapper>
|