Helius
2021-06-16 4e51778362c2130598a4c73ec4cebe6629dbc53f
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
<?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="com.xzx.gc.system.mapper.HomeServiceInfoMapper">
  <resultMap id="BaseResultMap" type="com.xzx.gc.entity.HomeServiceInfo">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="price" jdbcType="VARCHAR" property="price" />
    <result column="mark" jdbcType="VARCHAR" property="mark" />
    <result column="create_time" jdbcType="VARCHAR" property="createTime" />
    <result column="picture" jdbcType="VARCHAR" property="picture" />
    <result column="parent_id" jdbcType="BIGINT" property="parentId" />
    <result column="sort" jdbcType="SMALLINT" property="sort" />
    <result column="unit" jdbcType="VARCHAR" property="unit" />
    <result column="del_flag" jdbcType="BIT" property="delFlag" />
    <result column="show_flag" jdbcType="SMALLINT" property="showFlag" />
    <result column="level" property="level" />
  </resultMap>
 
 
    <select id="page" resultMap="BaseResultMap">
        SELECT a.*,c.name as parentName  from xzx_sys_home_service_info a
        inner join xzx_sys_home_service_info c on a.parent_id=c.id
        left join xzx_sys_home_service_ref b on c.id=b.service_id
        WHERE a.del_flag=0 and a.level=3
        <if test="parentId != null">
            and a.parent_id=#{parentId}
        </if>
        <choose>
            <when test="fenceId != null and fenceId != ''">
                and b.del_flag=0 and  b.fence_id =#{fenceId}
            </when>
            <when test="partnerId != null and partnerId != ''">
                and b.del_flag=0 and  b.partner_id=#{partnerId}
            </when>
        </choose>
        GROUP BY a.id
        ORDER BY a.create_time desc
    </select>
 
    <select id="findSecond" resultMap="BaseResultMap">
        SELECT a.*  from xzx_sys_home_service_info a
        left join xzx_sys_home_service_ref b on a.id=b.service_id
        WHERE a.del_flag=0 and a.level=2
        <choose>
            <when test="fenceId != null and fenceId != ''">
                and b.del_flag=0 and  b.fence_id =#{fenceId}
            </when>
            <when test="partnerId != null and partnerId != ''">
                and b.del_flag=0 and  b.partner_id=#{partnerId} and b.fence_id is null
            </when>
        </choose>
        order by  a.sort
    </select>
</mapper>