Compare commits
2 Commits
b6aa3959ce
...
81353344da
Author | SHA1 | Date | |
---|---|---|---|
81353344da | |||
be5ff6ff74 |
13
doc/WorkReport/2025-05-14hky.md
Normal file
13
doc/WorkReport/2025-05-14hky.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# 工作日报 - 2025年5月
|
||||||
|
## 2025年5月14日
|
||||||
|
### ✅ 今日完成
|
||||||
|
完成分页查询
|
||||||
|
|
||||||
|
### 🚧 进行中
|
||||||
|
删除操作
|
||||||
|
|
||||||
|
### ⚠️ 问题/障碍
|
||||||
|
测试方法不知道怎么写
|
||||||
|
|
||||||
|
### 📅 明日计划
|
||||||
|
写完删除代码,进行测试
|
7
pom.xml
7
pom.xml
@ -50,6 +50,13 @@
|
|||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!--分页查询-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
<version>1.4.7</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- KingbaseES V8/V9 数据库 JDBC 驱动 -->
|
<!-- KingbaseES V8/V9 数据库 JDBC 驱动 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.kingbase8</groupId>
|
<groupId>com.kingbase8</groupId>
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
package com.bipt.intelligentapplicationorchestrationservice.controller;
|
package com.bipt.intelligentapplicationorchestrationservice.controller;
|
||||||
|
|
||||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetDTO;
|
import com.bipt.intelligentapplicationorchestrationservice.pojo.*;
|
||||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetEntity;
|
|
||||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.OptResult;
|
|
||||||
import com.bipt.intelligentapplicationorchestrationservice.service.DatasetService;
|
import com.bipt.intelligentapplicationorchestrationservice.service.DatasetService;
|
||||||
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/dataset")
|
@RequestMapping("/dataset")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -27,6 +28,14 @@ public class DatasetController {
|
|||||||
return OptResult.success();
|
return OptResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
public OptResult<PageResult> page(DatasetPageQueryDTO dataSetPageQueryDTO) {
|
||||||
|
log.info("数据集分页查询:{}", dataSetPageQueryDTO);
|
||||||
|
PageResult pageResult = datasetService.pageQuery(dataSetPageQueryDTO);
|
||||||
|
return OptResult.success(pageResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改数据集
|
* 修改数据集
|
||||||
* @param datasetEntity
|
* @param datasetEntity
|
||||||
@ -39,5 +48,22 @@ public class DatasetController {
|
|||||||
return OptResult.success();
|
return OptResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除数据集
|
||||||
|
* @param datasetIds 数据集ID列表
|
||||||
|
* @return 操作结果
|
||||||
|
*/
|
||||||
|
@DeleteMapping
|
||||||
|
public OptResult<String> deleteBatch(@RequestBody List<Integer> datasetIds) {
|
||||||
|
log.info("批量删除数据集,ID列表:{}", datasetIds);
|
||||||
|
datasetService.deleteBatch(datasetIds);
|
||||||
|
return OptResult.success("批量删除成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,25 @@
|
|||||||
package com.bipt.intelligentapplicationorchestrationservice.mapper;
|
package com.bipt.intelligentapplicationorchestrationservice.mapper;
|
||||||
|
|
||||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetEntity;
|
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetEntity;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetPageQueryDTO;
|
||||||
import org.apache.ibatis.annotations.Update;
|
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetVO;
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
|
import org.apache.ibatis.annotations.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface DatasetMapper {
|
public interface DatasetMapper {
|
||||||
|
|
||||||
void updata(DatasetEntity datasetEntity);
|
void updata(DatasetEntity datasetEntity);
|
||||||
|
|
||||||
|
void insert(DatasetEntity datasetEntity);
|
||||||
|
|
||||||
|
Page<DatasetVO> pageQuery(DatasetPageQueryDTO dataSetPageQueryDTO);
|
||||||
|
|
||||||
|
@Select("select * from dataset where dataset_id=#{datasetId}")
|
||||||
|
DatasetEntity getById(Integer datasetId);
|
||||||
|
@Delete("delete from dataset where dataset_id = #{datasetId}")
|
||||||
|
void deleteBatch(List<Integer> datasetIds);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.bipt.intelligentapplicationorchestrationservice.pojo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hky
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DatasetPageQueryDTO implements Serializable{
|
||||||
|
private int page;
|
||||||
|
private int pageSize;
|
||||||
|
private Integer datasetType;
|
||||||
|
private Integer datasetStatus;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.bipt.intelligentapplicationorchestrationservice.pojo;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hky
|
||||||
|
*/
|
||||||
|
public class DatasetVO implements Serializable {
|
||||||
|
private String datasetName;
|
||||||
|
private Integer datasetType;
|
||||||
|
private Integer datasetStatus;
|
||||||
|
private String dsPath;
|
||||||
|
private Map<String,String> args;
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.bipt.intelligentapplicationorchestrationservice.pojo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
* @param <T>
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class PageResult<T> {
|
||||||
|
private Long total;
|
||||||
|
private List<T> rows;
|
||||||
|
}
|
@ -2,10 +2,20 @@ package com.bipt.intelligentapplicationorchestrationservice.service;
|
|||||||
|
|
||||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetDTO;
|
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetDTO;
|
||||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetEntity;
|
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetEntity;
|
||||||
import org.springframework.stereotype.Service;
|
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetPageQueryDTO;
|
||||||
|
import com.bipt.intelligentapplicationorchestrationservice.pojo.PageResult;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hky
|
||||||
|
*/
|
||||||
public interface DatasetService {
|
public interface DatasetService {
|
||||||
void save(DatasetDTO datasetDTO);
|
void save(DatasetDTO datasetDTO);
|
||||||
|
|
||||||
void update(DatasetEntity datasetEntity);
|
void update(DatasetEntity datasetEntity);
|
||||||
|
|
||||||
|
PageResult pageQuery(DatasetPageQueryDTO dataSetPageQueryDTO);
|
||||||
|
|
||||||
|
void deleteBatch(List<Integer> datasetIds);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package com.bipt.intelligentapplicationorchestrationservice.service.Impl;
|
package com.bipt.intelligentapplicationorchestrationservice.service.Impl;
|
||||||
|
|
||||||
import com.bipt.intelligentapplicationorchestrationservice.mapper.DatasetMapper;
|
import com.bipt.intelligentapplicationorchestrationservice.mapper.DatasetMapper;
|
||||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetDTO;
|
import com.bipt.intelligentapplicationorchestrationservice.pojo.*;
|
||||||
import com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetEntity;
|
|
||||||
import com.bipt.intelligentapplicationorchestrationservice.service.DatasetService;
|
import com.bipt.intelligentapplicationorchestrationservice.service.DatasetService;
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -11,6 +12,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -36,11 +38,18 @@ public class DatasetServiceImpl implements DatasetService {
|
|||||||
|
|
||||||
//TODO 调用数据仓库保存到分布式文件系统
|
//TODO 调用数据仓库保存到分布式文件系统
|
||||||
}
|
}
|
||||||
|
DatasetEntity datasetEntity = new DatasetEntity();
|
||||||
|
BeanUtils.copyProperties(datasetEntity,datasetDTO);
|
||||||
|
datasetEntity.setDatasetStatus(1);
|
||||||
|
datasetEntity.setCreateTime(LocalDateTime.now());
|
||||||
|
datasetEntity.setUpdateTime(LocalDateTime.now());
|
||||||
|
datasetMapper.insert(datasetEntity);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改数据集
|
* 修改数据集
|
||||||
|
*
|
||||||
* @param datasetEntity
|
* @param datasetEntity
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -50,12 +59,46 @@ public class DatasetServiceImpl implements DatasetService {
|
|||||||
//TODO 覆盖保存到分布式文件系统中
|
//TODO 覆盖保存到分布式文件系统中
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
|
|
||||||
//TODO 覆盖数据文件
|
//TODO 覆盖数据文件
|
||||||
|
|
||||||
|
|
||||||
|
//TODO
|
||||||
datasetEntity.setUpdateTime(LocalDateTime.now());
|
datasetEntity.setUpdateTime(LocalDateTime.now());
|
||||||
//maybe需要判断
|
|
||||||
datasetMapper.updata(datasetEntity);
|
datasetMapper.updata(datasetEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
* @param dataSetPageQueryDTO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult pageQuery(DatasetPageQueryDTO dataSetPageQueryDTO) {
|
||||||
|
int pageNum = dataSetPageQueryDTO.getPage();
|
||||||
|
int pageSize = dataSetPageQueryDTO.getPageSize();
|
||||||
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
|
Page<DatasetVO> page = datasetMapper.pageQuery(dataSetPageQueryDTO);
|
||||||
|
return new PageResult(page.getTotal(), page.getResult());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
* @param datasetIds
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void deleteBatch(List<Integer> datasetIds) {
|
||||||
|
for (Integer datasetId : datasetIds) {
|
||||||
|
DatasetEntity datasetEntity = datasetMapper.getById(datasetId);
|
||||||
|
if (datasetEntity == null) {
|
||||||
|
throw new IllegalArgumentException("数据集不存在,ID:" + datasetId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//TODO 在分布式文件系统中删除
|
||||||
|
|
||||||
|
datasetMapper.deleteBatch(datasetIds);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.bipt.intelligentapplicationorchestrationservice.mapper.DatasetMapper">
|
<mapper namespace="com.bipt.intelligentapplicationorchestrationservice.mapper.DatasetMapper">
|
||||||
|
<insert id="insert">
|
||||||
|
INSERT INTO dataset
|
||||||
|
(dataset_name,dataset_type,dataset_status,ds_path,args,create_time,update_time)
|
||||||
|
values (#{datasetName}, #{datasetType}, #{datasetStatus}, #{dsPath}, #{args},#{createTime},#{updateTime})
|
||||||
|
</insert>
|
||||||
|
|
||||||
<update id="updata">
|
<update id="updata">
|
||||||
update dataset
|
update dataset
|
||||||
@ -29,4 +34,30 @@
|
|||||||
</set>
|
</set>
|
||||||
where dataset_id = #{datasetId}
|
where dataset_id = #{datasetId}
|
||||||
</update>
|
</update>
|
||||||
|
<select id="pageQuery" resultType="com.bipt.intelligentapplicationorchestrationservice.pojo.DatasetVO">
|
||||||
|
SELECT * FROM dataset
|
||||||
|
<where>
|
||||||
|
<if test="datasetName != null and datasetName!=''">
|
||||||
|
dataset_name LIKE CONCAT('%', #{datasetName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="datasetType != null">
|
||||||
|
and dataset_type=#{datasetType}
|
||||||
|
</if>
|
||||||
|
<if test="datasetStatus != null">
|
||||||
|
and dataset_status=#{datasetStatus}
|
||||||
|
</if>
|
||||||
|
<if test="dsPath != null">
|
||||||
|
and ds_path=#{dsPath}
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
and create_time=#{createTime}
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
and create_time=#{createTime}
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
and update_time=#{updateTime}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Reference in New Issue
Block a user