13693261870
2024-09-02 7d1535b74b9c27411bc45b695675b335c30f3c3a
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
package com.wgcloud.service;
 
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wgcloud.entity.DbTable;
import com.wgcloud.mapper.DbTableMapper;
import com.wgcloud.util.DateUtil;
import com.wgcloud.util.UUIDUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.List;
import java.util.Map;
 
/**
 * @version v2.3
 * @ClassName:DbTableService.java
 * @author: http://www.wgstart.com
 * @date: 2019年11月16日
 * @Description: DbTableService.java
 * @Copyright: 2017-2024 wgcloud. All rights reserved.
 */
@Service
public class DbTableService {
 
    public PageInfo selectByParams(Map<String, Object> params, int currPage, int pageSize) throws Exception {
        PageHelper.startPage(currPage, pageSize);
        List<DbTable> list = dbTableMapper.selectByParams(params);
        PageInfo<DbTable> pageInfo = new PageInfo<DbTable>(list);
        return pageInfo;
    }
 
    public void save(DbTable DbTable) throws Exception {
        DbTable.setId(UUIDUtil.getUUID());
        DbTable.setCreateTime(DateUtil.getNowTime());
        dbTableMapper.save(DbTable);
    }
 
    public int countByParams(Map<String, Object> params) throws Exception {
        return dbTableMapper.countByParams(params);
    }
 
    public Long sumByParams(Map<String, Object> params) throws Exception {
        return dbTableMapper.sumByParams(params);
    }
 
    @Transactional
    public int deleteById(String[] id) throws Exception {
        return dbTableMapper.deleteById(id);
    }
 
    @Transactional
    public int deleteByDbInfoId(String dbInfoId) throws Exception {
        if (StringUtils.isEmpty(dbInfoId)) {
            return 0;
        }
        return dbTableMapper.deleteByDbInfoId(dbInfoId);
    }
 
    public void updateById(DbTable DbTable)
            throws Exception {
        dbTableMapper.updateById(DbTable);
    }
 
    @Transactional
    public void updateRecord(List<DbTable> recordList) throws Exception {
        if (recordList.size() < 1) {
            return;
        }
        dbTableMapper.updateList(recordList);
    }
 
    public DbTable selectById(String id) throws Exception {
        return dbTableMapper.selectById(id);
    }
 
    public List<DbTable> selectAllByParams(Map<String, Object> params) throws Exception {
        return dbTableMapper.selectAllByParams(params);
    }
 
 
    @Autowired
    private DbTableMapper dbTableMapper;
 
 
}