修改了对应bug

This commit is contained in:
chenze 2024-08-16 18:01:23 +08:00
parent d0da4caa5e
commit ecb05e470c
4 changed files with 24 additions and 4 deletions

View File

@ -145,12 +145,14 @@ public class RepairDeviceTypeController extends BaseController {
customerStaffService.updateIcsCustomerStaff(staff1);
}
}
int i1 = repairRelationalService.deleteByTypeId(repairDeviceType.getId());
if (i1>=0){
int count = repairRelationalService.selectCountByUserId(repairDeviceType.getStaffId());
if (count >0){
IcsCustomerStaff staff = customerStaffService.selectIcsCustomerStaffById(repairDeviceType.getStaffId());
return R.error(""+staff.getUsername()+"已有角色,请先删除对应角色在添加");
}
//保存成功后添加设备与派单员关联关系
@ -167,6 +169,13 @@ public class RepairDeviceTypeController extends BaseController {
//保存成功后添加设备与维修人关联关系
for (Long aLong : repairDeviceType.getWorkerId()) {
int count1 = repairRelationalService.selectCountByUserId(aLong);
if (count1 >0){
IcsCustomerStaff staff1 = customerStaffService.selectIcsCustomerStaffById(aLong);
return R.error(""+staff1.getUsername()+"已有角色,请先删除对应角色在添加");
}
RepairRelational repairRelational1 = new RepairRelational();
repairRelational1.setTypeId(repairDeviceType.getId());
repairRelational1.setUserId(aLong);

View File

@ -66,4 +66,6 @@ public interface IRepairRelationalService extends IService<RepairRelational> {
List<RepairRelational> selectWorkerIdByTypeId(Long typeId);
Long selectByUserId(Long id);
int selectCountByUserId(Long staffId);
}

View File

@ -124,4 +124,11 @@ public class RepairRelationalServiceImpl extends ServiceImpl<RepairRelationalMap
RepairRelational repairRelational = repairRelationalMapper.selectOne(wrapper);
return repairRelational.getTypeId();
}
@Override
public int selectCountByUserId(Long staffId) {
QueryWrapper<RepairRelational> wrapper = new QueryWrapper<>();
wrapper.eq("user_id",staffId);
return repairRelationalMapper.selectCount(wrapper);
}
}

View File

@ -331,7 +331,9 @@ public class WxLoginAPIController extends BaseController {
IcsCustomerStaff customerStaff = icsCustomerStaffService.selectIcsCustomerStaffById(userId);
if (null != customerStaff) {
if (customerStaff.getDataType().equals("3")) customerStaff.setTypeId(repairRelationalService.selectByUserId(customerStaff.getId()));
if (customerStaff.getDataType() !=null && customerStaff.getDataType().equals("3")){
customerStaff.setTypeId(repairRelationalService.selectByUserId(customerStaff.getId()));
}
StaffCustomer staffCustomer = new StaffCustomer();
staffCustomer.setStaffId(userId);
List<StaffCustomer> staffCustomers = staffCustomerService.selectStaffCustomerByStaffId(userId);