BootTestServiceImpl.java
2.24 KB
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
package com.cnlive.shenhe.serviceImpl;
import com.google.common.collect.Lists;
import com.cnlive.shenhe.entity.BootTest;
import com.cnlive.shenhe.mapper.BootTestMapper;
import com.cnlive.shenhe.utils.CommonUtils;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author: yanzhaowang
* @Date: 2022/3/4 13:38
*/
@Service
public class BootTestServiceImpl {
@Autowired
BootTestMapper bootTestMapper;
/**
*根据主键查询对象
* @param boottestid
* @return
*/
public BootTest selectByid(String boottestid) {
if (CommonUtils.isEmpty(boottestid)) {
return null;
}
BootTest bootTest = bootTestMapper.selectByPrimaryKey(boottestid);
return bootTest;
}
/**
* 查询所有的数据
* @return
*/
public List<BootTest> selectAll(int pagesaiz, int pagenum){
// PageInfo pageInfo = new PageInfo();
// pageInfo.setSize(pagesaiz);
// pageInfo.setPageNum(pagenum);
// PageHelper pageHelper = new PageHelper();
List<BootTest> bootTestList = bootTestMapper.selectAll();
// pageInfo.setList(bootTestList);
return bootTestList;
}
/**
* 添加一个对象
* @param bootTest
* @return
*/
public int addBootTest(BootTest bootTest) {
Integer age = bootTest.getAge();
if (age >= 18 && age <= 60) {
int i = bootTestMapper.insertSelective(bootTest);
return i;
}
return 0;
}
/**
* 根据主键删除一个对象
* @param boottestid
* @return
*/
public int deleteBootTest(String boottestid){
if (boottestid == null) {
return 0;
}
int i = bootTestMapper.deleteByPrimaryKey(boottestid);
return i;
}
/**
* 根据条件修改对象
* @return
*/
public int updateBootTest(BootTest bootTest){
if (bootTest != null) {
int i = bootTestMapper.updateByPrimaryKeySelective(bootTest);
return i;
}
return 0;
}
}