增加了权限的修改

master
lwj 2024-09-01 20:24:04 +08:00
parent 15c79db8d7
commit 1546346945
6 changed files with 56 additions and 7 deletions

View File

@ -1,15 +1,18 @@
package com.muyu.domain.req; package com.muyu.domain.req;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
@Data @Data
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@Builder @SuperBuilder
public class AccreditReq { @EqualsAndHashCode(callSuper = true)
public class AccreditReq extends BaseEntity {
private Integer basicId; private Integer basicId;
private Integer tableId; private Integer tableId;
private Integer userId; private Integer userId;

View File

@ -5,11 +5,9 @@ import com.muyu.common.core.domain.Result;
import com.muyu.domain.Accredit; import com.muyu.domain.Accredit;
import com.muyu.domain.rep.AccreditDeptRep; import com.muyu.domain.rep.AccreditDeptRep;
import com.muyu.domain.rep.AccreditUserRep; import com.muyu.domain.rep.AccreditUserRep;
import com.muyu.domain.req.AccreditReq;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@ -39,5 +37,19 @@ public class AccreditController {
return Result.success(repList); return Result.success(repList);
} }
//根据数据源ID,和表Id部门Id和用户Id 进行添加中间表 添加权限
@PostMapping("/addMiddle")
public Result addMiddle(@RequestBody AccreditReq accreditReq) {
Integer i=accreditService.addMiddle(accreditReq);
return i>0?Result.success(i):Result.error();
}
//根据数据源Id,和表Id部门Id和用户Id 删除中间表取消授权
@PostMapping("/remove")
public Result remove(@RequestBody AccreditReq accreditReq) {
Integer i = accreditService.remove(accreditReq);
return i>0?Result.success(i):Result.error();
}
} }

View File

@ -3,6 +3,7 @@ package com.muyu.cloud.etl.mapper;
import com.muyu.domain.Accredit; import com.muyu.domain.Accredit;
import com.muyu.domain.rep.AccreditDeptRep; import com.muyu.domain.rep.AccreditDeptRep;
import com.muyu.domain.rep.AccreditUserRep; import com.muyu.domain.rep.AccreditUserRep;
import com.muyu.domain.req.AccreditReq;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -15,4 +16,8 @@ public interface AccreditMapper {
List<AccreditDeptRep> findDeptListStatus(@Param("tableId") Long tableId, @Param("basicId") Long basicId); List<AccreditDeptRep> findDeptListStatus(@Param("tableId") Long tableId, @Param("basicId") Long basicId);
List<AccreditUserRep> findUserListStatus(@Param("tableId") Long tableId, @Param("basicId") Long basicId); List<AccreditUserRep> findUserListStatus(@Param("tableId") Long tableId, @Param("basicId") Long basicId);
Integer addMiddle(AccreditReq accreditReq);
Integer remove(AccreditReq accreditReq);
} }

View File

@ -3,6 +3,7 @@ package com.muyu.cloud.etl.service;
import com.muyu.domain.Accredit; import com.muyu.domain.Accredit;
import com.muyu.domain.rep.AccreditDeptRep; import com.muyu.domain.rep.AccreditDeptRep;
import com.muyu.domain.rep.AccreditUserRep; import com.muyu.domain.rep.AccreditUserRep;
import com.muyu.domain.req.AccreditReq;
import java.util.List; import java.util.List;
@ -12,4 +13,9 @@ public interface AccreditService {
List<AccreditDeptRep> findDeptListStatus(Long tableId, Long basicId); List<AccreditDeptRep> findDeptListStatus(Long tableId, Long basicId);
List<AccreditUserRep> findUserListStatus(Long tableId, Long basicId); List<AccreditUserRep> findUserListStatus(Long tableId, Long basicId);
Integer addMiddle(AccreditReq accreditReq);
Integer remove(AccreditReq accreditReq);
} }

View File

@ -5,6 +5,7 @@ import com.muyu.cloud.etl.service.AccreditService;
import com.muyu.domain.Accredit; import com.muyu.domain.Accredit;
import com.muyu.domain.rep.AccreditDeptRep; import com.muyu.domain.rep.AccreditDeptRep;
import com.muyu.domain.rep.AccreditUserRep; import com.muyu.domain.rep.AccreditUserRep;
import com.muyu.domain.req.AccreditReq;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -30,4 +31,14 @@ public class AccreditServiceImpl implements AccreditService{
public List<AccreditUserRep> findUserListStatus(Long tableId, Long basicId) { public List<AccreditUserRep> findUserListStatus(Long tableId, Long basicId) {
return accreditMapper.findUserListStatus(tableId,basicId); return accreditMapper.findUserListStatus(tableId,basicId);
} }
@Override
public Integer addMiddle(AccreditReq accreditReq) {
return accreditMapper.addMiddle(accreditReq);
}
@Override
public Integer remove(AccreditReq accreditReq) {
return accreditMapper.remove(accreditReq);
}
} }

View File

@ -44,6 +44,18 @@
<result property="status" column="status"/> <result property="status" column="status"/>
</resultMap> </resultMap>
<insert id="addMiddle">
INSERT INTO `text`.`middle`
(`basic_id`, `user_id`, `table_id`,
`dept_id`, `create_by`, `create_time`, `update_by`,
`update_time`) VALUES ( #{basicId}, #{userId}, #{tableId}, #{deptId});
</insert>
<delete id="remove">
DELETE FROM middle WHERE basic_id=#{basicId} AND table_id=#{tableId}
AND (user_id=#{userId} OR dept_id=#{deptId})
</delete>
<select id="findAccredit" resultType="com.muyu.domain.Accredit" resultMap="Accredit"> <select id="findAccredit" resultType="com.muyu.domain.Accredit" resultMap="Accredit">
-- 根据 -- 根据
SELECT source.data_resource_name,source.database_name,source.data_sources_system_name, SELECT source.data_resource_name,source.database_name,source.data_sources_system_name,