|
|
|
@ -20,6 +20,7 @@ package com.elink.esua.epdc.service.impl; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
|
@ -93,6 +94,12 @@ public class SubCheckDictionaryServiceImpl extends BaseServiceImpl<SubCheckDicti |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(SubCheckDictionaryDTO dto) { |
|
|
|
String checkLabel = dto.getCheckLabel(); |
|
|
|
if (StringUtils.isNotBlank(checkLabel)) { |
|
|
|
if (getcheckLabelCount(dto) > 0) { |
|
|
|
throw new RenException("您输入的考核项名称已存在!"); |
|
|
|
} |
|
|
|
} |
|
|
|
SubCheckDictionaryEntity entity = ConvertUtils.sourceToTarget(dto, SubCheckDictionaryEntity.class); |
|
|
|
insert(entity); |
|
|
|
} |
|
|
|
@ -100,10 +107,30 @@ public class SubCheckDictionaryServiceImpl extends BaseServiceImpl<SubCheckDicti |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(SubCheckDictionaryDTO dto) { |
|
|
|
String checkLabel = dto.getCheckLabel(); |
|
|
|
if (StringUtils.isNotBlank(checkLabel)) { |
|
|
|
if (getcheckLabelCount(dto) > 0) { |
|
|
|
throw new RenException("您输入的考核项名称已存在!"); |
|
|
|
} |
|
|
|
} |
|
|
|
SubCheckDictionaryEntity entity = ConvertUtils.sourceToTarget(dto, SubCheckDictionaryEntity.class); |
|
|
|
updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 统计考核项名称数量 |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public Integer getcheckLabelCount(SubCheckDictionaryDTO dto) { |
|
|
|
QueryWrapper<SubCheckDictionaryEntity> wrapper = new QueryWrapper<>(); |
|
|
|
wrapper.eq("checkLabel", dto.getCheckLabel()); |
|
|
|
String id = dto.getId(); |
|
|
|
wrapper.ne(id != null, "id", dto.getId()); |
|
|
|
wrapper.eq("del_flag", "0"); |
|
|
|
return baseDao.selectCount(wrapper); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void delete(String[] ids) { |
|
|
|
|