Merge remote-tracking branch 'origin/dev_PMS' into dev_PMS

This commit is contained in:
xxq250 2024-03-11 11:08:55 +08:00
commit addc5fbf6a
18 changed files with 160 additions and 26 deletions

View File

@ -27,7 +27,7 @@ gitlink_db_name=forgeplus
gitlink_db_username=root gitlink_db_username=root
gitlink_db_password=Trust_#%01 gitlink_db_password=Trust_#%01
## 文件服务访问地址 ## 文件服务访问地址
file_url=https://gateway.gitlink.org.cn/api/file file_url=http://172.20.32.201:8080/api/file
# 容器内文件上传路径 # 容器内文件上传路径
file_path=/home/gitlink/uploadPath file_path=/home/gitlink/uploadPath
## 内容管理系统配置 ## 内容管理系统配置
@ -99,13 +99,13 @@ pmsUrl=http://172.20.32.201:8000
# 用户头像文件目录 # 用户头像文件目录
militaryServerUserLogoPath=images/avatars/User/ militaryServerUserLogoPath=images/avatars/User/
# gitea接口域名 # gitea接口域名
giteaWikiApiDomain=https://172.20.32.201:10082 giteaWikiApiDomain=http://172.20.32.201:10082
# gitea接口前缀 # gitea接口前缀
giteaWikiApiBaseUrl=/api/v1 giteaWikiApiBaseUrl=/api/v1
# ssh方式克隆地址前缀 # ssh方式克隆地址前缀
giteaWikiSshCloneDomain=git@172.20.32.201 giteaWikiSshCloneDomain=git@172.20.32.201
# http方式克隆地址前缀 # http方式克隆地址前缀
giteaWikiHttpsCloneDomain=https://172.20.32.201:10082 giteaWikiHttpsCloneDomain=http://172.20.32.201:10082
# gitea管理员token # gitea管理员token
giteaWikiToken=xxxx giteaWikiToken=xxxx
# wiki导出PDF保存目录 # wiki导出PDF保存目录

View File

@ -0,0 +1,27 @@
package com.ruoyi.common.core.utils;
import com.ruoyi.common.core.exception.ServiceException;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.error.YAMLException;
import java.util.Base64;
public class YamlValidatorUtils {
public static void validateYaml(String base64Yaml) {
// 将base64编码的字符串解码为原始YAML字符串
byte[] decodedBytes = Base64.getDecoder().decode(base64Yaml);
String yamlString = new String(decodedBytes);
// 创建YAML解析器
Yaml yaml = new Yaml();
try {
// 尝试解析YAML字符串
yaml.load(yamlString);
} catch (YAMLException e) {
// 捕获YAML格式错误并返回错误提示信息
throw new ServiceException("YAML格式错误");
}
}
}

View File

