Merge remote-tracking branch 'origin/dev' into dev
commit
89045be56c
1
pom.xml
1
pom.xml
|
@ -24,6 +24,7 @@
|
|||
<module>srt-cloud-gateway</module>
|
||||
<module>srt-data-development</module>
|
||||
<module>srt-cloud-data-governance</module>
|
||||
<module>srt-cloud-data-service</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -73,6 +73,10 @@
|
|||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -6,8 +6,9 @@ import net.srt.convert.DatastandardConvert;
|
|||
import net.srt.entity.DatastandardEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.query.StandardManagementQuery;
|
||||
import net.srt.query.DatastandrdQuery;
|
||||
import net.srt.service.DatastandardService;
|
||||
import net.srt.vo.DatastandardVo;
|
||||
import net.srt.vo.MetamodelPropertyVO;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -33,15 +34,15 @@ public class DatastandardController {
|
|||
|
||||
@GetMapping("page")
|
||||
@Operation(summary = "分页")
|
||||
public Result<PageResult<StandardManagementVo>> page(@Valid StandardManagementQuery query){
|
||||
PageResult<StandardManagementVo> page = datastandardService.page(query);
|
||||
public Result<PageResult<DatastandardVo>> page(@Valid DatastandrdQuery query){
|
||||
PageResult<DatastandardVo> page = datastandardService.page(query);
|
||||
return Result.ok(page);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("{id}")
|
||||
@Operation(summary ="信息")
|
||||
public Result<StandardManagementVo> get(@PathVariable("id") Integer categoryId) {
|
||||
public Result<DatastandardVo> get(@PathVariable("id") Integer categoryId) {
|
||||
DatastandardEntity entity = datastandardService.getById(categoryId);
|
||||
return Result.ok(DatastandardConvert.INSTANCE.convert(entity));
|
||||
}
|
||||
|
@ -57,15 +58,15 @@ public class DatastandardController {
|
|||
|
||||
@PostMapping
|
||||
@Operation(summary = "保存")
|
||||
public Result<String> save(@RequestBody DatastandardEntity entity) {
|
||||
datastandardService.save(entity);
|
||||
public Result<String> save(@RequestBody DatastandardVo vo) {
|
||||
datastandardService.save(vo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改")
|
||||
public Result<String> update(@RequestBody @Valid DatastandardEntity datastandardEntity){
|
||||
datastandardService.update1(datastandardEntity);
|
||||
public Result<String> update(@RequestBody @Valid DatastandardVo vo){
|
||||
datastandardService.update1(vo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,17 +3,18 @@ package net.srt.controller;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.convert.MetadataCollectConvert;
|
||||
import net.srt.entity.MetadataCollectEntity;
|
||||
import net.srt.entity.MetadataCollectQuery;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.service.MetadataCollectService;
|
||||
import net.srt.vo.MetadataCollectVO;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("metadata-collect")
|
||||
|
@ -24,8 +25,66 @@ public class MetadataCollectController {
|
|||
|
||||
@GetMapping("page")
|
||||
@Operation(summary = "分页")
|
||||
@PreAuthorize("hasAuthority('data-governance:metadata-collect:page')")
|
||||
public Result<PageResult<MetadataCollectVO>> page(@Valid MetadataCollectQuery query){
|
||||
PageResult<MetadataCollectVO> page = metadataCollectService.page(query);
|
||||
return Result.ok(page);
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@Operation(summary = "信息")
|
||||
@PreAuthorize("hasAuthority('data-governance:metadata-collect:info')")
|
||||
public Result<MetadataCollectVO> get(@PathVariable("id") Long id){
|
||||
MetadataCollectEntity entity = metadataCollectService.getById(id);
|
||||
return Result.ok(MetadataCollectConvert.INSTANCE.convert(entity));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "保存")
|
||||
@PreAuthorize("hasAuthority('data-governance:metadata-collect:save')")
|
||||
public Result<String> save(@RequestBody MetadataCollectVO vo){
|
||||
metadataCollectService.save(vo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改")
|
||||
@PreAuthorize("hasAuthority('data-governance:metadata-collect:update')")
|
||||
public Result<String> update(@RequestBody @Valid MetadataCollectVO vo){
|
||||
metadataCollectService.update(vo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PutMapping("/release/{id}")
|
||||
@Operation(summary = "发布")
|
||||
@PreAuthorize("hasAuthority('data-governance:metadata-collect:release')")
|
||||
public Result<String> release(@PathVariable Long id){
|
||||
metadataCollectService.release(id);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PutMapping("/cancel/{id}")
|
||||
@Operation(summary = "取消发布")
|
||||
@PreAuthorize("hasAuthority('data-governance:metadata-collect:cancel')")
|
||||
public Result<String> cancel(@PathVariable Long id){
|
||||
metadataCollectService.cancel(id);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PostMapping("hand-run/{id}")
|
||||
@Operation(summary = "手动执行")
|
||||
@PreAuthorize("hasAuthority('data-governance:metadata-collect:hand-run')")
|
||||
public Result<String> handRun(@PathVariable Long id){
|
||||
metadataCollectService.handRun(id);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@PreAuthorize("hasAuthority('data-governance:metadata-collect:delete')")
|
||||
public Result<String> delete(@RequestBody List<Long> idList){
|
||||
metadataCollectService.delete(idList);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ import net.srt.vo.StandardManagementVo;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -21,46 +23,39 @@ import java.util.List;
|
|||
* @Date: 2023-12-20 11:30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/standard-category")
|
||||
@Tag(name = "标准管理列表")
|
||||
@RequestMapping("standard-category")
|
||||
@Tag(name = "数据开发-调度中心目录")
|
||||
public class StandardController {
|
||||
@Autowired
|
||||
private StandardService standardService;
|
||||
@GetMapping("list-tree")
|
||||
StandardService standardService;
|
||||
|
||||
@GetMapping("/list-tree")
|
||||
@Operation(summary = "查询文件分组树")
|
||||
public Result<List<TreeNodeVo>> listTree() {
|
||||
return Result.ok(standardService.listTree());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@Operation(summary = "根据id获取")
|
||||
public Result<TreeNodeVo> getById(@PathVariable Integer id) {
|
||||
StandardEntity entity = standardService.getById(id);
|
||||
TreeNodeVo nodeVo = BeanUtil.copyProperties(entity, TreeNodeVo::new);
|
||||
nodeVo.setLabel(entity.getName());
|
||||
nodeVo.setParentPath(entity.getPath().contains("/") ? entity.getPath().substring(0, entity.getPath().lastIndexOf("/")) : null);
|
||||
return Result.ok(nodeVo);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "保存")
|
||||
public Result<String > save(@RequestBody StandardEntity standardEntity){
|
||||
standardService.save1(standardEntity);
|
||||
public Result<String> save(@RequestBody StandardManagementVo vo) {
|
||||
standardService.save1(vo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改")
|
||||
public Result<String > update(@RequestBody StandardEntity standardEntity){
|
||||
standardService.update1(standardEntity);
|
||||
return Result.ok();
|
||||
}
|
||||
@DeleteMapping("/id")
|
||||
@Operation(summary = "删除")
|
||||
public Result<String > del(@PathVariable Long id){
|
||||
standardService.del(id);
|
||||
public Result<String> update(@RequestBody StandardManagementVo vo) {
|
||||
standardService.update1(vo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public Result<String> delete(Long id) {
|
||||
standardService.delete(id);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.entity.DatastandardEntity;
|
||||
import net.srt.vo.DatastandardVo;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
@ -19,8 +20,10 @@ public interface DatastandardConvert {
|
|||
DatastandardConvert INSTANCE = Mappers.getMapper(DatastandardConvert.class);
|
||||
|
||||
|
||||
List<StandardManagementVo> convertList(List<DatastandardEntity> list);
|
||||
List<DatastandardVo> convertList(List<DatastandardEntity> list);
|
||||
|
||||
StandardManagementVo convert(DatastandardEntity entity);
|
||||
|
||||
DatastandardVo convert(DatastandardEntity entity);
|
||||
DatastandardEntity convert(DatastandardVo entity);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.entity.StandardEntity;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : StandardConvert
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 12:14
|
||||
*/
|
||||
@Mapper
|
||||
public interface StandardConvert {
|
||||
|
||||
StandardConvert INSTANCE = Mappers.getMapper(StandardConvert.class);
|
||||
|
||||
StandardEntity convert(StandardManagementVo vo);
|
||||
|
||||
StandardManagementVo convert(StandardEntity entity);
|
||||
|
||||
List<StandardManagementVo> convertList(List<StandardEntity> list);
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* 文件分组表
|
||||
*
|
||||
* @author zrx 985134801@qq.com
|
||||
* @since 1.0.0 2022-11-12
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@SuperBuilder
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("data_file_category")
|
||||
public class DatagovernanceEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 父级id(顶级为0)
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 分组序号
|
||||
*/
|
||||
private Integer orderNo;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 分组路径
|
||||
*/
|
||||
private String path;
|
||||
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
}
|
|
@ -17,8 +17,6 @@ import net.srt.framework.mybatis.entity.BaseEntity;
|
|||
@TableName("standard_management")
|
||||
public class DatastandardEntity extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId("id")
|
||||
private Long id;
|
||||
private Integer categoryId;
|
||||
private String engName;
|
||||
private String cnName;
|
||||
|
@ -30,10 +28,8 @@ public class DatastandardEntity extends BaseEntity {
|
|||
private Integer standardCodeId;
|
||||
private Integer type;
|
||||
private String note;
|
||||
private Integer projectId;
|
||||
private Long projectId;
|
||||
private Integer status;
|
||||
private Integer version;
|
||||
private Integer deleted;
|
||||
private Integer ifStandardRel;
|
||||
|
||||
}
|
||||
|
|
|
@ -15,11 +15,11 @@ import net.srt.framework.mybatis.entity.BaseEntity;
|
|||
* @since 1.0.0 2022-11-12
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@SuperBuilder
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("data_file_category")
|
||||
@TableName(value = "data_dispatch_catalogue", autoResultMap = true)
|
||||
public class StandardEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
|
@ -53,5 +53,4 @@ public class StandardEntity extends BaseEntity {
|
|||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.srt.framework.common.query.Query;
|
|||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema (description = "标准管理列表")
|
||||
public class StandardManagementQuery extends Query {
|
||||
public class DatastandrdQuery extends Query {
|
||||
private Integer categoryId;
|
||||
private String t;
|
||||
private String cnName;
|
|
@ -3,7 +3,8 @@ package net.srt.service;
|
|||
import net.srt.entity.DatastandardEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.query.StandardManagementQuery;
|
||||
import net.srt.query.DatastandrdQuery;
|
||||
import net.srt.vo.DatastandardVo;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
|
||||
|
@ -17,11 +18,13 @@ import java.util.List;
|
|||
*/
|
||||
@MapperScan("net.srt.service.DatastandardService")
|
||||
public interface DatastandardService extends BaseService<DatastandardEntity> {
|
||||
PageResult<StandardManagementVo> page(StandardManagementQuery query);
|
||||
PageResult<DatastandardVo> page(DatastandrdQuery query);
|
||||
|
||||
List<DatastandardEntity> getTableCode();
|
||||
|
||||
void update1(DatastandardEntity datastandardEntity);
|
||||
|
||||
void delete(List<Long> idList);
|
||||
|
||||
void update1(DatastandardVo entity);
|
||||
|
||||
void save(DatastandardVo vo);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,21 @@ import net.srt.framework.common.page.PageResult;
|
|||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.vo.MetadataCollectVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MetadataCollectService extends BaseService<MetadataCollectEntity> {
|
||||
|
||||
PageResult<MetadataCollectVO> page(MetadataCollectQuery query);
|
||||
|
||||
void save(MetadataCollectVO vo);
|
||||
|
||||
void update(MetadataCollectVO vo);
|
||||
|
||||
void cancel(Long id);
|
||||
|
||||
void release(Long id);
|
||||
|
||||
void handRun(Long id);
|
||||
|
||||
void delete(List<Long> idList);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.srt.service;
|
|||
import net.srt.entity.StandardEntity;
|
||||
import net.srt.framework.common.utils.TreeNodeVo;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -14,12 +15,12 @@ import java.util.List;
|
|||
*/
|
||||
public interface StandardService extends BaseService<StandardEntity> {
|
||||
|
||||
|
||||
List<TreeNodeVo> listTree();
|
||||
|
||||
void save1(StandardEntity standardEntity);
|
||||
void save1(StandardManagementVo vo);
|
||||
|
||||
void update1(StandardEntity standardEntity);
|
||||
|
||||
void del(Long id);
|
||||
void update1(StandardManagementVo vo);
|
||||
|
||||
void delete(Long id);
|
||||
}
|
||||
|
|
|
@ -11,8 +11,9 @@ import net.srt.entity.DatastandardEntity;
|
|||
import net.srt.entity.MetamodelEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.query.StandardManagementQuery;
|
||||
import net.srt.query.DatastandrdQuery;
|
||||
import net.srt.service.DatastandardService;
|
||||
import net.srt.vo.DatastandardVo;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
@ -30,7 +31,7 @@ import java.util.List;
|
|||
public class DatastandardServiceImpl extends BaseServiceImpl<DatastandardDao, DatastandardEntity> implements DatastandardService {
|
||||
private final DatastandardDao datastandardDao;
|
||||
@Override
|
||||
public PageResult<StandardManagementVo> page(StandardManagementQuery query) {
|
||||
public PageResult<DatastandardVo> page(DatastandrdQuery query) {
|
||||
IPage<DatastandardEntity> page = baseMapper.selectPage(getPage(query), getWrapper(query));
|
||||
return new PageResult<>(DatastandardConvert.INSTANCE.convertList(page.getRecords()), page.getTotal());
|
||||
}
|
||||
|
@ -41,12 +42,7 @@ public class DatastandardServiceImpl extends BaseServiceImpl<DatastandardDao, Da
|
|||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update1(DatastandardEntity datastandardEntity) {
|
||||
StandardManagementVo standardManagementVo=DatastandardConvert.INSTANCE.convert(datastandardEntity);
|
||||
standardManagementVo.setProjectId(getProjectId());
|
||||
updateById(datastandardEntity);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void delete(List<Long> idList) {
|
||||
|
@ -60,8 +56,22 @@ public class DatastandardServiceImpl extends BaseServiceImpl<DatastandardDao, Da
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update1(DatastandardVo vo) {
|
||||
DatastandardEntity entity = DatastandardConvert.INSTANCE.convert(vo);
|
||||
entity.setProjectId(getProjectId());
|
||||
updateById(entity);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<DatastandardEntity> getWrapper(StandardManagementQuery query) {
|
||||
@Override
|
||||
public void save(DatastandardVo vo) {
|
||||
DatastandardEntity entity = DatastandardConvert.INSTANCE.convert(vo);
|
||||
entity.setProjectId(getProjectId());
|
||||
baseMapper.insert(entity);
|
||||
}
|
||||
|
||||
|
||||
private LambdaQueryWrapper<DatastandardEntity> getWrapper(DatastandrdQuery query) {
|
||||
LambdaQueryWrapper<DatastandardEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StringUtil.isNotBlank(query.getCnName()), DatastandardEntity::getCnName, query.getCnName());
|
||||
wrapper.like(StringUtil.isNotBlank(query.getEngName()), DatastandardEntity::getEngName, query.getEngName());
|
||||
|
|
|
@ -1,30 +1,97 @@
|
|||
package net.srt.service.impl;
|
||||
|
||||
import cn.hutool.cron.CronException;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.api.module.data.governance.constant.MetadataCollectType;
|
||||
import net.srt.api.module.quartz.QuartzDataGovernanceMetadataCollectApi;
|
||||
import net.srt.convert.MetadataCollectConvert;
|
||||
import net.srt.dao.MetadataCollectDao;
|
||||
import net.srt.entity.MetadataCollectEntity;
|
||||
import net.srt.entity.MetadataCollectQuery;
|
||||
import net.srt.framework.common.exception.ServerException;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.service.MetadataCollectService;
|
||||
import net.srt.vo.MetadataCollectVO;
|
||||
import org.quartz.CronExpression;
|
||||
import org.springframework.stereotype.Service;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class MetadataCollectServiceImpl extends BaseServiceImpl<MetadataCollectDao, MetadataCollectEntity> implements MetadataCollectService {
|
||||
|
||||
private final QuartzDataGovernanceMetadataCollectApi metadataCollectApi;
|
||||
|
||||
@Override
|
||||
public PageResult<MetadataCollectVO> page(MetadataCollectQuery query) {
|
||||
IPage<MetadataCollectEntity> page = baseMapper.selectPage(getPage(query), getWrapper(query));
|
||||
return new PageResult<>(MetadataCollectConvert.INSTANCE.convertList(page.getRecords()), page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(MetadataCollectVO vo) {
|
||||
checkParam(vo);
|
||||
MetadataCollectEntity entity = MetadataCollectConvert.INSTANCE.convert(vo);
|
||||
entity.setProjectId(getProjectId());
|
||||
baseMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(MetadataCollectVO vo) {
|
||||
checkParam(vo);
|
||||
MetadataCollectEntity entity = MetadataCollectConvert.INSTANCE.convert(vo);
|
||||
entity.setProjectId(getProjectId());
|
||||
updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(Long id) {
|
||||
metadataCollectApi.cancel(id);
|
||||
MetadataCollectEntity entity = baseMapper.selectById(id);
|
||||
entity.setReleaseTime(null);
|
||||
entity.setStatus(0);
|
||||
baseMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void release(Long id) {
|
||||
metadataCollectApi.release(id);
|
||||
MetadataCollectEntity entity = baseMapper.selectById(id);
|
||||
entity.setReleaseTime(new Date());
|
||||
entity.setStatus(1);
|
||||
baseMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handRun(Long id) {
|
||||
metadataCollectApi.handRun(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(List<Long> idList) {
|
||||
removeByIds(idList);
|
||||
// for (Long id : idList) {
|
||||
// LambdaQueryWrapper<MetadataCollectEntity> wrapper = Wrappers.lambdaQuery();
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
private void checkParam(MetadataCollectVO vo){
|
||||
if(MetadataCollectType.CRON.getValue().equals(vo.getTaskType())){
|
||||
if(!CronExpression.isValidExpression(vo.getCron())){
|
||||
throw new ServerException("cron表达式有误,请检查!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Wrapper<MetadataCollectEntity> getWrapper(MetadataCollectQuery query) {
|
||||
LambdaQueryWrapper<MetadataCollectEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StringUtil.isNotBlank(query.getName()),MetadataCollectEntity::getName,query.getName())
|
||||
|
@ -34,4 +101,6 @@ public class MetadataCollectServiceImpl extends BaseServiceImpl<MetadataCollectD
|
|||
dataScopeWithOrgId(wrapper);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,14 +2,22 @@ package net.srt.service.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.controller.StandardController;
|
||||
import net.srt.convert.StandardConvert;
|
||||
import net.srt.dao.StandardDao;
|
||||
import net.srt.entity.StandardEntity;
|
||||
import net.srt.framework.common.exception.ServerException;
|
||||
import net.srt.framework.common.utils.BeanUtil;
|
||||
import net.srt.framework.common.utils.BuildTreeUtils;
|
||||
import net.srt.framework.common.utils.TreeNodeVo;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.service.StandardService;
|
||||
import net.srt.utils.CatalogueBuildTreeUtils;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -24,6 +32,9 @@ import static net.srt.framework.security.user.SecurityUser.getUserId;
|
|||
@Service
|
||||
@AllArgsConstructor
|
||||
public class StandardServiceImpl extends BaseServiceImpl<StandardDao, StandardEntity> implements StandardService {
|
||||
@Autowired
|
||||
StandardDao standardDao;
|
||||
|
||||
|
||||
@Override
|
||||
public List<TreeNodeVo> listTree() {
|
||||
|
@ -39,48 +50,48 @@ public class StandardServiceImpl extends BaseServiceImpl<StandardDao, StandardEn
|
|||
newItem.setParentPath(newItem.getPath().substring(0, newItem.getPath().lastIndexOf("/")));
|
||||
}
|
||||
});
|
||||
return BuildTreeUtils.buildTree(treeNodeVos);
|
||||
return CatalogueBuildTreeUtils.buildTree(treeNodeVos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save1(StandardEntity standardEntity) {
|
||||
if (standardEntity.getId() == null) {
|
||||
standardEntity.setCreateTime(new java.util.Date());
|
||||
standardEntity.setUpdateTime(new java.util.Date());
|
||||
standardEntity.setDeleted(0);
|
||||
standardEntity.setVersion(0);
|
||||
standardEntity.setCreator(getUserId());
|
||||
standardEntity.setUpdater(getUserId());
|
||||
baseMapper.insert(standardEntity);
|
||||
} else {
|
||||
standardEntity.setUpdateTime(new java.util.Date());
|
||||
public void save1(StandardManagementVo vo) {
|
||||
StandardEntity entity = StandardConvert.INSTANCE.convert(vo);
|
||||
entity.setPath(recursionPath(entity, null));
|
||||
entity.setProjectId(getProjectId());
|
||||
baseMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update1(StandardManagementVo vo) {
|
||||
StandardEntity entity = StandardConvert.INSTANCE.convert(vo);
|
||||
entity.setPath(recursionPath(entity, null));
|
||||
entity.setProjectId(getProjectId());
|
||||
updateById(entity);
|
||||
}
|
||||
|
||||
|
||||
private String recursionPath(StandardEntity categoryEntity, String path) {
|
||||
if (StringUtil.isBlank(path)) {
|
||||
path = categoryEntity.getName();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update1(StandardEntity standardEntity) {
|
||||
if (standardEntity.getId()!= null) {
|
||||
standardEntity.setUpdateTime(new java.util.Date());
|
||||
standardEntity.setUpdater(getUserId());
|
||||
baseMapper.updateById(standardEntity);
|
||||
if (categoryEntity.getParentId() != 0) {
|
||||
StandardEntity parent = getById(categoryEntity.getParentId());
|
||||
path = parent.getName() + "/" + path;
|
||||
return recursionPath(parent, path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void del(Long id) {
|
||||
//判断是否有子节点
|
||||
public void delete(Long id) {
|
||||
//查询有没有子节点
|
||||
LambdaQueryWrapper<StandardEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(StandardEntity::getParentId,id).last("limit 1");
|
||||
if(baseMapper.selectCount(wrapper)!=null){
|
||||
throw new RuntimeException("请先删除子节点");
|
||||
wrapper.eq(StandardEntity::getParentId, id).last(" limit 1");
|
||||
StandardEntity one = baseMapper.selectOne(wrapper);
|
||||
if (one != null) {
|
||||
throw new ServerException("存在子节点,不允许删除!");
|
||||
}
|
||||
removeById(id);
|
||||
//删除属性
|
||||
LambdaQueryWrapper<StandardEntity> wrapper1 = new LambdaQueryWrapper<>();
|
||||
wrapper1.eq(StandardEntity::getParentId,id);
|
||||
baseMapper.delete(wrapper1);
|
||||
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package net.srt.utils;
|
||||
|
||||
import net.srt.framework.common.utils.TreeNodeVo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : CatalogueBuildTreeUtils
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 12:40
|
||||
*/
|
||||
public class CatalogueBuildTreeUtils {
|
||||
/**
|
||||
* 构建结构树
|
||||
*
|
||||
* @param nodeVos
|
||||
* @return
|
||||
*/
|
||||
public static List<TreeNodeVo> buildTree(List<TreeNodeVo> nodeVos) {
|
||||
List<TreeNodeVo> resultVos = new ArrayList<>(10);
|
||||
for (TreeNodeVo node : nodeVos) {
|
||||
// 一级菜单parentId为0
|
||||
if (node.getParentId() == 0) {
|
||||
resultVos.add(node);
|
||||
}
|
||||
}
|
||||
// 为一级菜单设置子菜单,getChild是递归调用的
|
||||
for (TreeNodeVo node : resultVos) {
|
||||
node.setChildren(getChild(node.getId(), nodeVos));
|
||||
}
|
||||
return resultVos;
|
||||
}
|
||||
|
||||
|
||||
private static List<TreeNodeVo> getChild(Long id, List<TreeNodeVo> nodeVos) {
|
||||
// 子菜单
|
||||
List<TreeNodeVo> childList = new ArrayList<>(10);
|
||||
for (TreeNodeVo node : nodeVos) {
|
||||
// 遍历所有节点,将父菜单id与传过来的id比较
|
||||
if (node.getParentId() != 0) {
|
||||
if (node.getParentId().equals(id)) {
|
||||
childList.add(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 把子菜单的子菜单再循环一遍
|
||||
for (TreeNodeVo node : childList) {
|
||||
node.setChildren(getChild(node.getId(), nodeVos));
|
||||
}
|
||||
return childList;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package net.srt.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : DatastandardVo
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 12:05
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "标准管理查询")
|
||||
public class DatastandardVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId("id")
|
||||
private Long id;
|
||||
private Integer categoryId;
|
||||
private String engName;
|
||||
private String cnName;
|
||||
private Integer codeNum;
|
||||
private String dataType;
|
||||
private Integer dataLength;
|
||||
private Integer dataPrecision;
|
||||
private Integer nullable;
|
||||
private Integer standardCodeId;
|
||||
private Integer type;
|
||||
private String note;
|
||||
private Long projectId;
|
||||
private Integer status;
|
||||
private Integer version;
|
||||
private Integer deleted;
|
||||
private String creator;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
private String updater;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTime;
|
||||
private Integer ifStandardRel;
|
||||
private String group;
|
||||
}
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import net.srt.framework.common.utils.DateUtils;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -16,34 +17,49 @@ import java.util.Date;
|
|||
* @Date: 2023-12-20 11:24
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "标准管理查询")
|
||||
@Schema(description = "目录表")
|
||||
public class StandardManagementVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId("id")
|
||||
|
||||
@Schema(description = "主键id")
|
||||
private Long id;
|
||||
private Integer categoryId;
|
||||
private String engName;
|
||||
private String cnName;
|
||||
private Integer codeNum;
|
||||
private String dataType;
|
||||
private Integer dataLength;
|
||||
private Integer dataPrecision;
|
||||
private Integer nullable;
|
||||
private Integer standardCodeId;
|
||||
|
||||
@Schema(description = "父级id(顶级为0)")
|
||||
private Long parentId;
|
||||
@Schema(description = "0-文件夹 1-文件目录")
|
||||
private Integer type;
|
||||
private String note;
|
||||
@Schema(description = "分组名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "分组序号")
|
||||
private Integer orderNo;
|
||||
|
||||
@Schema(description = "描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "分组路径")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "项目id")
|
||||
private Long projectId;
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "版本号")
|
||||
private Integer version;
|
||||
|
||||
@Schema(description = "删除标识 0:正常 1:已删除")
|
||||
private Integer deleted;
|
||||
private String creator;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
|
||||
@Schema(description = "创建者")
|
||||
private Long creator;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date createTime;
|
||||
private String updater;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
|
||||
@Schema(description = "更新者")
|
||||
private Long updater;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date updateTime;
|
||||
private Integer ifStandardRel;
|
||||
private String group;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package net.srt.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.convert.DataServiceAppConvert;
|
||||
import net.srt.entity.DataServiceApppEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.query.DataServiceAppQuery;
|
||||
import net.srt.service.DataServiceAppService;
|
||||
import net.srt.vo.DataServiceAppVo;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceAppController
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 08:53
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app")
|
||||
@AllArgsConstructor
|
||||
public class DataServiceAppController {
|
||||
private final DataServiceAppService dataServiceAppService;
|
||||
|
||||
@GetMapping("page")
|
||||
@Operation(summary = "分页")
|
||||
public Result<PageResult<DataServiceAppVo> > page(@Valid DataServiceAppQuery query) {
|
||||
PageResult<DataServiceAppVo> pageResult = dataServiceAppService.page(query);
|
||||
return Result.ok(pageResult);
|
||||
}
|
||||
@GetMapping("{id}")
|
||||
@Operation(summary = "信息")
|
||||
public Result<DataServiceAppVo> get(@PathVariable("id") Long id){
|
||||
DataServiceApppEntity dataServiceApppEntity = dataServiceAppService.getById(id);
|
||||
return Result.ok(DataServiceAppConvert.INSTANCE.convert(dataServiceApppEntity));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.entity.DataServiceApppEntity;
|
||||
import net.srt.vo.DataServiceAppVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceAppConvert
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 09:06
|
||||
*/
|
||||
@Mapper
|
||||
public interface DataServiceAppConvert {
|
||||
DataServiceAppConvert INSTANCE = Mappers.getMapper(DataServiceAppConvert.class);
|
||||
|
||||
DataServiceApppEntity convert(DataServiceAppVo vo);
|
||||
|
||||
DataServiceAppVo convert(DataServiceApppEntity entity);
|
||||
|
||||
List<DataServiceAppVo> convertList(List<DataServiceApppEntity> list);
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package net.srt.dao;
|
||||
|
||||
import net.srt.entity.DataServiceApppEntity;
|
||||
import net.srt.framework.mybatis.dao.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceAppDao
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 08:59
|
||||
*/
|
||||
@Mapper
|
||||
public interface DataServiceAppDao extends BaseDao<DataServiceApppEntity> {
|
||||
DataServiceApppEntity selectByApplyId(@Param("applyId") Long applyId);
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceApppEntity
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 08:46
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@TableName("data_service_app")
|
||||
public class DataServiceApppEntity extends BaseEntity {
|
||||
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String note;
|
||||
|
||||
@Schema(description = "app_key")
|
||||
private String appKey;
|
||||
|
||||
@Schema(description = "app_secret")
|
||||
private String appSecret;
|
||||
|
||||
@Schema(description = "过期描述")
|
||||
private String expireDesc;
|
||||
|
||||
/**
|
||||
* 过期时间 -1永久;0 单次失效;> 0 失效时间
|
||||
*/
|
||||
private Long expireDuration;
|
||||
|
||||
private Integer ifMarket;
|
||||
|
||||
@Schema(description = "所属项目id")
|
||||
private Long projectId;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package net.srt.query;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.srt.framework.common.query.Query;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceAppQuery
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 08:51
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(defaultValue = "app权限")
|
||||
public class DataServiceAppQuery extends Query {
|
||||
private String name;
|
||||
private String appKey;
|
||||
private Integer ifMarket;
|
||||
private Boolean ifInfo;
|
||||
private Long applyId;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package net.srt.service;
|
||||
|
||||
import net.srt.entity.DataServiceApppEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.query.DataServiceAppQuery;
|
||||
import net.srt.vo.DataServiceAppVo;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceAppService
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 08:53
|
||||
*/
|
||||
public interface DataServiceAppService extends BaseService<DataServiceApppEntity> {
|
||||
PageResult<DataServiceAppVo> page(DataServiceAppQuery query);
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package net.srt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.convert.DataServiceAppConvert;
|
||||
import net.srt.dao.DataServiceAppDao;
|
||||
import net.srt.entity.DataServiceApppEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.framework.security.user.SecurityUser;
|
||||
import net.srt.query.DataServiceAppQuery;
|
||||
import net.srt.service.DataServiceAppService;
|
||||
import net.srt.vo.DataServiceAppVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceAppServiceImpl
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 08:53
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class DataServiceAppServiceImpl extends BaseServiceImpl<DataServiceAppDao, DataServiceApppEntity> implements DataServiceAppService {
|
||||
@Override
|
||||
public PageResult<DataServiceAppVo> page(DataServiceAppQuery query) {
|
||||
if (query.getApplyId()!=null){
|
||||
DataServiceApppEntity dataServiceApppEntity=baseMapper.selectByApplyId(query.getApplyId());
|
||||
List<DataServiceApppEntity> list=new ArrayList<>(1);
|
||||
if (dataServiceApppEntity!=null){
|
||||
list.add(dataServiceApppEntity);
|
||||
return new PageResult<>(DataServiceAppConvert.INSTANCE.convertList(list),1);
|
||||
}
|
||||
return new PageResult<>(new ArrayList<>(),0);
|
||||
|
||||
}
|
||||
IPage<DataServiceApppEntity> page=baseMapper.selectPage(getPage(query),getWrapper(query));
|
||||
return new PageResult<>(DataServiceAppConvert.INSTANCE.convertList(page.getRecords()),page.getTotal());
|
||||
}
|
||||
|
||||
|
||||
private LambdaQueryWrapper<DataServiceApppEntity> getWrapper(DataServiceAppQuery query) {
|
||||
LambdaQueryWrapper<DataServiceApppEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StringUtil.isNotBlank(query.getName()), DataServiceApppEntity::getName, query.getName())
|
||||
.eq(DataServiceApppEntity::getIfMarket, query.getIfMarket() != null ? query.getIfMarket() : 0)
|
||||
.eq(query.getIfMarket() != null, DataServiceApppEntity::getCreator, SecurityUser.getUserId())
|
||||
.eq(StringUtil.isNotBlank(query.getAppKey()), DataServiceApppEntity::getAppKey, query.getAppKey())
|
||||
.orderByDesc(DataServiceApppEntity::getCreateTime).orderByDesc(DataServiceApppEntity::getId);
|
||||
dataScopeWithoutOrgId(wrapper);
|
||||
return wrapper;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package net.srt.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import net.srt.framework.common.utils.DateUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceAppVo
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-22 21:21
|
||||
*/
|
||||
@Data
|
||||
@Schema(defaultValue = "app权限")
|
||||
public class DataServiceAppVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String note;
|
||||
|
||||
@Schema(description = "app_key")
|
||||
private String appKey;
|
||||
|
||||
@Schema(description = "app_secret")
|
||||
private String appSecret;
|
||||
|
||||
@Schema(description = "过期描述")
|
||||
private String expireDesc;
|
||||
|
||||
/**
|
||||
* 过期时间 -1永久;0 单次失效;> 0 失效时间
|
||||
*/
|
||||
private Long expireDuration;
|
||||
|
||||
private Integer ifMarket;
|
||||
|
||||
@Schema(description = "所属项目id")
|
||||
private Long projectId;
|
||||
|
||||
@Schema(description = "版本号")
|
||||
private Integer version;
|
||||
|
||||
@Schema(description = "删除标识 0:正常 1:已删除")
|
||||
private Integer deleted;
|
||||
|
||||
@Schema(description = "创建者")
|
||||
private Long creator;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "更新者")
|
||||
private Long updater;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date updateTime;
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?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="net.srt.dao.DataServiceAppDao">
|
||||
|
||||
|
||||
<select id="selectByApplyId" resultType="net.srt.entity.DataServiceApppEntity">
|
||||
SELECT dsa.* FROM data_service_app dsa INNER JOIN data_market_resource_apply dmra ON dsa.id=dmra.app_id WHERE dmra.id=#{applyId}
|
||||
</select>
|
||||
</mapper>
|
Binary file not shown.
|
@ -56,7 +56,7 @@ public class DataProductionServiceImpl extends BaseServiceImpl<DataProductionMap
|
|||
}
|
||||
|
||||
|
||||
private static List<DataProductionTreeVo> getChild(Integer id, List<DataProductionTreeVo> nodeVos) {
|
||||
private static List<DataProductionTreeVo> getChild(Long id, List<DataProductionTreeVo> nodeVos) {
|
||||
// 子菜单
|
||||
List<DataProductionTreeVo> childList = new ArrayList<>(10);
|
||||
for (DataProductionTreeVo node : nodeVos) {
|
||||
|
@ -93,5 +93,4 @@ public class DataProductionServiceImpl extends BaseServiceImpl<DataProductionMap
|
|||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue