cy
2022-06-21 129904537f66509f97b285e7eb4f42b3dc349dd0
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
package cn.ksource.beans;
 
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
 
import org.apache.commons.lang.StringUtils;
 
 
import cn.ksource.core.dao.BaseBean;
import cn.ksource.core.util.ConvertUtil;
import cn.ksource.core.util.StringUtil;
 
/**
 * 
 */
public class CMS_POP extends BaseBean{
 
    public final static Map<String, String> KEYS = new HashMap<String, String>();
    private Map BEAN_VALUES = null;
    
    static {
        KEYS.put("id", "String");
        KEYS.put("pop_up", "Integer");
        KEYS.put("pop_left", "String");
        KEYS.put("pop_top", "String");
        KEYS.put("pop_right", "String");
        KEYS.put("pop_bottom", "String");
        KEYS.put("pop_width", "String");
        KEYS.put("pop_height", "String");
        KEYS.put("pop_state", "Integer");
        KEYS.put("update_time", "Long");
        KEYS.put("update_people_id", "String");
    }
    public Map getColumnMap(){
        return KEYS;
    }
 
    private String id;
    private Boolean isSetted_id = false;;
    
    private Integer pop_up;
    private Boolean isSetted_pop_up = false;
    private String pop_left;
    private Boolean isSetted_pop_left = false;
    private String pop_top;
    private Boolean isSetted_pop_top = false;
    private String pop_right;
    private Boolean isSetted_pop_right = false;
    private String pop_bottom;
    private Boolean isSetted_pop_bottom = false;
    private String pop_width;
    private Boolean isSetted_pop_width = false;
    private String pop_height;
    private Boolean isSetted_pop_height = false;
    private Integer pop_state;
    private Boolean isSetted_pop_state = false;
    private Long update_time;
    private Boolean isSetted_update_time = false;
    private String update_people_id;
    private Boolean isSetted_update_people_id = false;
 
    private void initBeanValues(){
        BEAN_VALUES = new HashMap<String, Object>();
        BEAN_VALUES.put("id",id);
            BEAN_VALUES.put("pop_up", null);
            BEAN_VALUES.put("pop_left", null);
            BEAN_VALUES.put("pop_top", null);
            BEAN_VALUES.put("pop_right", null);
            BEAN_VALUES.put("pop_bottom", null);
            BEAN_VALUES.put("pop_width", null);
            BEAN_VALUES.put("pop_height", null);
            BEAN_VALUES.put("pop_state", null);
            BEAN_VALUES.put("update_time", null);
            BEAN_VALUES.put("update_people_id", null);
    }
    
    public CMS_POP() {
        initBeanValues();
    }
    
    public CMS_POP(String id) {
        super();
        this.id = id;
        initBeanValues();
        BEAN_VALUES.put("id",id);
    }
 
    /**
     * 获取ID
     */
    public String getId() {
        return this.id;
    }
    /**
     * 设置ID
     */
    public CMS_POP setId(String id) {
        this.id = id;
        this.isSetted_id = true;
        BEAN_VALUES.put("id",id);
        return this;
    }
    
