123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <?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.property.dao.TpBuildingOwnerInfoMapper">
- <select id="selectUserApprove" parameterType="map" resultType="com.huiju.estateagents.property.model.TpBuildingOwnerInfo" >
- SELECT
- id,
- phase,
- owner_name,
- owner_tel,
- building,
- gender,
- id_card,
- unit,
- LEVEL ,
- room_no,
- create_date,
- verify_status
- FROM
- tp_building_owner_info
- <where>
- <if test="ownerName != null and ownerName != ''" >
- AND owner_name like concat('%',#{ownerName,jdbcType=VARCHAR},'%')
-
- </if>
- <if test="ownerTel != null and ownerTel != ''" >
- AND owner_tel like concat('%',#{ownerTel,jdbcType=VARCHAR},'%')
- </if>
- <if test="VerifyStatus != null and VerifyStatus != ''" >
- AND verify_status = #{VerifyStatus,jdbcType=VARCHAR}
- </if>
- <if test="VerifyStatus == null or VerifyStatus == ''" >
- and (verify_status = 1 or verify_status = 2)
- </if>
- and org_id=#{orgId,jdbcType=INTEGER}
- order by create_date desc
- </where>
- </select>
-
- <insert id="batchInsert" useGeneratedKeys="true" keyProperty="id" parameterType="java.util.ArrayList">
- insert into tp_building_owner_info(org_id,id_card, phase, building,unit, `level`,
- room_no,owner_name,owner_tel,gender,pair_status,verify_status,create_user,create_date,update_user,update_date)
- VALUES
- <foreach collection="list" item="item" index="index" separator=",">
- (#{item.orgId},#{item.idCard},#{item.phase},#{item.building},#{item.unit}, #{item.level},#{item.roomNo},#{item.ownerName},
- #{item.ownerTel},#{item.gender},#{item.pairStatus},#{item.verifyStatus},#{item.createUser},#{item.createDate},#{item.updateUser},#{item.updateDate})
- </foreach>
- </insert>
-
- <update id="batchUpdate" parameterType="java.util.ArrayList">
- <foreach collection="list" item="item" index="index" open="" close="" separator=";">
- update tp_building_owner_info
- <set>
- owner_name = #{item.ownerName},
- owner_tel = #{item.ownerTel},
- owner_status = #{item.ownerStatus}
- </set>
- where id = #{item.id}
- </foreach>
- </update>
-
- <select id="selectListByParams" resultType="com.huiju.estateagents.property.model.TpBuildingOwnerInfo">
- SELECT
- distinct
- u.id,
- u.phase_name,
- u.building_name,
- u.unit_name,
- u.level_name,
- u.room_no_name,
- u.ta_user_verify_id AS userVerifyId,
- u.org_id AS orgId,
- u.owner_tel AS ownerTel,
- u.owner_name AS ownerName,
- u.id_card AS idCard,
- u.verify_status AS verifyStatus,
- u.update_user AS updateName,
- u.create_date AS createDate
- FROM
- tp_building_owner_info u
- left join ta_user_verify t on t.id = u.ta_user_verify_id
- WHERE
-
- u.org_id=#{tpBuildingOwnerInfo.orgId,jdbcType=INTEGER}
- <if test="tpBuildingOwnerInfo.phaseId != null and tpBuildingOwnerInfo.phaseId != ''">
- and u.phase_id = #{tpBuildingOwnerInfo.phaseId,jdbcType=INTEGER}
- </if>
- <if test="tpBuildingOwnerInfo.buildingId != null and tpBuildingOwnerInfo.buildingId != ''">
- and u.building_id = #{tpBuildingOwnerInfo.buildingId,jdbcType=INTEGER}
- </if>
- <if test="tpBuildingOwnerInfo.unitId != null and tpBuildingOwnerInfo.unitId != ''">
- and u.unit_id = #{tpBuildingOwnerInfo.unitId,jdbcType=INTEGER}
- </if>
- <if test="tpBuildingOwnerInfo.levelId != null and tpBuildingOwnerInfo.levelId != ''">
- and u.level_id = #{tpBuildingOwnerInfo.levelId,jdbcType=INTEGER}
- </if>
- <if test="tpBuildingOwnerInfo.roomNoId != null and tpBuildingOwnerInfo.roomNoId != ''">
- and u.room_no_id = #{tpBuildingOwnerInfo.roomNoId,jdbcType=INTEGER}
- </if>
- <if test="tpBuildingOwnerInfo.ownerName != null and tpBuildingOwnerInfo.ownerName != ''">
- and u.owner_name like concat('%',#{tpBuildingOwnerInfo.ownerName,jdbcType=VARCHAR},'%')
- </if>
- <if test="tpBuildingOwnerInfo.ownerTel != null and tpBuildingOwnerInfo.ownerTel != ''">
- and u.owner_tel like concat('%',#{tpBuildingOwnerInfo.ownerTel,jdbcType=VARCHAR},'%')
- </if>
- <if test="tpBuildingOwnerInfo.idCard != null and tpBuildingOwnerInfo.idCard != ''">
- and u.id_card like concat('%',#{tpBuildingOwnerInfo.idCard,jdbcType=VARCHAR},'%')
- </if>
- <if test="tpBuildingOwnerInfo.roleName != null and tpBuildingOwnerInfo.roleName != ''">
- and t.role_id = #{tpBuildingOwnerInfo.roleName}
- </if>
- <if test="tpBuildingOwnerInfo.verifyStatus != null and tpBuildingOwnerInfo.verifyStatus != ''">
- and u.verify_status = #{tpBuildingOwnerInfo.verifyStatus}
- </if>
- order by
- <if test="tpBuildingOwnerInfo.sortKey != null and tpBuildingOwnerInfo.sortKey != ''">
- ${tpBuildingOwnerInfo.sortKey} ${tpBuildingOwnerInfo.sortOrder},
- </if>
- u.create_date desc
- </select>
- <select id="getAvailableProp" resultType="java.lang.Integer">
- select count(*)
- from tp_building_owner_info t
- where t.org_id = #{orgId}
- and t.community_id = #{communityId}
- and t.verify_status = 1
- </select>
- <select id="getVerifyNum" resultType="java.util.Map">
- SELECT
- count( DISTINCT t.id ) AS total,
- count( DISTINCT f.room_no_id ) AS valid
- FROM
- tp_room_no t
- INNER JOIN tp_phase s ON s.id = t.phase_id
- INNER JOIN tp_building m ON m.id = t.building_id
- INNER JOIN tp_unit n ON n.id = t.unit_id
- INNER JOIN tp_level q ON q.id = t.level_id
- LEFT JOIN tp_building_owner_info f ON f.room_no_id = t.id
- AND f.verify_status = 1
- WHERE
- t.org_id = #{orgId}
- AND t.community_id = #{communityId}
- </select>
- <select id="countProp" resultType="java.lang.Integer">
- SELECT
- count( * )
- FROM
- tp_building_owner_info t
- WHERE
- t.org_id = #{orgId}
- AND t.room_no_id = #{roomNoId}
- AND t.verify_status IN ( '0', '1' )
- </select>
- </mapper>
|