xieb
2024-01-24 aa2004ef65a3d8c8e15ec1689fc4f8e1b8d91c59
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
<?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="cn.gistack.sm.materials.mapper.RescueTeamManageMapper">
    <!--namespace根据自己需要创建的的mapper的路径和名称填写-->
    <select id="selectMyPage" resultType="cn.gistack.sm.materials.vo.RescueTeamManageVO">
        SELECT RM.*,
        arb."res_reg_code" as resRegCode,arb."eng_scal" as engScal,
        case when b."ad_grad" = 4 THEN b."ad_name" ELSE NULL
            END AS townName,
        case when b."ad_grad" = 3 THEN b."ad_name"
            when c."ad_grad" = 3 THEN c."ad_name"
            END AS countyName,
        case when b."ad_grad" = 2 THEN b."ad_name"
            when c."ad_grad" = 2 THEN c."ad_name"
            ELSE d."ad_name" END AS cityName
        FROM SM_RESCUETEAM_MANAGE RM
        LEFT JOIN SJZT_MD."att_res_base" arb ON RM.res_guid = arb."guid"
        LEFT JOIN SJZT_MD."att_ad_base" b ON arb."interior_ad_guid" = b."guid"
        LEFT JOIN SJZT_MD."att_ad_base" c ON b."p_ad_code" = c."guid"
        LEFT JOIN SJZT_MD."att_ad_base" d ON c."p_ad_code" = d."guid"
        WHERE RM.IS_DELETED = 0
        <if test="vo.resName !=null and vo.resName !=''">
            AND RM.RES_NAME LIKE CONCAT('%',#{vo.resName},'%')
        </if>
        <if test="vo.userName !=null and vo.userName !=''">
            AND RM.USER_NAME LIKE CONCAT('%',#{vo.userName},'%')
        </if>
        <if test="vo.userPhone !=null and vo.userPhone !=''">
            AND RM.USER_PHONE LIKE CONCAT('%',#{vo.userPhone},'%')
        </if>
        <if test="vo.city !=null and vo.city !=''">
            AND RM.city = #{vo.city}
        </if>
        <if test="vo.county !=null and vo.county !=''">
            AND RM.county = #{vo.county}
        </if>
        <if test="vo.town !=null and vo.town !=''">
            AND RM.town = #{vo.town}
        </if>
        <if test="vo.resGuid !=null and vo.resGuid !=''">
            AND RM.res_guid = #{vo.resGuid}
        </if>
        <if test="vo.year!=null and vo.year!=''">
            and date_format(RM.create_time,'%Y') = #{vo.year}
        </if>
    </select>
</mapper>