    @Override
    public String getUpdateSql() {
        StringBuffer sBuffer = new StringBuffer("update CMS_POP set ");
            if (isSetted_pop_up) {
                sBuffer.append("pop_up=:pop_up,");
            }
            if (isSetted_pop_left) {
                sBuffer.append("pop_left=:pop_left,");
            }
            if (isSetted_pop_top) {
                sBuffer.append("pop_top=:pop_top,");
            }
            if (isSetted_pop_right) {
                sBuffer.append("pop_right=:pop_right,");
            }
            if (isSetted_pop_bottom) {
                sBuffer.append("pop_bottom=:pop_bottom,");
            }
            if (isSetted_pop_width) {
                sBuffer.append("pop_width=:pop_width,");
            }
            if (isSetted_pop_height) {
                sBuffer.append("pop_height=:pop_height,");
            }
            if (isSetted_pop_state) {
                sBuffer.append("pop_state=:pop_state,");
            }
            if (isSetted_update_time) {
                sBuffer.append("update_time=:update_time,");
            }
            if (isSetted_update_people_id) {
                sBuffer.append("update_people_id=:update_people_id,");
            }
        String sql = sBuffer.toString();
        return StringUtils.removeEnd(sql, ",") + " where id=:id";
    }
    
    
    @Override
    public String getInsertSql() {
        StringBuffer sBuffer = new StringBuffer("insert into CMS_POP(");
        StringBuffer fileds = new StringBuffer("id,");
        StringBuffer values = new StringBuffer(":id,");        
            fileds.append("pop_up,");
            values.append(":pop_up,");
            fileds.append("pop_left,");
            values.append(":pop_left,");
            fileds.append("pop_top,");
            values.append(":pop_top,");
            fileds.append("pop_right,");
            values.append(":pop_right,");
            fileds.append("pop_bottom,");
            values.append(":pop_bottom,");
            fileds.append("pop_width,");
            values.append(":pop_width,");
            fileds.append("pop_height,");
            values.append(":pop_height,");
            fileds.append("pop_state,");
            values.append(":pop_state,");
            fileds.append("update_time,");
            values.append(":update_time,");
            fileds.append("update_people_id,");
            values.append(":update_people_id,");
        sBuffer.append(StringUtils.removeEnd(fileds.toString(), ",") + ") values("+StringUtils.removeEnd(values.toString(), ",")+")");
        return sBuffer.toString();
    }
    
 
        /**
         * 获取弹窗位置(1:左上角,2:右上角,3:左下角,4:右下角)<BR/>
         * 䣺2014-24-25 hh:08
         */
        public Integer getPop_up() {
            return pop_up;
        }
        /**
         * 设置弹窗位置(1:左上角,2:右上角,3:左下角,4:右下角)<BR/>
         * 2014-24-25 hh:08
         */
        public CMS_POP setPop_up(Integer pop_up) {
            this.pop_up = pop_up;
            this.isSetted_pop_up = true;
            BEAN_VALUES.put("pop_up",pop_up);
            return this;
        }
        /**
         * 获取弹窗居左<BR/>
         * 䣺2014-24-25 hh:08
         */
        public String getPop_left() {
            return pop_left;
        }
        /**
         * 设置弹窗居左<BR/>
         * 2014-24-25 hh:08
         */
        public CMS_POP setPop_left(String pop_left) {
            this.pop_left = pop_left;
            this.isSetted_pop_left = true;
            BEAN_VALUES.put("pop_left",pop_left);
            return this;
        }
        /**
         * 获取弹窗居上<BR/>
         * 䣺2014-24-25 hh:08
         */
        public String getPop_top() {
            return pop_top;
        }
        /**
         * 设置弹窗居上<BR/>
         * 2014-24-25 hh:08
         */
        public CMS_POP setPop_top(String pop_top) {
            this.pop_top = pop_top;
            this.isSetted_pop_top = true;
            BEAN_VALUES.put("pop_top",pop_top);
            return this;
        }
        /**
         * 获取弹窗居右<BR/>
         * 䣺2014-24-25 hh:08
         */
        public String getPop_right() {
            return pop_right;
        }
        /**
         * 设置弹窗居右<BR/>
         * 2014-24-25 hh:08
         */
        public CMS_POP setPop_right(String pop_right) {
            this.pop_right = pop_right;
            this.isSetted_pop_right = true;
            BEAN_VALUES.put("pop_right",pop_right);
            return this;
        }
        /**
         * 获取弹窗居下<BR/>
         * 䣺2014-24-25 hh:08
         */
        public String getPop_bottom() {
            return pop_bottom;
        }
        /**
         * 设置弹窗居下<BR/>
         * 2014-24-25 hh:08
         */
        public CMS_POP setPop_bottom(String pop_bottom) {
            this.pop_bottom = pop_bottom;
            this.isSetted_pop_bottom = true;
            BEAN_VALUES.put("pop_bottom",pop_bottom);
            return this;
        }
        /**
         * 获取弹窗宽度<BR/>
         * 䣺2014-24-25 hh:08
         */
        public String getPop_width() {
            return pop_width;
        }
        /**
         * 设置弹窗宽度<BR/>
         * 2014-24-25 hh:08
         */
        public CMS_POP setPop_width(String pop_width) {
            this.pop_width = pop_width;
            this.isSetted_pop_width = true;
            BEAN_VALUES.put("pop_width",pop_width);
            return this;
        }
        /**
         * 获取弹窗高度<BR/>
         * 䣺2014-24-25 hh:08
         */
        public String getPop_height() {
            return pop_height;
        }
        /**
         * 设置弹窗高度<BR/>
         * 2014-24-25 hh:08
         */
        public CMS_POP setPop_height(String pop_height) {
            this.pop_height = pop_height;
            this.isSetted_pop_height = true;
            BEAN_VALUES.put("pop_height",pop_height);
            return this;
        }
        /**
         * 获取弹窗开启状态(1:打开,2:关闭)<BR/>
         * 䣺2014-24-25 hh:08
         */
        public Integer getPop_state() {
            return pop_state;
        }
        /**
         * 设置弹窗开启状态(1:打开,2:关闭)<BR/>
         * 2014-24-25 hh:08
         */
        public CMS_POP setPop_state(Integer pop_state) {
            this.pop_state = pop_state;
            this.isSetted_pop_state = true;
            BEAN_VALUES.put("pop_state",pop_state);
            return this;
        }
        /**
         * 获取<BR/>
         * 䣺2014-24-25 hh:08
         */
        public Long getUpdate_time() {
            return update_time;
        }
        /**
         * 设置<BR/>
         * 2014-24-25 hh:08
         */
        public CMS_POP setUpdate_time(Long update_time) {
            this.update_time = update_time;
            this.isSetted_update_time = true;
            BEAN_VALUES.put("update_time",update_time);
            return this;
        }
        /**
         * 获取<BR/>
         * 䣺2014-24-25 hh:08
         */
        public String getUpdate_people_id() {
            return update_people_id;
        }
        /**
         * 设置<BR/>
         * 2014-24-25 hh:08
         */
        public CMS_POP setUpdate_people_id(String update_people_id) {
            this.update_people_id = update_people_id;
            this.isSetted_update_people_id = true;
            BEAN_VALUES.put("update_people_id",update_people_id);
            return this;
        }
 