@ -40,10 +40,11 @@ public class PmsCiPipelinesController extends BaseController
@ApiImplicitParam(name = "isAsc", value = "排序的方向desc或者asc,默认asc", paramType = "query", dataType = "String") @ApiImplicitParam(name = "isAsc", value = "排序的方向desc或者asc,默认asc", paramType = "query", dataType = "String")
}) })
@ApiOperation("流水线列表") @ApiOperation("流水线列表")
public GenericsTableDataInfo<PmsCiPipelinesDetailVo> list(@ApiParam("流水线名称搜索") @RequestParam(required = false) String pipelineName) public GenericsTableDataInfo<PmsCiPipelinesDetailVo> list(@ApiParam(name = "enterpriseIdentifier", value = "企业标识") @PathVariable String enterpriseIdentifier,
@ApiParam("流水线名称搜索") @RequestParam(required = false) String pipelineName)
{ {
return pmsCiPipelinesService.selectPmsCiPipelinesList(pipelineName); return pmsCiPipelinesService.selectPmsCiPipelinesList(enterpriseIdentifier, pipelineName);
} }
/** /**

View File

@ -46,6 +46,9 @@ public class PmsCiPipelines extends BaseEntity
@Excel(name = "仓库标识") @Excel(name = "仓库标识")
private String repoIdentifier; private String repoIdentifier;
@Excel(name = "仓库名")
private String repoName;
/** 分支 */ /** 分支 */
@Excel(name = "分支") @Excel(name = "分支")
private String branch; private String branch;
@ -146,6 +149,15 @@ public class PmsCiPipelines extends BaseEntity
{ {
return repoIdentifier; return repoIdentifier;
} }
public String getRepoName() {
return repoName;
}
public void setRepoName(String repoName) {
this.repoName = repoName;
}
public void setBranch(String branch) public void setBranch(String branch)
{ {
this.branch = branch; this.branch = branch;

View File

@ -37,7 +37,7 @@ public class PmsCiPipelinesDetailVo
/** 仓库标识 */ /** 仓库标识 */
@ApiModelProperty(value = "仓库标识") @ApiModelProperty(value = "仓库标识")
private String repo; private String repoIdentifier;
/** 分支 */ /** 分支 */
@ApiModelProperty(value = "分支") @ApiModelProperty(value = "分支")
@ -65,7 +65,7 @@ public class PmsCiPipelinesDetailVo
@ApiModelProperty(value = "创建者") @ApiModelProperty(value = "创建者")
private SimpleSysUser creator; private SimpleSysUser creator;
@ApiModelProperty(value = "仓库详情") @ApiModelProperty(value = "仓库")
private JSONObject repoDetails; private String repoName;
} }

View File

@ -27,6 +27,10 @@ public class PmsCiPipelinesInputVo
@NotNull @NotNull
private String repoIdentifier; private String repoIdentifier;
@ApiModelProperty(value = "仓库名")
@NotNull
private String repoName;
/** 分支 */ /** 分支 */
@ApiModelProperty(value = "分支") @ApiModelProperty(value = "分支")
@NotNull @NotNull

View File

@ -3,6 +3,7 @@ package com.ruoyi.pms.pipeline.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.pms.pipeline.domain.PmsCiPipelines; import com.ruoyi.pms.pipeline.domain.PmsCiPipelines;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* 流水线Mapper接口 * 流水线Mapper接口
@ -60,4 +61,6 @@ public interface PmsCiPipelinesMapper
* @return 结果 * @return 结果
*/ */
public int deletePmsCiPipelinesByIds(Long[] ids); public int deletePmsCiPipelinesByIds(Long[] ids);
int selectCountByPipelineNameAndRepoInfo(@Param("pipelineName") String pipelineName, @Param("owner") String owner, @Param("repoIdentifier") String repoIdentifier, @Param("branch") String branch);
} }

View File

