字典修改
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
// 清理缓存
|
// 清理缓存
|
||||||
|
|||||||
Reference in New Issue
Block a user