        /**
         * 使用ID删除Bean<BR/>
         */
        public void deleteById() {
            if (StringUtils.isBlank(id)) {
                throw new RuntimeException("删除bean时ID不能为空");
            }
            dao.execute("delete from " + getTableName() + " where id = :id", BEAN_VALUES);
        }
    
        @Override
        public CMS_POP getInstanceById() {
            if (StringUtils.isBlank(id)) {
                throw new RuntimeException("获取Bean时ID不能为空");
            }
            return dao.queryForBean("select * from " + getTableName() + " where id=:id", BEAN_VALUES, this);
        }
    
        
        
        @Override
        public CMS_POP queryForBean() {
            StringBuffer sBuffer = new StringBuffer("select * from CMS_POP where ");
            if(isSetted_id){
                sBuffer.append("id=:id and ");
            }
                if (isSetted_pop_up) {
                    sBuffer.append("pop_up=:pop_up and ");
                }
                if (isSetted_pop_left) {
                    sBuffer.append("pop_left=:pop_left and ");
                }
                if (isSetted_pop_top) {
                    sBuffer.append("pop_top=:pop_top and ");
                }
                if (isSetted_pop_right) {
                    sBuffer.append("pop_right=:pop_right and ");
                }
                if (isSetted_pop_bottom) {
                    sBuffer.append("pop_bottom=:pop_bottom and ");
                }
                if (isSetted_pop_width) {
                    sBuffer.append("pop_width=:pop_width and ");
                }
                if (isSetted_pop_height) {
                    sBuffer.append("pop_height=:pop_height and ");
                }
                if (isSetted_pop_state) {
                    sBuffer.append("pop_state=:pop_state and ");
                }
                if (isSetted_update_time) {
                    sBuffer.append("update_time=:update_time and ");
                }
                if (isSetted_update_people_id) {
                    sBuffer.append("update_people_id=:update_people_id and ");
                }
            String sql = sBuffer.toString();
            sql = StringUtils.removeEnd(sql, " and ");
            return dao.queryForBean(sql,this);
        }
    
