linwe
2023-12-18 d0b0e00e40226700a0ffa1f1671a8dc273610f67
src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml
@@ -16,15 +16,17 @@
        select
        jp.*,
        bu.real_name as username,bu.phone as phone,
        bx.real_name as createUserName
         from jczz_place jp
        bx.real_name as createUserName,
        jpe.confirm_flag confirmFlag
        from jczz_place jp
        left join blade_user bu on bu.id = jp.principal_user_id and bu.is_deleted = 0
        left join blade_user bx on bx.id = jp.create_user and bx.is_deleted = 0
        LEFT JOIN jczz_place_ext jpe on jpe.place_id=jp.id
        left join (
            select a.* from jczz_place_poi_label a inner join
            (
            select place_id,max(id) as id from jczz_place_poi_label b group by place_id
            ) b on a.id = b.id
        select a.* from jczz_place_poi_label a inner join
        (
        select place_id,max(id) as id from jczz_place_poi_label b group by place_id
        ) b on a.id = b.id
        ) jppl on jppl.place_id = jp.id
        where jp.is_deleted = 0
        <if test="place.roleName!=null and place.roleName!=''">
@@ -49,12 +51,18 @@
        <if test="place.placeName!=null and place.placeName!=''">
            and jp.place_name like concat('%',#{place.placeName},'%')
        </if>
        <if test="place.principal!=null and place.principal!=''">
            and jp.principal like concat('%',#{place.principal},'%')
        </if>
        <if test="place.principalPhone!=null and place.principalPhone!=''">
            and jp.principal_phone like concat('%',#{place.principalPhone},'%')
        </if>
        <if test="place.isPerfect==1">
            and
            (
            jp.place_name is null
            or jp.image_urls is null
            or jppl.poi_code is not null
            or jppl.poi_code is null
            or bu.real_name is null
            or bu.phone is null
            )
@@ -66,15 +74,17 @@
            and bu.real_name != ""
            and bu.phone != ""
        </if>
        order by jpe.create_time desc
    </select>
    <!--查询场所集合信息-->
    <select id="selectPlaceNodeList" resultType="org.springblade.common.node.TreeNode" >
    <select id="selectPlaceNodeList" resultType="org.springblade.common.node.TreeStringNode" >
        select jp.id,
               jp.house_code      houseCode,
               jp.place_name as   name,
               jda.doorplate_type doorplateType,
               jda.address_level  addressLevel,
               jda.nei_name  neiName,
               false         as   hasChildren
        from jczz_place jp
                 left join jczz_doorplate_address jda on jp.house_code = jda.address_code
@@ -86,8 +96,8 @@
    <!--插入用户标签-->
    <insert id="saveUserLabel">
        insert into jczz_user_label(user_id,label_id,create_time,update_time)
        values(#{userId},#{labelId},now(),now())
        insert into jczz_user_house_label(user_id,label_id,lable_type)
        values(#{userId},#{labelId},1)
    </insert>
    <!--查询所有的场所(手机号不为空)-->
@@ -125,4 +135,32 @@
            and jp.id = #{place.id}
        </if>
    </select>
    <!--判断商超是否导入-->
    <select id="getPlaceAndRelInfo" resultType="org.springblade.modules.place.entity.PlaceEntity">
        select
        jp.*
        from jczz_place jp
        left join jczz_place_rel jpr on jpr.place_id = jp.id and jpr.is_deleted = 0
        where jp.is_deleted = 0
        <if test="place.buildingName!=null and place.buildingName!=''">
            and jpr.building_name = #{place.buildingName}
        </if>
        <if test="place.doorplateNum!=null and place.doorplateNum!=''">
            and jpr.doorplate_num = #{place.doorplateNum}
        </if>
        <if test="place.placeName!=null and place.placeName!=''">
            and jp.place_name = #{place.placeName}
        </if>
        limit 1
    </select>
    <!--查询出有用户id 的场所-->
    <select id="getHasUserIdPlaceList" resultType="org.springblade.modules.place.entity.PlaceEntity">
        select
        jp.*
        from jczz_place jp
        left join blade_user bu on bu.id = jp.principal_user_id and bu.is_deleted = 0
        where jp.is_deleted = 0 and jp.principal_user_id is not null
    </select>
</mapper>