suerprisePlus
2024-09-23 e7c3276f2f5091fe8626af61ba5d7b41b2a1f2df
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
package com.yb.service.impl;
 
import org.springframework.stereotype.Service;
 
import java.util.HashMap;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yb.config.PageUtils;
import com.yb.config.R;
import com.yb.config.Query;
 
import com.yb.dao.THistoryDao;
import com.yb.entity.THistoryEntity;
import com.yb.service.THistoryService;
 
 
@Service("tHistoryService")
public class THistoryServiceImpl extends ServiceImpl<THistoryDao, THistoryEntity> implements THistoryService {
 
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<THistoryEntity> page = this.page(
                new Query<THistoryEntity>().getPage(params),
                new QueryWrapper<THistoryEntity>()
        );
 
        return new PageUtils(page);
    }
    @Override
    public PageUtils query(Map<String, Object> params) {
        Map<String,Object> p = new HashMap<>();
        QueryWrapper q = new QueryWrapper<THistoryEntity>();
        for(String key:params.keySet()){
 
            String value = params.get(key).toString();
            if( key.equals("page") || key.equals("limit")) {
                p.put(key,value);
                continue;
            }
            if( key.indexOf("name") > -1 )
                q.like(key,value);
            else
                q.eq(key,value);
            System.out.println("key:"+key+" vlaue:"+value);
        }
        IPage<THistoryEntity> page = this.page(
                new Query<THistoryEntity>().getPage(p),
               q
        );
 
        return new PageUtils(page);
    }
}