数据回流,数据

This commit is contained in:
ire 2024-12-18 19:06:32 +08:00
parent d983fa649e
commit d2fa70dcf7
19 changed files with 788 additions and 1 deletions

View File

@ -13,6 +13,10 @@ public interface ErrorCodeConstants {
ErrorCode FINE_TUNING_TASK_NOT_EXISTS = new ErrorCode(10005, "微调任务不存在");
ErrorCode APPLICATION_NOT_EXISTS = new ErrorCode(10005, "应用名称服务不存在");
ErrorCode APPLICATION_NOT_EXISTS = new ErrorCode(10006, "应用名称服务不存在");
ErrorCode DATA_REFLUX_DATA_NOT_EXISTS = new ErrorCode(10007, "数据回流 —— 数据不存在");
ErrorCode DATA_REFLUX_CONFIG_NOT_EXISTS = new ErrorCode(10008, "数据回流不存在");
}

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.llm.controller.admin.datarefluxconfig;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.llm.controller.admin.datarefluxconfig.vo.*;
import cn.iocoder.yudao.module.llm.dal.dataobject.datarefluxconfig.DataRefluxConfigDO;
import cn.iocoder.yudao.module.llm.service.datarefluxconfig.DataRefluxConfigService;
@Tag(name = "管理后台 - 数据回流配置")
@RestController
@RequestMapping("/llm/data-reflux-config")
@Validated
public class DataRefluxConfigController {
@Resource
private DataRefluxConfigService dataRefluxConfigService;
@PostMapping("/create")
@Operation(summary = "创建数据回流配置")
@PreAuthorize("@ss.hasPermission('llm:data-reflux-config:create')")
public CommonResult<Long> createDataRefluxConfig(@Valid @RequestBody DataRefluxConfigSaveReqVO createReqVO) {
return success(dataRefluxConfigService.createDataRefluxConfig(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新数据回流配置")
@PreAuthorize("@ss.hasPermission('llm:data-reflux-config:update')")
public CommonResult<Boolean> updateDataRefluxConfig(@Valid @RequestBody DataRefluxConfigSaveReqVO updateReqVO) {
dataRefluxConfigService.updateDataRefluxConfig(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除数据回流配置")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('llm:data-reflux-config:delete')")
public CommonResult<Boolean> deleteDataRefluxConfig(@RequestParam("id") Long id) {
dataRefluxConfigService.deleteDataRefluxConfig(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得数据回流配置")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('llm:data-reflux-config:query')")
public CommonResult<DataRefluxConfigRespVO> getDataRefluxConfig(@RequestParam("id") Long id) {
DataRefluxConfigDO dataRefluxConfig = dataRefluxConfigService.getDataRefluxConfig(id);
return success(BeanUtils.toBean(dataRefluxConfig, DataRefluxConfigRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得数据回流配置分页")
@PreAuthorize("@ss.hasPermission('llm:data-reflux-config:query')")
public CommonResult<PageResult<DataRefluxConfigRespVO>> getDataRefluxConfigPage(@Valid DataRefluxConfigPageReqVO pageReqVO) {
PageResult<DataRefluxConfigDO> pageResult = dataRefluxConfigService.getDataRefluxConfigPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, DataRefluxConfigRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出数据回流配置 Excel")
@PreAuthorize("@ss.hasPermission('llm:data-reflux-config:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportDataRefluxConfigExcel(@Valid DataRefluxConfigPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<DataRefluxConfigDO> list = dataRefluxConfigService.getDataRefluxConfigPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "数据回流配置.xls", "数据", DataRefluxConfigRespVO.class,
BeanUtils.toBean(list, DataRefluxConfigRespVO.class));
}
}

View File

@ -0,0 +1,25 @@
package cn.iocoder.yudao.module.llm.controller.admin.datarefluxconfig.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 数据回流配置分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DataRefluxConfigPageReqVO extends PageParam {
@Schema(description = "模型服务ID", example = "2475")
private Long modelServiceId;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,27 @@
package cn.iocoder.yudao.module.llm.controller.admin.datarefluxconfig.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 数据回流配置 Response VO")
@Data
@ExcelIgnoreUnannotated
public class DataRefluxConfigRespVO {
@Schema(description = "配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "31011")
@ExcelProperty("配置ID")
private Long id;
@Schema(description = "模型服务ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2475")
@ExcelProperty("模型服务ID")
private Long modelServiceId;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.llm.controller.admin.datarefluxconfig.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 数据回流配置新增/修改 Request VO")
@Data
public class DataRefluxConfigSaveReqVO {
@Schema(description = "配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "31011")
private Long id;
@Schema(description = "模型服务ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2475")
@NotNull(message = "模型服务ID不能为空")
private Long modelServiceId;
}

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.llm.controller.admin.datarefluxdata;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.llm.controller.admin.datarefluxdata.vo.*;
import cn.iocoder.yudao.module.llm.dal.dataobject.datarefluxdata.DataRefluxDataDO;
import cn.iocoder.yudao.module.llm.service.datarefluxdata.DataRefluxDataService;
@Tag(name = "管理后台 - 数据回流 —— 数据")
@RestController
@RequestMapping("/llm/data-reflux-data")
@Validated
public class DataRefluxDataController {
@Resource
private DataRefluxDataService dataRefluxDataService;
@PostMapping("/create")
@Operation(summary = "创建数据回流 —— 数据")
@PreAuthorize("@ss.hasPermission('llm:data-reflux-data:create')")
public CommonResult<Long> createDataRefluxData(@Valid @RequestBody DataRefluxDataSaveReqVO createReqVO) {
return success(dataRefluxDataService.createDataRefluxData(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新数据回流 —— 数据")
@PreAuthorize("@ss.hasPermission('llm:data-reflux-data:update')")
public CommonResult<Boolean> updateDataRefluxData(@Valid @RequestBody DataRefluxDataSaveReqVO updateReqVO) {
dataRefluxDataService.updateDataRefluxData(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除数据回流 —— 数据")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('llm:data-reflux-data:delete')")
public CommonResult<Boolean> deleteDataRefluxData(@RequestParam("id") Long id) {
dataRefluxDataService.deleteDataRefluxData(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得数据回流 —— 数据")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('llm:data-reflux-data:query')")
public CommonResult<DataRefluxDataRespVO> getDataRefluxData(@RequestParam("id") Long id) {
DataRefluxDataDO dataRefluxData = dataRefluxDataService.getDataRefluxData(id);
return success(BeanUtils.toBean(dataRefluxData, DataRefluxDataRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得数据回流 —— 数据分页")
@PreAuthorize("@ss.hasPermission('llm:data-reflux-data:query')")
public CommonResult<PageResult<DataRefluxDataRespVO>> getDataRefluxDataPage(@Valid DataRefluxDataPageReqVO pageReqVO) {
PageResult<DataRefluxDataDO> pageResult = dataRefluxDataService.getDataRefluxDataPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, DataRefluxDataRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出数据回流 —— 数据 Excel")
@PreAuthorize("@ss.hasPermission('llm:data-reflux-data:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportDataRefluxDataExcel(@Valid DataRefluxDataPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<DataRefluxDataDO> list = dataRefluxDataService.getDataRefluxDataPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "数据回流 —— 数据.xls", "数据", DataRefluxDataRespVO.class,
BeanUtils.toBean(list, DataRefluxDataRespVO.class));
}
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.llm.controller.admin.datarefluxdata.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 数据回流 —— 数据分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class DataRefluxDataPageReqVO extends PageParam {
@Schema(description = "模型服务ID", example = "16823")
private Long modelServiceId;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "system")
private String system;
@Schema(description = "Prompt")
private String prompt;
@Schema(description = "Response")
private String response;
}

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.llm.controller.admin.datarefluxdata.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 数据回流 —— 数据 Response VO")
@Data
@ExcelIgnoreUnannotated
public class DataRefluxDataRespVO {
@Schema(description = "配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "11768")
@ExcelProperty("配置ID")
private Long id;
@Schema(description = "模型服务ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16823")
@ExcelProperty("模型服务ID")
private Long modelServiceId;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "system")
@ExcelProperty("system")
private String system;
@Schema(description = "Prompt")
@ExcelProperty("Prompt")
private String prompt;
@Schema(description = "Response")
@ExcelProperty("Response")
private String response;
}

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.module.llm.controller.admin.datarefluxdata.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 数据回流 —— 数据新增/修改 Request VO")
@Data
public class DataRefluxDataSaveReqVO {
@Schema(description = "配置ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "11768")
private Long id;
@Schema(description = "模型服务ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16823")
@NotNull(message = "模型服务ID不能为空")
private Long modelServiceId;
@Schema(description = "system")
private String system;
@Schema(description = "Prompt")
private String prompt;
@Schema(description = "Response")
private String response;
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.llm.dal.dataobject.datarefluxconfig;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 数据回流配置 DO
*
* @author 华大大模型
*/
@TableName("llm_data_reflux_config")
@KeySequence("llm_data_reflux_config_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DataRefluxConfigDO extends BaseDO {
/**
* 配置ID
*/
@TableId
private Long id;
/**
* 模型服务ID
*/
private Long modelServiceId;
}

View File

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.llm.dal.dataobject.datarefluxdata;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 数据回流 数据 DO
*
* @author 华大大模型
*/
@TableName("llm_data_reflux_data")
@KeySequence("llm_data_reflux_data_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DataRefluxDataDO extends BaseDO {
/**
* 配置ID
*/
@TableId
private Long id;
/**
* 模型服务ID
*/
private Long modelServiceId;
/**
* system
*/
private String system;
/**
* Prompt
*/
private String prompt;
/**
* Response
*/
private String response;
}

View File

@ -0,0 +1,27 @@
package cn.iocoder.yudao.module.llm.dal.mysql.datarefluxconfig;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.llm.dal.dataobject.datarefluxconfig.DataRefluxConfigDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.llm.controller.admin.datarefluxconfig.vo.*;
/**
* 数据回流配置 Mapper
*
* @author 华大大模型
*/
@Mapper
public interface DataRefluxConfigMapper extends BaseMapperX<DataRefluxConfigDO> {
default PageResult<DataRefluxConfigDO> selectPage(DataRefluxConfigPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<DataRefluxConfigDO>()
.eqIfPresent(DataRefluxConfigDO::getModelServiceId, reqVO.getModelServiceId())
.betweenIfPresent(DataRefluxConfigDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(DataRefluxConfigDO::getId));
}
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.llm.dal.mysql.datarefluxdata;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.llm.dal.dataobject.datarefluxdata.DataRefluxDataDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.llm.controller.admin.datarefluxdata.vo.*;
/**
* 数据回流 数据 Mapper
*
* @author 华大大模型
*/
@Mapper
public interface DataRefluxDataMapper extends BaseMapperX<DataRefluxDataDO> {
default PageResult<DataRefluxDataDO> selectPage(DataRefluxDataPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<DataRefluxDataDO>()
.eqIfPresent(DataRefluxDataDO::getModelServiceId, reqVO.getModelServiceId())
.betweenIfPresent(DataRefluxDataDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(DataRefluxDataDO::getSystem, reqVO.getSystem())
.eqIfPresent(DataRefluxDataDO::getPrompt, reqVO.getPrompt())
.eqIfPresent(DataRefluxDataDO::getResponse, reqVO.getResponse())
.orderByDesc(DataRefluxDataDO::getId));
}
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.llm.service.datarefluxconfig;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.llm.controller.admin.datarefluxconfig.vo.*;
import cn.iocoder.yudao.module.llm.dal.dataobject.datarefluxconfig.DataRefluxConfigDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 数据回流配置 Service 接口
*
* @author 华大大模型
*/
public interface DataRefluxConfigService {
/**
* 创建数据回流配置
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createDataRefluxConfig(@Valid DataRefluxConfigSaveReqVO createReqVO);
/**
* 更新数据回流配置
*
* @param updateReqVO 更新信息
*/
void updateDataRefluxConfig(@Valid DataRefluxConfigSaveReqVO updateReqVO);
/**
* 删除数据回流配置
*
* @param id 编号
*/
void deleteDataRefluxConfig(Long id);
/**
* 获得数据回流配置
*
* @param id 编号
* @return 数据回流配置
*/
DataRefluxConfigDO getDataRefluxConfig(Long id);
/**
* 获得数据回流配置分页
*
* @param pageReqVO 分页查询
* @return 数据回流配置分页
*/
PageResult<DataRefluxConfigDO> getDataRefluxConfigPage(DataRefluxConfigPageReqVO pageReqVO);
}

View File

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.llm.service.datarefluxconfig;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.llm.controller.admin.datarefluxconfig.vo.*;
import cn.iocoder.yudao.module.llm.dal.dataobject.datarefluxconfig.DataRefluxConfigDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.llm.dal.mysql.datarefluxconfig.DataRefluxConfigMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.llm.enums.ErrorCodeConstants.*;
/**
* 数据回流配置 Service 实现类
*
* @author 华大大模型
*/
@Service
@Validated
public class DataRefluxConfigServiceImpl implements DataRefluxConfigService {
@Resource
private DataRefluxConfigMapper dataRefluxConfigMapper;
@Override
public Long createDataRefluxConfig(DataRefluxConfigSaveReqVO createReqVO) {
// 插入
DataRefluxConfigDO dataRefluxConfig = BeanUtils.toBean(createReqVO, DataRefluxConfigDO.class);
dataRefluxConfigMapper.insert(dataRefluxConfig);
// 返回
return dataRefluxConfig.getId();
}
@Override
public void updateDataRefluxConfig(DataRefluxConfigSaveReqVO updateReqVO) {
// 校验存在
validateDataRefluxConfigExists(updateReqVO.getId());
// 更新
DataRefluxConfigDO updateObj = BeanUtils.toBean(updateReqVO, DataRefluxConfigDO.class);
dataRefluxConfigMapper.updateById(updateObj);
}
@Override
public void deleteDataRefluxConfig(Long id) {
// 校验存在
validateDataRefluxConfigExists(id);
// 删除
dataRefluxConfigMapper.deleteById(id);
}
private void validateDataRefluxConfigExists(Long id) {
if (dataRefluxConfigMapper.selectById(id) == null) {
throw exception(DATA_REFLUX_CONFIG_NOT_EXISTS);
}
}
@Override
public DataRefluxConfigDO getDataRefluxConfig(Long id) {
return dataRefluxConfigMapper.selectById(id);
}
@Override
public PageResult<DataRefluxConfigDO> getDataRefluxConfigPage(DataRefluxConfigPageReqVO pageReqVO) {
return dataRefluxConfigMapper.selectPage(pageReqVO);
}
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.llm.service.datarefluxdata;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.llm.controller.admin.datarefluxdata.vo.*;
import cn.iocoder.yudao.module.llm.dal.dataobject.datarefluxdata.DataRefluxDataDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 数据回流 数据 Service 接口
*
* @author 华大大模型
*/
public interface DataRefluxDataService {
/**
* 创建数据回流 数据
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createDataRefluxData(@Valid DataRefluxDataSaveReqVO createReqVO);
/**
* 更新数据回流 数据
*
* @param updateReqVO 更新信息
*/
void updateDataRefluxData(@Valid DataRefluxDataSaveReqVO updateReqVO);
/**
* 删除数据回流 数据
*
* @param id 编号
*/
void deleteDataRefluxData(Long id);
/**
* 获得数据回流 数据
*
* @param id 编号
* @return 数据回流 数据
*/
DataRefluxDataDO getDataRefluxData(Long id);
/**
* 获得数据回流 数据分页
*
* @param pageReqVO 分页查询
* @return 数据回流 数据分页
*/
PageResult<DataRefluxDataDO> getDataRefluxDataPage(DataRefluxDataPageReqVO pageReqVO);
}

View File

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.llm.service.datarefluxdata;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.llm.controller.admin.datarefluxdata.vo.*;
import cn.iocoder.yudao.module.llm.dal.dataobject.datarefluxdata.DataRefluxDataDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.llm.dal.mysql.datarefluxdata.DataRefluxDataMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.llm.enums.ErrorCodeConstants.*;
/**
* 数据回流 数据 Service 实现类
*
* @author 华大大模型
*/
@Service
@Validated
public class DataRefluxDataServiceImpl implements DataRefluxDataService {
@Resource
private DataRefluxDataMapper dataRefluxDataMapper;
@Override
public Long createDataRefluxData(DataRefluxDataSaveReqVO createReqVO) {
// 插入
DataRefluxDataDO dataRefluxData = BeanUtils.toBean(createReqVO, DataRefluxDataDO.class);
dataRefluxDataMapper.insert(dataRefluxData);
// 返回
return dataRefluxData.getId();
}
@Override
public void updateDataRefluxData(DataRefluxDataSaveReqVO updateReqVO) {
// 校验存在
validateDataRefluxDataExists(updateReqVO.getId());
// 更新
DataRefluxDataDO updateObj = BeanUtils.toBean(updateReqVO, DataRefluxDataDO.class);
dataRefluxDataMapper.updateById(updateObj);
}
@Override
public void deleteDataRefluxData(Long id) {
// 校验存在
validateDataRefluxDataExists(id);
// 删除
dataRefluxDataMapper.deleteById(id);
}
private void validateDataRefluxDataExists(Long id) {
if (dataRefluxDataMapper.selectById(id) == null) {
throw exception(DATA_REFLUX_DATA_NOT_EXISTS);
}
}
@Override
public DataRefluxDataDO getDataRefluxData(Long id) {
return dataRefluxDataMapper.selectById(id);
}
@Override
public PageResult<DataRefluxDataDO> getDataRefluxDataPage(DataRefluxDataPageReqVO pageReqVO) {
return dataRefluxDataMapper.selectPage(pageReqVO);
}
}

View File

@ -0,0 +1,12 @@
<?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">
<mapper namespace="cn.iocoder.yudao.module.llm.dal.mysql.datarefluxconfig.DataRefluxConfigMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -0,0 +1,12 @@
<?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">
<mapper namespace="cn.iocoder.yudao.module.llm.dal.mysql.datarefluxdata.DataRefluxDataMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>