提交 | 用户 | 时间
|
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.IndItemCalDao; |
|
10 |
import com.iailab.module.data.ind.entity.IndItemCalEntity; |
|
11 |
import com.iailab.module.data.ind.service.IndItemCalService; |
|
12 |
import com.iailab.module.data.ind.dao.IndItemCalDao; |
|
13 |
import com.iailab.module.data.ind.entity.IndItemCalEntity; |
|
14 |
import com.iailab.module.data.ind.service.IndItemCalService; |
|
15 |
import com.iailab.module.data.ind.dao.IndItemCalDao; |
|
16 |
import com.iailab.module.data.ind.dto.IndItemCalDTO; |
|
17 |
import com.iailab.module.data.ind.entity.IndItemCalEntity; |
|
18 |
import com.iailab.module.data.ind.service.IndItemCalService; |
|
19 |
import com.iailab.module.data.ind.dao.IndItemCalDao; |
|
20 |
import com.iailab.module.data.ind.entity.IndItemCalEntity; |
|
21 |
import com.iailab.module.data.ind.service.IndItemCalService; |
|
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 IndItemCalServiceImpl extends BaseServiceImpl<IndItemCalDao, IndItemCalEntity> implements IndItemCalService { |
|
36 |
|
|
37 |
@Override |
|
38 |
public PageData<IndItemCalDTO> page(Map<String, Object> params) { |
|
39 |
IPage<IndItemCalEntity> page = baseDao.selectPage( |
|
40 |
getPage(params, Constant.CREATE_DATE, false), |
|
41 |
getWrapper(params) |
|
42 |
); |
|
43 |
return getPageData(page, IndItemCalDTO.class); |
|
44 |
} |
|
45 |
|
|
46 |
private QueryWrapper<IndItemCalEntity> getWrapper(Map<String, Object> params){ |
|
47 |
String itemId = (String)params.get("itemId"); |
|
48 |
|
|
49 |
QueryWrapper<IndItemCalEntity> wrapper = new QueryWrapper<>(); |
|
50 |
wrapper.like(StringUtils.isNotBlank(itemId), "item_id", itemId); |
|
51 |
|
|
52 |
return wrapper; |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public IndItemCalDTO get(String id) { |
|
57 |
IndItemCalEntity entity = baseDao.selectById(id); |
|
58 |
|
|
59 |
return ConvertUtils.sourceToTarget(entity, IndItemCalDTO.class); |
|
60 |
} |
|
61 |
|
|
62 |
@Override |
|
63 |
public IndItemCalDTO getItemId(String itemId) { |
|
64 |
QueryWrapper<IndItemCalEntity> wrapper = new QueryWrapper<>(); |
|
65 |
wrapper.like(StringUtils.isNotBlank(itemId), "item_id", itemId); |
|
66 |
IndItemCalEntity entity = baseDao.selectOne(wrapper); |
|
67 |
|
|
68 |
return ConvertUtils.sourceToTarget(entity, IndItemCalDTO.class); |
|
69 |
} |
|
70 |
|
|
71 |
@Override |
|
72 |
public void save(IndItemCalDTO dto) { |
|
73 |
IndItemCalEntity entity = ConvertUtils.sourceToTarget(dto, IndItemCalEntity.class); |
|
74 |
|
|
75 |
insert(entity); |
|
76 |
} |
|
77 |
|
|
78 |
@Override |
|
79 |
public void update(IndItemCalDTO dto) { |
|
80 |
IndItemCalEntity entity = ConvertUtils.sourceToTarget(dto, IndItemCalEntity.class); |
|
81 |
|
|
82 |
updateById(entity); |
|
83 |
} |
|
84 |
|
|
85 |
@Override |
|
86 |
@Transactional(rollbackFor = Exception.class) |
|
87 |
public void delete(String[] ids) { |
|
88 |
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
89 |
|
|
90 |
} |
|
91 |
|
|
92 |
@Override |
|
93 |
public void deleteByItemId(String[] ids) { |
|
94 |
QueryWrapper<IndItemCalEntity> wrapper = new QueryWrapper<>(); |
|
95 |
wrapper.in("item_id", ids); |
|
96 |
baseDao.delete(wrapper); |
|
97 |
} |
|
98 |
} |