提交 | 用户 | 时间
|
a6de49
|
1 |
package com.iailab.module.data.ind.service.impl; |
H |
2 |
|
|
3 |
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
4 |
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
5 |
import com.iailab.framework.common.constant.Constant; |
|
6 |
import com.iailab.framework.common.page.PageData; |
|
7 |
import com.iailab.framework.common.service.impl.BaseServiceImpl; |
|
8 |
import com.iailab.framework.common.util.object.ConvertUtils; |
|
9 |
import com.iailab.module.data.ind.dao.IndItemValueDao; |
|
10 |
import com.iailab.module.data.ind.entity.IndItemValueEntity; |
|
11 |
import com.iailab.module.data.ind.service.IndItemValueService; |
|
12 |
import com.iailab.module.data.ind.dao.IndItemValueDao; |
|
13 |
import com.iailab.module.data.ind.entity.IndItemValueEntity; |
|
14 |
import com.iailab.module.data.ind.service.IndItemValueService; |
|
15 |
import com.iailab.module.data.ind.dao.IndItemValueDao; |
|
16 |
import com.iailab.module.data.ind.dto.IndItemValueDTO; |
|
17 |
import com.iailab.module.data.ind.entity.IndItemValueEntity; |
|
18 |
import com.iailab.module.data.ind.service.IndItemValueService; |
|
19 |
import com.iailab.module.data.ind.dao.IndItemValueDao; |
|
20 |
import com.iailab.module.data.ind.entity.IndItemValueEntity; |
|
21 |
import com.iailab.module.data.ind.service.IndItemValueService; |
|
22 |
import org.apache.commons.lang3.StringUtils; |
|
23 |
import org.springframework.stereotype.Service; |
|
24 |
import org.springframework.transaction.annotation.Transactional; |
|
25 |
|
|
26 |
import java.util.Arrays; |
|
27 |
import java.util.Map; |
|
28 |
|
|
29 |
/** |
|
30 |
* @author PanZhibao |
|
31 |
* @Description |
|
32 |
* @createTime 2024年05月25日 |
|
33 |
*/ |
|
34 |
@Service |
|
35 |
public class IndItemValueServiceImpl extends BaseServiceImpl<IndItemValueDao, IndItemValueEntity> implements IndItemValueService { |
|
36 |
|
|
37 |
@Override |
|
38 |
public PageData<IndItemValueDTO> page(Map<String, Object> params) { |
|
39 |
IPage<IndItemValueEntity> page = baseDao.selectPage( |
|
40 |
getPage(params, Constant.CREATE_DATE, false), |
|
41 |
getWrapper(params) |
|
42 |
); |
|
43 |
return getPageData(page, IndItemValueDTO.class); |
|
44 |
} |
|
45 |
|
|
46 |
private QueryWrapper<IndItemValueEntity> getWrapper(Map<String, Object> params) { |
|
47 |
String itemNo = (String) params.get("itemNo"); |
|
48 |
|
|
49 |
QueryWrapper<IndItemValueEntity> wrapper = new QueryWrapper<>(); |
|
50 |
wrapper.like(StringUtils.isNotBlank(itemNo), "item_no", itemNo); |
|
51 |
|
|
52 |
return wrapper; |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public IndItemValueDTO get(String id) { |
|
57 |
IndItemValueEntity entity = baseDao.selectById(id); |
|
58 |
|
|
59 |
return ConvertUtils.sourceToTarget(entity, IndItemValueDTO.class); |
|
60 |
} |
|
61 |
|
|
62 |
@Override |
|
63 |
public void save(IndItemValueDTO dto) { |
|
64 |
IndItemValueEntity entity = ConvertUtils.sourceToTarget(dto, IndItemValueEntity.class); |
|
65 |
|
|
66 |
insert(entity); |
|
67 |
} |
|
68 |
|
|
69 |
@Override |
|
70 |
public void update(IndItemValueDTO dto) { |
|
71 |
IndItemValueEntity entity = ConvertUtils.sourceToTarget(dto, IndItemValueEntity.class); |
|
72 |
|
|
73 |
updateById(entity); |
|
74 |
} |
|
75 |
|
|
76 |
@Override |
|
77 |
@Transactional(rollbackFor = Exception.class) |
|
78 |
public void delete(String[] ids) { |
|
79 |
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
80 |
|
|
81 |
} |
|
82 |
} |