提交 | 用户 | 时间
|
7fd198
|
1 |
package com.iailab.module.model.mcs.pre.service.impl; |
潘 |
2 |
|
|
3 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
5c6007
|
4 |
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
7fd198
|
5 |
import com.iailab.framework.common.pojo.PageResult; |
潘 |
6 |
import com.iailab.module.model.mcs.pre.dao.DmModuleDao; |
|
7 |
import com.iailab.module.model.mcs.pre.entity.DmModuleEntity; |
|
8 |
import com.iailab.module.model.mcs.pre.service.DmModuleService; |
|
9 |
import com.iailab.module.model.mcs.pre.vo.DmModulePageReqVO; |
|
10 |
import org.apache.commons.lang3.StringUtils; |
5c6007
|
11 |
import org.springframework.beans.factory.annotation.Autowired; |
7fd198
|
12 |
import org.springframework.stereotype.Service; |
潘 |
13 |
|
|
14 |
import java.util.*; |
|
15 |
|
|
16 |
/** |
|
17 |
* @author PanZhibao |
|
18 |
* @date 2021年04月23日 8:36 |
|
19 |
*/ |
5c6007
|
20 |
@Service |
L |
21 |
public class DmModuleServiceImpl extends ServiceImpl<DmModuleDao, DmModuleEntity> implements DmModuleService { |
|
22 |
|
|
23 |
@Autowired |
|
24 |
private DmModuleDao dmModuleDao; |
7fd198
|
25 |
|
潘 |
26 |
@Override |
|
27 |
public PageResult<DmModuleEntity> queryPage(DmModulePageReqVO reqVO) { |
5c6007
|
28 |
return dmModuleDao.selectPage(reqVO); |
7fd198
|
29 |
} |
潘 |
30 |
|
|
31 |
@Override |
|
32 |
public List<DmModuleEntity> list(Map<String, Object> params) { |
|
33 |
QueryWrapper<DmModuleEntity> wrapper = getWrapper(params); |
905742
|
34 |
wrapper.orderByDesc("create_time"); |
5c6007
|
35 |
return dmModuleDao.selectList(wrapper); |
7fd198
|
36 |
} |
潘 |
37 |
|
bbc1ee
|
38 |
@Override |
5c6007
|
39 |
public DmModuleEntity info(String id) { |
L |
40 |
return dmModuleDao.selectById(id); |
bbc1ee
|
41 |
} |
潘 |
42 |
|
7fd198
|
43 |
private QueryWrapper<DmModuleEntity> getWrapper(Map<String, Object> params) { |
潘 |
44 |
String modulename = (String) params.get("modulename"); |
|
45 |
String moduletype = (String) params.get("moduletype"); |
|
46 |
|
|
47 |
QueryWrapper<DmModuleEntity> wrapper = new QueryWrapper<>(); |
|
48 |
wrapper.like(StringUtils.isNotBlank(modulename), "modulename", modulename) |
|
49 |
.eq(StringUtils.isNotBlank(moduletype), "moduletype", moduletype); |
|
50 |
|
|
51 |
return wrapper; |
|
52 |
} |
|
53 |
|
|
54 |
@Override |
905742
|
55 |
public void saveModule(DmModuleEntity entity) { |
潘 |
56 |
entity.setId(UUID.randomUUID().toString()); |
|
57 |
entity.setCreateTime(new Date()); |
|
58 |
entity.setUpdateTime(new Date()); |
|
59 |
dmModuleDao.insert(entity); |
7fd198
|
60 |
} |
潘 |
61 |
|
|
62 |
@Override |
905742
|
63 |
public void update(DmModuleEntity entity) { |
潘 |
64 |
entity.setUpdateTime(new Date()); |
|
65 |
dmModuleDao.updateById(entity); |
7fd198
|
66 |
} |
潘 |
67 |
|
|
68 |
@Override |
|
69 |
public void deleteBatch(String[] moduleIds) { |
5c6007
|
70 |
dmModuleDao.deleteBatchIds(Arrays.asList(moduleIds)); |
7fd198
|
71 |
} |
潘 |
72 |
|
|
73 |
@Override |
|
74 |
public List<DmModuleEntity> getModuleByModuleType(String moduletype) { |
|
75 |
Map<String, Object> params = new HashMap<>(1); |
|
76 |
params.put("moduletype", moduletype); |
|
77 |
QueryWrapper<DmModuleEntity> wrapper = getWrapper(params); |
5c6007
|
78 |
return dmModuleDao.selectList(wrapper); |
7fd198
|
79 |
|
潘 |
80 |
} |
|
81 |
|
|
82 |
@Override |
|
83 |
public int check(DmModuleEntity module) { |
|
84 |
String id = module.getId(); |
|
85 |
String modulename = module.getModulename(); |
|
86 |
QueryWrapper<DmModuleEntity> moduleWrapper = new QueryWrapper<>(); |
|
87 |
moduleWrapper.ne(StringUtils.isNotBlank(id), "id", id); |
|
88 |
moduleWrapper.and(wrapper -> wrapper.eq("modulename", modulename)); |
|
89 |
|
5c6007
|
90 |
List<DmModuleEntity> list = dmModuleDao.selectList(moduleWrapper); |
7fd198
|
91 |
return list.size(); |
潘 |
92 |
} |
|
93 |
|
|
94 |
} |