zhongrj
2023-11-11 072106a6169739156311ed71ca33890f27c35b85
src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml
@@ -2,11 +2,25 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.place.mapper.PlaceMapper">
    <!--详情map-->
    <resultMap id="detailMap" type="org.springblade.modules.place.vo.PlaceVO" autoMapping="true">
        <id property="id" column="id"/>
        <collection property="placePoiLabelVOList" javaType="java.util.List" ofType="org.springblade.modules.place.vo.PlacePoiLabelVO"
        autoMapping="true">
            <id property="id" column="plid"/>
        </collection>
    </resultMap>
    <!--自定义分页查询-->
    <select id="selectPlacePage" resultType="org.springblade.modules.place.vo.PlaceVO">
        select jp.*,bu.real_name as username,bu.phone as phone from jczz_place jp
        left join blade_user bu on bu.id = jp.principal_user_id and bu.is_deleted = 0
        left join jczz_place_poi_label jppl on jppl.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
        ) jppl on jppl.place_id = jp.id
        where jp.is_deleted = 0
        <if test="place.placeName!=null and place.placeName!=''">
            and jp.place_name like concat('%',#{place.placeName},'%')
@@ -60,4 +74,23 @@
        update jczz_place set principal_user_id = #{place.principalUserId}
        WHERE house_code = #{place.houseCode}
    </update>
    <!--查询场所详情数据-->
    <select id="getDetail" resultMap="detailMap">
        select
        jp.*,
        bu.real_name as username,bu.phone as phone,
        jppl.id as plid,jppl.*,jcl.category_name as labelName
        from jczz_place jp
        left join blade_user bu on bu.id = jp.principal_user_id and bu.is_deleted = 0
        left join jczz_place_poi_label jppl on jppl.place_id = jp.id
        left join jczz_category_label jcl on jcl.category_no = jppl.poi_code
        where jp.is_deleted = 0
        <if test="place.houseCode!=null and place.houseCode!=''">
            and jp.house_code = #{place.houseCode}
        </if>
        <if test="place.id!=null">
            and jp.id = #{place.id}
        </if>
    </select>
</mapper>