tangzy
2021-09-25 8dbbc89c906a4d6c52fb4863b2cfc4a64a560bf2
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?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.Site.mapper.SiteMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="SiteResultMap" type="org.springblade.modules.Site.entity.Site">
        <result column="site_Id" property="siteId"/>
        <result column="site_name" property="siteName"/>
        <result column="site_code" property="siteCode"/>
        <result column="create_time" property="createTime"/>
        <result column="remark" property="remark"/>
        <result column="lgtd" property="lgtd"/>
        <result column="lttd" property="lttd"/>
        <result column="basin" property="basin"/>
        <result column="orderby" property="orderby"/>
        <result column="city" property="city"/>
        <result column="county" property="county"/>
        <result column="sttp" property="sttp"/>
        <result column="unit" property="unit"/>
        <result column="principal" property="principal"/>
        <result column="img_url" property="img_url"/>
        <result column="goal_wq" property="goal_wq"/>
        <result column="angle" property="angle"/>
        <result column="types" property="types"/>
        <result column="sxi" property="sxi"/>
        <result column="hl" property="hl"/>
        <result column="sk" property="sk"/>
        <result column="sh" property="sh"/>
        <result column="fzx" property="fzx"/>
    </resultMap>
 
    <resultMap id="siteMapss" type="org.springblade.modules.Site.vo.SiteVO">
        <result column="site_Id" property="siteId"/>
        <result column="did" property="did"/>
        <result column="site_name" property="siteName"/>
        <result column="site_code" property="siteCode"/>
        <result column="create_time" property="createTime"/>
        <result column="remark" property="remark"/>
        <result column="lgtd" property="lgtd"/>
        <result column="lttd" property="lttd"/>
        <result column="basin" property="basin"/>
        <result column="orderby" property="orderby"/>
        <result column="city" property="city"/>
        <result column="county" property="county"/>
        <result column="sttp" property="sttp"/>
        <result column="unit" property="unit"/>
        <result column="principal" property="principal"/>
        <result column="img_url" property="img_url"/>
        <result column="goal_wq" property="goal_wq"/>
        <result column="angle" property="angle"/>
        <result column="types" property="types"/>
        <result column="sxi" property="sxi"/>
        <result column="hl" property="hl"/>
        <result column="sk" property="sk"/>
        <result column="sh" property="sh"/>
        <result column="fzx" property="fzx"/>
        <result column="hz" property="hz"/>
        <result column="oy" property="oy"/>
        <result column="ty" property="ty"/>
        <result column="toy" property="toy"/>
    </resultMap>
 
    <!-- &lt;!&ndash;站点列表&ndash;&gt;
    <select id="selectStbprpBPage" resultMap="stbprpBResultMap">
        select * from st_stbprp_b ORDER BY BGFRYM DESC LIMIT #{startIndex},#{pageSize}
    </select>-->
    <!--自定义分页-->
    <select id="selectSitePage" resultMap="siteMapss">
SELECT
    s.*
FROM
    site s
        <if test="SiteVO.siteName!=null">
            and s.site_name like '%' + #{SiteVO.siteName} + '%'
        </if>
        <if test="SiteVO.siteCode!=null">
            and s.site_code like '%' + #{SiteVO.siteCode} + '%'
        </if>
        <if test="SiteVO.sttp!=null">
            and s.sttp like '%' + #{SiteVO.sttp} + '%'
        </if>
        <if test="SiteVO.city!=null">
            and s.city like '%' + #{SiteVO.city} + '%'
        </if>
    </select>
 
    <select id="selectInfo" resultMap="siteMapss">
SELECT
    s.*
FROM
    site s
    where s.site_Id=#{id}
    </select>
 
 
   <!-- 模糊查询-->
    <select id="selectSiteList" resultMap="SiteResultMap">
        select * from  site where 1=1
        <if test="addvcd !=null and addvcd!=''">
           and site_code=#{addvcd}
        </if>
 
        <if test="name !=null and name!=''">
            and site_name like '%${name}%'
        </if>
        order by orderby
    </select>
 
    <!--查询全部-->
    <select id="selectAllList" resultMap="SiteResultMap">
         select * from site ORDER BY orderby asc
    </select>
 
    <!--站点详情-->
  <select id="selectSiteInfo" resultMap="SiteResultMap">
       select * from site where site_code=#{code} ORDER BY orderby
  </select>
 
    <select id="selectInfos" resultType="java.util.Map">
       select lgtd,lttd,site_name,site_code from site where site_code =#{code}
  </select>
 
    <!--分页查询-->
    <select id="selectPageSize" resultType="java.util.Map">
        SELECT TOP ${pageSize} *
        FROM site
        WHERE (site_Id NOT IN
        (SELECT TOP (#{startIndex}) site_Id
        FROM site where 1=1))
        ORDER BY orderby ASC
    </select>
 
    <select id="countAll" resultType="java.lang.Integer">
        select count(*) from site
    </select>
 
    <!--查询全部-->
    <select id="selectAllLists" resultMap="SiteResultMap">
         select * from site where 1=1
        <choose>
         <when test="sttp!=null and sttp!='' and sttp!='ZX'">
             and sttp=#{sttp}
         </when>
        <when test="sttp=ZX and sttp=''">
            and types=1
        </when>
        </choose>
    </select>
 
    <!-- 统计查询-->
    <select id="statistics" resultType="java.util.Map">
        SELECT
            count( sttp ) as value,
            sttp
        FROM
            site
        GROUP BY
            sttp
    </select>
 
 
</mapper>