|
@ -438,22 +438,25 @@ public class ProvinceService implements IProvinceService { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void updateLeader(ProvinceCompeteDto.ModifyLeader param) { |
|
|
public void updateLeader(ProvinceCompeteDto.ModifyLeader param) { |
|
|
Long coachId = param.getCoachId(); |
|
|
if(ObjectUtil.isNull(param.getCoachId())){ |
|
|
// Long companyId = param.getCompanyId();
|
|
|
CompeteCoachExample competeCoachExample = new CompeteCoachExample(); |
|
|
// CompeteCoachExample competeCoachExample = new CompeteCoachExample();
|
|
|
competeCoachExample.createCriteria().andCompanyIdEqualTo(param.getCompanyId()).andIdentityEqualTo((byte) param.getIdentity()); |
|
|
// competeCoachExample.createCriteria().andCompanyIdEqualTo(companyId);
|
|
|
long count = competeCoachMapper.countByExample(competeCoachExample); |
|
|
// List<CompeteCoach> competeCoachList = competeCoachMapper.selectByExample(competeCoachExample);
|
|
|
if (param.getIdentity() == 0 && count >= 2){ |
|
|
if(ObjectUtil.isNull(coachId)){ |
|
|
throw new BaseException(CodeEnum.COACH_NUM_FULL); |
|
|
CompeteCoach competeCoach=new CompeteCoach(); |
|
|
} |
|
|
competeCoach.setId(snowflake.nextId()); |
|
|
if (param.getIdentity() == 1 && count >=3){ |
|
|
BeanUtil.copyProperties(param,competeCoach); |
|
|
throw new BaseException(CodeEnum.COACH_NUM_FULL); |
|
|
competeCoachMapper.insertSelective(competeCoach); |
|
|
|
|
|
}else{ |
|
|
|
|
|
CompeteCoach competeCoach=competeCoachMapper.selectByPrimaryKey(coachId); |
|
|
|
|
|
if(ObjectUtil.isNotNull(competeCoach)){ |
|
|
|
|
|
BeanUtil.copyProperties(param,competeCoach); |
|
|
|
|
|
competeCoachMapper.updateByPrimaryKeySelective(competeCoach); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
CompeteCoach competeCoach1 = new CompeteCoach(); |
|
|
|
|
|
competeCoach1.setId(snowflake.nextId()); |
|
|
|
|
|
BeanUtil.copyProperties(param, competeCoach1); |
|
|
|
|
|
competeCoachMapper.insertSelective(competeCoach1); |
|
|
|
|
|
}else { |
|
|
|
|
|
CompeteCoach competeCoach2 = new CompeteCoach(); |
|
|
|
|
|
competeCoach2.setId(snowflake.nextId()); |
|
|
|
|
|
BeanUtil.copyProperties(param, competeCoach2); |
|
|
|
|
|
competeCoachMapper.insertSelective(competeCoach2); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|