|
@@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
+import com.management.platform.entity.BusinessOpportunity;
|
|
|
import com.management.platform.entity.CustomerInfo;
|
|
|
import com.management.platform.entity.Stage;
|
|
|
import com.management.platform.entity.User;
|
|
|
+import com.management.platform.mapper.BusinessOpportunityMapper;
|
|
|
import com.management.platform.mapper.StageMapper;
|
|
|
import com.management.platform.mapper.UserMapper;
|
|
|
import com.management.platform.service.StageService;
|
|
@@ -34,6 +36,8 @@ public class StageServiceImpl extends ServiceImpl<StageMapper, Stage> implements
|
|
|
@Autowired
|
|
|
private StageMapper stageMapper;
|
|
|
@Autowired
|
|
|
+ private BusinessOpportunityMapper boMapper;
|
|
|
+ @Autowired
|
|
|
private UserMapper userMapper;
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -56,10 +60,27 @@ public class StageServiceImpl extends ServiceImpl<StageMapper, Stage> implements
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public HttpRespMsg getStage(HttpServletRequest request) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
msg.setData(stageMapper.selectList(new QueryWrapper<Stage>().eq("company_id",userMapper.selectById(request.getHeader("Token")).getCompanyId()).orderBy(true, true, "seq")));
|
|
|
return msg;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public HttpRespMsg deleteStage(Stage stage) {
|
|
|
+ Integer i = boMapper.selectCount(new QueryWrapper<BusinessOpportunity>().eq("stage_id", stage.getId()));
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ if (i > 0){
|
|
|
+ msg.setError("此阶段已使用");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ stageMapper.deleteById(stage.getId());
|
|
|
+ msg.setMsg("操作成功");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
}
|