|
@@ -0,0 +1,150 @@
|
|
|
+package com.taais.biz.service.impl;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.mybatisflex.core.paginate.Page;
|
|
|
+import com.mybatisflex.core.query.QueryWrapper;
|
|
|
+import com.taais.common.core.utils.MapstructUtils;
|
|
|
+import com.taais.common.core.utils.StringUtils;
|
|
|
+import com.taais.common.orm.core.page.PageQuery;
|
|
|
+import com.taais.common.core.core.page.PageResult;
|
|
|
+import com.taais.common.orm.core.service.impl.BaseServiceImpl;
|
|
|
+import jakarta.annotation.Resource;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import com.taais.biz.mapper.DataSeqMapper;
|
|
|
+import com.taais.biz.domain.DataSeq;
|
|
|
+import com.taais.biz.domain.bo.DataSeqBo;
|
|
|
+import com.taais.biz.domain.vo.DataSeqVo;
|
|
|
+import com.taais.biz.service.IDataSeqService;
|
|
|
+import static com.taais.biz.domain.table.DataSeqTableDef.DATA_SEQ;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 数据管理Service业务层处理
|
|
|
+ *
|
|
|
+ * @author wangkang
|
|
|
+ * 2024-10-08
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class DataSeqServiceImpl extends BaseServiceImpl<DataSeqMapper, DataSeq> implements IDataSeqService {
|
|
|
+ @Resource
|
|
|
+ private DataSeqMapper dataSeqMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public QueryWrapper query() {
|
|
|
+ return super.query().from(DATA_SEQ);
|
|
|
+ }
|
|
|
+
|
|
|
+ private QueryWrapper buildQueryWrapper(DataSeqBo dataSeqBo) {
|
|
|
+ QueryWrapper queryWrapper = super.buildBaseQueryWrapper();
|
|
|
+ queryWrapper.and(DATA_SEQ.NAME.like
|
|
|
+ (dataSeqBo.getName()));
|
|
|
+ queryWrapper.and(DATA_SEQ.DATA_TYPE.eq
|
|
|
+ (dataSeqBo.getDataType()));
|
|
|
+ queryWrapper.and(DATA_SEQ.FILE_TYPE.eq
|
|
|
+ (dataSeqBo.getFileType()));
|
|
|
+ queryWrapper.and(DATA_SEQ.OBJECT_TYPE.eq
|
|
|
+ (dataSeqBo.getObjectType()));
|
|
|
+ queryWrapper.and(DATA_SEQ.OBJECT_SUBTYPE.eq
|
|
|
+ (dataSeqBo.getObjectSubtype()));
|
|
|
+ queryWrapper.and(DATA_SEQ.BATCH_NUM.eq
|
|
|
+ (dataSeqBo.getBatchNum()));
|
|
|
+ queryWrapper.and(DATA_SEQ.SCENE.eq
|
|
|
+ (dataSeqBo.getScene()));
|
|
|
+ queryWrapper.and(DATA_SEQ.DATA_SOURCE.eq
|
|
|
+ (dataSeqBo.getDataSource()));
|
|
|
+ queryWrapper.and(DATA_SEQ.GATHER_TIME.eq
|
|
|
+ (dataSeqBo.getGatherTime()));
|
|
|
+ queryWrapper.and(DATA_SEQ.GATHER_SPOT.eq
|
|
|
+ (dataSeqBo.getGatherSpot()));
|
|
|
+ queryWrapper.and(DATA_SEQ.URL.eq
|
|
|
+ (dataSeqBo.getUrl()));
|
|
|
+ queryWrapper.and(DATA_SEQ.LOG.eq
|
|
|
+ (dataSeqBo.getLog()));
|
|
|
+ queryWrapper.and(DATA_SEQ.REMARKS.eq
|
|
|
+ (dataSeqBo.getRemarks()));
|
|
|
+
|
|
|
+ return queryWrapper;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询数据管理
|
|
|
+ *
|
|
|
+ * @param id 数据管理主键
|
|
|
+ * @return 数据管理
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public DataSeqVo selectById(Long id) {
|
|
|
+ return this.getOneAs(query().where(DATA_SEQ.ID.eq(id)), DataSeqVo.class);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询数据管理列表
|
|
|
+ *
|
|
|
+ * @param dataSeqBo 数据管理Bo
|
|
|
+ * @return 数据管理集合
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<DataSeqVo> selectList(DataSeqBo dataSeqBo) {
|
|
|
+ QueryWrapper queryWrapper = buildQueryWrapper(dataSeqBo);
|
|
|
+ return this.listAs(queryWrapper, DataSeqVo.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询数据管理列表
|
|
|
+ *
|
|
|
+ * @param dataSeqBo 数据管理Bo
|
|
|
+ * @return 分页数据管理集合
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public PageResult<DataSeqVo> selectPage(DataSeqBo dataSeqBo) {
|
|
|
+ QueryWrapper queryWrapper = buildQueryWrapper(dataSeqBo);
|
|
|
+ Page<DataSeqVo> page = this.pageAs(PageQuery.build(), queryWrapper, DataSeqVo.class);
|
|
|
+ return PageResult.build(page);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增数据管理
|
|
|
+ *
|
|
|
+ * @param dataSeqBo 数据管理Bo
|
|
|
+ * @return 结果:true 操作成功,false 操作失败
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public boolean insert(DataSeqBo dataSeqBo) {
|
|
|
+ DataSeq dataSeq =MapstructUtils.convert(dataSeqBo, DataSeq. class);
|
|
|
+
|
|
|
+ return this.save(dataSeq);//使用全局配置的雪花算法主键生成器生成ID值
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改数据管理
|
|
|
+ *
|
|
|
+ * @param dataSeqBo 数据管理Bo
|
|
|
+ * @return 结果:true 更新成功,false 更新失败
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public boolean update(DataSeqBo dataSeqBo) {
|
|
|
+ DataSeq dataSeq =MapstructUtils.convert(dataSeqBo, DataSeq. class);
|
|
|
+ if (ObjectUtil.isNotNull(dataSeq) && ObjectUtil.isNotNull(dataSeq.getId())){
|
|
|
+ boolean updated = this.updateById(dataSeq);
|
|
|
+ return updated;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除数据管理
|
|
|
+ *
|
|
|
+ * @param ids 需要删除的数据管理主键集合
|
|
|
+ * @return 结果:true 删除成功,false 删除失败
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public boolean deleteByIds(Long[] ids) {
|
|
|
+ return this.removeByIds(Arrays.asList(ids));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|