|
@@ -0,0 +1,144 @@
|
|
|
+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.biz.domain.CommonAlgorithmConfig;
|
|
|
+import com.taais.biz.domain.bo.CommonAlgorithmConfigBo;
|
|
|
+import com.taais.biz.domain.vo.CommonAlgorithmConfigVo;
|
|
|
+import com.taais.biz.mapper.CommonAlgorithmConfigMapper;
|
|
|
+import com.taais.biz.service.ICommonAlgorithmConfigService;
|
|
|
+import com.taais.common.core.utils.MapstructUtils;
|
|
|
+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 static com.taais.biz.domain.table.CommonAlgorithmConfigTableDef.COMMON_ALGORITHM_CONFIG;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 【请填写功能名称】Service业务层处理
|
|
|
+ *
|
|
|
+ * @author km
|
|
|
+ * 2024-12-23
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class CommonAlgorithmConfigServiceImpl extends BaseServiceImpl<CommonAlgorithmConfigMapper, CommonAlgorithmConfig> implements ICommonAlgorithmConfigService {
|
|
|
+ @Resource
|
|
|
+ private CommonAlgorithmConfigMapper commonAlgorithmConfigMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public QueryWrapper query() {
|
|
|
+ return super.query().from(COMMON_ALGORITHM_CONFIG);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CommonAlgorithmConfig getByAlgorithmName(String algorithmName) {
|
|
|
+ return commonAlgorithmConfigMapper.getByAlgorithmName(algorithmName).get(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ private QueryWrapper buildQueryWrapper(CommonAlgorithmConfigBo commonAlgorithmConfigBo) {
|
|
|
+ QueryWrapper queryWrapper = super.buildBaseQueryWrapper();
|
|
|
+ queryWrapper.and(COMMON_ALGORITHM_CONFIG.TOOL.eq
|
|
|
+ (commonAlgorithmConfigBo.getTool()));
|
|
|
+ queryWrapper.and(COMMON_ALGORITHM_CONFIG.MODULE.eq
|
|
|
+ (commonAlgorithmConfigBo.getModule()));
|
|
|
+ queryWrapper.and(COMMON_ALGORITHM_CONFIG.ALGORITHM_NAME.like
|
|
|
+ (commonAlgorithmConfigBo.getAlgorithmName()));
|
|
|
+ queryWrapper.and(COMMON_ALGORITHM_CONFIG.START_API.eq
|
|
|
+ (commonAlgorithmConfigBo.getStartApi()));
|
|
|
+ queryWrapper.and(COMMON_ALGORITHM_CONFIG.PAUSE_API.eq
|
|
|
+ (commonAlgorithmConfigBo.getPauseApi()));
|
|
|
+ queryWrapper.and(COMMON_ALGORITHM_CONFIG.TERMINATE_API.eq
|
|
|
+ (commonAlgorithmConfigBo.getTerminateApi()));
|
|
|
+ queryWrapper.and(COMMON_ALGORITHM_CONFIG.PARAMETERS.eq
|
|
|
+ (commonAlgorithmConfigBo.getParameters()));
|
|
|
+ queryWrapper.and(COMMON_ALGORITHM_CONFIG.REMARKS.eq
|
|
|
+ (commonAlgorithmConfigBo.getRemarks()));
|
|
|
+
|
|
|
+ return queryWrapper;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询【请填写功能名称】
|
|
|
+ *
|
|
|
+ * @param id 【请填写功能名称】主键
|
|
|
+ * @return 【请填写功能名称】
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public CommonAlgorithmConfigVo selectById(Integer id) {
|
|
|
+ return this.getOneAs(query().where(COMMON_ALGORITHM_CONFIG.ID.eq(id)), CommonAlgorithmConfigVo.class);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询【请填写功能名称】列表
|
|
|
+ *
|
|
|
+ * @param commonAlgorithmConfigBo 【请填写功能名称】Bo
|
|
|
+ * @return 【请填写功能名称】集合
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<CommonAlgorithmConfigVo> selectList(CommonAlgorithmConfigBo commonAlgorithmConfigBo) {
|
|
|
+ QueryWrapper queryWrapper = buildQueryWrapper(commonAlgorithmConfigBo);
|
|
|
+ return this.listAs(queryWrapper, CommonAlgorithmConfigVo.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询【请填写功能名称】列表
|
|
|
+ *
|
|
|
+ * @param commonAlgorithmConfigBo 【请填写功能名称】Bo
|
|
|
+ * @return 分页【请填写功能名称】集合
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public PageResult<CommonAlgorithmConfigVo> selectPage(CommonAlgorithmConfigBo commonAlgorithmConfigBo) {
|
|
|
+ QueryWrapper queryWrapper = buildQueryWrapper(commonAlgorithmConfigBo);
|
|
|
+ Page<CommonAlgorithmConfigVo> page = this.pageAs(PageQuery.build(), queryWrapper, CommonAlgorithmConfigVo.class);
|
|
|
+ return PageResult.build(page);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增【请填写功能名称】
|
|
|
+ *
|
|
|
+ * @param commonAlgorithmConfigBo 【请填写功能名称】Bo
|
|
|
+ * @return 结果:true 操作成功,false 操作失败
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public boolean insert(CommonAlgorithmConfigBo commonAlgorithmConfigBo) {
|
|
|
+ CommonAlgorithmConfig commonAlgorithmConfig =MapstructUtils.convert(commonAlgorithmConfigBo, CommonAlgorithmConfig. class);
|
|
|
+
|
|
|
+ return this.save(commonAlgorithmConfig);//使用全局配置的雪花算法主键生成器生成ID值
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改【请填写功能名称】
|
|
|
+ *
|
|
|
+ * @param commonAlgorithmConfigBo 【请填写功能名称】Bo
|
|
|
+ * @return 结果:true 更新成功,false 更新失败
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public boolean update(CommonAlgorithmConfigBo commonAlgorithmConfigBo) {
|
|
|
+ CommonAlgorithmConfig commonAlgorithmConfig =MapstructUtils.convert(commonAlgorithmConfigBo, CommonAlgorithmConfig. class);
|
|
|
+ if (ObjectUtil.isNotNull(commonAlgorithmConfig) && ObjectUtil.isNotNull(commonAlgorithmConfig.getId())){
|
|
|
+ boolean updated = this.updateById(commonAlgorithmConfig);
|
|
|
+ return updated;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除【请填写功能名称】
|
|
|
+ *
|
|
|
+ * @param ids 需要删除的【请填写功能名称】主键集合
|
|
|
+ * @return 结果:true 删除成功,false 删除失败
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public boolean deleteByIds(Integer[] ids) {
|
|
|
+ return this.removeByIds(Arrays.asList(ids));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|