字典修改

This commit is contained in:
2022-12-01 16:47:05 +08:00
parent 0f0baf7299
commit 28d59d7742
2 changed files with 2 additions and 2 deletions

View File

@@ -39,5 +39,5 @@ public interface DictDetailRepository extends JpaRepository<DictDetail, Long>, J
* @param label * @param label
* @return * @return
*/ */
List<DictDetail> findByLabel(String label); List<DictDetail> findByLabelAndDict_Id(String label, Long dict_id);
} }

View File

@@ -62,7 +62,7 @@ public class DictDetailServiceImpl implements DictDetailService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void create(DictDetail resources) { public void create(DictDetail resources) {
List<DictDetail> label = dictDetailRepository.findByLabel(resources.getLabel()); List<DictDetail> label = dictDetailRepository.findByLabelAndDict_Id(resources.getLabel(), resources.getDict().getId());
if (ObjectUtil.isNotEmpty(label)) throw new BadRequestException("字典[" + resources.getLabel() + "]已存在"); if (ObjectUtil.isNotEmpty(label)) throw new BadRequestException("字典[" + resources.getLabel() + "]已存在");
dictDetailRepository.save(resources); dictDetailRepository.save(resources);
// 清理缓存 // 清理缓存