提交 | 用户 | 时间
|
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.IndItemAtomDao; |
|
10 |
import com.iailab.module.data.ind.dto.IndItemAtomDTO; |
|
11 |
import com.iailab.module.data.ind.dao.IndItemAtomDao; |
|
12 |
import com.iailab.module.data.ind.dto.IndItemAtomDTO; |
|
13 |
import com.iailab.module.data.ind.dao.IndItemAtomDao; |
|
14 |
import com.iailab.module.data.ind.dto.IndItemAtomDTO; |
|
15 |
import com.iailab.module.data.ind.entity.IndItemAtomEntity; |
|
16 |
import com.iailab.module.data.ind.service.IndItemAtomService; |
|
17 |
import com.iailab.module.data.ind.dao.IndItemAtomDao; |
|
18 |
import com.iailab.module.data.ind.dto.IndItemAtomDTO; |
|
19 |
import org.apache.commons.lang3.StringUtils; |
|
20 |
import org.springframework.stereotype.Service; |
|
21 |
import org.springframework.transaction.annotation.Transactional; |
|
22 |
|
|
23 |
import java.util.Arrays; |
|
24 |
import java.util.Map; |
|
25 |
|
|
26 |
/** |
|
27 |
* @author PanZhibao |
|
28 |
* @Description |
|
29 |
* @createTime 2024年05月25日 |
|
30 |
*/ |
|
31 |
@Service |
|
32 |
public class IndItemAtomServiceImpl extends BaseServiceImpl<IndItemAtomDao, IndItemAtomEntity> implements IndItemAtomService { |
|
33 |
|
|
34 |
@Override |
|
35 |
public PageData<IndItemAtomDTO> page(Map<String, Object> params) { |
|
36 |
IPage<IndItemAtomEntity> page = baseDao.selectPage( |
|
37 |
getPage(params, Constant.CREATE_DATE, false), |
|
38 |
getWrapper(params) |
|
39 |
); |
|
40 |
return getPageData(page, IndItemAtomDTO.class); |
|
41 |
} |
|
42 |
|
|
43 |
private QueryWrapper<IndItemAtomEntity> getWrapper(Map<String, Object> params){ |
|
44 |
String itemId = (String)params.get("itemId"); |
|
45 |
|
|
46 |
QueryWrapper<IndItemAtomEntity> wrapper = new QueryWrapper<>(); |
|
47 |
wrapper.like(StringUtils.isNotBlank(itemId), "item_id", itemId); |
|
48 |
|
|
49 |
return wrapper; |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
53 |
public IndItemAtomDTO get(String id) { |
|
54 |
IndItemAtomEntity entity = baseDao.selectById(id); |
|
55 |
|
|
56 |
return ConvertUtils.sourceToTarget(entity, IndItemAtomDTO.class); |
|
57 |
} |
|
58 |
|
|
59 |
@Override |
|
60 |
public IndItemAtomDTO getItemId(String itemId) { |
|
61 |
QueryWrapper<IndItemAtomEntity> wrapper = new QueryWrapper<>(); |
|
62 |
wrapper.like(StringUtils.isNotBlank(itemId), "item_id", itemId); |
|
63 |
IndItemAtomEntity entity = baseDao.selectOne(wrapper); |
|
64 |
|
|
65 |
return ConvertUtils.sourceToTarget(entity, IndItemAtomDTO.class); |
|
66 |
} |
|
67 |
|
|
68 |
|
|
69 |
@Override |
|
70 |
public void save(IndItemAtomDTO dto) { |
|
71 |
IndItemAtomEntity entity = ConvertUtils.sourceToTarget(dto, IndItemAtomEntity.class); |
|
72 |
|
|
73 |
insert(entity); |
|
74 |
} |
|
75 |
|
|
76 |
@Override |
|
77 |
public void update(IndItemAtomDTO dto) { |
|
78 |
IndItemAtomEntity entity = ConvertUtils.sourceToTarget(dto, IndItemAtomEntity.class); |
|
79 |
|
|
80 |
updateById(entity); |
|
81 |
} |
|
82 |
|
|
83 |
@Override |
|
84 |
@Transactional(rollbackFor = Exception.class) |
|
85 |
public void delete(String[] ids) { |
|
86 |
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
87 |
|
|
88 |
} |
|
89 |
|
|
90 |
@Override |
|
91 |
public void deleteByItemId(String[] ids) { |
|
92 |
QueryWrapper<IndItemAtomEntity> wrapper = new QueryWrapper<>(); |
|
93 |
wrapper.in("item_id", ids); |
|
94 |
baseDao.delete(wrapper); |
|
95 |
} |
|
96 |
} |