| <?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> |