        @Override
        public String getTableName() {
            return "CMS_POP";
        }
        
        
        public Map getBeanValues(){
            return this.BEAN_VALUES;
        }
    
        @Override
        public CMS_POP insert() {
            if (StringUtils.isBlank(id)) {
                this.setId(StringUtil.getUUID());
            }
            dao.execute(getInsertSql(),BEAN_VALUES);
            return this;
        }
    
        @Override
        public CMS_POP update() {
            if (StringUtils.isBlank(id)) {
                throw new RuntimeException("更新Bean时ID不能为空");
            }
            dao.execute(getUpdateSql(),BEAN_VALUES);
            return this;
        }  
        
        public CMS_POP insertOrUpdate(){
            if (StringUtils.isNotBlank(id)) {
                return update();
            } else {
                return insert();
            }
        }
        
        /**
         * 通过ID获取该条信息的Map结构
         */
        public Map getBeanMapById() {
            
            if (StringUtils.isBlank(id)) {
                throw new RuntimeException("ID不能为空!");
            }
            
            return dao.queryForMap("select * from CMS_POP where id=:id",BEAN_VALUES);
        }
 
        public Object mapRow(ResultSet rs, int rownum) throws SQLException {
            Object id = rs.getObject("ID");
            this.setId(ConvertUtil.obj2Str(id));
            BEAN_VALUES.put("id",id);
            Object obj = null;
            obj = rs.getObject("POP_UP");
            BEAN_VALUES.put("pop_up",obj);
                this.setPop_up(ConvertUtil.obj2Integer(obj));
            obj = rs.getObject("POP_LEFT");
            BEAN_VALUES.put("pop_left",obj);
                this.setPop_left(ConvertUtil.obj2Str(obj));
            obj = rs.getObject("POP_TOP");
            BEAN_VALUES.put("pop_top",obj);
                this.setPop_top(ConvertUtil.obj2Str(obj));
            obj = rs.getObject("POP_RIGHT");
            BEAN_VALUES.put("pop_right",obj);
                this.setPop_right(ConvertUtil.obj2Str(obj));
            obj = rs.getObject("POP_BOTTOM");
            BEAN_VALUES.put("pop_bottom",obj);
                this.setPop_bottom(ConvertUtil.obj2Str(obj));
            obj = rs.getObject("POP_WIDTH");
            BEAN_VALUES.put("pop_width",obj);
                this.setPop_width(ConvertUtil.obj2Str(obj));
            obj = rs.getObject("POP_HEIGHT");
            BEAN_VALUES.put("pop_height",obj);
                this.setPop_height(ConvertUtil.obj2Str(obj));
            obj = rs.getObject("POP_STATE");
            BEAN_VALUES.put("pop_state",obj);
                this.setPop_state(ConvertUtil.obj2Integer(obj));
            obj = rs.getObject("UPDATE_TIME");
            BEAN_VALUES.put("update_time",obj);
                this.setUpdate_time(ConvertUtil.obj2Long(obj));
            obj = rs.getObject("UPDATE_PEOPLE_ID");
            BEAN_VALUES.put("update_people_id",obj);
                this.setUpdate_people_id(ConvertUtil.obj2Str(obj));
            return this;
        }
        
        
        public String toString() {
            StringBuffer sb = new StringBuffer("[");
            for (Iterator iterator = KEYS.keySet().iterator(); iterator.hasNext();) {
                String key = (String) iterator.next();
                sb.append(key+"=" + BEAN_VALUES.get(key)+",");
            }
            sb.append("]");
            return sb.toString();
        }
        
        public CMS_POP newInstance(){
            return new CMS_POP();
        }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
}