提交 | 用户 | 时间
|
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.pojo.PageResult; |
|
6 |
import com.iailab.framework.common.service.impl.BaseServiceImpl; |
|
7 |
import com.iailab.framework.common.util.object.BeanUtils; |
|
8 |
import com.iailab.framework.common.util.object.ConvertUtils; |
|
9 |
import com.iailab.module.pms.coalquality.modules.detection.dao.QualityMediumDao; |
|
10 |
import com.iailab.module.pms.coalquality.modules.detection.dto.QualityMediumDTO; |
|
11 |
import com.iailab.module.pms.coalquality.modules.detection.entity.QualityMediumEntity; |
|
12 |
import com.iailab.module.pms.coalquality.modules.detection.service.QualityMediumService; |
|
13 |
import com.iailab.module.pms.coalquality.modules.detection.vo.MediumPageReqVO; |
|
14 |
import lombok.extern.slf4j.Slf4j; |
|
15 |
import org.apache.commons.lang3.StringUtils; |
|
16 |
import org.springframework.stereotype.Service; |
|
17 |
import org.springframework.transaction.annotation.Transactional; |
|
18 |
|
|
19 |
import java.util.Arrays; |
|
20 |
import java.util.Date; |
|
21 |
|
|
22 |
/** |
|
23 |
* 介质粉检测 |
|
24 |
* |
|
25 |
* @author PanZhibao |
|
26 |
* @Description |
|
27 |
* @createTime 2023年02月07日 17:27:00 |
|
28 |
*/ |
|
29 |
@Slf4j |
|
30 |
@Service |
|
31 |
public class QualityMediumServiceImpl extends BaseServiceImpl<QualityMediumDao, QualityMediumEntity> |
|
32 |
implements QualityMediumService { |
|
33 |
|
|
34 |
private String BUSINESS_CODE = "QualityMedium"; |
|
35 |
|
|
36 |
@Override |
|
37 |
public PageResult<QualityMediumDTO> page(MediumPageReqVO reqVO) { |
|
38 |
PageResult<QualityMediumEntity> page = baseDao.selectPage(reqVO); |
|
39 |
|
|
40 |
return BeanUtils.toBean(page, QualityMediumDTO.class); |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
public QualityMediumDTO get(String id) { |
|
45 |
QualityMediumEntity entity = baseDao.selectById(id); |
|
46 |
|
|
47 |
return ConvertUtils.sourceToTarget(entity, QualityMediumDTO.class); |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
public void save(QualityMediumDTO dto) { |
8d3ff6
|
52 |
//dto.setCode(serialNumUtils.getByBusinessDate(BUSINESS_CODE, dto.getRq(), 4)); |
7e21bc
|
53 |
QualityMediumEntity entity = ConvertUtils.sourceToTarget(dto, QualityMediumEntity.class); |
J |
54 |
entity.setCreateDate(new Date()); |
|
55 |
// entity.setCreator(SecurityUser.getUserId().toString()); |
|
56 |
insert(entity); |
|
57 |
} |
|
58 |
|
|
59 |
@Override |
|
60 |
public void update(QualityMediumDTO dto) { |
|
61 |
QualityMediumEntity entity = ConvertUtils.sourceToTarget(dto, QualityMediumEntity.class); |
|
62 |
entity.setUpdateDate(new Date()); |
|
63 |
// entity.setUpdater(SecurityUser.getUserId().toString()); |
|
64 |
updateById(entity); |
|
65 |
} |
|
66 |
|
|
67 |
@Override |
|
68 |
@Transactional(rollbackFor = Exception.class) |
|
69 |
public void delete(String[] ids) { |
|
70 |
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
71 |
} |
|
72 |
|
|
73 |
@Override |
|
74 |
public Long cheack(QualityMediumDTO dto) { |
|
75 |
String id = dto.getId(); |
|
76 |
String code = dto.getCode(); |
|
77 |
|
|
78 |
QueryWrapper<QualityMediumEntity> queryWrapper = new QueryWrapper<>(); |
|
79 |
queryWrapper.ne(StringUtils.isNotBlank(id), "id", id); |
|
80 |
queryWrapper.and(wrapper -> wrapper.eq("code", code)); |
|
81 |
return baseDao.selectCount(queryWrapper); |
|
82 |
} |
|
83 |
|
|
84 |
} |