提交 | 用户 | 时间
|
200ade
|
1 |
package com.iailab.module.model.mpk.service.impl; |
D |
2 |
|
|
3 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
4 |
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
5 |
import com.iailab.framework.common.page.PageData; |
|
6 |
import com.iailab.framework.common.service.impl.BaseServiceImpl; |
|
7 |
import com.iailab.module.model.mpk.dao.ChartParamDao; |
|
8 |
import com.iailab.module.model.mpk.dto.ChartParamDTO; |
|
9 |
import com.iailab.module.model.mpk.entity.ChartEntity; |
|
10 |
import com.iailab.module.model.mpk.entity.ChartParamEntity; |
|
11 |
import com.iailab.module.model.mpk.service.ChartParamService; |
|
12 |
import lombok.extern.slf4j.Slf4j; |
|
13 |
import org.apache.commons.lang3.StringUtils; |
|
14 |
import org.springframework.beans.factory.annotation.Autowired; |
|
15 |
import org.springframework.stereotype.Service; |
|
16 |
|
|
17 |
import java.util.Date; |
|
18 |
import java.util.Map; |
|
19 |
import java.util.UUID; |
|
20 |
|
|
21 |
/** |
|
22 |
* @description: |
|
23 |
* @author: dzd |
|
24 |
* @date: 2024/11/5 11:21 |
|
25 |
**/ |
|
26 |
@Slf4j |
|
27 |
@Service |
|
28 |
public class ChartParamServiceImpl extends BaseServiceImpl<ChartParamDao, ChartParamEntity> implements ChartParamService { |
|
29 |
|
|
30 |
@Override |
|
31 |
public PageData<ChartParamDTO> page(Map<String, Object> params) { |
|
32 |
IPage<ChartParamEntity> page = baseDao.selectPage( |
|
33 |
getPage(params, "create_time", false), |
|
34 |
getWrapper(params) |
|
35 |
); |
|
36 |
|
|
37 |
return getPageData(page, ChartParamDTO.class); |
|
38 |
} |
|
39 |
|
|
40 |
@Override |
|
41 |
public void create(ChartParamEntity entity) { |
|
42 |
entity.setId(UUID.randomUUID().toString()); |
|
43 |
entity.setCreateTime(new Date()); |
|
44 |
baseDao.insert(entity); |
|
45 |
} |
|
46 |
|
|
47 |
@Override |
|
48 |
public void update(ChartParamEntity entity) { |
|
49 |
entity.setUpdateTime(new Date()); |
|
50 |
baseDao.updateById(entity); |
|
51 |
} |
|
52 |
|
|
53 |
@Override |
|
54 |
public ChartParamEntity get(String id) { |
|
55 |
return baseDao.selectById(id); |
|
56 |
} |
|
57 |
|
|
58 |
@Override |
|
59 |
public void delete(String id) { |
|
60 |
baseDao.deleteById(id); |
|
61 |
} |
|
62 |
|
|
63 |
private QueryWrapper<ChartParamEntity> getWrapper(Map<String, Object> params) { |
|
64 |
String paramName = (String) params.get("paramName"); |
|
65 |
String paramCode = (String) params.get("paramCode"); |
|
66 |
String chartId = (String) params.get("chartId"); |
|
67 |
|
|
68 |
QueryWrapper<ChartParamEntity> wrapper = new QueryWrapper<>(); |
|
69 |
wrapper.like(StringUtils.isNotBlank(paramName), "param_name", paramName) |
|
70 |
.like(StringUtils.isNotBlank(paramCode), "param_code", paramCode) |
|
71 |
.eq(StringUtils.isNotBlank(chartId), "chart_id", chartId); |
|
72 |
return wrapper; |
|
73 |
} |
|
74 |
} |