1、修改用户信息查询角色返回

2、修改代码配置,设置仓库名称唯一性
This commit is contained in:
chenzhihang 2024-09-02 10:37:18 +08:00
parent 072686bfa0
commit 36b13448fd
4 changed files with 25 additions and 4 deletions

View File

@ -14,6 +14,8 @@ public interface CodeConfigDao {
CodeConfig queryById(Long id);
Long queryByCodeRepoName(@Param("codeRepoName") String codeRepoName);
int insert(@Param("codeConfig") CodeConfig codeConfig);
int update(@Param("codeConfig") CodeConfig codeConfig);

View File

@ -38,6 +38,10 @@ public class CodeConfigServiceImpl implements CodeConfigService {
@Override
public CodeConfig insert(CodeConfig codeConfig) {
Long id = this.codeConfigDao.queryByCodeRepoName(codeConfig.getCodeRepoName());
if(id != null){
throw new IllegalStateException("代码仓库名称已存在");
}
LoginUser loginUser = SecurityUtils.getLoginUser();
codeConfig.setCreateBy(loginUser.getUsername());
codeConfig.setUpdateBy(loginUser.getUsername());
@ -49,6 +53,10 @@ public class CodeConfigServiceImpl implements CodeConfigService {
@Override
public CodeConfig update(CodeConfig codeConfig) {
Long id = this.codeConfigDao.queryByCodeRepoName(codeConfig.getCodeRepoName());
if(id != null){
throw new IllegalStateException("代码仓库名称已存在");
}
LoginUser loginUser = SecurityUtils.getLoginUser();
codeConfig.setUpdateBy(loginUser.getUsername());

View File

@ -3,9 +3,12 @@
<mapper namespace="com.ruoyi.platform.mapper.CodeConfigDao">
<insert id="insert">
insert into code_config(code_repo_name, code_repo_vis, git_url, git_branch, verify_mode, git_user_name, git_password,ssh_key, create_by, create_time, update_by, update_time)
values(#{codeConfig.codeRepoName}, #{codeConfig.codeRepoVis}, #{codeConfig.gitUrl}, #{codeConfig.gitBranch}, #{codeConfig.verifyMode}, #{codeConfig.gitUserName}, #{codeConfig.gitPassword},
#{codeConfig.sshKey}, #{codeConfig.createBy}, #{codeConfig.createTime}, #{codeConfig.updateBy}, #{codeConfig.updateTime})
insert into code_config(code_repo_name, code_repo_vis, git_url, git_branch, verify_mode, git_user_name,
git_password, ssh_key, create_by, create_time, update_by, update_time)
values (#{codeConfig.codeRepoName}, #{codeConfig.codeRepoVis}, #{codeConfig.gitUrl}, #{codeConfig.gitBranch},
#{codeConfig.verifyMode}, #{codeConfig.gitUserName}, #{codeConfig.gitPassword},
#{codeConfig.sshKey}, #{codeConfig.createBy}, #{codeConfig.createTime}, #{codeConfig.updateBy},
#{codeConfig.updateTime})
</insert>
<update id="update">
@ -64,6 +67,13 @@
and state = 1
</select>
<select id="queryByCodeRepoName" resultType="java.lang.Long">
select id
from code_config
where code_repo_name = #{codeRepoName}
and state = 1
</select>
<sql id="common_condition">
<where>
state = 1

View File

@ -156,7 +156,8 @@ public class SysUserController extends BaseController {
userService.checkUserDataScope(userId);
AjaxResult ajax = AjaxResult.success();
List<SysRole> roles = roleService.selectRoleAll();
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
ajax.put("roles", roles);
// ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
ajax.put("posts", postService.selectPostAll());
if (StringUtils.isNotNull(userId)) {
SysUser sysUser = userService.selectUserById(userId);