分组接口修改
This commit is contained in:
parent
fb6bb22dcf
commit
04885cac86
@ -8,7 +8,10 @@ import cd.casic.ci.process.process.converter.GroupConverter;
|
||||
import cd.casic.ci.process.process.dao.pipeline.PipGroupDao;
|
||||
import cd.casic.ci.process.process.dataObject.pipgroup.PipGroup;
|
||||
import cd.casic.ci.process.process.service.group.GroupService;
|
||||
import cd.casic.ci.process.process.service.pipeline.PipelineService;
|
||||
import cd.casic.ci.process.util.WebFrameworkUtils;
|
||||
import cd.casic.framework.commons.exception.ServiceException;
|
||||
import cd.casic.framework.commons.exception.enums.GlobalErrorCodeConstants;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -20,6 +23,8 @@ public class GroupServiceImpl extends ServiceImpl<PipGroupDao, PipGroup> impleme
|
||||
private GroupConverter converter;
|
||||
@Resource
|
||||
private PipGroupDao groupDao;
|
||||
@Resource
|
||||
private PipelineService pipelineService;
|
||||
@Override
|
||||
public void addGroup(GroupAddReq req) {
|
||||
PipGroup pipGroup = converter.reqToDto(req);
|
||||
@ -40,6 +45,9 @@ public class GroupServiceImpl extends ServiceImpl<PipGroupDao, PipGroup> impleme
|
||||
|
||||
@Override
|
||||
public void deleteGroup(String id) {
|
||||
if (pipelineService.getGroupCount(id) != 0) {
|
||||
throw new ServiceException(GlobalErrorCodeConstants.PIPELINE_ERROR.getCode(),"分组下辖流水线不为空不允许删除");
|
||||
}
|
||||
removeById(id);
|
||||
}
|
||||
}
|
||||
|
@ -37,4 +37,5 @@ public interface PipelineService extends IService<PipPipeline> {
|
||||
PipelineFindResp findPipelineById(@Valid PipelineQueryReq pipelineQueryReq);
|
||||
|
||||
TreeRunContextResp getPipelineRunState(String pipelineId);
|
||||
Long getGroupCount(String groupId);
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ import cd.casic.framework.commons.exception.enums.GlobalErrorCodeConstants;
|
||||
import cd.casic.framework.commons.pojo.PageResult;
|
||||
import cd.casic.framework.security.dal.user.AdminUserDO;
|
||||
import cd.casic.framework.tenant.core.service.AdminUserServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -555,6 +556,17 @@ public class PipelineServiceImpl extends ServiceImpl<PipelineDao, PipPipeline> i
|
||||
|
||||
return new TreeRunContextResp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getGroupCount(String groupId) {
|
||||
if (StringUtils.isEmpty(groupId)) {
|
||||
return -1L;
|
||||
}
|
||||
LambdaQueryWrapper<PipPipeline> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PipPipeline::getGroupId,groupId);
|
||||
return pipelineDao.selectCount(wrapper);
|
||||
}
|
||||
|
||||
private String between(LocalDateTime startTime,LocalDateTime endTime){
|
||||
if (startTime==null||endTime==null) {
|
||||
return "";
|
||||
|
@ -21,6 +21,12 @@
|
||||
LEFT JOIN
|
||||
(SELECT group_id,COUNT(*) count FROM pip_pipeline GROUP BY group_id) pl
|
||||
ON ((pg.id = pl.group_id ) OR (ISNULL(pl.group_id) AND ISNULL(pl.group_id)))
|
||||
WHERE pg.`name` LIKE #{groupName} AND ((pg.creator = #{userId} AND pg.type = 'PERSON') OR (pg.type = 'PROJECT'))
|
||||
<where>
|
||||
<if test="groupName!=null and groupName!=''">
|
||||
AND pg.`group_name` LIKE CONCAT('%',#{groupName},'%')
|
||||
</if>
|
||||
AND ((pg.creator = #{userId} AND pg.type = 'PERSON') OR (pg.type = 'PROJECT'))
|
||||
</where>
|
||||
|
||||
</select>
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user