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.IndItemValueDao;
|
import com.iailab.module.data.ind.entity.IndItemValueEntity;
|
import com.iailab.module.data.ind.service.IndItemValueService;
|
import com.iailab.module.data.ind.dao.IndItemValueDao;
|
import com.iailab.module.data.ind.entity.IndItemValueEntity;
|
import com.iailab.module.data.ind.service.IndItemValueService;
|
import com.iailab.module.data.ind.dao.IndItemValueDao;
|
import com.iailab.module.data.ind.dto.IndItemValueDTO;
|
import com.iailab.module.data.ind.entity.IndItemValueEntity;
|
import com.iailab.module.data.ind.service.IndItemValueService;
|
import com.iailab.module.data.ind.dao.IndItemValueDao;
|
import com.iailab.module.data.ind.entity.IndItemValueEntity;
|
import com.iailab.module.data.ind.service.IndItemValueService;
|
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 IndItemValueServiceImpl extends BaseServiceImpl<IndItemValueDao, IndItemValueEntity> implements IndItemValueService {
|
|
@Override
|
public PageData<IndItemValueDTO> page(Map<String, Object> params) {
|
IPage<IndItemValueEntity> page = baseDao.selectPage(
|
getPage(params, Constant.CREATE_DATE, false),
|
getWrapper(params)
|
);
|
return getPageData(page, IndItemValueDTO.class);
|
}
|
|
private QueryWrapper<IndItemValueEntity> getWrapper(Map<String, Object> params) {
|
String itemNo = (String) params.get("itemNo");
|
|
QueryWrapper<IndItemValueEntity> wrapper = new QueryWrapper<>();
|
wrapper.like(StringUtils.isNotBlank(itemNo), "item_no", itemNo);
|
|
return wrapper;
|
}
|
|
@Override
|
public IndItemValueDTO get(String id) {
|
IndItemValueEntity entity = baseDao.selectById(id);
|
|
return ConvertUtils.sourceToTarget(entity, IndItemValueDTO.class);
|
}
|
|
@Override
|
public void save(IndItemValueDTO dto) {
|
IndItemValueEntity entity = ConvertUtils.sourceToTarget(dto, IndItemValueEntity.class);
|
|
insert(entity);
|
}
|
|
@Override
|
public void update(IndItemValueDTO dto) {
|
IndItemValueEntity entity = ConvertUtils.sourceToTarget(dto, IndItemValueEntity.class);
|
|
updateById(entity);
|
}
|
|
@Override
|
@Transactional(rollbackFor = Exception.class)
|
public void delete(String[] ids) {
|
baseDao.deleteBatchIds(Arrays.asList(ids));
|
|
}
|
}
|