fix: 提交标准标签
This commit is contained in:
@@ -0,0 +1,106 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.controller.admin.tag;
|
||||||
|
|
||||||
|
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.*;
|
||||||
|
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.EXPORT;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.controller.admin.tag.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.dataobject.tag.TagDO;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.service.tag.TagService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 标准标签")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/ydoyun/tag")
|
||||||
|
@Validated
|
||||||
|
public class TagController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TagService tagService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建标准标签")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag:create')")
|
||||||
|
public CommonResult<Long> createTag(@Valid @RequestBody TagSaveReqVO createReqVO) {
|
||||||
|
return success(tagService.createTag(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新标准标签")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag:update')")
|
||||||
|
public CommonResult<Boolean> updateTag(@Valid @RequestBody TagSaveReqVO updateReqVO) {
|
||||||
|
tagService.updateTag(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除标准标签")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTag(@RequestParam("id") Long id) {
|
||||||
|
tagService.deleteTag(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除标准标签")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTagList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
tagService.deleteTagListByIds(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得标准标签")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag:query')")
|
||||||
|
public CommonResult<TagRespVO> getTag(@RequestParam("id") Long id) {
|
||||||
|
TagDO tag = tagService.getTag(id);
|
||||||
|
return success(BeanUtils.toBean(tag, TagRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得标准标签分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag:query')")
|
||||||
|
public CommonResult<PageResult<TagRespVO>> getTagPage(@Valid TagPageReqVO pageReqVO) {
|
||||||
|
PageResult<TagDO> pageResult = tagService.getTagPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, TagRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list-by-type")
|
||||||
|
@Operation(summary = "按类型获取标签列表")
|
||||||
|
@Parameter(name = "type", description = "标签类型(product/store/supplier)")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag:query')")
|
||||||
|
public CommonResult<List<TagRespVO>> getTagListByType(@RequestParam(value = "type", required = false) String type) {
|
||||||
|
List<TagDO> list = tagService.getTagListByType(type);
|
||||||
|
return success(BeanUtils.toBean(list, TagRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出标准标签 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportTagExcel(@Valid TagPageReqVO pageReqVO, HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<TagDO> list = tagService.getTagPage(pageReqVO).getList();
|
||||||
|
ExcelUtils.write(response, "标准标签.xls", "数据", TagRespVO.class, BeanUtils.toBean(list, TagRespVO.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.controller.admin.tag.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
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
|
||||||
|
public class TagPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "标签名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "标签类型(product/store/supplier)")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Schema(description = "标签表达式")
|
||||||
|
private String expression;
|
||||||
|
|
||||||
|
@Schema(description = "标签颜色")
|
||||||
|
private String color;
|
||||||
|
|
||||||
|
@Schema(description = "SQL脚本")
|
||||||
|
private String sqlScript;
|
||||||
|
|
||||||
|
@Schema(description = "是否代入参数(0否 1是)")
|
||||||
|
private Boolean useParams;
|
||||||
|
|
||||||
|
@Schema(description = "参数列表(逗号分隔)")
|
||||||
|
private String params;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.controller.admin.tag.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import cn.idev.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 标准标签 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class TagRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID")
|
||||||
|
@ExcelProperty("主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "标签名称")
|
||||||
|
@ExcelProperty("标签名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "标签类型(product/store/supplier)")
|
||||||
|
@ExcelProperty("标签类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Schema(description = "标签表达式")
|
||||||
|
@ExcelProperty("标签表达式")
|
||||||
|
private String expression;
|
||||||
|
|
||||||
|
@Schema(description = "标签颜色")
|
||||||
|
@ExcelProperty("标签颜色")
|
||||||
|
private String color;
|
||||||
|
|
||||||
|
@Schema(description = "SQL脚本")
|
||||||
|
@ExcelProperty("SQL脚本")
|
||||||
|
private String sqlScript;
|
||||||
|
|
||||||
|
@Schema(description = "已拼接参数的SQL,执行时直接使用")
|
||||||
|
@ExcelProperty("已拼接SQL")
|
||||||
|
private String sqlScriptResolved;
|
||||||
|
|
||||||
|
@Schema(description = "是否代入参数(0否 1是)")
|
||||||
|
@ExcelProperty("是否代入参数")
|
||||||
|
private Boolean useParams;
|
||||||
|
|
||||||
|
@Schema(description = "参数列表(逗号分隔)")
|
||||||
|
@ExcelProperty("参数列表")
|
||||||
|
private String params;
|
||||||
|
|
||||||
|
@Schema(description = "参数值 JSON,如 {\"参数1\":\"28\",\"参数2\":\"90\"}")
|
||||||
|
private String paramValues;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.controller.admin.tag.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 标准标签新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class TagSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "标签名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "标签名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "标签类型(product/store/supplier)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "标签类型不能为空")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Schema(description = "标签表达式")
|
||||||
|
private String expression;
|
||||||
|
|
||||||
|
@Schema(description = "标签颜色")
|
||||||
|
private String color;
|
||||||
|
|
||||||
|
@Schema(description = "SQL脚本")
|
||||||
|
private String sqlScript;
|
||||||
|
|
||||||
|
@Schema(description = "已拼接参数的SQL,执行时直接使用")
|
||||||
|
private String sqlScriptResolved;
|
||||||
|
|
||||||
|
@Schema(description = "是否代入参数(0否 1是)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "是否代入参数不能为空")
|
||||||
|
private Boolean useParams;
|
||||||
|
|
||||||
|
@Schema(description = "参数列表(逗号分隔)")
|
||||||
|
private String params;
|
||||||
|
|
||||||
|
@Schema(description = "参数值 JSON,如 {\"参数1\":\"28\",\"参数2\":\"90\"}")
|
||||||
|
private String paramValues;
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.controller.admin.tagconfig;
|
||||||
|
|
||||||
|
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.*;
|
||||||
|
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.EXPORT;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.controller.admin.tagconfig.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.dataobject.tagconfig.TagConfigDO;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.service.tagconfig.TagConfigService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 标签基础配置")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/ydoyun/tag-config")
|
||||||
|
@Validated
|
||||||
|
public class TagConfigController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TagConfigService tagConfigService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建标签同步配置")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag-config:create')")
|
||||||
|
public CommonResult<Long> createTagConfig(@Valid @RequestBody TagConfigSaveReqVO createReqVO) {
|
||||||
|
return success(tagConfigService.createTagConfig(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新标签同步配置")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag-config:update')")
|
||||||
|
public CommonResult<Boolean> updateTagConfig(@Valid @RequestBody TagConfigSaveReqVO updateReqVO) {
|
||||||
|
tagConfigService.updateTagConfig(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除标签同步配置")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag-config:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTagConfig(@RequestParam("id") Long id) {
|
||||||
|
tagConfigService.deleteTagConfig(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得标签同步配置")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag-config:query')")
|
||||||
|
public CommonResult<TagConfigRespVO> getTagConfig(@RequestParam("id") Long id) {
|
||||||
|
TagConfigDO tagConfig = tagConfigService.getTagConfig(id);
|
||||||
|
return success(BeanUtils.toBean(tagConfig, TagConfigRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-by-database")
|
||||||
|
@Operation(summary = "根据数据源ID获得标签同步配置")
|
||||||
|
@Parameter(name = "databaseId", description = "数据源ID", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag-config:query')")
|
||||||
|
public CommonResult<TagConfigRespVO> getTagConfigByDatabaseId(@RequestParam("databaseId") Long databaseId) {
|
||||||
|
TagConfigDO tagConfig = tagConfigService.getTagConfigByDatabaseId(databaseId);
|
||||||
|
return success(BeanUtils.toBean(tagConfig, TagConfigRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-by-tenant")
|
||||||
|
@Operation(summary = "根据当前租户获得标签同步配置(每租户仅一条)")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag-config:query')")
|
||||||
|
public CommonResult<TagConfigRespVO> getTagConfigByTenant() {
|
||||||
|
TagConfigDO tagConfig = tagConfigService.getTagConfigByTenant();
|
||||||
|
return success(BeanUtils.toBean(tagConfig, TagConfigRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/save")
|
||||||
|
@Operation(summary = "统一保存(配置+标准标签)")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag-config:create') or @ss.hasPermission('ydoyun:tag-config:update')")
|
||||||
|
public CommonResult<Boolean> saveAll(@Valid @RequestBody TagConfigSaveAllReqVO reqVO) {
|
||||||
|
tagConfigService.saveAll(reqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得标签同步配置分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag-config:query')")
|
||||||
|
public CommonResult<PageResult<TagConfigRespVO>> getTagConfigPage(@Valid TagConfigPageReqVO pageReqVO) {
|
||||||
|
PageResult<TagConfigDO> pageResult = tagConfigService.getTagConfigPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, TagConfigRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/manual-sync")
|
||||||
|
@Operation(summary = "手动同步")
|
||||||
|
@Parameter(name = "tagConfigId", description = "标签配置ID", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag-config:sync')")
|
||||||
|
public CommonResult<Boolean> manualSync(@RequestParam("tagConfigId") Long tagConfigId) {
|
||||||
|
tagConfigService.manualSync(tagConfigId);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出标签同步配置 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag-config:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportTagConfigExcel(@Valid TagConfigPageReqVO pageReqVO, HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<TagConfigDO> list = tagConfigService.getTagConfigPage(pageReqVO).getList();
|
||||||
|
ExcelUtils.write(response, "标签同步配置.xls", "数据", TagConfigRespVO.class,
|
||||||
|
BeanUtils.toBean(list, TagConfigRespVO.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.controller.admin.tagconfig.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
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
|
||||||
|
public class TagConfigPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "同步数据源ID")
|
||||||
|
private Long databaseId;
|
||||||
|
|
||||||
|
@Schema(description = "定时任务表达式(CRON)")
|
||||||
|
private String cronExpression;
|
||||||
|
|
||||||
|
@Schema(description = "上次同步时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] lastSyncTime;
|
||||||
|
|
||||||
|
@Schema(description = "下次预计同步时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] nextSyncTime;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.controller.admin.tagconfig.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import cn.idev.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 标签同步配置 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class TagConfigRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID")
|
||||||
|
@ExcelProperty("主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "同步数据源ID")
|
||||||
|
@ExcelProperty("同步数据源ID")
|
||||||
|
private Long databaseId;
|
||||||
|
|
||||||
|
@Schema(description = "定时任务表达式(CRON)")
|
||||||
|
@ExcelProperty("定时任务表达式")
|
||||||
|
private String cronExpression;
|
||||||
|
|
||||||
|
@Schema(description = "是否开启自动同步(0否 1是)")
|
||||||
|
@ExcelProperty("自动同步")
|
||||||
|
private Boolean autoSync;
|
||||||
|
|
||||||
|
@Schema(description = "剔除大类(多选,逗号分隔)")
|
||||||
|
@ExcelProperty("剔除大类")
|
||||||
|
private String productCategoryIds;
|
||||||
|
|
||||||
|
@Schema(description = "剔除仓库(多选,逗号分隔)")
|
||||||
|
@ExcelProperty("剔除仓库")
|
||||||
|
private String syncWarehouseIds;
|
||||||
|
|
||||||
|
@Schema(description = "上次同步时间")
|
||||||
|
@ExcelProperty("上次同步时间")
|
||||||
|
private LocalDateTime lastSyncTime;
|
||||||
|
|
||||||
|
@Schema(description = "下次预计同步时间")
|
||||||
|
@ExcelProperty("下次预计同步时间")
|
||||||
|
private LocalDateTime nextSyncTime;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.controller.admin.tagconfig.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.controller.admin.tag.vo.TagSaveReqVO;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 标签配置统一保存 Request VO(配置+标准标签)")
|
||||||
|
@Data
|
||||||
|
public class TagConfigSaveAllReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "标签同步配置(可为空,不保存配置)")
|
||||||
|
private TagConfigSaveReqVO config;
|
||||||
|
|
||||||
|
@Schema(description = "标准标签列表")
|
||||||
|
@Valid
|
||||||
|
private List<TagSaveReqVO> tags = new ArrayList<>();
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.controller.admin.tagconfig.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 标签同步配置新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class TagConfigSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "同步数据源ID(ydoyun_report_database.id),新增时必填")
|
||||||
|
private Long databaseId;
|
||||||
|
|
||||||
|
@Schema(description = "定时任务表达式(CRON)")
|
||||||
|
private String cronExpression;
|
||||||
|
|
||||||
|
@Schema(description = "是否开启自动同步(0否 1是)")
|
||||||
|
private Boolean autoSync;
|
||||||
|
|
||||||
|
@Schema(description = "剔除大类(多选,逗号分隔)")
|
||||||
|
private String productCategoryIds;
|
||||||
|
|
||||||
|
@Schema(description = "剔除仓库(多选,逗号分隔)")
|
||||||
|
private String syncWarehouseIds;
|
||||||
|
|
||||||
|
@Schema(description = "上次同步时间")
|
||||||
|
private LocalDateTime lastSyncTime;
|
||||||
|
|
||||||
|
@Schema(description = "下次预计同步时间")
|
||||||
|
private LocalDateTime nextSyncTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.controller.admin.tagsyncdetail;
|
||||||
|
|
||||||
|
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 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.module.ydoyun.controller.admin.tagsyncdetail.vo.TagSyncDetailRespVO;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.dataobject.tagsyncdetail.TagSyncDetailDO;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.service.tagsyncdetail.TagSyncDetailService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 标签同步详情")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/ydoyun/tag-sync-detail")
|
||||||
|
@Validated
|
||||||
|
public class TagSyncDetailController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TagSyncDetailService tagSyncDetailService;
|
||||||
|
|
||||||
|
@GetMapping("/list-by-sync-history-id")
|
||||||
|
@Operation(summary = "根据同步记录ID获取详情列表")
|
||||||
|
@Parameter(name = "syncHistoryId", description = "同步记录ID", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag-sync-history:query')")
|
||||||
|
public CommonResult<List<TagSyncDetailRespVO>> getDetailListBySyncHistoryId(@RequestParam("syncHistoryId") Long syncHistoryId) {
|
||||||
|
List<TagSyncDetailDO> list = tagSyncDetailService.getDetailListBySyncHistoryId(syncHistoryId);
|
||||||
|
return success(BeanUtils.toBean(list, TagSyncDetailRespVO.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.controller.admin.tagsyncdetail.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 标签同步详情 Response VO")
|
||||||
|
@Data
|
||||||
|
public class TagSyncDetailRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "同步记录ID")
|
||||||
|
private Long syncHistoryId;
|
||||||
|
|
||||||
|
@Schema(description = "标签ID")
|
||||||
|
private Long tagId;
|
||||||
|
|
||||||
|
@Schema(description = "标签名称")
|
||||||
|
private String tagName;
|
||||||
|
|
||||||
|
@Schema(description = "标签类型")
|
||||||
|
private String tagType;
|
||||||
|
|
||||||
|
@Schema(description = "实际执行的SQL脚本")
|
||||||
|
private String sqlExecuted;
|
||||||
|
|
||||||
|
@Schema(description = "执行状态(success/fail)")
|
||||||
|
private String execStatus;
|
||||||
|
|
||||||
|
@Schema(description = "影响记录数")
|
||||||
|
private Long recordCount;
|
||||||
|
|
||||||
|
@Schema(description = "错误信息(失败时)")
|
||||||
|
private String errorMessage;
|
||||||
|
|
||||||
|
@Schema(description = "执行顺序")
|
||||||
|
private Integer execOrder;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.controller.admin.tagsynchistory;
|
||||||
|
|
||||||
|
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.*;
|
||||||
|
|
||||||
|
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.module.ydoyun.controller.admin.tagsynchistory.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.dataobject.tagsynchistory.TagSyncHistoryDO;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.service.tagsynchistory.TagSyncHistoryService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 标签同步历史")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/ydoyun/tag-sync-history")
|
||||||
|
@Validated
|
||||||
|
public class TagSyncHistoryController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TagSyncHistoryService tagSyncHistoryService;
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得标签同步历史")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag-sync-history:query')")
|
||||||
|
public CommonResult<TagSyncHistoryRespVO> getTagSyncHistory(@RequestParam("id") Long id) {
|
||||||
|
TagSyncHistoryDO history = tagSyncHistoryService.getTagSyncHistory(id);
|
||||||
|
return success(BeanUtils.toBean(history, TagSyncHistoryRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得标签同步历史分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('ydoyun:tag-sync-history:query')")
|
||||||
|
public CommonResult<PageResult<TagSyncHistoryRespVO>> getTagSyncHistoryPage(@Valid TagSyncHistoryPageReqVO pageReqVO) {
|
||||||
|
PageResult<TagSyncHistoryDO> pageResult = tagSyncHistoryService.getTagSyncHistoryPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, TagSyncHistoryRespVO.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.controller.admin.tagsynchistory.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
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
|
||||||
|
public class TagSyncHistoryPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "标签同步配置ID")
|
||||||
|
private Long tagConfigId;
|
||||||
|
|
||||||
|
@Schema(description = "同步类型(manual/cron)")
|
||||||
|
private String syncType;
|
||||||
|
|
||||||
|
@Schema(description = "同步时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] syncTime;
|
||||||
|
|
||||||
|
@Schema(description = "同步状态(success/fail)")
|
||||||
|
private String syncStatus;
|
||||||
|
|
||||||
|
@Schema(description = "同步记录数")
|
||||||
|
private Long recordCount;
|
||||||
|
|
||||||
|
@Schema(description = "错误信息")
|
||||||
|
private String errorMessage;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.controller.admin.tagsynchistory.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import cn.idev.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 标签同步历史 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class TagSyncHistoryRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID")
|
||||||
|
@ExcelProperty("主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "标签同步配置ID")
|
||||||
|
@ExcelProperty("标签同步配置ID")
|
||||||
|
private Long tagConfigId;
|
||||||
|
|
||||||
|
@Schema(description = "同步类型(manual/cron)")
|
||||||
|
@ExcelProperty("同步类型")
|
||||||
|
private String syncType;
|
||||||
|
|
||||||
|
@Schema(description = "同步时间")
|
||||||
|
@ExcelProperty("同步时间")
|
||||||
|
private LocalDateTime syncTime;
|
||||||
|
|
||||||
|
@Schema(description = "同步状态(success/fail/partial)")
|
||||||
|
@ExcelProperty("同步状态")
|
||||||
|
private String syncStatus;
|
||||||
|
|
||||||
|
@Schema(description = "本次同步标签总数")
|
||||||
|
@ExcelProperty("标签总数")
|
||||||
|
private Integer totalCount;
|
||||||
|
|
||||||
|
@Schema(description = "成功数")
|
||||||
|
@ExcelProperty("成功数")
|
||||||
|
private Integer successCount;
|
||||||
|
|
||||||
|
@Schema(description = "失败数")
|
||||||
|
@ExcelProperty("失败数")
|
||||||
|
private Integer failCount;
|
||||||
|
|
||||||
|
@Schema(description = "同步记录数")
|
||||||
|
@ExcelProperty("同步记录数")
|
||||||
|
private Long recordCount;
|
||||||
|
|
||||||
|
@Schema(description = "错误信息")
|
||||||
|
@ExcelProperty("错误信息")
|
||||||
|
private String errorMessage;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.dal.dataobject.tag;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标准标签 DO
|
||||||
|
*/
|
||||||
|
@TableName("ydoyun_tag")
|
||||||
|
@KeySequence("ydoyun_tag_seq")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class TagDO extends BaseDO {
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
private String name;
|
||||||
|
private String type;
|
||||||
|
private String expression;
|
||||||
|
private String color;
|
||||||
|
private String sqlScript;
|
||||||
|
private String sqlScriptResolved;
|
||||||
|
private Boolean useParams;
|
||||||
|
private String params;
|
||||||
|
/** 参数值 JSON,如 {"参数1":"28","参数2":"90"} */
|
||||||
|
private String paramValues;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.dal.dataobject.tagconfig;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标签同步配置 DO
|
||||||
|
*/
|
||||||
|
@TableName("ydoyun_tag_config")
|
||||||
|
@KeySequence("ydoyun_tag_config_seq")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class TagConfigDO extends BaseDO {
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
private Long databaseId;
|
||||||
|
private String cronExpression;
|
||||||
|
private Boolean autoSync;
|
||||||
|
private String productCategoryIds;
|
||||||
|
private String syncWarehouseIds;
|
||||||
|
private LocalDateTime lastSyncTime;
|
||||||
|
private LocalDateTime nextSyncTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.dal.dataobject.tagsyncdetail;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标签同步详情 DO(每条标签的执行明细)
|
||||||
|
*/
|
||||||
|
@TableName("ydoyun_tag_sync_detail")
|
||||||
|
@KeySequence("ydoyun_tag_sync_detail_seq")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class TagSyncDetailDO extends BaseDO {
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
private Long syncHistoryId;
|
||||||
|
private Long tagId;
|
||||||
|
private String tagName;
|
||||||
|
private String tagType;
|
||||||
|
private String sqlExecuted;
|
||||||
|
private String execStatus;
|
||||||
|
private Long recordCount;
|
||||||
|
private String errorMessage;
|
||||||
|
private Integer execOrder;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.dal.dataobject.tagsynchistory;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标签同步历史 DO
|
||||||
|
*/
|
||||||
|
@TableName("ydoyun_tag_sync_history")
|
||||||
|
@KeySequence("ydoyun_tag_sync_history_seq")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class TagSyncHistoryDO extends BaseDO {
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
private Long tagConfigId;
|
||||||
|
private String syncType;
|
||||||
|
private LocalDateTime syncTime;
|
||||||
|
private String syncStatus;
|
||||||
|
private Integer totalCount;
|
||||||
|
private Integer successCount;
|
||||||
|
private Integer failCount;
|
||||||
|
private Long recordCount;
|
||||||
|
private String errorMessage;
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.dal.mysql.tag;
|
||||||
|
|
||||||
|
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.ydoyun.dal.dataobject.tag.TagDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.controller.admin.tag.vo.TagPageReqVO;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TagMapper extends BaseMapperX<TagDO> {
|
||||||
|
|
||||||
|
default PageResult<TagDO> selectPage(TagPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<TagDO>()
|
||||||
|
.likeIfPresent(TagDO::getName, reqVO.getName())
|
||||||
|
.eqIfPresent(TagDO::getType, reqVO.getType())
|
||||||
|
.eqIfPresent(TagDO::getExpression, reqVO.getExpression())
|
||||||
|
.eqIfPresent(TagDO::getColor, reqVO.getColor())
|
||||||
|
.eqIfPresent(TagDO::getSqlScript, reqVO.getSqlScript())
|
||||||
|
.eqIfPresent(TagDO::getUseParams, reqVO.getUseParams())
|
||||||
|
.eqIfPresent(TagDO::getParams, reqVO.getParams())
|
||||||
|
.betweenIfPresent(TagDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(TagDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
default java.util.List<TagDO> selectListByType(String type) {
|
||||||
|
return selectList(new LambdaQueryWrapperX<TagDO>()
|
||||||
|
.eqIfPresent(TagDO::getType, type)
|
||||||
|
.orderByDesc(TagDO::getId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.dal.mysql.tagconfig;
|
||||||
|
|
||||||
|
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.ydoyun.dal.dataobject.tagconfig.TagConfigDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.controller.admin.tagconfig.vo.TagConfigPageReqVO;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TagConfigMapper extends BaseMapperX<TagConfigDO> {
|
||||||
|
|
||||||
|
default PageResult<TagConfigDO> selectPage(TagConfigPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<TagConfigDO>()
|
||||||
|
.eqIfPresent(TagConfigDO::getDatabaseId, reqVO.getDatabaseId())
|
||||||
|
.eqIfPresent(TagConfigDO::getCronExpression, reqVO.getCronExpression())
|
||||||
|
.betweenIfPresent(TagConfigDO::getLastSyncTime, reqVO.getLastSyncTime())
|
||||||
|
.betweenIfPresent(TagConfigDO::getNextSyncTime, reqVO.getNextSyncTime())
|
||||||
|
.betweenIfPresent(TagConfigDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(TagConfigDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
default TagConfigDO selectByDatabaseId(Long databaseId) {
|
||||||
|
return selectOne(TagConfigDO::getDatabaseId, databaseId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 根据租户查询配置(每租户仅一条) */
|
||||||
|
default TagConfigDO selectOneByTenant() {
|
||||||
|
return selectOne(new LambdaQueryWrapperX<TagConfigDO>().last("LIMIT 1"));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.dal.mysql.tagsyncdetail;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.dataobject.tagsyncdetail.TagSyncDetailDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TagSyncDetailMapper extends BaseMapperX<TagSyncDetailDO> {
|
||||||
|
|
||||||
|
default List<TagSyncDetailDO> selectListBySyncHistoryId(Long syncHistoryId) {
|
||||||
|
return selectList(new LambdaQueryWrapperX<TagSyncDetailDO>()
|
||||||
|
.eq(TagSyncDetailDO::getSyncHistoryId, syncHistoryId)
|
||||||
|
.orderByAsc(TagSyncDetailDO::getExecOrder));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.dal.mysql.tagsynchistory;
|
||||||
|
|
||||||
|
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.ydoyun.dal.dataobject.tagsynchistory.TagSyncHistoryDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.controller.admin.tagsynchistory.vo.TagSyncHistoryPageReqVO;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TagSyncHistoryMapper extends BaseMapperX<TagSyncHistoryDO> {
|
||||||
|
|
||||||
|
default PageResult<TagSyncHistoryDO> selectPage(TagSyncHistoryPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<TagSyncHistoryDO>()
|
||||||
|
.eqIfPresent(TagSyncHistoryDO::getTagConfigId, reqVO.getTagConfigId())
|
||||||
|
.eqIfPresent(TagSyncHistoryDO::getSyncType, reqVO.getSyncType())
|
||||||
|
.betweenIfPresent(TagSyncHistoryDO::getSyncTime, reqVO.getSyncTime())
|
||||||
|
.eqIfPresent(TagSyncHistoryDO::getSyncStatus, reqVO.getSyncStatus())
|
||||||
|
.eqIfPresent(TagSyncHistoryDO::getRecordCount, reqVO.getRecordCount())
|
||||||
|
.likeIfPresent(TagSyncHistoryDO::getErrorMessage, reqVO.getErrorMessage())
|
||||||
|
.betweenIfPresent(TagSyncHistoryDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(TagSyncHistoryDO::getId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,13 +2,7 @@ package cn.iocoder.yudao.module.ydoyun.enums;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||||
|
|
||||||
/**
|
|
||||||
* Report 错误码枚举类
|
|
||||||
*
|
|
||||||
* report 系统,使用 1-003-000-000 段
|
|
||||||
*/
|
|
||||||
public interface ErrorCodeConstants {
|
public interface ErrorCodeConstants {
|
||||||
|
|
||||||
// TODO 待办:请将下面的错误码复制到 yudao-module-ydoyun 模块的 ErrorCodeConstants 类中。注意,请给“TODO 补充编号”设置一个错误码编号!!!
|
// TODO 待办:请将下面的错误码复制到 yudao-module-ydoyun 模块的 ErrorCodeConstants 类中。注意,请给“TODO 补充编号”设置一个错误码编号!!!
|
||||||
// ========== 报表规则模板 1-024-000-000 ==========
|
// ========== 报表规则模板 1-024-000-000 ==========
|
||||||
ErrorCode REPORT_TEMPLATE_NOT_EXISTS = new ErrorCode(1_024_000_000, "yudao-module-ydoyun 衣朵云报表项目不存在");
|
ErrorCode REPORT_TEMPLATE_NOT_EXISTS = new ErrorCode(1_024_000_000, "yudao-module-ydoyun 衣朵云报表项目不存在");
|
||||||
@@ -26,4 +20,8 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode STORE_NOT_EXISTS = new ErrorCode(1_024_000_008, "门店不存在");
|
ErrorCode STORE_NOT_EXISTS = new ErrorCode(1_024_000_008, "门店不存在");
|
||||||
ErrorCode STORE_USER_NOT_EXISTS = new ErrorCode(1_024_000_009, "门店用户记录不存在");
|
ErrorCode STORE_USER_NOT_EXISTS = new ErrorCode(1_024_000_009, "门店用户记录不存在");
|
||||||
ErrorCode CUSTOM_TAG_NOT_EXISTS = new ErrorCode(1_024_000_010, "自定义标签不存在");
|
ErrorCode CUSTOM_TAG_NOT_EXISTS = new ErrorCode(1_024_000_010, "自定义标签不存在");
|
||||||
|
ErrorCode TAG_NOT_EXISTS = new ErrorCode(1_001_001_001, "标准标签不存在");
|
||||||
|
ErrorCode TAG_CONFIG_NOT_EXISTS = new ErrorCode(1_001_001_002, "标签同步配置不存在");
|
||||||
|
ErrorCode TAG_SYNC_HISTORY_NOT_EXISTS = new ErrorCode(1_001_001_003, "标签同步历史不存在");
|
||||||
|
ErrorCode TAG_CONFIG_DATABASE_REQUIRED = new ErrorCode(1_001_001_004, "新增配置时同步数据源不能为空");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.service.tag;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.controller.admin.tag.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.dataobject.tag.TagDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
public interface TagService {
|
||||||
|
|
||||||
|
Long createTag(@Valid TagSaveReqVO createReqVO);
|
||||||
|
void updateTag(@Valid TagSaveReqVO updateReqVO);
|
||||||
|
void deleteTag(Long id);
|
||||||
|
void deleteTagListByIds(List<Long> ids);
|
||||||
|
TagDO getTag(Long id);
|
||||||
|
PageResult<TagDO> getTagPage(TagPageReqVO pageReqVO);
|
||||||
|
List<TagDO> getTagListByType(String type);
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.service.tag;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.controller.admin.tag.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.dataobject.tag.TagDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.mysql.tag.TagMapper;
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.ydoyun.enums.ErrorCodeConstants.TAG_NOT_EXISTS;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class TagServiceImpl implements TagService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TagMapper tagMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createTag(TagSaveReqVO createReqVO) {
|
||||||
|
TagDO tag = BeanUtils.toBean(createReqVO, TagDO.class);
|
||||||
|
tagMapper.insert(tag);
|
||||||
|
return tag.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTag(TagSaveReqVO updateReqVO) {
|
||||||
|
validateTagExists(updateReqVO.getId());
|
||||||
|
TagDO updateObj = BeanUtils.toBean(updateReqVO, TagDO.class);
|
||||||
|
tagMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTag(Long id) {
|
||||||
|
validateTagExists(id);
|
||||||
|
tagMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTagListByIds(List<Long> ids) {
|
||||||
|
tagMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateTagExists(Long id) {
|
||||||
|
if (tagMapper.selectById(id) == null) {
|
||||||
|
throw exception(TAG_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TagDO getTag(Long id) {
|
||||||
|
return tagMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<TagDO> getTagPage(TagPageReqVO pageReqVO) {
|
||||||
|
return tagMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TagDO> getTagListByType(String type) {
|
||||||
|
return tagMapper.selectListByType(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.service.tagconfig;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.controller.admin.tagconfig.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.dataobject.tagconfig.TagConfigDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
public interface TagConfigService {
|
||||||
|
|
||||||
|
Long createTagConfig(@Valid TagConfigSaveReqVO createReqVO);
|
||||||
|
void updateTagConfig(@Valid TagConfigSaveReqVO updateReqVO);
|
||||||
|
void deleteTagConfig(Long id);
|
||||||
|
void deleteTagConfigListByIds(List<Long> ids);
|
||||||
|
TagConfigDO getTagConfig(Long id);
|
||||||
|
TagConfigDO getTagConfigByDatabaseId(Long databaseId);
|
||||||
|
TagConfigDO getTagConfigByTenant();
|
||||||
|
PageResult<TagConfigDO> getTagConfigPage(TagConfigPageReqVO pageReqVO);
|
||||||
|
void saveAll(@Valid TagConfigSaveAllReqVO reqVO);
|
||||||
|
void manualSync(Long tagConfigId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.service.tagconfig;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.controller.admin.tag.vo.TagSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.controller.admin.tagconfig.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.dataobject.tagconfig.TagConfigDO;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.dataobject.tagsynchistory.TagSyncHistoryDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.mysql.tagconfig.TagConfigMapper;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.mysql.tagsynchistory.TagSyncHistoryMapper;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.service.tag.TagService;
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.ydoyun.enums.ErrorCodeConstants.TAG_CONFIG_DATABASE_REQUIRED;
|
||||||
|
import static cn.iocoder.yudao.module.ydoyun.enums.ErrorCodeConstants.TAG_CONFIG_NOT_EXISTS;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class TagConfigServiceImpl implements TagConfigService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TagConfigMapper tagConfigMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TagSyncHistoryMapper tagSyncHistoryMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TagService tagService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createTagConfig(TagConfigSaveReqVO createReqVO) {
|
||||||
|
TagConfigDO tagConfig = BeanUtils.toBean(createReqVO, TagConfigDO.class);
|
||||||
|
tagConfigMapper.insert(tagConfig);
|
||||||
|
return tagConfig.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTagConfig(TagConfigSaveReqVO updateReqVO) {
|
||||||
|
validateTagConfigExists(updateReqVO.getId());
|
||||||
|
TagConfigDO updateObj = BeanUtils.toBean(updateReqVO, TagConfigDO.class);
|
||||||
|
tagConfigMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTagConfig(Long id) {
|
||||||
|
validateTagConfigExists(id);
|
||||||
|
tagConfigMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTagConfigListByIds(List<Long> ids) {
|
||||||
|
tagConfigMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateTagConfigExists(Long id) {
|
||||||
|
if (tagConfigMapper.selectById(id) == null) {
|
||||||
|
throw exception(TAG_CONFIG_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TagConfigDO getTagConfig(Long id) {
|
||||||
|
return tagConfigMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TagConfigDO getTagConfigByDatabaseId(Long databaseId) {
|
||||||
|
return tagConfigMapper.selectByDatabaseId(databaseId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TagConfigDO getTagConfigByTenant() {
|
||||||
|
return tagConfigMapper.selectOneByTenant();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveAll(TagConfigSaveAllReqVO reqVO) {
|
||||||
|
if (reqVO.getConfig() != null) {
|
||||||
|
TagConfigSaveReqVO config = reqVO.getConfig();
|
||||||
|
if (config.getId() != null) {
|
||||||
|
validateTagConfigExists(config.getId());
|
||||||
|
TagConfigDO updateObj = BeanUtils.toBean(config, TagConfigDO.class);
|
||||||
|
tagConfigMapper.updateById(updateObj);
|
||||||
|
} else {
|
||||||
|
TagConfigDO existing = tagConfigMapper.selectOneByTenant();
|
||||||
|
if (existing != null) {
|
||||||
|
config.setId(existing.getId());
|
||||||
|
TagConfigDO updateObj = BeanUtils.toBean(config, TagConfigDO.class);
|
||||||
|
tagConfigMapper.updateById(updateObj);
|
||||||
|
} else {
|
||||||
|
if (config.getDatabaseId() == null) {
|
||||||
|
throw exception(TAG_CONFIG_DATABASE_REQUIRED);
|
||||||
|
}
|
||||||
|
TagConfigDO tagConfig = BeanUtils.toBean(config, TagConfigDO.class);
|
||||||
|
tagConfigMapper.insert(tagConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (reqVO.getTags() != null && !reqVO.getTags().isEmpty()) {
|
||||||
|
for (TagSaveReqVO tagVO : reqVO.getTags()) {
|
||||||
|
if (tagVO.getId() != null) {
|
||||||
|
tagService.updateTag(tagVO);
|
||||||
|
} else {
|
||||||
|
tagService.createTag(tagVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<TagConfigDO> getTagConfigPage(TagConfigPageReqVO pageReqVO) {
|
||||||
|
return tagConfigMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void manualSync(Long tagConfigId) {
|
||||||
|
validateTagConfigExists(tagConfigId);
|
||||||
|
TagConfigDO config = tagConfigMapper.selectById(tagConfigId);
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
TagSyncHistoryDO history = TagSyncHistoryDO.builder()
|
||||||
|
.tagConfigId(tagConfigId)
|
||||||
|
.syncType("manual")
|
||||||
|
.syncTime(now)
|
||||||
|
.syncStatus("success")
|
||||||
|
.totalCount(0)
|
||||||
|
.successCount(0)
|
||||||
|
.failCount(0)
|
||||||
|
.recordCount(0L)
|
||||||
|
.build();
|
||||||
|
tagSyncHistoryMapper.insert(history);
|
||||||
|
config.setLastSyncTime(now);
|
||||||
|
tagConfigMapper.updateById(config);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.service.tagsyncdetail;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.dataobject.tagsyncdetail.TagSyncDetailDO;
|
||||||
|
|
||||||
|
public interface TagSyncDetailService {
|
||||||
|
|
||||||
|
List<TagSyncDetailDO> getDetailListBySyncHistoryId(Long syncHistoryId);
|
||||||
|
|
||||||
|
void insertBatch(List<TagSyncDetailDO> list);
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.service.tagsyncdetail;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.dataobject.tagsyncdetail.TagSyncDetailDO;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.mysql.tagsyncdetail.TagSyncDetailMapper;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class TagSyncDetailServiceImpl implements TagSyncDetailService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TagSyncDetailMapper tagSyncDetailMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TagSyncDetailDO> getDetailListBySyncHistoryId(Long syncHistoryId) {
|
||||||
|
return tagSyncDetailMapper.selectListBySyncHistoryId(syncHistoryId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertBatch(List<TagSyncDetailDO> list) {
|
||||||
|
if (list == null || list.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
list.forEach(tagSyncDetailMapper::insert);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.service.tagsynchistory;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.controller.admin.tagsynchistory.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.dataobject.tagsynchistory.TagSyncHistoryDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
public interface TagSyncHistoryService {
|
||||||
|
|
||||||
|
PageResult<TagSyncHistoryDO> getTagSyncHistoryPage(TagSyncHistoryPageReqVO pageReqVO);
|
||||||
|
TagSyncHistoryDO getTagSyncHistory(Long id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package cn.iocoder.yudao.module.ydoyun.service.tagsynchistory;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.controller.admin.tagsynchistory.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.dataobject.tagsynchistory.TagSyncHistoryDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.ydoyun.dal.mysql.tagsynchistory.TagSyncHistoryMapper;
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.ydoyun.enums.ErrorCodeConstants.TAG_SYNC_HISTORY_NOT_EXISTS;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class TagSyncHistoryServiceImpl implements TagSyncHistoryService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TagSyncHistoryMapper tagSyncHistoryMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<TagSyncHistoryDO> getTagSyncHistoryPage(TagSyncHistoryPageReqVO pageReqVO) {
|
||||||
|
return tagSyncHistoryMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TagSyncHistoryDO getTagSyncHistory(Long id) {
|
||||||
|
TagSyncHistoryDO history = tagSyncHistoryMapper.selectById(id);
|
||||||
|
if (history == null) {
|
||||||
|
throw exception(TAG_SYNC_HISTORY_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
return history;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?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.ydoyun.dal.mysql.tag.TagMapper">
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?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.ydoyun.dal.mysql.tagconfig.TagConfigMapper">
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?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.ydoyun.dal.mysql.tagsyncdetail.TagSyncDetailMapper">
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?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.ydoyun.dal.mysql.tagsynchistory.TagSyncHistoryMapper">
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user