资产授权

master
冷调 2024-09-01 22:11:37 +08:00
parent 7bb78b227b
commit 7d5a95c4d1
14 changed files with 327 additions and 9 deletions

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.annotation.Excel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ -28,28 +29,29 @@ public class AssetAccredit {
*/
@TableId(value = "id", type = IdType.AUTO)
@Excel(name = "主键")
@Schema(name = "id", title = "主键", type = "Long", description = "主键")
private Long id;
/**
*
*/
@Excel(name = "授权编号")
private String accreditNo;
@Schema(name = "accreditId", title = "授权编号", type = "String", description = "授权编号")
private String accreditId;
/**
*
*/
@Schema(name = "dataId", title = "授权数据", type = "Long", description = "授权数据")
private Long dataId;
/**
* /
*/
private String accreditType;
@Schema(name = "idType", title = "授权类型", type = "String", description = "授权类型")
private String idType;
/**
* 1: 2:
*/
private String accreditDataType;
/**
* 1: 2:
*/
private String status;
@Schema(name = "dataType", title = "授权数据类型", type = "String", description = "授权数据类型")
private String dataType;
}

View File

@ -34,6 +34,10 @@ public class AssetAuthorization extends BaseEntity {
* ID
*/
private Long tableId;
/**
* ID
*/
private Long basicId;
/**
*
*/

View File

@ -0,0 +1,29 @@
package com.muyu.source.domain.rep;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author Lenovo
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-01-20:40
* @ Version1.0
* @ Description
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Tag(name = "资产授权响应对象")
public class AssetAuthorizationRep {
/**
* ID
*/
private Long basicId;
/**
* ID
*/
private Long tableId;
}

View File

@ -0,0 +1,27 @@
package com.muyu.source.domain.req;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
*
*
* @author CHX
* on 2024/4/28
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class AssetAccreditQueryReq {
/**
* dept/user
*/
private String idType;
/**
* source/table
*/
private String dataType;
}

View File

@ -0,0 +1,34 @@
package com.muyu.source.domain.req;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author Lenovo
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-01-20:39
* @ Version1.0
* @ Description
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Tag(name = "资产授权请求")
public class AssetAuthorizationReq {
@Schema(name = "id", description = "主键",defaultValue = "1")
private Long id;
@Schema(name = "tableId", description = "表ID",defaultValue = "1")
private Long tableId;
@Schema(name = "basicId", description = "数据接入ID",defaultValue = "1")
private Long basicId;
@Schema(name = "deptId", description = "部门ID",defaultValue = "1")
private Long deptId;
@Schema(name = "userId", description = "用户ID",defaultValue = "1")
private Long userId;
}

View File

@ -0,0 +1,71 @@
package com.muyu.source.controller;
import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
import com.muyu.common.core.domain.Result;
import com.muyu.source.domain.AssetAccredit;
import com.muyu.source.domain.req.AssetAccreditQueryReq;
import com.muyu.source.service.AssetAccreditService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author Lenovo
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-01-21:48
* @ Version1.0
* @ Description
*/
@Log4j2
@RestController
@RequestMapping("/asset")
@Tag(name = "资产授权控制层", description = "进行资产授权管理,查看等相关操作")
public class AssetAccreditController {
public AssetAccreditController() {
log.info("forest扫描路径:{}", ForestScannerRegister.getBasePackages());
}
@Autowired
private AssetAccreditService assetAccreditService;
/**
*
* @param assetAccreditQueryReq
* @return
*/
@PostMapping("/list")
@Operation(summary = "查询资产授权列表", description = "查询资产授权列表")
public Result list(@RequestBody AssetAccreditQueryReq assetAccreditQueryReq){
List<AssetAccredit> assetAccreditList =assetAccreditService.getList(assetAccreditQueryReq);
return Result.success(assetAccreditList);
}
/**
*
* @param assetAccredit
* @return
*/
@PostMapping("/addAccredit")
@Operation(summary = "添加资产授权", description = "添加资产授权")
public Result addAccredit(@RequestBody AssetAccredit assetAccredit){
assetAccreditService.save(assetAccredit);
return Result.success();
}
/**
*
* @param id id
* @return
*/
@DeleteMapping("/delAccredit/{id}")
@Operation(summary = "删除资产授权", description = "删除资产授权")
public Result remove(@PathVariable("id") Long id){
assetAccreditService.removeById(id);
return Result.success();
}
}

View File

@ -0,0 +1,20 @@
package com.muyu.source.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-01-20:46
* @ Version1.0
* @ Description
* @author Lenovo
*/
@RestController
@RequestMapping("/asset")
public class AssetAuthorizationController {
}

View File

@ -1,7 +1,6 @@
package com.muyu.source.controller;
import com.muyu.common.core.web.controller.BaseController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
@ -13,7 +12,6 @@ import org.springframework.web.bind.annotation.RestController;
* @ Description
*/
@RestController
@RequestMapping("/asset")
public class AssetDataSourceController extends BaseController {

View File

@ -0,0 +1,17 @@
package com.muyu.source.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.source.domain.AssetAccredit;
import org.apache.ibatis.annotations.Mapper;
/**
* @author Lenovo
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-01-21:49
* @ Version1.0
* @ Description
*/
@Mapper
public interface AssetAccreditMapper extends BaseMapper<AssetAccredit> {
}

View File

@ -0,0 +1,17 @@
package com.muyu.source.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.source.domain.AssetAuthorization;
import org.apache.ibatis.annotations.Mapper;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-01-20:47
* @ Version1.0
* @ Description
* @author Lenovo
*/
@Mapper
public interface AssetAuthorizationMapper extends BaseMapper<AssetAuthorization> {
}

View File

@ -0,0 +1,21 @@
package com.muyu.source.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.source.domain.AssetAccredit;
import com.muyu.source.domain.req.AssetAccreditQueryReq;
import java.util.List;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-01-21:50
* @ Version1.0
* @ Description
* @author Lenovo
*/
public interface AssetAccreditService extends IService<AssetAccredit> {
List<AssetAccredit> getList(AssetAccreditQueryReq assetAccreditQueryReq);
}

View File

@ -0,0 +1,17 @@
package com.muyu.source.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.source.domain.AssetAuthorization;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-01-20:47
* @ Version1.0
* @ Description
* @author Lenovo
*/
public interface AssetAuthorizationService extends IService<AssetAuthorization> {
}

View File

@ -0,0 +1,39 @@
package com.muyu.source.service.Impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.StringUtils;
import com.muyu.source.domain.AssetAccredit;
import com.muyu.source.domain.req.AssetAccreditQueryReq;
import com.muyu.source.mapper.AssetAccreditMapper;
import com.muyu.source.service.AssetAccreditService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-01-21:51
* @ Version1.0
* @ Description
* @author Lenovo
*/
@Service
public class AssetAccreditServiceImpl extends ServiceImpl<AssetAccreditMapper, AssetAccredit> implements AssetAccreditService {
@Override
public List<AssetAccredit> getList(AssetAccreditQueryReq assetAccreditQueryReq) {
if(StringUtils.isNotNull(assetAccreditQueryReq.getIdType())){
throw new RuntimeException("授权类型不能为空");
}
if(StringUtils.isNotNull(assetAccreditQueryReq.getDataType())){
throw new RuntimeException("授权数据类型不能为空");
}
List<AssetAccredit> list = list(new LambdaQueryWrapper<>() {{
eq(AssetAccredit::getIdType, assetAccreditQueryReq.getIdType())
.eq(AssetAccredit::getDataType, assetAccreditQueryReq.getDataType());
}});
return list;
}
}

View File

@ -0,0 +1,22 @@
package com.muyu.source.service.Impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.source.domain.AssetAuthorization;
import com.muyu.source.mapper.AssetAuthorizationMapper;
import com.muyu.source.service.AssetAuthorizationService;
import org.springframework.stereotype.Service;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-01-20:48
* @ Version1.0
* @ Description
* @author Lenovo
*/
@Service
public class AssetAuthorizationServiceImpl extends ServiceImpl<AssetAuthorizationMapper, AssetAuthorization> implements AssetAuthorizationService {
}