|
@@ -3,8 +3,10 @@ package com.management.platform.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.management.platform.entity.Participation;
|
|
|
import com.management.platform.entity.Project;
|
|
|
import com.management.platform.entity.Report;
|
|
|
+import com.management.platform.mapper.ParticipationMapper;
|
|
|
import com.management.platform.mapper.ProjectMapper;
|
|
|
import com.management.platform.mapper.ReportMapper;
|
|
|
import com.management.platform.mapper.UserMapper;
|
|
@@ -35,6 +37,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
private UserMapper userMapper;
|
|
|
@Resource
|
|
|
private ReportMapper reportMapper;
|
|
|
+ @Resource
|
|
|
+ private ParticipationMapper participationMapper;
|
|
|
|
|
|
//获取项目列表
|
|
|
@Override
|
|
@@ -71,7 +75,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
|
|
|
//添加或编辑项目
|
|
|
@Override
|
|
|
- public HttpRespMsg editProject(Integer id, String name, HttpServletRequest request) {
|
|
|
+ public HttpRespMsg editProject(Integer id, String name, String[] userIds, HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
try {
|
|
|
Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
|
|
@@ -90,6 +94,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
httpRespMsg.setError("操作失败");
|
|
|
}
|
|
|
}
|
|
|
+ //编辑关系
|
|
|
+ participationMapper.delete(new QueryWrapper<Participation>().eq("project_id", id));
|
|
|
+ for (String userId : userIds) {
|
|
|
+ participationMapper.insert(new Participation().setProjectId(id).setUserId(userId));
|
|
|
+ }
|
|
|
} catch (NullPointerException e) {
|
|
|
httpRespMsg.setError("验证失败");
|
|
|
return httpRespMsg;
|