parent
072686bfa0
commit
36b13448fd
|
@ -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);
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue