feiyu02
2024-08-15 196bb14112448857a885e32dc4149e308e00b01a
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<?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="cn.flightfeather.supervision.domain.mapper.OverallEvaluationMapper">
  <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.entity.OverallEvaluation">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="OE_GUID" jdbcType="INTEGER" property="oeGuid" />
    <result column="BI_GUID" jdbcType="VARCHAR" property="biGuid" />
    <result column="OE_Score" jdbcType="INTEGER" property="oeScore" />
    <result column="OE_Publish_Time" jdbcType="TIMESTAMP" property="oePublishTime" />
    <result column="OE_Update_Time" jdbcType="TIMESTAMP" property="oeUpdateTime" />
    <result column="OE_Scene_Type_Id" jdbcType="TINYINT" property="oeSceneTypeId" />
    <result column="OE_Scene_Type" jdbcType="VARCHAR" property="oeSceneType" />
    <result column="OE_Period" jdbcType="VARCHAR" property="oePeriod" />
    <result column="OE_Code_Level" jdbcType="TINYINT" property="oeCodeLevel" />
    <result column="OE_Start_Time" jdbcType="DATE" property="oeStartTime" />
    <result column="OE_End_Time" jdbcType="DATE" property="oeEndTime" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
    -->
    OE_GUID, BI_GUID, OE_Score, OE_Publish_Time, OE_Update_Time, OE_Scene_Type_Id, OE_Scene_Type, 
    OE_Period, OE_Code_Level, OE_Start_Time, OE_End_Time
  </sql>
 
  <resultMap id="CreditInfoVo" type="cn.flightfeather.supervision.lightshare.vo.CreditInfoVo">
 
  </resultMap>
 
  <select id="getLatestPeriod" resultType="String">
    SELECT @var_period:= (
    SELECT
    a.OE_Start_Time
    FROM
    ea_t_overall_evaluation AS a
    LEFT JOIN ea_t_baseinfo AS b ON a.BI_GUID = b.BI_GUID
    <where>
      <if test="provinceCode != null">
        AND b.BI_Province_Code = #{provinceCode}
      </if>
      <if test="provinceName != null">
        AND b.BI_Province_Name = #{provinceName}
      </if>
      <if test="cityCode != null">
        AND b.BI_City_Code = #{cityCode}
      </if>
      <if test="cityName != null">
        AND b.BI_City_Name = #{cityName}
      </if>
      <if test="districtCode != null">
        AND b.BI_District_Code = #{districtCode}
      </if>
      <if test="districtName != null">
        AND b.BI_District_Name = #{districtName}
      </if>
      <if test="townCode != null">
        AND b.BI_Town_Code = #{townCode}
      </if>
      <if test="townName != null">
        AND b.BI_Town_Name = #{townName}
      </if>
      <if test="areaCode != null">
        AND b.BI_Area_Code = #{areaCode}
      </if>
      <if test="area != null">
        AND b.BI_Area = #{area}
      </if>
      <if test="mcId != null">
        AND b.BI_Management_Company_Id = #{mcId}
      </if>
      <if test="mcName != null">
        AND b.BI_Management_Company = #{mcName}
      </if>
      <if test="sceneTypes.size() != 0">
        AND a.OE_Scene_Type_Id in
        <foreach collection="sceneTypes" item="type" open="(" separator="," close=")">
          #{type, jdbcType=VARCHAR}
        </foreach>
      </if>
    </where>
    ORDER BY
    a.OE_Publish_Time DESC
    LIMIT 1
    );
  </select>
  <select id="getCreditCount" resultMap="BaseResultMap">
    SELECT
    a.*
    FROM
    ea_t_overall_evaluation AS a
    LEFT JOIN ea_t_baseinfo AS b ON a.BI_GUID = b.BI_GUID
    <where>
      <if test="provinceCode != null">
        AND b.BI_Province_Code = #{provinceCode}
      </if>
      <if test="provinceName != null">
        AND b.BI_Province_Name = #{provinceName}
      </if>
      <if test="cityCode != null">
        AND b.BI_City_Code = #{cityCode}
      </if>
      <if test="cityName != null">
        AND b.BI_City_Name = #{cityName}
      </if>
      <if test="districtCode != null">
        AND b.BI_District_Code = #{districtCode}
      </if>
      <if test="districtName != null">
        AND b.BI_District_Name = #{districtName}
      </if>
      <if test="townCode != null">
        AND b.BI_Town_Code = #{townCode}
      </if>
      <if test="townName != null">
        AND b.BI_Town_Name = #{townName}
      </if>
      <if test="areaCode != null">
        AND b.BI_Area_Code = #{areaCode}
      </if>
      <if test="area != null">
        AND b.BI_Area = #{area}
      </if>
      <if test="mcId != null">
        AND b.BI_Management_Company_Id = #{mcId}
      </if>
      <if test="mcName != null">
        AND b.BI_Management_Company = #{mcName}
      </if>
      <if test="sceneTypes.size() != 0">
        AND a.OE_Scene_Type_Id in
        <foreach collection="sceneTypes" item="type" open="(" separator="," close=")">
          #{type}
        </foreach>
      </if>
      <if test="period != null">
        AND a.OE_Start_Time &lt;= '${period}'
        AND a.OE_End_Time >= '${period}'
      </if>
    </where>
  </select>
  <select id="searchEcCodeList" resultMap="CreditInfoVo">
    SELECT
      b.BI_GUID AS userId,
      b.BI_Name AS name,
      c.UI_Extension2 AS sceneType,
      b.CI_Name AS departmentName,
      b.BI_Management_Company AS managementCompany,
      a.OE_Publish_Time AS publishTime,
      a.OE_Update_Time AS updateTime,
      a.OE_Code_Level AS codeLevel,
      b.BI_District_Name AS district,
      b.BI_Town_Name AS town,
      c.UI_IsEnable AS status
    FROM
      ea_t_overall_evaluation AS a
      LEFT JOIN ea_t_baseinfo AS b ON a.BI_GUID = b.BI_GUID
      LEFT JOIN sm_t_userinfo AS c ON a.BI_GUID = c.UI_GUID
    <where>
      <if test="provinceCode != null">
        AND b.BI_Province_Code = #{provinceCode}
      </if>
      <if test="provinceName != null">
        AND b.BI_Province_Name = #{provinceName}
      </if>
      <if test="cityCode != null">
        AND b.BI_City_Code = #{cityCode}
      </if>
      <if test="cityName != null">
        AND b.BI_City_Name = #{cityName}
      </if>
      <if test="districtCode != null">
        AND b.BI_District_Code = #{districtCode}
      </if>
      <if test="districtName != null">
        AND b.BI_District_Name = #{districtName}
      </if>
      <if test="townCode != null">
        AND b.BI_Town_Code = #{townCode}
      </if>
      <if test="townName != null">
        AND b.BI_Town_Name = #{townName}
      </if>
      <if test="areaCode != null">
        AND b.BI_Area_Code = #{areaCode}
      </if>
      <if test="area != null">
        AND b.BI_Area = #{area}
      </if>
      <if test="mcId != null">
        AND b.BI_Management_Company_Id = #{mcId}
      </if>
      <if test="mcName != null">
        AND b.BI_Management_Company = #{mcName}
      </if>
      <if test="sceneTypes.size() != 0">
        AND a.OE_Scene_Type_Id in
        <foreach collection="sceneTypes" item="type" open="(" separator="," close=")">
          #{type, jdbcType=VARCHAR}
        </foreach>
      </if>
      <if test="codeType != null">
        AND a.OE_Code_Level = ${codeType}
      </if>
      <if test="searchText != null">
        AND b.BI_Name LIKE '%${searchText}%'
      </if>
      <if test="period != null">
        AND a.OE_Start_Time &lt;= '${period}'
        AND a.OE_End_Time >= '${period}'
      </if>
    </where>
  </select>
</mapper>