Administrator
2023-06-19 49588f5a462ae7425e7eb030438a35fd80c246fa
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<?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.gk.firework.Mapper.WarnContentInfoMapper" >
  <resultMap id="BaseResultMap" type="com.gk.firework.Domain.WarnContentInfo" >
    <!--          -->
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="warntype" property="warntype" jdbcType="VARCHAR" />
    <result column="warnlevel" property="warnlevel" jdbcType="VARCHAR" />
    <result column="warncontent" property="warncontent" jdbcType="VARCHAR" />
    <result column="customid" property="customid" jdbcType="BIGINT" />
    <result column="enterpriseid" property="enterpriseid" jdbcType="BIGINT" />
    <result column="ismend" property="ismend" jdbcType="TINYINT" />
    <result column="isneed" property="isneed" jdbcType="TINYINT" />
    <result column="issend" property="issend" jdbcType="TINYINT" />
    <result column="modifiedby" property="modifiedby" jdbcType="VARCHAR" />
    <result column="modifieddate" property="modifieddate" jdbcType="TIMESTAMP" />
    <result column="createddate" property="createddate" jdbcType="TIMESTAMP" />
    <result column="period" property="period" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, warntype, warnlevel, warncontent, customid, enterpriseid, ismend, isneed, issend, modifiedby, modifieddate,createddate, period
  </sql>
    <insert id="insertBatch">
        insert into
        warncontent
        <trim prefix="(" suffix=") values" suffixOverrides=",">
          warntype,
          warnlevel,
          warncontent,
          customid,
          enterpriseid,
          ismend,
          isneed,
          issend,
          modifiedby,
          modifieddate,
          createddate,
          period,
        </trim>
        <foreach collection="list" item="item" open="(" close=")" separator=",">
          <trim prefix="(" suffix=")" suffixOverrides=",">
          #{item.warntype},
          #{item.warnlevel},
          #{item.warncontent},
          #{item.customid},
          #{item.ismend},
          #{item.isneed},
          #{item.issend},
          #{item.modifiedby},
          #{item.modifieddate},
          #{item.createddate},
          #{item.period},
          </trim>
        </foreach>
 
 
    </insert>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    select
    <include refid="Base_Column_List" />
    from warncontent
    where id = #{id,jdbcType=BIGINT}
  </select>
  <select id="selectStockDataGrid" resultType="com.gk.firework.Domain.Vo.WarnContentVo">
    SELECT
    warncontent.*,
    enterprise.safetysupervision as enterprisetype,
    enterprise.enterprisename,
    enterprise.enterprisenumber,
    enterprise.officeaddress
    from warncontent
    LEFT JOIN enterprise ON enterprise.id = warncontent.enterpriseid
    <where>
      1=1
      <if test="condition.warntype != null and condition.warntype !=''">
        and  warncontent.warntype = #{condition.warntype}
      </if>
      <if test="condition.ismend != null">
        and warncontent.ismend = #{ismend}
      </if>
      <if test="condition.starttime != null and condition.starttime !=''">
        and  warncontent.modifieddate &gt;= #{condition.starttime}
      </if>
      <if test="condition.endtime != null and condition.endtime !=''">
        and  warncontent.modifieddate &lt;= #{condition.endtime}
      </if>
      <if test="condition.warnlevel != null and condition.warnlevel !=''">
        and  warncontent.warnlevel = #{condition.warnlevel}
      </if>
      <if test="condition.enterprisename != null and condition.enterprisename !=''">
        and enterprise.enterprisename LIKE CONCAT('%',#{condition.enterprisename},'%')
      </if>
      <if test="condition.enterprisetype != null and condition.enterprisetype !=''">
        and  enterprise.safetysupervision = #{condition.enterprisetype}
      </if>
      <if test="condition.province != null and condition.province !=''">
        and  enterprise.province = #{condition.province}
      </if>
      <if test="condition.city != null and condition.city !=''">
        and  enterprise.city = #{condition.city}
      </if>
      <if test="condition.area != null and condition.area !=''">
        and  enterprise.district = #{condition.area}
      </if>
      <if test="condition.town != null and condition.town !=''">
        and  enterprise.street = #{condition.town}
      </if>
      <if test="condition.community != null and condition.community !=''">
        and  enterprise.committee = #{condition.community}
      </if>
    </where>
  </select>
  <select id="selectPurchaseDataGrid" resultType="com.gk.firework.Domain.Vo.WarnContentVo">
    SELECT
    warncontent.*,
    customer.idcardnum as idcard,
    customer.`name` as purchasename,
    customer.address as purchaseaddress
    from warncontent
    LEFT JOIN customer AS customer ON customer.id = warncontent.customid
    <where>
      1=1
      <if test="condition.warntype != null and condition.warntype !=''">
        and  warncontent.warntype = #{condition.warntype}
      </if>
      <if test="condition.ismend != null">
        and warncontent.ismend = #{ismend}
      </if>
      <if test="condition.starttime != null and condition.starttime !=''">
        and  warncontent.modifieddate &gt;= #{condition.starttime}
      </if>
      <if test="condition.endtime != null and condition.endtime !=''">
        and  warncontent.modifieddate &lt;= #{condition.endtime}
      </if>
      <if test="condition.warnlevel != null and condition.warnlevel !=''">
        and  warncontent.warnlevel = #{condition.warnlevel}
      </if>
      <if test="condition.customer != null and condition.customer !=''">
        and  customer.`name` = #{condition.customer}
      </if>
      <if test="condition.idcard != null and condition.idcard !=''">
        and  customer.idcardnum = #{condition.idcard}
      </if>
    </where>
  </select>
  <select id="selectByWarn" resultType="com.gk.firework.Domain.WarnContentInfo">
    SELECT
    <include refid="Base_Column_List" />
    from warncontent
    <where>
      1=1
      <if test="warntype != null and warntype !=''">
        and warntype = #{warntype}
      </if>
      <if test="warnlevel != null and warnlevel !=''">
        and  warnlevel = #{warnlevel}
      </if>
      <if test="customer != null">
        and customid = #{customer}
      </if>
      <if test="warncontent != null and warncontent !=''">
        and  warncontent = #{warncontent}
      </if>
    </where>
    limit 1
  </select>
  <select id="selectByEnterpriseWarn" resultType="com.gk.firework.Domain.WarnContentInfo">
    SELECT
    <include refid="Base_Column_List" />
    from warncontent
    <where>
      1=1
      <if test="warntype != null and warntype !=''">
        and warntype = #{warntype}
      </if>
      <if test="warnlevel != null and warnlevel !=''">
        and warnlevel = #{warnlevel}
      </if>
      <if test="enterpriseid != null">
        and enterpriseid = #{enterpriseid}
      </if>
      <if test="warncontent != null and warncontent !=''">
        and warncontent = #{warncontent}
      </if>
    </where>
    limit 1
  </select>
  <select id="selectNeedMail" resultType="com.gk.firework.Domain.Vo.WarnContentVo">
    select
        warncontent.*,
        enterprise.enterprisename,
        customer.`name` as purchasename,
        customer.`name` as purchasename,
        customer.idcardnum as idcard
    from warncontent
    LEFT JOIN enterprise ON enterprise.id = warncontent.enterpriseid
    LEFT JOIN customer AS customer ON customer.id = warncontent.customid
    where
        warncontent.isneed = 1
    AND warncontent.issend = 0
    AND warncontent.createddate &gt;= #{starttime}
    AND warncontent.createddate &lt;= #{endtime}
  </select>
  <select id="selectIsNotMend" resultType="com.gk.firework.Domain.Vo.WarnContentVo">
    select
        warncontent.*,
        enterprise.enterprisename,
        enterprise.officeaddress,
        customer.`name` as purchasename,
        customer.`name` as purchasename,
        customer.idcardnum as idcard,
        customer.address as purchaseaddress
    from warncontent
    LEFT JOIN enterprise ON enterprise.id = warncontent.enterpriseid
    LEFT JOIN customer AS customer ON customer.id = warncontent.customid
    where
        warncontent.ismend = 0
        and warncontent.warnlevel = '报警'
    order by warncontent.createddate DESC
  </select>
  <select id="selectWarningDataGrid" resultType="com.gk.firework.Domain.Vo.WarnContentVo">
    SELECT
    warncontent.*,
    enterprise.safetysupervision as enterprisetype,
    enterprise.enterprisename,
    enterprise.enterprisenumber,
    enterprise.officeaddress,
    customer.idcardnum as idcard,
    customer.`name` as purchasename,
    customer.address as purchaseaddress
    from warncontent
    LEFT JOIN enterprise ON enterprise.id = warncontent.enterpriseid
    LEFT JOIN customer AS customer ON customer.id = warncontent.customid
    <where>
      1=1
      <if test="condition.warntype != null and condition.warntype !=''">
        and  warncontent.warntype = #{condition.warntype}
      </if>
      <if test="condition.ismend != null">
        and warncontent.ismend = #{ismend}
      </if>
      <if test="condition.starttime != null and condition.starttime !=''">
        and  warncontent.modifieddate &gt;= #{condition.starttime}
      </if>
      <if test="condition.endtime != null and condition.endtime !=''">
        and  warncontent.modifieddate &lt;= #{condition.endtime}
      </if>
      <if test="condition.warnlevel != null and condition.warnlevel !=''">
        and  warncontent.warnlevel = #{condition.warnlevel}
      </if>
      <if test="condition.customer != null and condition.customer !=''">
        and  customer.`name` = #{condition.customer}
      </if>
      <if test="condition.idcard != null and condition.idcard !=''">
        and  customer.idcardnum = #{condition.idcard}
      </if>
      <if test="condition.enterprisename != null and condition.enterprisename !=''">
        and enterprise.enterprisename LIKE CONCAT('%',#{condition.enterprisename},'%')
      </if>
      <if test="condition.enterprisetype != null and condition.enterprisetype !=''">
        and  enterprise.safetysupervision = #{condition.enterprisetype}
      </if>
    </where>
  </select>
</mapper>