| <?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.order.mapper.PartnerFenceMapper">  | 
|   <resultMap id="BaseResultMap" type="com.xzx.gc.entity.PartnerFence">  | 
|     <!--  | 
|       WARNING - @mbg.generated  | 
|     -->  | 
|     <id column="id" jdbcType="INTEGER" property="id" />  | 
|     <result column="partner_id" jdbcType="VARCHAR" property="partnerId" />  | 
|     <result column="fence_id" jdbcType="VARCHAR" property="fenceId" />  | 
|     <result column="create_time" jdbcType="VARCHAR" property="createTime" />  | 
|     <result column="del_flag" jdbcType="TINYINT" property="delFlag" />  | 
|     <result column="update_time" jdbcType="VARCHAR" property="updateTime" />  | 
|   </resultMap>  | 
|   | 
|   | 
|   <delete id="deleteByFenceId">  | 
|     update xzx_partner_fence  | 
|     set del_flag = 1  | 
|     where fence_id = #{id}  | 
|   </delete>  | 
|   | 
|   | 
|   <select id="queryElectronicFencePage" resultType="com.xzx.gc.model.admin.XzxCityPartnerModel">  | 
|     select a.id,a.fence_name as fenceName,a.longitude,a.latitude,a.longLatiArr,a.radius,  | 
|     a.keyword,a.create_time,a.fence_type,b.partner_id as partnerIds,a.keyword,a.prohibit,  | 
|     c.partner_name as partnerName,  | 
|     c.mobile_phone as mobilePhone,  | 
|     c.account_no as accountNo  | 
|     from xzx_electronic_fence a  | 
|     left join xzx_partner_fence b on b.fence_id=a.id  | 
|     left join xzx_city_partner c on b.partner_id=c.id  | 
|     where a.del_flag=0 and c.partner_type=1  | 
|   | 
|     <if test="name != null and name != ''">  | 
|       AND (c.partner_name like concat("%",#{name} ,"%") or c.mobile_phone like concat("%",#{name} ,"%") or a.fence_name like concat("%",#{name} ,"%") )  | 
|     </if>  | 
|   | 
|     <if test="fenceType != null and fenceType != ''">  | 
|       AND a.fence_type =#{fenceType}  | 
|     </if>  | 
|   | 
|     <if test="id != null and id != ''">  | 
|       AND a.id =#{id}  | 
|     </if>  | 
|   | 
|     <if test="prohibit != null">  | 
|       AND a.prohibit =#{prohibit}  | 
|   | 
|     </if>  | 
|   | 
|     <if test="fenceName != null and fenceName != ''">  | 
|       AND a.fence_name like concat("%",#{fenceName} ,"%")  | 
|     </if>  | 
|   | 
|     <if test="startTime != null and startTime != ''">  | 
|       AND a.create_time>=#{startTime}  | 
|     </if>  | 
|   | 
|     <if test="endTime != null and endTime != ''">  | 
|       AND a.create_time<=#{endTime}  | 
|     </if>  | 
|   | 
|     <if test="partnerIdList != null and partnerIdList.size() != 0">  | 
|       AND c.id in  | 
|       <foreach collection="partnerIdList" index="index" item="id" open="(" separator="," close=")">  | 
|         #{id}  | 
|       </foreach>  | 
|     </if>  | 
|   </select>  | 
|   | 
|   <update id="updateByFenceId">  | 
|     update xzx_partner_fence  | 
|     set partner_id = #{partnerId}, update_time = #{updateTime}  | 
|     where fence_id = #{fenceId}  | 
|   </update>  | 
|   | 
|   <select id="queryPartnerIds" resultType="java.lang.String">  | 
|     select partner_id from xzx_partner_fence  where fence_id=#{fenceId} and del_flag=0  | 
|   </select>  | 
|   | 
|     <select id="queryElectricTownIds" resultType="java.lang.String"  >  | 
|         select b.partner_key from xzx_partner_fence a  | 
|         LEFT JOIN xzx_city_partner b ON a.partner_id= b.id  | 
|         LEFT JOIN xzx_electronic_fence c ON a.fence_id= c.id where  | 
|         1=1  | 
|         <if test="partnerId != null and partnerId != ''">  | 
|             and a.partner_id=#{partnerId}  | 
|         </if>  | 
|         and a.del_flag=0 group by b.partner_key  | 
|     </select>  | 
|   | 
|   | 
| </mapper> |