package com.iailab.module.data.ind.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.iailab.framework.common.constant.Constant;
|
import com.iailab.framework.common.page.PageData;
|
import com.iailab.framework.common.service.impl.BaseServiceImpl;
|
import com.iailab.framework.common.util.object.ConvertUtils;
|
import com.iailab.module.data.ind.dao.IndItemCalDao;
|
import com.iailab.module.data.ind.entity.IndItemCalEntity;
|
import com.iailab.module.data.ind.service.IndItemCalService;
|
import com.iailab.module.data.ind.dao.IndItemCalDao;
|
import com.iailab.module.data.ind.entity.IndItemCalEntity;
|
import com.iailab.module.data.ind.service.IndItemCalService;
|
import com.iailab.module.data.ind.dao.IndItemCalDao;
|
import com.iailab.module.data.ind.dto.IndItemCalDTO;
|
import com.iailab.module.data.ind.entity.IndItemCalEntity;
|
import com.iailab.module.data.ind.service.IndItemCalService;
|
import com.iailab.module.data.ind.dao.IndItemCalDao;
|
import com.iailab.module.data.ind.entity.IndItemCalEntity;
|
import com.iailab.module.data.ind.service.IndItemCalService;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import java.util.Arrays;
|
import java.util.Map;
|
|
/**
|
* @author PanZhibao
|
* @Description
|
* @createTime 2024年05月25日
|
*/
|
@Service
|
public class IndItemCalServiceImpl extends BaseServiceImpl<IndItemCalDao, IndItemCalEntity> implements IndItemCalService {
|
|
@Override
|
public PageData<IndItemCalDTO> page(Map<String, Object> params) {
|
IPage<IndItemCalEntity> page = baseDao.selectPage(
|
getPage(params, Constant.CREATE_DATE, false),
|
getWrapper(params)
|
);
|
return getPageData(page, IndItemCalDTO.class);
|
}
|
|
private QueryWrapper<IndItemCalEntity> getWrapper(Map<String, Object> params){
|
String itemId = (String)params.get("itemId");
|
|
QueryWrapper<IndItemCalEntity> wrapper = new QueryWrapper<>();
|
wrapper.like(StringUtils.isNotBlank(itemId), "item_id", itemId);
|
|
return wrapper;
|
}
|
|
@Override
|
public IndItemCalDTO get(String id) {
|
IndItemCalEntity entity = baseDao.selectById(id);
|
|
return ConvertUtils.sourceToTarget(entity, IndItemCalDTO.class);
|
}
|
|
@Override
|
public IndItemCalDTO getItemId(String itemId) {
|
QueryWrapper<IndItemCalEntity> wrapper = new QueryWrapper<>();
|
wrapper.like(StringUtils.isNotBlank(itemId), "item_id", itemId);
|
IndItemCalEntity entity = baseDao.selectOne(wrapper);
|
|
return ConvertUtils.sourceToTarget(entity, IndItemCalDTO.class);
|
}
|
|
@Override
|
public void save(IndItemCalDTO dto) {
|
IndItemCalEntity entity = ConvertUtils.sourceToTarget(dto, IndItemCalEntity.class);
|
|
insert(entity);
|
}
|
|
@Override
|
public void update(IndItemCalDTO dto) {
|
IndItemCalEntity entity = ConvertUtils.sourceToTarget(dto, IndItemCalEntity.class);
|
|
updateById(entity);
|
}
|
|
@Override
|
@Transactional(rollbackFor = Exception.class)
|
public void delete(String[] ids) {
|
baseDao.deleteBatchIds(Arrays.asList(ids));
|
|
}
|
|
@Override
|
public void deleteByItemId(String[] ids) {
|
QueryWrapper<IndItemCalEntity> wrapper = new QueryWrapper<>();
|
wrapper.in("item_id", ids);
|
baseDao.delete(wrapper);
|
}
|
}
|