LoginCabinetService.java
1.64 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
package cn.csbr.app.auth;
import cn.csbr.app.config.FxConfigure;
import cn.csbr.springboot.dao.mapper.CabinetMapper;
import cn.csbr.springboot.dao.model.Cabinet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
/**
* 封装 耗材柜查找 。开柜门 以及扫描刷卡信息等操作
* 这个类用于登录前使用和后边的业务类分开
*/
@Service
public class LoginCabinetService {
@Autowired
private CabinetMapper cabinetMapper;
@Autowired
private FxConfigure fxConfigure;
private List<Cabinet> arrayList;
/**
* 有个固定条件就这个柜子的柜子组
* 查询全部一个柜子组下所有的柜子
*
* @return
*/
public List<Cabinet> queryAllCabinet() {
if (arrayList == null) {
Cabinet cabinet = new Cabinet();
cabinet.setGroupcode(fxConfigure.getCabinetGroupCode());
arrayList = this.queryCabinetByCondition(cabinet);
}
return arrayList;
}
/**
* 有个固定条件就这个柜子的柜子组
*
* @param cabinet
* @return
*/
public List<Cabinet> queryCabinetByCondition(Cabinet cabinet) {
if (cabinet.getGroupcode() == null) {
cabinet.setGroupcode(fxConfigure.getCabinetGroupCode());
}
Example condition = new Example(Cabinet.class);
condition.createCriteria().andEqualTo("cabinetcode", cabinet.getCabinetcode()).andEqualTo("groupcode", cabinet.getGroupcode());
return cabinetMapper.selectByExample(condition);
}
}