package com.iailab.module.data.ind.data.service.impl; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.framework.common.util.object.BeanUtils; import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.module.data.ind.category.entity.IndItemCategoryEntity; import com.iailab.module.data.ind.data.dao.IndDataSetDao; import com.iailab.module.data.ind.data.dto.IndDataSetDTO; import com.iailab.module.data.ind.data.dto.IndDataSetFieldDTO; import com.iailab.module.data.ind.data.entity.IndDataSetEntity; import com.iailab.module.data.ind.data.service.IndDataSetFieldService; import com.iailab.module.data.ind.data.service.IndDataSetService; import com.iailab.module.data.ind.data.vo.IndDataSetPageReqVO; import com.iailab.module.data.ind.data.vo.IndDataSetSaveReqVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Date; import java.util.List; import java.util.UUID; /** * @author PanZhibao * @Description * @createTime 2024年09月10日 */ @Service public class IndDataSetServiceImpl extends BaseServiceImpl implements IndDataSetService { @Autowired private IndDataSetFieldService indDataSetFieldService; @Override public PageResult page(IndDataSetPageReqVO reqVO) { return baseDao.selectPage(reqVO); } @Override public List list(IndDataSetPageReqVO reqVO) { return baseDao.selectList(); } @Override public void create(IndDataSetSaveReqVO createReqVO) { IndDataSetEntity entity = BeanUtils.toBean(createReqVO, IndDataSetEntity.class); entity.setId(UUID.randomUUID().toString()); entity.setCreateTime(new Date()); baseDao.insert(entity); } @Override public void update(IndDataSetSaveReqVO updateReqVO) { IndDataSetEntity entity = BeanUtils.toBean(updateReqVO, IndDataSetEntity.class); entity.setUpdateTime(new Date()); baseDao.updateById(entity); } @Override public IndDataSetEntity get(String id) { return baseDao.selectById(id); } @Override public void delete(String id) { baseDao.deleteById(id); } @Override public IndDataSetDTO getDet(String id) { IndDataSetDTO result = new IndDataSetDTO(); IndDataSetEntity dataSet = baseDao.selectById(id); result = ConvertUtils.sourceToTarget(dataSet, IndDataSetDTO.class); result.setFieldList(ConvertUtils.sourceToTarget(indDataSetFieldService.list(id), IndDataSetFieldDTO.class)); return result; } }