|
|
@@ -53,16 +53,14 @@ public class DepartmentServiceImpl extends BaseMybatisDao<WorkingHoursMapper> im
|
|
|
//如果没有分类,则无法判断数据库,也用于修改
|
|
|
if (in.getType()!=null){
|
|
|
List<WorkingHours> typeCount = workingHoursMapper.getTypeCount(in.getType());
|
|
|
- //大于1,则一定是重复,等于1,要判断id是否一致
|
|
|
- if(typeCount.size()>1) {
|
|
|
- return true;
|
|
|
+ //新增,有则不允许新增
|
|
|
+ if (in.getId()==null) {
|
|
|
+ if(typeCount.size()>0) return true;
|
|
|
+ //修改,判断
|
|
|
}else {
|
|
|
- //新增不用判断
|
|
|
- if (in.getId()!=null){
|
|
|
- for (WorkingHours e : typeCount) {
|
|
|
- if (!e.getId().equals(in.getId())){
|
|
|
- return true;
|
|
|
- }
|
|
|
+ for (WorkingHours e : typeCount) {
|
|
|
+ if (!e.getId().equals(in.getId())){
|
|
|
+ return true;
|
|
|
}
|
|
|
}
|
|
|
}
|