zhongrj
2023-12-06 54cfc5505931c5e7d8892222d2095a45b8eac8ed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?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="org.springblade.modules.place.mapper.PlaceExtMapper">
 
    <resultMap id="detailMap" type="org.springblade.modules.place.vo.PlaceExtVO" autoMapping="true">
        <id property="id" column="id"/>
        <collection property="placePractitioner" javaType="java.util.List"
                    ofType="org.springblade.modules.place.vo.PlacePractitionerVO" autoMapping="true">
            <id property="id" column="cid"/>
        </collection>
    </resultMap>
 
    <!--自定义分页查询-->
    <select id="selectPlaceExtPage" resultType="org.springblade.modules.place.vo.PlaceExtVO">
        select jpe.*,jp.place_name as placeName from jczz_place_ext jpe
        left join jczz_place jp on jpe.place_id = jp.id and jp.is_deleted = 0
        where jpe.is_deleted = 0
        <if test="placeExt.placeName != null and placeExt.placeName != ''">
            and jp.place_name like concat('%',#{placeExt.placeName},'%')
        </if>
        <if test="placeExt.houseCode != null and placeExt.houseCode != ''">
            and jp.house_code = #{placeExt.houseCode}
        </if>
        <if test="placeExt.confirmFlag != null">
            and jpe.confirm_flag = #{placeExt.confirmFlag}
        </if>
        <if test="placeExt.roleName!=null and placeExt.roleName!='' and placeExt.createUser!=null">
            <choose>
                <when test="placeExt.roleName=='网格员'">
                    and
                    (
                    jp.create_user = #{placeExt.createUser}
                    <if test="houseCodeList != null and houseCodeList.size()>0">
                        or jp.house_code in
                        <foreach collection="houseCodeList" item="houseCode" separator ="," open="("  close=")">
                            #{houseCode}
                        </foreach>
                    </if>
                    )
                </when>
                <otherwise>
                    and jp.principal_user_id = #{placeExt.createUser}
                </otherwise>
            </choose>
        </if>
        order by jpe.create_time desc,jpe.id desc
    </select>
 
    <!--自定义详情查询-->
    <select id="getDetail" resultType="org.springblade.modules.place.vo.PlaceExtVO">
        select jpe.*,jp.place_name as placeName from jczz_place_ext jpe
        left join jczz_place jp on jpe.place_id = jp.id and jp.is_deleted = 0
        where jpe.is_deleted = 0
        and jpe.place_id = #{placeExt.placeId}
    </select>
 
 
</mapper>