提交 | 用户 | 时间
|
7e21bc
|
1 |
package com.iailab.module.pms.coalquality.modules.detection.service.impl; |
J |
2 |
|
|
3 |
|
|
4 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
5 |
import com.iailab.framework.common.service.impl.BaseServiceImpl; |
|
6 |
import com.iailab.framework.common.util.object.ConvertUtils; |
|
7 |
import com.iailab.module.pms.coalquality.modules.detection.dao.QualityQuickItemDao; |
|
8 |
import com.iailab.module.pms.coalquality.modules.detection.dto.QualityQuickItemDTO; |
|
9 |
import com.iailab.module.pms.coalquality.modules.detection.entity.QualityQuickItemEntity; |
|
10 |
import com.iailab.module.pms.coalquality.modules.detection.service.QualityQuickItemService; |
|
11 |
import lombok.extern.slf4j.Slf4j; |
|
12 |
import org.apache.commons.lang3.StringUtils; |
|
13 |
import org.springframework.stereotype.Service; |
|
14 |
import org.springframework.transaction.annotation.Transactional; |
|
15 |
|
|
16 |
import java.util.Arrays; |
|
17 |
import java.util.List; |
|
18 |
import java.util.Map; |
|
19 |
|
|
20 |
/** |
|
21 |
* @author DongYukun |
|
22 |
* @Description |
|
23 |
* @createTime 2023年12月27日 9:53:00 |
|
24 |
*/ |
|
25 |
@Slf4j |
|
26 |
@Service |
|
27 |
public class QualityQuickItemServiceImpl extends BaseServiceImpl<QualityQuickItemDao, QualityQuickItemEntity> |
|
28 |
implements QualityQuickItemService { |
|
29 |
|
|
30 |
@Override |
|
31 |
public QualityQuickItemDTO get(String id) { |
|
32 |
QualityQuickItemEntity entity = baseDao.selectById(id); |
|
33 |
|
|
34 |
return ConvertUtils.sourceToTarget(entity, QualityQuickItemDTO.class); |
|
35 |
} |
|
36 |
|
|
37 |
@Override |
|
38 |
public void save(QualityQuickItemDTO dto) { |
|
39 |
QualityQuickItemEntity entity = ConvertUtils.sourceToTarget(dto, QualityQuickItemEntity.class); |
|
40 |
insert(entity); |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
public void update(QualityQuickItemDTO dto) { |
|
45 |
QualityQuickItemEntity entity = ConvertUtils.sourceToTarget(dto, QualityQuickItemEntity.class); |
|
46 |
|
|
47 |
updateById(entity); |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
@Transactional(rollbackFor = Exception.class) |
|
52 |
public void delete(String[] ids) { |
|
53 |
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public List<QualityQuickItemDTO> queryList(Map<String, Object> params) { |
|
58 |
List<QualityQuickItemEntity> list = baseDao.selectList(getWrapper(params)); |
|
59 |
|
|
60 |
return ConvertUtils.sourceToTarget(list, QualityQuickItemDTO.class); |
|
61 |
} |
|
62 |
|
|
63 |
@Override |
|
64 |
public void deleteByLsh(String lsh) { |
|
65 |
baseDao.deleteByLsh(lsh); |
|
66 |
} |
|
67 |
|
|
68 |
private QueryWrapper<QualityQuickItemEntity> getWrapper(Map<String, Object> params) { |
|
69 |
String lsh = (String) params.get("lsh"); |
|
70 |
|
|
71 |
QueryWrapper<QualityQuickItemEntity> wrapper = new QueryWrapper<>(); |
|
72 |
wrapper.eq(StringUtils.isNotBlank(lsh), "lsh", lsh).orderByAsc("lsh"); |
|
73 |
|
|
74 |
return wrapper; |
|
75 |
} |
|
76 |
|
|
77 |
} |