Helius
2021-06-30 02b38bb7c08d68fffc6af25e4ba00a456d96e94e
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?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&lt;=#{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>