| | |
| | | public R<PageInfo<TCrmClinicVO>> pageList(@RequestBody TCrmClinicQuery query) { |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | if(roleType == 2 || roleType == 3){ |
| | | if(roleType == 2){ |
| | | query.setUserId(userId); |
| | | query.setRoleType(roleType); |
| | | // 查询账号绑定的分公司 |
| | | TCrmBranch crmBranch = crmBranchService.getOne(Wrappers.lambdaQuery(TCrmBranch.class) |
| | | .eq(TCrmBranch::getUserId,userId) |
| | | .last("LIMIT 1")); |
| | | query.setBranchId(crmBranch.getId()); |
| | | } |
| | | if(roleType == 3){ |
| | | query.setUserId(userId); |
| | | query.setRoleType(roleType); |
| | | // 查询账号绑定的业务员 |
| | | TCrmSalesperson crmSalesperson = crmSalespersonService.getOne(Wrappers.lambdaQuery(TCrmSalesperson.class) |
| | | .eq(TCrmSalesperson::getUserId,userId) |
| | | .last("LIMIT 1")); |
| | | query.setSalespersonId(crmSalesperson.getId()); |
| | | } |
| | | return R.ok(crmClinicService.pageList(query)); |
| | | } |
| | |
| | | @ApiOperation(value = "添加crm诊所管理") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TCrmClinicDTO dto) { |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | if (roleType == 1){ |
| | | dto.setStatus(3); |
| | | }else { |
| | | dto.setStatus(1); |
| | | } |
| | | return crmClinicService.addClinic(dto); |
| | | } |
| | | |