@ -24,10 +24,11 @@ public interface IPmsCiPipelinesService
/** /**
* 查询流水线列表 * 查询流水线列表
* *
* @param enterpriseIdentifier
* @param pipelineName 流水线名 * @param pipelineName 流水线名
* @return 流水线集合 * @return 流水线集合
*/ */
public GenericsTableDataInfo<PmsCiPipelinesDetailVo> selectPmsCiPipelinesList(String pipelineName); public GenericsTableDataInfo<PmsCiPipelinesDetailVo> selectPmsCiPipelinesList(String enterpriseIdentifier, String pipelineName);
/** /**
* 新增流水线 * 新增流水线

View File

@ -1,12 +1,14 @@
package com.ruoyi.pms.pipeline.service.impl; package com.ruoyi.pms.pipeline.service.impl;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.Date;
import java.util.List; import java.util.List;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.YamlValidatorUtils;
import com.ruoyi.common.core.web.page.GenericsTableDataInfo; import com.ruoyi.common.core.web.page.GenericsTableDataInfo;
import com.ruoyi.common.httpClient.domain.EntryDto; import com.ruoyi.common.httpClient.domain.EntryDto;
import com.ruoyi.common.httpClient.domain.FileEntryDto; import com.ruoyi.common.httpClient.domain.FileEntryDto;
@ -77,14 +79,17 @@ public class PmsCiPipelinesServiceImpl implements IPmsCiPipelinesService
/** /**
* 查询流水线列表 * 查询流水线列表
* *
* @param enterpriseIdentifier 企业标识
* @param pipelineName 流水线名 * @param pipelineName 流水线名
* @return 流水线 * @return 流水线
*/ */
@Override @Override
public GenericsTableDataInfo<PmsCiPipelinesDetailVo> selectPmsCiPipelinesList(String pipelineName) public GenericsTableDataInfo<PmsCiPipelinesDetailVo> selectPmsCiPipelinesList(String enterpriseIdentifier, String pipelineName)
{ {
PmsEnterprise pmsEnterprise = pmsEnterpriseService.selectPmsEnterpriseByIdentifier(enterpriseIdentifier);
PmsCiPipelines pmsCiPipelines = new PmsCiPipelines(); PmsCiPipelines pmsCiPipelines = new PmsCiPipelines();
pmsCiPipelines.setPipelineName(pipelineName); pmsCiPipelines.setPipelineName(pipelineName);
pmsCiPipelines.setPmsEnterpriseId(pmsEnterprise.getId());
startPage(); startPage();
List<PmsCiPipelines> pipelinesList = pmsCiPipelinesMapper.selectPmsCiPipelinesList(pmsCiPipelines); List<PmsCiPipelines> pipelinesList = pmsCiPipelinesMapper.selectPmsCiPipelinesList(pmsCiPipelines);
return toPage(pipelinesList, this::buildPmsCiPipelinesDetailVo); return toPage(pipelinesList, this::buildPmsCiPipelinesDetailVo);
@ -94,7 +99,6 @@ public class PmsCiPipelinesServiceImpl implements IPmsCiPipelinesService
PmsCiPipelinesDetailVo pmsCiPipelinesDetailVo = new PmsCiPipelinesDetailVo(); PmsCiPipelinesDetailVo pmsCiPipelinesDetailVo = new PmsCiPipelinesDetailVo();
BeanUtils.copyProperties(pmsCiPipelines, pmsCiPipelinesDetailVo); BeanUtils.copyProperties(pmsCiPipelines, pmsCiPipelinesDetailVo);
pmsCiPipelinesDetailVo.setCreator(pmsCommonService.getSimpleSysUserByUsername(pmsCiPipelines.getCreateBy())); pmsCiPipelinesDetailVo.setCreator(pmsCommonService.getSimpleSysUserByUsername(pmsCiPipelines.getCreateBy()));
pmsCiPipelinesDetailVo.setRepoDetails(getRepoNameByOwnerAndIdentifier(pmsCiPipelines.getOwner(), pmsCiPipelines.getRepoIdentifier()));
return pmsCiPipelinesDetailVo; return pmsCiPipelinesDetailVo;
} }
@ -108,19 +112,35 @@ public class PmsCiPipelinesServiceImpl implements IPmsCiPipelinesService
@Override @Override
public JSONObject insertPmsCiPipelines(PmsCiPipelinesInputVo pmsCiPipelinesInputVo, String enterpriseIdentifier) public JSONObject insertPmsCiPipelines(PmsCiPipelinesInputVo pmsCiPipelinesInputVo, String enterpriseIdentifier)
{ {
checkPipelineExistence(pmsCiPipelinesInputVo);
PmsEnterprise pmsEnterprise = pmsEnterpriseService.selectPmsEnterpriseByIdentifier(enterpriseIdentifier); PmsEnterprise pmsEnterprise = pmsEnterpriseService.selectPmsEnterpriseByIdentifier(enterpriseIdentifier);
PmsCiPipelines pmsCiPipelines = new PmsCiPipelines(); PmsCiPipelines pmsCiPipelines = new PmsCiPipelines();
BeanUtils.copyProperties(pmsCiPipelinesInputVo, pmsCiPipelines); BeanUtils.copyProperties(pmsCiPipelinesInputVo, pmsCiPipelines);
pmsCiPipelines.setDeptId(pmsEnterprise.getDeptId()); pmsCiPipelines.setDeptId(pmsEnterprise.getDeptId());
pmsCiPipelines.setPmsEnterpriseId(pmsEnterprise.getId()); pmsCiPipelines.setPmsEnterpriseId(pmsEnterprise.getId());
pmsCiPipelines.setCreateTime(DateUtils.getNowDate()); Date nowDate = DateUtils.getNowDate();
pmsCiPipelines.setCreateTime(nowDate);
pmsCiPipelines.setUpdateTime(nowDate);
pmsCiPipelines.setCreateBy(SecurityUtils.getUsername()); pmsCiPipelines.setCreateBy(SecurityUtils.getUsername());
pmsCiPipelinesMapper.insertPmsCiPipelines(pmsCiPipelines); pmsCiPipelinesMapper.insertPmsCiPipelines(pmsCiPipelines);
openRepoActionModule(pmsCiPipelines.getOwner(), pmsCiPipelines.getRepoIdentifier());
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
result.put("id", pmsCiPipelines.getId()); result.put("id", pmsCiPipelines.getId());
return result; return result;
} }
private void checkPipelineExistence(PmsCiPipelinesInputVo pmsCiPipelinesInputVo) {
int pmsCiPipelineCount = pmsCiPipelinesMapper.selectCountByPipelineNameAndRepoInfo(
pmsCiPipelinesInputVo.getPipelineName(),
pmsCiPipelinesInputVo.getOwner(),
pmsCiPipelinesInputVo.getRepoIdentifier(),
pmsCiPipelinesInputVo.getBranch());
if (pmsCiPipelineCount > 0) {
throw new ServiceException("该项目流水线已存在(流水线名[%s])", pmsCiPipelinesInputVo.getPipelineName());
}
}
/** /**
* 修改流水线 * 修改流水线
* *
@ -179,7 +199,12 @@ public class PmsCiPipelinesServiceImpl implements IPmsCiPipelinesService
@Override @Override
public int createOrUpdatePmsCiPipelineFile(PmsCiPipelineFileInputVo pmsCiPipelineFileInputVo) { public int createOrUpdatePmsCiPipelineFile(PmsCiPipelineFileInputVo pmsCiPipelineFileInputVo) {
YamlValidatorUtils.validateYaml(pmsCiPipelineFileInputVo.getContent());
PmsCiPipelines pmsCiPipelines = pmsCiPipelinesMapper.selectPmsCiPipelinesById(pmsCiPipelineFileInputVo.getId()); PmsCiPipelines pmsCiPipelines = pmsCiPipelinesMapper.selectPmsCiPipelinesById(pmsCiPipelineFileInputVo.getId());
if (pmsCiPipelines == null) {
throw new ServiceException("该项目流水线不存在(流水线ID[%s])", pmsCiPipelineFileInputVo.getId());
}
String filePath = PIPELINE_FILE_DIRECTORY + pmsCiPipelines.getPipelineName() + PIPELINE_YML_FILE_SUFFIX; String filePath = PIPELINE_FILE_DIRECTORY + pmsCiPipelines.getPipelineName() + PIPELINE_YML_FILE_SUFFIX;
FileEntryDto updateBeforeFileEntryDto = new FileEntryDto(); FileEntryDto updateBeforeFileEntryDto = new FileEntryDto();
try { try {
@ -289,8 +314,10 @@ public class PmsCiPipelinesServiceImpl implements IPmsCiPipelinesService
return result; return result;
} }
private JSONObject getRepoNameByOwnerAndIdentifier(String repoOwner, String repoIdentifier) { private JSONObject openRepoActionModule(String repoOwner, String repoIdentifier) {
return gitLinkRequestHelper.doGet(PmsGitLinkRequestUrl.GET_REPO_DETAILS(repoOwner, repoIdentifier)); JSONObject updateRepoActionBody = new JSONObject();
updateRepoActionBody.put("has_actions", true);
return gitLinkRequestHelper.doPatch(PmsGitLinkRequestUrl.UPDATE_REPO_ACTION_MODULE(repoOwner, repoIdentifier), updateRepoActionBody);
} }
private void createFileOnGitlinkAndUpdateDatabase(String fileContent, String filePath, PmsCiPipelines pmsCiPipelines) { private void createFileOnGitlinkAndUpdateDatabase(String fileContent, String filePath, PmsCiPipelines pmsCiPipelines) {
@ -308,6 +335,8 @@ public class PmsCiPipelinesServiceImpl implements IPmsCiPipelinesService
pmsCiPipelines.setPipelineStatus(PIPELINE_ENABLE_STATUS); pmsCiPipelines.setPipelineStatus(PIPELINE_ENABLE_STATUS);
pmsCiPipelines.setFileName(result.getString("name")); pmsCiPipelines.setFileName(result.getString("name"));
pmsCiPipelines.setSha(result.getString("sha")); pmsCiPipelines.setSha(result.getString("sha"));
pmsCiPipelines.setUpdateTime(DateUtils.getNowDate());
pmsCiPipelines.setUpdateBy(SecurityUtils.getUsername());
pmsCiPipelinesMapper.updatePmsCiPipelines(pmsCiPipelines); pmsCiPipelinesMapper.updatePmsCiPipelines(pmsCiPipelines);
} }
@ -329,7 +358,8 @@ public class PmsCiPipelinesServiceImpl implements IPmsCiPipelinesService
if (updateAfterFileEntryDto != null && updateAfterFileEntryDto.getEntries() != null) { if (updateAfterFileEntryDto != null && updateAfterFileEntryDto.getEntries() != null) {
EntryDto entryDto = updateAfterFileEntryDto.getEntries(); EntryDto entryDto = updateAfterFileEntryDto.getEntries();
pmsCiPipelines.setSha(entryDto.getSha()); pmsCiPipelines.setSha(entryDto.getSha());
pmsCiPipelines.setPipelineStatus(PIPELINE_ENABLE_STATUS); pmsCiPipelines.setUpdateTime(DateUtils.getNowDate());
pmsCiPipelines.setUpdateBy(SecurityUtils.getUsername());
pmsCiPipelinesMapper.updatePmsCiPipelines(pmsCiPipelines); pmsCiPipelinesMapper.updatePmsCiPipelines(pmsCiPipelines);
} }
} }

View File

@ -9,7 +9,6 @@ import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.bean.BeanUtils; import com.ruoyi.common.core.utils.bean.BeanUtils;
import com.ruoyi.common.core.web.page.GenericsTableDataInfo; import com.ruoyi.common.core.web.page.GenericsTableDataInfo;
import com.ruoyi.common.httpClient.util.GitLinkRequestHelper; import com.ruoyi.common.httpClient.util.GitLinkRequestHelper;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.pms.common.service.IPmsCommonService; import com.ruoyi.pms.common.service.IPmsCommonService;
import com.ruoyi.pms.enterprise.domain.PmsEnterprise; import com.ruoyi.pms.enterprise.domain.PmsEnterprise;
import com.ruoyi.pms.enterprise.service.IPmsEnterpriseService; import com.ruoyi.pms.enterprise.service.IPmsEnterpriseService;
@ -383,7 +382,7 @@ public class PmsProjectServiceImpl implements IPmsProjectService
PmsProject pmsProjectSearch = new PmsProject(); PmsProject pmsProjectSearch = new PmsProject();
pmsProjectSearch.setPmsProductId(productId); pmsProjectSearch.setPmsProductId(productId);
List<PmsProject> pmsProjectList = pmsProjectMapper.selectPmsProjectListByNoDataScope(pmsProjectSearch); List<PmsProject> pmsProjectList = pmsProjectMapper.selectPmsProjectListByNoDataScope(pmsProjectSearch);
if (pmsProjectList != null && pmsProjectList.size() > 0) { if (pmsProjectList != null && !pmsProjectList.isEmpty()) {
List<Long> projectIdList = pmsProjectList.stream().map(PmsProject::getId).collect(Collectors.toList()); List<Long> projectIdList = pmsProjectList.stream().map(PmsProject::getId).collect(Collectors.toList());
pmsProjectMapper.updatePmsProjectNoProduct(projectIdList); pmsProjectMapper.updatePmsProjectNoProduct(projectIdList);
} }

View File

@ -372,4 +372,8 @@ public class PmsGitLinkRequestUrl extends GitLinkRequestUrl {
public static GitLinkRequestUrl DISABLE_PIPELINE_FILE(String owner, String repoIdentifier, String fileName) { public static GitLinkRequestUrl DISABLE_PIPELINE_FILE(String owner, String repoIdentifier, String fileName) {
return getGitLinkRequestUrl(String.format("/api/v1/%s/%s/actions/disable?workflow=%s", owner, repoIdentifier, fileName)); return getGitLinkRequestUrl(String.format("/api/v1/%s/%s/actions/disable?workflow=%s", owner, repoIdentifier, fileName));
} }
public static GitLinkRequestUrl UPDATE_REPO_ACTION_MODULE(String repoOwner, String repoIdentifier) {
return getGitLinkRequestUrl(String.format("/api/%s/%s.json", repoOwner, repoIdentifier));
}
} }

View File

@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="filePath" column="file_path" /> <result property="filePath" column="file_path" />
<result property="login" column="login" /> <result property="login" column="login" />
<result property="sync" column="sync" /> <result property="sync" column="sync" />
<result property="repoName" column="repo_name" />
<result property="repoIdentifier" column="repo_identifier" /> <result property="repoIdentifier" column="repo_identifier" />
<result property="branch" column="branch" /> <result property="branch" column="branch" />
<result property="event" column="event" /> <result property="event" column="event" />
@ -27,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectPmsCiPipelinesVo"> <sql id="selectPmsCiPipelinesVo">
select id, pipeline_name, pipeline_status, file_name, file_path, login, sync, repo_identifier, branch, event, sha, owner, dept_id, pms_enterprise_id, pms_project_id, update_time, update_by, create_time, create_by from pms_ci_pipelines select id, pipeline_name, pipeline_status, file_name, file_path, login, sync, repo_name, repo_identifier, branch, event, sha, owner, dept_id, pms_enterprise_id, pms_project_id, update_time, update_by, create_time, create_by from pms_ci_pipelines
</sql> </sql>
<select id="selectPmsCiPipelinesList" parameterType="PmsCiPipelines" resultMap="PmsCiPipelinesResult"> <select id="selectPmsCiPipelinesList" parameterType="PmsCiPipelines" resultMap="PmsCiPipelinesResult">
@ -38,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if> <if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
<if test="login != null and login != ''"> and login = #{login}</if> <if test="login != null and login != ''"> and login = #{login}</if>
<if test="sync != null "> and sync = #{sync}</if> <if test="sync != null "> and sync = #{sync}</if>
<if test="repoName != null and repoName != ''"> and repo_name = #{repoName}</if>
<if test="repoIdentifier != null and repoIdentifier != ''"> and repo_identifier = #{repoIdentifier}</if> <if test="repoIdentifier != null and repoIdentifier != ''"> and repo_identifier = #{repoIdentifier}</if>
<if test="branch != null and branch != ''"> and branch = #{branch}</if> <if test="branch != null and branch != ''"> and branch = #{branch}</if>
<if test="event != null and event != ''"> and event = #{event}</if> <if test="event != null and event != ''"> and event = #{event}</if>
@ -46,6 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null "> and dept_id = #{deptId}</if> <if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="pmsEnterpriseId != null "> and pms_enterprise_id = #{pmsEnterpriseId}</if> <if test="pmsEnterpriseId != null "> and pms_enterprise_id = #{pmsEnterpriseId}</if>
<if test="pmsProjectId != null "> and pms_project_id = #{pmsProjectId}</if> <if test="pmsProjectId != null "> and pms_project_id = #{pmsProjectId}</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where> </where>
</select> </select>
@ -53,6 +57,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectPmsCiPipelinesVo"/> <include refid="selectPmsCiPipelinesVo"/>
where id = #{id} where id = #{id}
</select> </select>
<select id="selectCountByPipelineNameAndRepoInfo" resultType="java.lang.Integer">
select count(*)
from pms_ci_pipelines
where pipeline_name = #{pipelineName}
and owner = #{owner}
and repo_identifier = #{repoIdentifier}
and branch = #{branch}
</select>
<insert id="insertPmsCiPipelines" parameterType="PmsCiPipelines" useGeneratedKeys="true" keyProperty="id"> <insert id="insertPmsCiPipelines" parameterType="PmsCiPipelines" useGeneratedKeys="true" keyProperty="id">
insert into pms_ci_pipelines insert into pms_ci_pipelines
@ -63,6 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="filePath != null and filePath != ''">file_path,</if> <if test="filePath != null and filePath != ''">file_path,</if>
<if test="login != null">login,</if> <if test="login != null">login,</if>
<if test="sync != null">sync,</if> <if test="sync != null">sync,</if>
<if test="repoName != null">repo_name,</if>
<if test="repoIdentifier != null">repo_identifier,</if> <if test="repoIdentifier != null">repo_identifier,</if>
<if test="branch != null">branch,</if> <if test="branch != null">branch,</if>
<if test="event != null">event,</if> <if test="event != null">event,</if>
@ -83,6 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="filePath != null and filePath != ''">#{filePath},</if> <if test="filePath != null and filePath != ''">#{filePath},</if>
<if test="login != null">#{login},</if> <if test="login != null">#{login},</if>
<if test="sync != null">#{sync},</if> <if test="sync != null">#{sync},</if>
<if test="repoName != null">#{repoName},</if>
<if test="repoIdentifier != null">#{repoIdentifier},</if> <if test="repoIdentifier != null">#{repoIdentifier},</if>
<if test="branch != null">#{branch},</if> <if test="branch != null">#{branch},</if>
<if test="event != null">#{event},</if> <if test="event != null">#{event},</if>
@ -107,6 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="filePath != null and filePath != ''">file_path = #{filePath},</if> <if test="filePath != null and filePath != ''">file_path = #{filePath},</if>
<if test="login != null">login = #{login},</if> <if test="login != null">login = #{login},</if>
<if test="sync != null">sync = #{sync},</if> <if test="sync != null">sync = #{sync},</if>
<if test="repoName != null">repo_name = #{repoName},</if>
<if test="repoIdentifier != null">repo_identifier = #{repoIdentifier},</if> <if test="repoIdentifier != null">repo_identifier = #{repoIdentifier},</if>
<if test="branch != null">branch = #{branch},</if> <if test="branch != null">branch = #{branch},</if>
<if test="event != null">event = #{event},</if> <if test="event != null">event = #{event},</if>

View File

@ -70,6 +70,7 @@ public class SysNoticeController extends BaseController
public AjaxResult add(@Validated @RequestBody SysNotice notice) public AjaxResult add(@Validated @RequestBody SysNotice notice)
{ {
notice.setCreateBy(SecurityUtils.getUsername()); notice.setCreateBy(SecurityUtils.getUsername());
notice.setUpdateBy(SecurityUtils.getUsername());
return success(noticeService.insertNotice(notice)); return success(noticeService.insertNotice(notice));
} }
@ -83,6 +84,7 @@ public class SysNoticeController extends BaseController
public R<Long> innerAdd(@Validated @RequestBody SysNotice notice) public R<Long> innerAdd(@Validated @RequestBody SysNotice notice)
{ {
notice.setCreateBy(SecurityUtils.getUsername()); notice.setCreateBy(SecurityUtils.getUsername());
notice.setUpdateBy(SecurityUtils.getUsername());
return R.ok(noticeService.insertNoticeAnReturnId(notice)); return R.ok(noticeService.insertNoticeAnReturnId(notice));
} }

View File

@ -273,7 +273,8 @@ public class SysUserDeptRoleServiceImpl implements ISysUserDeptRoleService {
sysUserDeptRoleSearch.setRoleId(orgAdminRole.getRoleId()); sysUserDeptRoleSearch.setRoleId(orgAdminRole.getRoleId());
List<SysUserDeptRole> orgAdminUserDeptRoleList = List<SysUserDeptRole> orgAdminUserDeptRoleList =
sysUserDeptRoleMapper.selectSysUserDeptRoleList(sysUserDeptRoleSearch); sysUserDeptRoleMapper.selectSysUserDeptRoleList(sysUserDeptRoleSearch);
if (orgAdminUserDeptRoleList.isEmpty()) { if (orgAdminUserDeptRoleList.isEmpty()
|| (orgAdminUserDeptRoleList.size() == 1 && orgAdminUserDeptRoleList.stream().anyMatch(x -> x.getUserId().equals(userId)))) {
throw new ServiceException("至少需要保留一位组织管理员角色"); throw new ServiceException("至少需要保留一位组织管理员角色");
} }
} }

View File

@ -50,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != '' ">status, </if> <if test="status != null and status != '' ">status, </if>
<if test="remark != null and remark != ''">remark,</if> <if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
create_time create_time
)values( )values(
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if> <if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
@ -58,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''">#{status}, </if> <if test="status != null and status != ''">#{status}, </if>
<if test="remark != null and remark != ''">#{remark},</if> <if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
sysdate() sysdate()
) )
</insert> </insert>

View File

@ -28,7 +28,7 @@ WHERE `role_id` IN (10, 11, 12, 13, 14, 15);
INSERT INTO `sys_role` (`role_id`, `role_name`, `role_key`, `role_sort`, `data_scope`, `menu_check_strictly`, INSERT INTO `sys_role` (`role_id`, `role_name`, `role_key`, `role_sort`, `data_scope`, `menu_check_strictly`,
`dept_check_strictly`, `status`, `del_flag`, `create_by`, `create_time`, `update_by`, `dept_check_strictly`, `status`, `del_flag`, `create_by`, `create_time`, `update_by`,
`update_time`, `remark`, `dept_type`) `update_time`, `remark`, `dept_type`)
VALUES (10, '组织管理员', 'pms_org_admin', 1, '2', 0, 0, '0', '0', 'admin', '2024-01-05 11:21:29', NULL, NULL, VALUES (10, '组织管理员', 'pms_org_admin', 1, '1', 0, 0, '0', '0', 'admin', '2024-01-05 11:21:29', NULL, NULL,
'拥有组织工作台所有权限,可管理团队及组织工作台设置', 2); '拥有组织工作台所有权限,可管理团队及组织工作台设置', 2);
INSERT INTO `sys_role` (`role_id`, `role_name`, `role_key`, `role_sort`, `data_scope`, `menu_check_strictly`, INSERT INTO `sys_role` (`role_id`, `role_name`, `role_key`, `role_sort`, `data_scope`, `menu_check_strictly`,

View File

@ -0,0 +1,24 @@
-- 项目管理-制品库增加字典数据
INSERT INTO `sys_dict_type` (`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`,
`remark`)
VALUES ('xxxx软件段cpu架构', 'xxxx_rjd_cpu', '0', 'admin', '2023-12-15 16:51:30', 'admin', '2023-12-15 16:53:42', NULL);
INSERT INTO `sys_dict_type` (`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`,
`remark`)
VALUES ('xxxx软件段操作系统', 'xxxx_rjd_os', '0', 'admin', '2023-12-15 16:53:28', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`,
`is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
VALUES (0, 'X86商用系列', '1', 'xxxx_rjd_cpu', NULL, 'default', 'Y', '0', 'admin', '2023-12-15 16:52:30', '', NULL,
NULL);
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`,
`is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
VALUES (0, 'ARM商用系列', '2', 'xxxx_rjd_cpu', NULL, 'default', 'Y', '0', 'admin', '2023-12-15 16:52:48', '', NULL,
NULL);
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`,
`is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
VALUES (0, 'debian服务器版', '1', 'xxxx_rjd_os', NULL, NULL, 'Y', '0', 'admin', '2023-12-15 16:54:00', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`,
`is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
VALUES (0, 'debian桌面版', '2', 'xxxx_rjd_os', NULL, 'default', 'Y', '0', 'admin', '2023-12-15 16:54:21', '', NULL,
NULL);

View File

@ -0,0 +1,9 @@
-- 项目管理-流水线加代码仓库名字段
SET
FOREIGN_KEY_CHECKS = 0;
ALTER TABLE `pms_ci_pipelines`
ADD COLUMN `repo_name` VARCHAR(255) DEFAULT NULL COMMENT '代码仓库名' AFTER `sync`;
SET
FOREIGN_KEY_CHECKS = 1;