@Query(value = "select * from brand where brand_name = :#{#brand.brandName} and id <> :#{#brand.id}",nativeQuery = true) List<Brand> findAllByBrandNameNotId(@Param("brand") Brand brand);
List<Brand> list = brandRepository.findAllByBrandNameNotId(brand); if (list.size()>0) { throw new StatusCodeException(StatusCode.FAILED.getCode(),"品牌名称重复!"); }