资产授权
parent
7bb78b227b
commit
7d5a95c4d1
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -34,6 +34,10 @@ public class AssetAuthorization extends BaseEntity {
|
|||
* 表ID
|
||||
*/
|
||||
private Long tableId;
|
||||
/**
|
||||
* 数据接入ID
|
||||
*/
|
||||
private Long basicId;
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-01-20:40
|
||||
* @ Version:1.0
|
||||
* @ Description:资产授权
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name = "资产授权响应对象")
|
||||
public class AssetAuthorizationRep {
|
||||
/**
|
||||
* 数据接入ID
|
||||
*/
|
||||
private Long basicId;
|
||||
/**
|
||||
* 表ID
|
||||
*/
|
||||
private Long tableId;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-01-20:39
|
||||
* @ Version:1.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;
|
||||
}
|
|
@ -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
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-01-21:48
|
||||
* @ Version:1.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();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.muyu.source.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-01-20:46
|
||||
* @ Version:1.0
|
||||
* @ Description:资产授权控制层
|
||||
* @author Lenovo
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/asset")
|
||||
public class AssetAuthorizationController {
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -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 {
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-01-21:49
|
||||
* @ Version:1.0
|
||||
* @ Description:资产授权持久层
|
||||
*/
|
||||
@Mapper
|
||||
public interface AssetAccreditMapper extends BaseMapper<AssetAccredit> {
|
||||
}
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-01-20:47
|
||||
* @ Version:1.0
|
||||
* @ Description:资产授权持久层
|
||||
* @author Lenovo
|
||||
*/
|
||||
@Mapper
|
||||
public interface AssetAuthorizationMapper extends BaseMapper<AssetAuthorization> {
|
||||
}
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-01-21:50
|
||||
* @ Version:1.0
|
||||
* @ Description:资产授权业务层
|
||||
* @author Lenovo
|
||||
*/
|
||||
|
||||
public interface AssetAccreditService extends IService<AssetAccredit> {
|
||||
List<AssetAccredit> getList(AssetAccreditQueryReq assetAccreditQueryReq);
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.source.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.source.domain.AssetAuthorization;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-01-20:47
|
||||
* @ Version:1.0
|
||||
* @ Description:资产授权业务层
|
||||
* @author Lenovo
|
||||
*/
|
||||
public interface AssetAuthorizationService extends IService<AssetAuthorization> {
|
||||
|
||||
|
||||
}
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-01-21:51
|
||||
* @ Version:1.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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-09-01-20:48
|
||||
* @ Version:1.0
|
||||
* @ Description:资产授权业务实现层
|
||||
* @author Lenovo
|
||||
*/
|
||||
@Service
|
||||
public class AssetAuthorizationServiceImpl extends ServiceImpl<AssetAuthorizationMapper, AssetAuthorization> implements AssetAuthorizationService {
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue