Преглед на файлове

服务专利资源的平台浏览量统计

XMTT преди 6 години
родител
ревизия
d17b418591
променени са 1 файла, в които са добавени 1188 реда и са изтрити 6 реда
  1. 1188 6
      src/main/java/com/ekexiu/portal/views/dao/DayDao.java

+ 1188 - 6
src/main/java/com/ekexiu/portal/views/dao/DayDao.java

@ -19,7 +19,11 @@ import org.jfw.apt.orm.core.defaultImpl.StringHandler;
19 19
import org.jfw.util.PageQueryResult;
20 20
21 21
import java.sql.Connection;
22
import java.sql.PreparedStatement;
23
import java.sql.ResultSet;
22 24
import java.sql.SQLException;
25
import java.util.ArrayList;
26
import java.util.Collections;
23 27
import java.util.LinkedList;
24 28
import java.util.List;
25 29
@ -175,45 +179,1223 @@ public abstract class DayDao {
175 179
    @PageQuery
176 180
    @OrderBy("ORDER BY c.MODIFY_TIME DESC NULLS LAST")
177 181
    @Exclude("descp")
178
    public abstract PageQueryResult<WareSum> queryWareTime(Connection con, String platform, @Nullable @Like String name, @Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {
182
    public abstract PageQueryResult<WareSum> queryWareTime1(Connection con, @Nullable @Like String name, @Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {
179 183
            "CATEGORY='1' AND OWNER IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)",
180 184
            "CATEGORY ='2' AND OWNER IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)"},
181 185
            additional = 1, isAnd = false, force = true) String author, @Nullable @GtEq @Alias("modifyTime") String bt, @Nullable @Alias("modifyTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
182 186
187
    public PageQueryResult<WareSum> queryWareTime(Connection con,String platform,String name,String author,String bt,String et,int pageSize,int pageNo) throws SQLException{
188
        int _m_1 = 0;
189
        PageQueryResult<WareSum> _result = new PageQueryResult<WareSum>();
190
        int _m_3 = 1;
191
        boolean _m_2 = null == name;
192
        boolean _m_4 = null == author;
193
        boolean _m_5 = null == bt;
194
        boolean _m_6 = null == et;
195
        StringBuilder sql = new StringBuilder();
196
        boolean _m_8 = true;
197
        if(!_m_2){
198
            _m_8 =  false;
199
            sql.append(" WHERE c.NAME LIKE ?");
200
        }
201
        if(!_m_4){
202
            if(_m_8){
203
                _m_8 =  false;
204
                sql.append(" WHERE ((CATEGORY='1' AND OWNER IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)) OR (CATEGORY ='2' AND OWNER IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)))");
205
            }else{
206
                sql.append(" AND ((CATEGORY='1' AND OWNER IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)) OR (CATEGORY ='2' AND OWNER IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)))");
207
            }
208
        }
209
        if(!_m_5){
210
            if(_m_8){
211
                _m_8 =  false;
212
                sql.append(" WHERE c.MODIFY_TIME >= ?");
213
            }else{
214
                sql.append(" AND c.MODIFY_TIME >= ?");
215
            }
216
        }
217
        if(!_m_6){
218
            if(_m_8){
219
                _m_8 =  false;
220
                sql.append(" WHERE c.MODIFY_TIME <= ?");
221
            }else{
222
                sql.append(" AND c.MODIFY_TIME <= ?");
223
            }
224
        }
225
        StringBuilder _m_7 = sql;
226
        sql = new StringBuilder();
227
        sql.append("SELECT COUNT(1) FROM ware c LEFT JOIN ware_day_sum cds on c.id = cds.id AND cds.platform = ?");
228
        if(_m_7.length()>0){
229
            sql.append(_m_7);
230
        }
231
        PreparedStatement ps = con.prepareStatement(sql.toString());
232
        try{
233
            ps.setString(_m_3++,platform);
234
            if(!_m_2){
235
                ps.setString(_m_3++,name);
236
            }
237
            if(!_m_4){
238
                ps.setString(_m_3++,author);
239
                ps.setString(_m_3++,author);
240
                ps.setString(_m_3++,author);
241
            }
242
            if(!_m_5){
243
                ps.setString(_m_3++,bt);
244
            }
245
            if(!_m_6){
246
                ps.setString(_m_3++,et);
247
            }
248
            _result.setPageSize(pageSize);
249
            ResultSet _pageRs = ps.executeQuery();
250
            try{
251
                _pageRs.next();
252
                _m_1 = _pageRs.getInt(1);
253
            }finally{
254
                try{_pageRs.close();}catch(Exception _m_9){}
255
            }
256
        }finally{
257
            try{ps.close();}catch(Exception _m_10){}
258
        }
259
        _result.setTotal(_m_1);
260
        if(0== _m_1){
261
            _result.setPageNo(1);
262
            _result.setData(Collections.<WareSum>emptyList());
263
            return _result;
264
        }
265
        _m_3 = 1;
266
        boolean _m_11 = (1 == pageNo);
267
        if(_m_11){
268
            _result.setPageNo(1);
269
            sql = new StringBuilder();
270
            sql.append("SELECT cds.platform,COALESCE(cds.sum,0) as sum,c.PAGE_VIEWS,c.ID,c.NAME,c.KEYWORDS,c.CNT,c.COOPERATION,c.CATEGORY,c.OWNER,c.IMAGES,c.STATE,c.SHARE_ID,c.SORT_FIRST,c.CREATE_TIME,c.MODIFY_TIME FROM ware c LEFT JOIN ware_day_sum cds on c.id = cds.id AND cds.platform = ?");
271
            if(_m_7.length()>0){
272
                sql.append(_m_7);
273
            }
274
            sql.append(" ORDER BY c.MODIFY_TIME DESC NULLS LAST");
275
            sql.append(" LIMIT ").append(pageSize);
276
        }else{
277
            int _m_12 = _m_1 / pageSize;
278
            if(_m_1 % pageSize != 0){
279
                ++_m_12;
280
            }
281
            if(pageNo > _m_12){
282
                pageNo = _m_12;
283
            }
284
            _result.setPageNo(pageNo);
285
            --pageNo;
286
            int _m_13 = (pageNo * pageSize);
287
            sql = new StringBuilder();
288
            sql.append("SELECT cds.platform,COALESCE(cds.sum,0) as sum,c.PAGE_VIEWS,c.ID,c.NAME,c.KEYWORDS,c.CNT,c.COOPERATION,c.CATEGORY,c.OWNER,c.IMAGES,c.STATE,c.SHARE_ID,c.SORT_FIRST,c.CREATE_TIME,c.MODIFY_TIME FROM ware c LEFT JOIN ware_day_sum cds on c.id = cds.id AND cds.platform = ?");
289
            if(_m_7.length()>0){
290
                sql.append(_m_7);
291
            }
292
            sql.append(" ORDER BY c.MODIFY_TIME DESC NULLS LAST");
293
            sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(_m_13);
294
        }
295
        ps = con.prepareStatement(sql.toString());
296
        try{
297
            ps.setString(_m_3++,platform);
298
            if(!_m_2){
299
                ps.setString(_m_3++,name);
300
            }
301
            if(!_m_4){
302
                ps.setString(_m_3++,author);
303
                ps.setString(_m_3++,author);
304
                ps.setString(_m_3++,author);
305
            }
306
            if(!_m_5){
307
                ps.setString(_m_3++,bt);
308
            }
309
            if(!_m_6){
310
                ps.setString(_m_3++,et);
311
            }
312
            ResultSet rs = ps.executeQuery();
313
            try{
314
                List<WareSum> _m_14 = new ArrayList<WareSum>();
315
                _result.setData(_m_14);
316
                int _m_15 = 0;
317
                while((_m_15<pageSize) && rs.next()){
318
                    ++_m_15;
319
                    WareSum _obj =  new WareSum();
320
                    _obj.setPlatform(rs.getString(1));
321
                    _obj.setSum(rs.getInt(2));
322
                    _obj.setPageViews(rs.getLong(3));
323
                    _obj.setId(rs.getString(4));
324
                    _obj.setName(rs.getString(5));
325
                    String _m_16 = rs.getString(6);
326
                    if(rs.wasNull()){
327
                        _m_16 = null;
328
                    }
329
                    _obj.setKeywords(_m_16);
330
                    String _m_17 = rs.getString(7);
331
                    if(rs.wasNull()){
332
                        _m_17 = null;
333
                    }
334
                    _obj.setCnt(_m_17);
335
                    String _m_18 = rs.getString(8);
336
                    if(rs.wasNull()){
337
                        _m_18 = null;
338
                    }
339
                    _obj.setCooperation(_m_18);
340
                    _obj.setCategory(rs.getString(9));
341
                    _obj.setOwner(rs.getString(10));
342
                    String _m_19 = rs.getString(11);
343
                    if(rs.wasNull()){
344
                        _m_19 = null;
345
                    }
346
                    _obj.setImages(_m_19);
347
                    _obj.setState(rs.getString(12));
348
                    _obj.setShareId(rs.getLong(13));
349
                    _obj.setSortFirst(rs.getLong(14));
350
                    _obj.setCreateTime(rs.getString(15));
351
                    _obj.setModifyTime(rs.getString(16));
352
                    _m_14.add(_obj);
353
                }
354
                return _result;
355
            }finally{
356
                try{rs.close();}catch(Exception _m_20){}
357
            }
358
        }finally{
359
            try{ps.close();}catch(Exception _m_21){}
360
        }
361
    }
362
183 363
    @PageQuery
184 364
    @OrderBy("ORDER BY SUM DESC")
185 365
    @Exclude("descp")
186
    public abstract PageQueryResult<WareSum> queryWareViews(Connection con, String platform, @Nullable @Like String name, @Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {
366
    public abstract PageQueryResult<WareSum> queryWareViews1(Connection con, @Nullable @Like String name, @Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {
187 367
            "CATEGORY='1' AND OWNER IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)",
188 368
            "CATEGORY ='2' AND OWNER IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)"},
189 369
            additional = 1, isAnd = false, force = true) String author, @Nullable @GtEq @Alias("modifyTime") String bt, @Nullable @Alias("modifyTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
190 370
371
    public PageQueryResult<WareSum> queryWareViews(Connection con,String platform,String name,String author,String bt,String et,int pageSize,int pageNo) throws SQLException{
372
        int _m_1 = 0;
373
        PageQueryResult<WareSum> _result = new PageQueryResult<WareSum>();
374
        int _m_3 = 1;
375
        boolean _m_2 = null == name;
376
        boolean _m_4 = null == author;
377
        boolean _m_5 = null == bt;
378
        boolean _m_6 = null == et;
379
        StringBuilder sql = new StringBuilder();
380
        boolean _m_8 = true;
381
        if(!_m_2){
382
            _m_8 =  false;
383
            sql.append(" WHERE c.NAME LIKE ?");
384
        }
385
        if(!_m_4){
386
            if(_m_8){
387
                _m_8 =  false;
388
                sql.append(" WHERE ((CATEGORY='1' AND OWNER IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)) OR (CATEGORY ='2' AND OWNER IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)))");
389
            }else{
390
                sql.append(" AND ((CATEGORY='1' AND OWNER IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)) OR (CATEGORY ='2' AND OWNER IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)))");
391
            }
392
        }
393
        if(!_m_5){
394
            if(_m_8){
395
                _m_8 =  false;
396
                sql.append(" WHERE c.MODIFY_TIME >= ?");
397
            }else{
398
                sql.append(" AND c.MODIFY_TIME >= ?");
399
            }
400
        }
401
        if(!_m_6){
402
            if(_m_8){
403
                _m_8 =  false;
404
                sql.append(" WHERE c.MODIFY_TIME <= ?");
405
            }else{
406
                sql.append(" AND c.MODIFY_TIME <= ?");
407
            }
408
        }
409
        StringBuilder _m_7 = sql;
410
        sql = new StringBuilder();
411
        sql.append("SELECT COUNT(1) FROM ware c LEFT JOIN ware_day_sum cds on c.id = cds.id AND cds.platform = ?");
412
        if(_m_7.length()>0){
413
            sql.append(_m_7);
414
        }
415
        PreparedStatement ps = con.prepareStatement(sql.toString());
416
        try{
417
            ps.setString(_m_3++,platform);
418
            if(!_m_2){
419
                ps.setString(_m_3++,name);
420
            }
421
            if(!_m_4){
422
                ps.setString(_m_3++,author);
423
                ps.setString(_m_3++,author);
424
                ps.setString(_m_3++,author);
425
            }
426
            if(!_m_5){
427
                ps.setString(_m_3++,bt);
428
            }
429
            if(!_m_6){
430
                ps.setString(_m_3++,et);
431
            }
432
            _result.setPageSize(pageSize);
433
            ResultSet _pageRs = ps.executeQuery();
434
            try{
435
                _pageRs.next();
436
                _m_1 = _pageRs.getInt(1);
437
            }finally{
438
                try{_pageRs.close();}catch(Exception _m_9){}
439
            }
440
        }finally{
441
            try{ps.close();}catch(Exception _m_10){}
442
        }
443
        _result.setTotal(_m_1);
444
        if(0== _m_1){
445
            _result.setPageNo(1);
446
            _result.setData(Collections.<WareSum>emptyList());
447
            return _result;
448
        }
449
        _m_3 = 1;
450
        boolean _m_11 = (1 == pageNo);
451
        if(_m_11){
452
            _result.setPageNo(1);
453
            sql = new StringBuilder();
454
            sql.append("SELECT cds.platform,COALESCE(cds.sum,0) as sum,c.PAGE_VIEWS,c.ID,c.NAME,c.KEYWORDS,c.CNT,c.COOPERATION,c.CATEGORY,c.OWNER,c.IMAGES,c.STATE,c.SHARE_ID,c.SORT_FIRST,c.CREATE_TIME,c.MODIFY_TIME FROM ware c LEFT JOIN ware_day_sum cds on c.id = cds.id AND cds.platform = ?");
455
            if(_m_7.length()>0){
456
                sql.append(_m_7);
457
            }
458
            sql.append(" ORDER BY SUM DESC");
459
            sql.append(" LIMIT ").append(pageSize);
460
        }else{
461
            int _m_12 = _m_1 / pageSize;
462
            if(_m_1 % pageSize != 0){
463
                ++_m_12;
464
            }
465
            if(pageNo > _m_12){
466
                pageNo = _m_12;
467
            }
468
            _result.setPageNo(pageNo);
469
            --pageNo;
470
            int _m_13 = (pageNo * pageSize);
471
            sql = new StringBuilder();
472
            sql.append("SELECT cds.platform,COALESCE(cds.sum,0) as sum,c.PAGE_VIEWS,c.ID,c.NAME,c.KEYWORDS,c.CNT,c.COOPERATION,c.CATEGORY,c.OWNER,c.IMAGES,c.STATE,c.SHARE_ID,c.SORT_FIRST,c.CREATE_TIME,c.MODIFY_TIME FROM ware c LEFT JOIN ware_day_sum cds on c.id = cds.id AND cds.platform = ?");
473
            if(_m_7.length()>0){
474
                sql.append(_m_7);
475
            }
476
            sql.append(" ORDER BY SUM DESC");
477
            sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(_m_13);
478
        }
479
        ps = con.prepareStatement(sql.toString());
480
        try{
481
            ps.setString(_m_3++,platform);
482
            if(!_m_2){
483
                ps.setString(_m_3++,name);
484
            }
485
            if(!_m_4){
486
                ps.setString(_m_3++,author);
487
                ps.setString(_m_3++,author);
488
                ps.setString(_m_3++,author);
489
            }
490
            if(!_m_5){
491
                ps.setString(_m_3++,bt);
492
            }
493
            if(!_m_6){
494
                ps.setString(_m_3++,et);
495
            }
496
            ResultSet rs = ps.executeQuery();
497
            try{
498
                List<WareSum> _m_14 = new ArrayList<WareSum>();
499
                _result.setData(_m_14);
500
                int _m_15 = 0;
501
                while((_m_15<pageSize) && rs.next()){
502
                    ++_m_15;
503
                    WareSum _obj =  new WareSum();
504
                    _obj.setPlatform(rs.getString(1));
505
                    _obj.setSum(rs.getInt(2));
506
                    _obj.setPageViews(rs.getLong(3));
507
                    _obj.setId(rs.getString(4));
508
                    _obj.setName(rs.getString(5));
509
                    String _m_16 = rs.getString(6);
510
                    if(rs.wasNull()){
511
                        _m_16 = null;
512
                    }
513
                    _obj.setKeywords(_m_16);
514
                    String _m_17 = rs.getString(7);
515
                    if(rs.wasNull()){
516
                        _m_17 = null;
517
                    }
518
                    _obj.setCnt(_m_17);
519
                    String _m_18 = rs.getString(8);
520
                    if(rs.wasNull()){
521
                        _m_18 = null;
522
                    }
523
                    _obj.setCooperation(_m_18);
524
                    _obj.setCategory(rs.getString(9));
525
                    _obj.setOwner(rs.getString(10));
526
                    String _m_19 = rs.getString(11);
527
                    if(rs.wasNull()){
528
                        _m_19 = null;
529
                    }
530
                    _obj.setImages(_m_19);
531
                    _obj.setState(rs.getString(12));
532
                    _obj.setShareId(rs.getLong(13));
533
                    _obj.setSortFirst(rs.getLong(14));
534
                    _obj.setCreateTime(rs.getString(15));
535
                    _obj.setModifyTime(rs.getString(16));
536
                    _m_14.add(_obj);
537
                }
538
                return _result;
539
            }finally{
540
                try{rs.close();}catch(Exception _m_20){}
541
            }
542
        }finally{
543
            try{ps.close();}catch(Exception _m_21){}
544
        }
545
    }
546
191 547
    @Exclude("summary")
192 548
    @PageQuery
193 549
    @OrderBy("ORDER BY c.CREATE_TIME DESC NULLS LAST")
194
    public abstract PageQueryResult<PpatentSum> queryPpatentTime(Connection con, String platform, @Nullable @Like String name,@Nullable @Like String authors,@Nullable @GtEq @Alias("createTime") String bt, @Nullable @Alias("createTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
550
    public abstract PageQueryResult<PpatentSum> queryPpatentTime1(Connection con, @Nullable @Like String name,@Nullable @Like String authors,@Nullable @GtEq @Alias("createTime") String bt, @Nullable @Alias("createTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
551
552
    public PageQueryResult<PpatentSum> queryPpatentTime(Connection con,String platform,String name,String authors,String bt,String et,int pageSize,int pageNo) throws SQLException{
553
        int _m_1 = 0;
554
        PageQueryResult<PpatentSum> _result = new PageQueryResult<PpatentSum>();
555
        int _m_3 = 1;
556
        boolean _m_2 = null == name;
557
        boolean _m_4 = null == authors;
558
        boolean _m_5 = null == bt;
559
        boolean _m_6 = null == et;
560
        StringBuilder sql = new StringBuilder();
561
        boolean _m_8 = true;
562
        if(!_m_2){
563
            _m_8 =  false;
564
            sql.append(" WHERE c.NAME LIKE ?");
565
        }
566
        if(!_m_4){
567
            if(_m_8){
568
                _m_8 =  false;
569
                sql.append(" WHERE c.AUTHORS LIKE ?");
570
            }else{
571
                sql.append(" AND c.AUTHORS LIKE ?");
572
            }
573
        }
574
        if(!_m_5){
575
            if(_m_8){
576
                _m_8 =  false;
577
                sql.append(" WHERE c.CREATE_TIME >= ?");
578
            }else{
579
                sql.append(" AND c.CREATE_TIME >= ?");
580
            }
581
        }
582
        if(!_m_6){
583
            if(_m_8){
584
                _m_8 =  false;
585
                sql.append(" WHERE c.CREATE_TIME <= ?");
586
            }else{
587
                sql.append(" AND c.CREATE_TIME <= ?");
588
            }
589
        }
590
        StringBuilder _m_7 = sql;
591
        sql = new StringBuilder();
592
        sql.append("SELECT COUNT(1) FROM ppatent c LEFT JOIN ppatent_day_sum cds on c.id = cds.id AND cds.platform = ?");
593
        if(_m_7.length()>0){
594
            sql.append(_m_7);
595
        }
596
        PreparedStatement ps = con.prepareStatement(sql.toString());
597
        try{
598
            ps.setString(_m_3++,platform);
599
            if(!_m_2){
600
                ps.setString(_m_3++,name);
601
            }
602
            if(!_m_4){
603
                ps.setString(_m_3++,authors);
604
            }
605
            if(!_m_5){
606
                ps.setString(_m_3++,bt);
607
            }
608
            if(!_m_6){
609
                ps.setString(_m_3++,et);
610
            }
611
            _result.setPageSize(pageSize);
612
            ResultSet _pageRs = ps.executeQuery();
613
            try{
614
                _pageRs.next();
615
                _m_1 = _pageRs.getInt(1);
616
            }finally{
617
                try{_pageRs.close();}catch(Exception _m_9){}
618
            }
619
        }finally{
620
            try{ps.close();}catch(Exception _m_10){}
621
        }
622
        _result.setTotal(_m_1);
623
        if(0== _m_1){
624
            _result.setPageNo(1);
625
            _result.setData(Collections.<PpatentSum>emptyList());
626
            return _result;
627
        }
628
        _m_3 = 1;
629
        boolean _m_11 = (1 == pageNo);
630
        if(_m_11){
631
            _result.setPageNo(1);
632
            sql = new StringBuilder();
633
            sql.append("SELECT cds.platform,COALESCE(cds.sum,0) as sum,c.AUTHORS,c.SORT_NUM,c.ID,c.NAME,c.PAGE_VIEWS,c.CODE,c.REQ_CODE,c.REQ_PERSON,c.REQ_DAY,c.PUB_DAY,c.REF_PARAM,c.KEYWORDS,c.SHARE_ID,c.COOPERATION,c.CREATE_TIME FROM ppatent c LEFT JOIN ppatent_day_sum cds on c.id = cds.id AND cds.platform = ?");
634
            if(_m_7.length()>0){
635
                sql.append(_m_7);
636
            }
637
            sql.append(" ORDER BY c.CREATE_TIME DESC NULLS LAST");
638
            sql.append(" LIMIT ").append(pageSize);
639
        }else{
640
            int _m_12 = _m_1 / pageSize;
641
            if(_m_1 % pageSize != 0){
642
                ++_m_12;
643
            }
644
            if(pageNo > _m_12){
645
                pageNo = _m_12;
646
            }
647
            _result.setPageNo(pageNo);
648
            --pageNo;
649
            int _m_13 = (pageNo * pageSize);
650
            sql = new StringBuilder();
651
            sql.append("SELECT cds.platform,COALESCE(cds.sum,0) as sum,c.AUTHORS,c.SORT_NUM,c.ID,c.NAME,c.PAGE_VIEWS,c.CODE,c.REQ_CODE,c.REQ_PERSON,c.REQ_DAY,c.PUB_DAY,c.REF_PARAM,c.KEYWORDS,c.SHARE_ID,c.COOPERATION,c.CREATE_TIME FROM ppatent c LEFT JOIN ppatent_day_sum cds on c.id = cds.id AND cds.platform = ?");
652
            if(_m_7.length()>0){
653
                sql.append(_m_7);
654
            }
655
            sql.append(" ORDER BY c.CREATE_TIME DESC NULLS LAST");
656
            sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(_m_13);
657
        }
658
        ps = con.prepareStatement(sql.toString());
659
        try{
660
            ps.setString(_m_3++,platform);
661
            if(!_m_2){
662
                ps.setString(_m_3++,name);
663
            }
664
            if(!_m_4){
665
                ps.setString(_m_3++,authors);
666
            }
667
            if(!_m_5){
668
                ps.setString(_m_3++,bt);
669
            }
670
            if(!_m_6){
671
                ps.setString(_m_3++,et);
672
            }
673
            ResultSet rs = ps.executeQuery();
674
            try{
675
                List<PpatentSum> _m_14 = new ArrayList<PpatentSum>();
676
                _result.setData(_m_14);
677
                int _m_15 = 0;
678
                while((_m_15<pageSize) && rs.next()){
679
                    ++_m_15;
680
                    PpatentSum _obj =  new PpatentSum();
681
                    _obj.setPlatform(rs.getString(1));
682
                    _obj.setSum(rs.getInt(2));
683
                    _obj.setAuthors(rs.getString(3));
684
                    _obj.setSortNum(rs.getLong(4));
685
                    _obj.setId(rs.getString(5));
686
                    _obj.setName(rs.getString(6));
687
                    _obj.setPageViews(rs.getLong(7));
688
                    String _m_16 = rs.getString(8);
689
                    if(rs.wasNull()){
690
                        _m_16 = null;
691
                    }
692
                    _obj.setCode(_m_16);
693
                    String _m_17 = rs.getString(9);
694
                    if(rs.wasNull()){
695
                        _m_17 = null;
696
                    }
697
                    _obj.setReqCode(_m_17);
698
                    String _m_18 = rs.getString(10);
699
                    if(rs.wasNull()){
700
                        _m_18 = null;
701
                    }
702
                    _obj.setReqPerson(_m_18);
703
                    String _m_19 = rs.getString(11);
704
                    if(rs.wasNull()){
705
                        _m_19 = null;
706
                    }
707
                    _obj.setReqDay(_m_19);
708
                    String _m_20 = rs.getString(12);
709
                    if(rs.wasNull()){
710
                        _m_20 = null;
711
                    }
712
                    _obj.setPubDay(_m_20);
713
                    String _m_21 = rs.getString(13);
714
                    if(rs.wasNull()){
715
                        _m_21 = null;
716
                    }
717
                    _obj.setRef_param(_m_21);
718
                    String _m_22 = rs.getString(14);
719
                    if(rs.wasNull()){
720
                        _m_22 = null;
721
                    }
722
                    _obj.setKeywords(_m_22);
723
                    _obj.setShareId(rs.getLong(15));
724
                    String _m_23 = rs.getString(16);
725
                    if(rs.wasNull()){
726
                        _m_23 = null;
727
                    }
728
                    _obj.setCooperation(_m_23);
729
                    _obj.setCreateTime(rs.getString(17));
730
                    _m_14.add(_obj);
731
                }
732
                return _result;
733
            }finally{
734
                try{rs.close();}catch(Exception _m_24){}
735
            }
736
        }finally{
737
            try{ps.close();}catch(Exception _m_25){}
738
        }
739
    }
195 740
196 741
    @Exclude("summary")
197 742
    @PageQuery
198 743
    @OrderBy("ORDER BY SUM DESC NULLS LAST")
199
    public abstract PageQueryResult<PpatentSum> queryPpatentViews(Connection con, String platform, @Nullable @Like String name,@Nullable @Like String authors,@Nullable @GtEq @Alias("createTime") String bt, @Nullable @Alias("createTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
744
    public abstract PageQueryResult<PpatentSum> queryPpatentViews1(Connection con, @Nullable @Like String name,@Nullable @Like String authors,@Nullable @GtEq @Alias("createTime") String bt, @Nullable @Alias("createTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
745
746
    public PageQueryResult<PpatentSum> queryPpatentViews(Connection con,String platform, String name,String authors,String bt,String et,int pageSize,int pageNo) throws SQLException{
747
        int _m_1 = 0;
748
        PageQueryResult<PpatentSum> _result = new PageQueryResult<PpatentSum>();
749
        int _m_3 = 1;
750
        boolean _m_2 = null == name;
751
        boolean _m_4 = null == authors;
752
        boolean _m_5 = null == bt;
753
        boolean _m_6 = null == et;
754
        StringBuilder sql = new StringBuilder();
755
        boolean _m_8 = true;
756
        if(!_m_2){
757
            _m_8 =  false;
758
            sql.append(" WHERE c.NAME LIKE ?");
759
        }
760
        if(!_m_4){
761
            if(_m_8){
762
                _m_8 =  false;
763
                sql.append(" WHERE c.AUTHORS LIKE ?");
764
            }else{
765
                sql.append(" AND c.AUTHORS LIKE ?");
766
            }
767
        }
768
        if(!_m_5){
769
            if(_m_8){
770
                _m_8 =  false;
771
                sql.append(" WHERE c.CREATE_TIME >= ?");
772
            }else{
773
                sql.append(" AND c.CREATE_TIME >= ?");
774
            }
775
        }
776
        if(!_m_6){
777
            if(_m_8){
778
                _m_8 =  false;
779
                sql.append(" WHERE c.CREATE_TIME <= ?");
780
            }else{
781
                sql.append(" AND c.CREATE_TIME <= ?");
782
            }
783
        }
784
        StringBuilder _m_7 = sql;
785
        sql = new StringBuilder();
786
        sql.append("SELECT COUNT(1) FROM ppatent c LEFT JOIN ppatent_day_sum cds on c.id = cds.id AND platform = ?");
787
        if(_m_7.length()>0){
788
            sql.append(_m_7);
789
        }
790
        PreparedStatement ps = con.prepareStatement(sql.toString());
791
        try{
792
            ps.setString(_m_3++,platform);
793
            if(!_m_2){
794
                ps.setString(_m_3++,name);
795
            }
796
            if(!_m_4){
797
                ps.setString(_m_3++,authors);
798
            }
799
            if(!_m_5){
800
                ps.setString(_m_3++,bt);
801
            }
802
            if(!_m_6){
803
                ps.setString(_m_3++,et);
804
            }
805
            _result.setPageSize(pageSize);
806
            ResultSet _pageRs = ps.executeQuery();
807
            try{
808
                _pageRs.next();
809
                _m_1 = _pageRs.getInt(1);
810
            }finally{
811
                try{_pageRs.close();}catch(Exception _m_9){}
812
            }
813
        }finally{
814
            try{ps.close();}catch(Exception _m_10){}
815
        }
816
        _result.setTotal(_m_1);
817
        if(0== _m_1){
818
            _result.setPageNo(1);
819
            _result.setData(Collections.<PpatentSum>emptyList());
820
            return _result;
821
        }
822
        _m_3 = 1;
823
        boolean _m_11 = (1 == pageNo);
824
        if(_m_11){
825
            _result.setPageNo(1);
826
            sql = new StringBuilder();
827
            sql.append("SELECT cds.platform,COALESCE(cds.sum,0) as sum,c.AUTHORS,c.SORT_NUM,c.ID,c.NAME,c.PAGE_VIEWS,c.CODE,c.REQ_CODE,c.REQ_PERSON,c.REQ_DAY,c.PUB_DAY,c.REF_PARAM,c.KEYWORDS,c.SHARE_ID,c.COOPERATION,c.CREATE_TIME FROM ppatent c LEFT JOIN ppatent_day_sum cds on c.id = cds.id AND platform = ?");
828
            if(_m_7.length()>0){
829
                sql.append(_m_7);
830
            }
831
            sql.append(" ORDER BY SUM DESC NULLS LAST");
832
            sql.append(" LIMIT ").append(pageSize);
833
        }else{
834
            int _m_12 = _m_1 / pageSize;
835
            if(_m_1 % pageSize != 0){
836
                ++_m_12;
837
            }
838
            if(pageNo > _m_12){
839
                pageNo = _m_12;
840
            }
841
            _result.setPageNo(pageNo);
842
            --pageNo;
843
            int _m_13 = (pageNo * pageSize);
844
            sql = new StringBuilder();
845
            sql.append("SELECT cds.platform,COALESCE(cds.sum,0) as sum,c.AUTHORS,c.SORT_NUM,c.ID,c.NAME,c.PAGE_VIEWS,c.CODE,c.REQ_CODE,c.REQ_PERSON,c.REQ_DAY,c.PUB_DAY,c.REF_PARAM,c.KEYWORDS,c.SHARE_ID,c.COOPERATION,c.CREATE_TIME FROM ppatent c LEFT JOIN ppatent_day_sum cds on c.id = cds.id AND platform = ?");
846
            if(_m_7.length()>0){
847
                sql.append(_m_7);
848
            }
849
            sql.append(" ORDER BY SUM DESC NULLS LAST");
850
            sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(_m_13);
851
        }
852
        ps = con.prepareStatement(sql.toString());
853
        try{
854
            ps.setString(_m_3++,platform);
855
            if(!_m_2){
856
                ps.setString(_m_3++,name);
857
            }
858
            if(!_m_4){
859
                ps.setString(_m_3++,authors);
860
            }
861
            if(!_m_5){
862
                ps.setString(_m_3++,bt);
863
            }
864
            if(!_m_6){
865
                ps.setString(_m_3++,et);
866
            }
867
            ResultSet rs = ps.executeQuery();
868
            try{
869
                List<PpatentSum> _m_14 = new ArrayList<PpatentSum>();
870
                _result.setData(_m_14);
871
                int _m_15 = 0;
872
                while((_m_15<pageSize) && rs.next()){
873
                    ++_m_15;
874
                    PpatentSum _obj =  new PpatentSum();
875
                    _obj.setPlatform(rs.getString(1));
876
                    _obj.setSum(rs.getInt(2));
877
                    _obj.setAuthors(rs.getString(3));
878
                    _obj.setSortNum(rs.getLong(4));
879
                    _obj.setId(rs.getString(5));
880
                    _obj.setName(rs.getString(6));
881
                    _obj.setPageViews(rs.getLong(7));
882
                    String _m_16 = rs.getString(8);
883
                    if(rs.wasNull()){
884
                        _m_16 = null;
885
                    }
886
                    _obj.setCode(_m_16);
887
                    String _m_17 = rs.getString(9);
888
                    if(rs.wasNull()){
889
                        _m_17 = null;
890
                    }
891
                    _obj.setReqCode(_m_17);
892
                    String _m_18 = rs.getString(10);
893
                    if(rs.wasNull()){
894
                        _m_18 = null;
895
                    }
896
                    _obj.setReqPerson(_m_18);
897
                    String _m_19 = rs.getString(11);
898
                    if(rs.wasNull()){
899
                        _m_19 = null;
900
                    }
901
                    _obj.setReqDay(_m_19);
902
                    String _m_20 = rs.getString(12);
903
                    if(rs.wasNull()){
904
                        _m_20 = null;
905
                    }
906
                    _obj.setPubDay(_m_20);
907
                    String _m_21 = rs.getString(13);
908
                    if(rs.wasNull()){
909
                        _m_21 = null;
910
                    }
911
                    _obj.setRef_param(_m_21);
912
                    String _m_22 = rs.getString(14);
913
                    if(rs.wasNull()){
914
                        _m_22 = null;
915
                    }
916
                    _obj.setKeywords(_m_22);
917
                    _obj.setShareId(rs.getLong(15));
918
                    String _m_23 = rs.getString(16);
919
                    if(rs.wasNull()){
920
                        _m_23 = null;
921
                    }
922
                    _obj.setCooperation(_m_23);
923
                    _obj.setCreateTime(rs.getString(17));
924
                    _m_14.add(_obj);
925
                }
926
                return _result;
927
            }finally{
928
                try{rs.close();}catch(Exception _m_24){}
929
            }
930
        }finally{
931
            try{ps.close();}catch(Exception _m_25){}
932
        }
933
    }
200 934
201 935
202 936
    @PageQuery
203 937
    @OrderBy(" ORDER BY c.publish_time DESC NULLS LAST")
204 938
    @Exclude("descp")
205
    public abstract PageQueryResult<ResourceSum> queryResourceTime(Connection con, String platform, @Nullable @Like String resourceName,@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {
939
    public abstract PageQueryResult<ResourceSum> queryResourceTime1(Connection con, @Nullable @Like String resourceName,@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {
206 940
            "RESOURCE_TYPE='1' AND PROFESSOR_ID IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)",
207 941
            "RESOURCE_TYPE ='2' AND ORG_ID IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)"},
208 942
            additional = 1, isAnd = false, force = true) String author, @Nullable @GtEq @Alias("publishTime") String bt, @Nullable @Alias("publishTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
209 943
944
    public PageQueryResult<ResourceSum> queryResourceTime(Connection con,String platform, String resourceName,String author,String bt,String et,int pageSize,int pageNo) throws SQLException{
945
        int _m_1 = 0;
946
        PageQueryResult<ResourceSum> _result = new PageQueryResult<ResourceSum>();
947
        int _m_3 = 1;
948
        boolean _m_2 = null == resourceName;
949
        boolean _m_4 = null == author;
950
        boolean _m_5 = null == bt;
951
        boolean _m_6 = null == et;
952
        StringBuilder sql = new StringBuilder();
953
        boolean _m_8 = true;
954
        if(!_m_2){
955
            _m_8 =  false;
956
            sql.append(" WHERE c.RESOURCE_NAME LIKE ?");
957
        }
958
        if(!_m_4){
959
            if(_m_8){
960
                _m_8 =  false;
961
                sql.append(" WHERE ((RESOURCE_TYPE='1' AND PROFESSOR_ID IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)) OR (RESOURCE_TYPE ='2' AND ORG_ID IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)))");
962
            }else{
963
                sql.append(" AND ((RESOURCE_TYPE='1' AND PROFESSOR_ID IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)) OR (RESOURCE_TYPE ='2' AND ORG_ID IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)))");
964
            }
965
        }
966
        if(!_m_5){
967
            if(_m_8){
968
                _m_8 =  false;
969
                sql.append(" WHERE c.PUBLISH_TIME >= ?");
970
            }else{
971
                sql.append(" AND c.PUBLISH_TIME >= ?");
972
            }
973
        }
974
        if(!_m_6){
975
            if(_m_8){
976
                _m_8 =  false;
977
                sql.append(" WHERE c.PUBLISH_TIME <= ?");
978
            }else{
979
                sql.append(" AND c.PUBLISH_TIME <= ?");
980
            }
981
        }
982
        StringBuilder _m_7 = sql;
983
        sql = new StringBuilder();
984
        sql.append("SELECT COUNT(1) FROM resource c LEFT JOIN resource_day_sum cds on c.resource_id = cds.id AND platform = ?");
985
        if(_m_7.length()>0){
986
            sql.append(_m_7);
987
        }
988
        PreparedStatement ps = con.prepareStatement(sql.toString());
989
        try{
990
            ps.setString(_m_3++,platform);
991
            if(!_m_2){
992
                ps.setString(_m_3++,resourceName);
993
            }
994
            if(!_m_4){
995
                ps.setString(_m_3++,author);
996
                ps.setString(_m_3++,author);
997
                ps.setString(_m_3++,author);
998
            }
999
            if(!_m_5){
1000
                ps.setString(_m_3++,bt);
1001
            }
1002
            if(!_m_6){
1003
                ps.setString(_m_3++,et);
1004
            }
1005
            _result.setPageSize(pageSize);
1006
            ResultSet _pageRs = ps.executeQuery();
1007
            try{
1008
                _pageRs.next();
1009
                _m_1 = _pageRs.getInt(1);
1010
            }finally{
1011
                try{_pageRs.close();}catch(Exception _m_9){}
1012
            }
1013
        }finally{
1014
            try{ps.close();}catch(Exception _m_10){}
1015
        }
1016
        _result.setTotal(_m_1);
1017
        if(0== _m_1){
1018
            _result.setPageNo(1);
1019
            _result.setData(Collections.<ResourceSum>emptyList());
1020
            return _result;
1021
        }
1022
        _m_3 = 1;
1023
        boolean _m_11 = (1 == pageNo);
1024
        if(_m_11){
1025
            _result.setPageNo(1);
1026
            sql = new StringBuilder();
1027
            sql.append("SELECT cds.platform,COALESCE(cds.sum,0) as sum,c.RESOURCE_ID,c.RESOURCE_NAME,c.SUBJECT,c.INDUSTRY,c.SUPPORTED_SERVICES,c.ORG_NAME,c.SPEC,c.PARAMETER,c.STATUS,c.PROFESSOR_ID,c.ASCRIPTION,c.HOPE_PAY_METHOD,c.COOPERATION_NOTES,c.PUBLISH_TIME,c.PAGE_VIEWS,c.COMP,c.RESOURCE_TYPE,c.ORG_ID,c.SHARE_ID,c.SORT_NUM,c.CREATE_TIME,c.MODIFY_TIME FROM resource c LEFT JOIN resource_day_sum cds on c.resource_id = cds.id AND platform = ?");
1028
            if(_m_7.length()>0){
1029
                sql.append(_m_7);
1030
            }
1031
            sql.append(" ORDER BY c.publish_time DESC NULLS LAST");
1032
            sql.append(" LIMIT ").append(pageSize);
1033
        }else{
1034
            int _m_12 = _m_1 / pageSize;
1035
            if(_m_1 % pageSize != 0){
1036
                ++_m_12;
1037
            }
1038
            if(pageNo > _m_12){
1039
                pageNo = _m_12;
1040
            }
1041
            _result.setPageNo(pageNo);
1042
            --pageNo;
1043
            int _m_13 = (pageNo * pageSize);
1044
            sql = new StringBuilder();
1045
            sql.append("SELECT cds.platform,COALESCE(cds.sum,0) as sum,c.RESOURCE_ID,c.RESOURCE_NAME,c.SUBJECT,c.INDUSTRY,c.SUPPORTED_SERVICES,c.ORG_NAME,c.SPEC,c.PARAMETER,c.STATUS,c.PROFESSOR_ID,c.ASCRIPTION,c.HOPE_PAY_METHOD,c.COOPERATION_NOTES,c.PUBLISH_TIME,c.PAGE_VIEWS,c.COMP,c.RESOURCE_TYPE,c.ORG_ID,c.SHARE_ID,c.SORT_NUM,c.CREATE_TIME,c.MODIFY_TIME FROM resource c LEFT JOIN resource_day_sum cds on c.resource_id = cds.id AND platform = ?");
1046
            if(_m_7.length()>0){
1047
                sql.append(_m_7);
1048
            }
1049
            sql.append(" ORDER BY c.publish_time DESC NULLS LAST");
1050
            sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(_m_13);
1051
        }
1052
        ps = con.prepareStatement(sql.toString());
1053
        try{
1054
            ps.setString(_m_3++,platform);
1055
            if(!_m_2){
1056
                ps.setString(_m_3++,resourceName);
1057
            }
1058
            if(!_m_4){
1059
                ps.setString(_m_3++,author);
1060
                ps.setString(_m_3++,author);
1061
                ps.setString(_m_3++,author);
1062
            }
1063
            if(!_m_5){
1064
                ps.setString(_m_3++,bt);
1065
            }
1066
            if(!_m_6){
1067
                ps.setString(_m_3++,et);
1068
            }
1069
            ResultSet rs = ps.executeQuery();
1070
            try{
1071
                List<ResourceSum> _m_14 = new ArrayList<ResourceSum>();
1072
                _result.setData(_m_14);
1073
                int _m_15 = 0;
1074
                while((_m_15<pageSize) && rs.next()){
1075
                    ++_m_15;
1076
                    ResourceSum _obj =  new ResourceSum();
1077
                    _obj.setPlatform(rs.getString(1));
1078
                    _obj.setSum(rs.getInt(2));
1079
                    _obj.setResourceId(rs.getString(3));
1080
                    _obj.setResourceName(rs.getString(4));
1081
                    String _m_16 = rs.getString(5);
1082
                    if(rs.wasNull()){
1083
                        _m_16 = null;
1084
                    }
1085
                    _obj.setSubject(_m_16);
1086
                    String _m_17 = rs.getString(6);
1087
                    if(rs.wasNull()){
1088
                        _m_17 = null;
1089
                    }
1090
                    _obj.setIndustry(_m_17);
1091
                    _obj.setSupportedServices(rs.getString(7));
1092
                    String _m_18 = rs.getString(8);
1093
                    if(rs.wasNull()){
1094
                        _m_18 = null;
1095
                    }
1096
                    _obj.setOrgName(_m_18);
1097
                    String _m_19 = rs.getString(9);
1098
                    if(rs.wasNull()){
1099
                        _m_19 = null;
1100
                    }
1101
                    _obj.setSpec(_m_19);
1102
                    String _m_20 = rs.getString(10);
1103
                    if(rs.wasNull()){
1104
                        _m_20 = null;
1105
                    }
1106
                    _obj.setParameter(_m_20);
1107
                    String _m_21 = rs.getString(11);
1108
                    if(rs.wasNull()){
1109
                        _m_21 = null;
1110
                    }
1111
                    _obj.setStatus(_m_21);
1112
                    String _m_22 = rs.getString(12);
1113
                    if(rs.wasNull()){
1114
                        _m_22 = null;
1115
                    }
1116
                    _obj.setProfessorId(_m_22);
1117
                    String _m_23 = rs.getString(13);
1118
                    if(rs.wasNull()){
1119
                        _m_23 = null;
1120
                    }
1121
                    _obj.setAscription(_m_23);
1122
                    String _m_24 = rs.getString(14);
1123
                    if(rs.wasNull()){
1124
                        _m_24 = null;
1125
                    }
1126
                    _obj.setHopePayMethod(_m_24);
1127
                    String _m_25 = rs.getString(15);
1128
                    if(rs.wasNull()){
1129
                        _m_25 = null;
1130
                    }
1131
                    _obj.setCooperationNotes(_m_25);
1132
                    String _m_26 = rs.getString(16);
1133
                    if(rs.wasNull()){
1134
                        _m_26 = null;
1135
                    }
1136
                    _obj.setPublishTime(_m_26);
1137
                    _obj.setPageViews(rs.getInt(17));
1138
                    String _m_27 = rs.getString(18);
1139
                    if(rs.wasNull()){
1140
                        _m_27 = null;
1141
                    }
1142
                    _obj.setComp(_m_27);
1143
                    String _m_28 = rs.getString(19);
1144
                    if(rs.wasNull()){
1145
                        _m_28 = null;
1146
                    }
1147
                    _obj.setResourceType(_m_28);
1148
                    String _m_29 = rs.getString(20);
1149
                    if(rs.wasNull()){
1150
                        _m_29 = null;
1151
                    }
1152
                    _obj.setOrgId(_m_29);
1153
                    _obj.setShareId(rs.getLong(21));
1154
                    _obj.setSortNum(rs.getLong(22));
1155
                    _obj.setCreateTime(rs.getString(23));
1156
                    _obj.setModifyTime(rs.getString(24));
1157
                    _m_14.add(_obj);
1158
                }
1159
                return _result;
1160
            }finally{
1161
                try{rs.close();}catch(Exception _m_30){}
1162
            }
1163
        }finally{
1164
            try{ps.close();}catch(Exception _m_31){}
1165
        }
1166
    }
1167
210 1168
    @PageQuery
211 1169
    @OrderBy(" ORDER BY sum DESC")
212 1170
    @Exclude("descp")
213
    public abstract PageQueryResult<ResourceSum> queryResourceViews(Connection con, String platform, @Nullable @Like String resourceName,@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {
1171
    public abstract PageQueryResult<ResourceSum> queryResourceViews1(Connection con, @Nullable @Like String resourceName,@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {
214 1172
            "RESOURCE_TYPE='1' AND PROFESSOR_ID IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)",
215 1173
            "RESOURCE_TYPE ='2' AND ORG_ID IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)"},
216 1174
            additional = 1, isAnd = false, force = true) String author, @Nullable @GtEq @Alias("publishTime") String bt, @Nullable @Alias("publishTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
217 1175
1176
    public PageQueryResult<ResourceSum> queryResourceViews(Connection con,String platform, String resourceName,String author,String bt,String et,int pageSize,int pageNo) throws SQLException{
1177
        int _m_1 = 0;
1178
        PageQueryResult<ResourceSum> _result = new PageQueryResult<ResourceSum>();
1179
        int _m_3 = 1;
1180
        boolean _m_2 = null == resourceName;
1181
        boolean _m_4 = null == author;
1182
        boolean _m_5 = null == bt;
1183
        boolean _m_6 = null == et;
1184
        StringBuilder sql = new StringBuilder();
1185
        boolean _m_8 = true;
1186
        if(!_m_2){
1187
            _m_8 =  false;
1188
            sql.append(" WHERE c.RESOURCE_NAME LIKE ?");
1189
        }
1190
        if(!_m_4){
1191
            if(_m_8){
1192
                _m_8 =  false;
1193
                sql.append(" WHERE ((RESOURCE_TYPE='1' AND PROFESSOR_ID IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)) OR (RESOURCE_TYPE ='2' AND ORG_ID IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)))");
1194
            }else{
1195
                sql.append(" AND ((RESOURCE_TYPE='1' AND PROFESSOR_ID IN(SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)) OR (RESOURCE_TYPE ='2' AND ORG_ID IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)))");
1196
            }
1197
        }
1198
        if(!_m_5){
1199
            if(_m_8){
1200
                _m_8 =  false;
1201
                sql.append(" WHERE c.PUBLISH_TIME >= ?");
1202
            }else{
1203
                sql.append(" AND c.PUBLISH_TIME >= ?");
1204
            }
1205
        }
1206
        if(!_m_6){
1207
            if(_m_8){
1208
                _m_8 =  false;
1209
                sql.append(" WHERE c.PUBLISH_TIME <= ?");
1210
            }else{
1211
                sql.append(" AND c.PUBLISH_TIME <= ?");
1212
            }
1213
        }
1214
        StringBuilder _m_7 = sql;
1215
        sql = new StringBuilder();
1216
        sql.append("SELECT COUNT(1) FROM resource c LEFT JOIN resource_day_sum cds on c.resource_id = cds.id AND platform = ?");
1217
        if(_m_7.length()>0){
1218
            sql.append(_m_7);
1219
        }
1220
        PreparedStatement ps = con.prepareStatement(sql.toString());
1221
        try{
1222
            ps.setString(_m_3++,platform);
1223
            if(!_m_2){
1224
                ps.setString(_m_3++,resourceName);
1225
            }
1226
            if(!_m_4){
1227
                ps.setString(_m_3++,author);
1228
                ps.setString(_m_3++,author);
1229
                ps.setString(_m_3++,author);
1230
            }
1231
            if(!_m_5){
1232
                ps.setString(_m_3++,bt);
1233
            }
1234
            if(!_m_6){
1235
                ps.setString(_m_3++,et);
1236
            }
1237
            _result.setPageSize(pageSize);
1238
            ResultSet _pageRs = ps.executeQuery();
1239
            try{
1240
                _pageRs.next();
1241
                _m_1 = _pageRs.getInt(1);
1242
            }finally{
1243
                try{_pageRs.close();}catch(Exception _m_9){}
1244
            }
1245
        }finally{
1246
            try{ps.close();}catch(Exception _m_10){}
1247
        }
1248
        _result.setTotal(_m_1);
1249
        if(0== _m_1){
1250
            _result.setPageNo(1);
1251
            _result.setData(Collections.<ResourceSum>emptyList());
1252
            return _result;
1253
        }
1254
        _m_3 = 1;
1255
        boolean _m_11 = (1 == pageNo);
1256
        if(_m_11){
1257
            _result.setPageNo(1);
1258
            sql = new StringBuilder();
1259
            sql.append("SELECT cds.platform,COALESCE(cds.sum,0) as sum,c.RESOURCE_ID,c.RESOURCE_NAME,c.SUBJECT,c.INDUSTRY,c.SUPPORTED_SERVICES,c.ORG_NAME,c.SPEC,c.PARAMETER,c.STATUS,c.PROFESSOR_ID,c.ASCRIPTION,c.HOPE_PAY_METHOD,c.COOPERATION_NOTES,c.PUBLISH_TIME,c.PAGE_VIEWS,c.COMP,c.RESOURCE_TYPE,c.ORG_ID,c.SHARE_ID,c.SORT_NUM,c.CREATE_TIME,c.MODIFY_TIME FROM resource c LEFT JOIN resource_day_sum cds on c.resource_id = cds.id AND platform = ?");
1260
            if(_m_7.length()>0){
1261
                sql.append(_m_7);
1262
            }
1263
            sql.append(" ORDER BY sum DESC");
1264
            sql.append(" LIMIT ").append(pageSize);
1265
        }else{
1266
            int _m_12 = _m_1 / pageSize;
1267
            if(_m_1 % pageSize != 0){
1268
                ++_m_12;
1269
            }
1270
            if(pageNo > _m_12){
1271
                pageNo = _m_12;
1272
            }
1273
            _result.setPageNo(pageNo);
1274
            --pageNo;
1275
            int _m_13 = (pageNo * pageSize);
1276
            sql = new StringBuilder();
1277
            sql.append("SELECT cds.platform,COALESCE(cds.sum,0) as sum,c.RESOURCE_ID,c.RESOURCE_NAME,c.SUBJECT,c.INDUSTRY,c.SUPPORTED_SERVICES,c.ORG_NAME,c.SPEC,c.PARAMETER,c.STATUS,c.PROFESSOR_ID,c.ASCRIPTION,c.HOPE_PAY_METHOD,c.COOPERATION_NOTES,c.PUBLISH_TIME,c.PAGE_VIEWS,c.COMP,c.RESOURCE_TYPE,c.ORG_ID,c.SHARE_ID,c.SORT_NUM,c.CREATE_TIME,c.MODIFY_TIME FROM resource c LEFT JOIN resource_day_sum cds on c.resource_id = cds.id AND platform = ?");
1278
            if(_m_7.length()>0){
1279
                sql.append(_m_7);
1280
            }
1281
            sql.append(" ORDER BY sum DESC");
1282
            sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(_m_13);
1283
        }
1284
        ps = con.prepareStatement(sql.toString());
1285
        try{
1286
            ps.setString(_m_3++,platform);
1287
            if(!_m_2){
1288
                ps.setString(_m_3++,resourceName);
1289
            }
1290
            if(!_m_4){
1291
                ps.setString(_m_3++,author);
1292
                ps.setString(_m_3++,author);
1293
                ps.setString(_m_3++,author);
1294
            }
1295
            if(!_m_5){
1296
                ps.setString(_m_3++,bt);
1297
            }
1298
            if(!_m_6){
1299
                ps.setString(_m_3++,et);
1300
            }
1301
            ResultSet rs = ps.executeQuery();
1302
            try{
1303
                List<ResourceSum> _m_14 = new ArrayList<ResourceSum>();
1304
                _result.setData(_m_14);
1305
                int _m_15 = 0;
1306
                while((_m_15<pageSize) && rs.next()){
1307
                    ++_m_15;
1308
                    ResourceSum _obj =  new ResourceSum();
1309
                    _obj.setPlatform(rs.getString(1));
1310
                    _obj.setSum(rs.getInt(2));
1311
                    _obj.setResourceId(rs.getString(3));
1312
                    _obj.setResourceName(rs.getString(4));
1313
                    String _m_16 = rs.getString(5);
1314
                    if(rs.wasNull()){
1315
                        _m_16 = null;
1316
                    }
1317
                    _obj.setSubject(_m_16);
1318
                    String _m_17 = rs.getString(6);
1319
                    if(rs.wasNull()){
1320
                        _m_17 = null;
1321
                    }
1322
                    _obj.setIndustry(_m_17);
1323
                    _obj.setSupportedServices(rs.getString(7));
1324
                    String _m_18 = rs.getString(8);
1325
                    if(rs.wasNull()){
1326
                        _m_18 = null;
1327
                    }
1328
                    _obj.setOrgName(_m_18);
1329
                    String _m_19 = rs.getString(9);
1330
                    if(rs.wasNull()){
1331
                        _m_19 = null;
1332
                    }
1333
                    _obj.setSpec(_m_19);
1334
                    String _m_20 = rs.getString(10);
1335
                    if(rs.wasNull()){
1336
                        _m_20 = null;
1337
                    }
1338
                    _obj.setParameter(_m_20);
1339
                    String _m_21 = rs.getString(11);
1340
                    if(rs.wasNull()){
1341
                        _m_21 = null;
1342
                    }
1343
                    _obj.setStatus(_m_21);
1344
                    String _m_22 = rs.getString(12);
1345
                    if(rs.wasNull()){
1346
                        _m_22 = null;
1347
                    }
1348
                    _obj.setProfessorId(_m_22);
1349
                    String _m_23 = rs.getString(13);
1350
                    if(rs.wasNull()){
1351
                        _m_23 = null;
1352
                    }
1353
                    _obj.setAscription(_m_23);
1354
                    String _m_24 = rs.getString(14);
1355
                    if(rs.wasNull()){
1356
                        _m_24 = null;
1357
                    }
1358
                    _obj.setHopePayMethod(_m_24);
1359
                    String _m_25 = rs.getString(15);
1360
                    if(rs.wasNull()){
1361
                        _m_25 = null;
1362
                    }
1363
                    _obj.setCooperationNotes(_m_25);
1364
                    String _m_26 = rs.getString(16);
1365
                    if(rs.wasNull()){
1366
                        _m_26 = null;
1367
                    }
1368
                    _obj.setPublishTime(_m_26);
1369
                    _obj.setPageViews(rs.getInt(17));
1370
                    String _m_27 = rs.getString(18);
1371
                    if(rs.wasNull()){
1372
                        _m_27 = null;
1373
                    }
1374
                    _obj.setComp(_m_27);
1375
                    String _m_28 = rs.getString(19);
1376
                    if(rs.wasNull()){
1377
                        _m_28 = null;
1378
                    }
1379
                    _obj.setResourceType(_m_28);
1380
                    String _m_29 = rs.getString(20);
1381
                    if(rs.wasNull()){
1382
                        _m_29 = null;
1383
                    }
1384
                    _obj.setOrgId(_m_29);
1385
                    _obj.setShareId(rs.getLong(21));
1386
                    _obj.setSortNum(rs.getLong(22));
1387
                    _obj.setCreateTime(rs.getString(23));
1388
                    _obj.setModifyTime(rs.getString(24));
1389
                    _m_14.add(_obj);
1390
                }
1391
                return _result;
1392
            }finally{
1393
                try{rs.close();}catch(Exception _m_30){}
1394
            }
1395
        }finally{
1396
            try{ps.close();}catch(Exception _m_31){}
1397
        }
1398
    }
1399
218 1400
219 1401
}