zhongrj
2024-12-26 a1272d78844574b86645149a0d8ca257c2b8fe91
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
<?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.yw.mapper.RescueTeamMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="rescueTeamResultMap" type="org.springblade.modules.yw.entity.RescueTeamEntity">
        <result column="id" property="id"/>
        <result column="firm_id" property="firmId"/>
        <result column="per_in_cha" property="perInCha"/>
        <result column="per_in_cha_pho" property="perInChaPho"/>
        <result column="create_user" property="createUser"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
 
    <!--自定义分页查询-->
    <select id="selectRescueTeamPage" resultType="org.springblade.modules.yw.vo.RescueTeamVO">
        select
        yrt.*,
        yfi.name as firmName
        from
        yw_rescue_team yrt
        left join yw_firm_info yfi on yfi.id = yrt.firm_id and yfi.is_deleted = 0
        where yrt.is_deleted = 0
        <if test="rescueTeam.firmId!=null">
            and yrt.firm_id = #{rescueTeam.firmId}
        </if>
        <if test="rescueTeam.type!=null">
            and yrt.type = #{rescueTeam.type}
        </if>
        <if test="rescueTeam.perInCha!=null and rescueTeam.perInCha!=''">
            and yrt.per_in_cha like concat('%',#{rescueTeam.perInCha},'%')
        </if>
        <if test="rescueTeam.perInChaPho!=null and rescueTeam.perInChaPho!=''">
            and yrt.per_in_cha_pho like concat('%',#{rescueTeam.perInChaPho},'%')
        </if>
    </select>
 
    <!--自定义分页查询-->
    <select id="getStatisticData" resultType="java.util.Map">
        SELECT
            team_name as type,
            count(*) AS num
        FROM
            yw_rescue_team
        <where>
            <if test="rescueTeam.type!=null">
                and type = #{rescueTeam.type}
            </if>
        </where>
        GROUP BY team_name
    </select>
 
</mapper>