2022-02-12 08:48:57 +08:00

49 lines
1.3 KiB
Java

package com.xkrs.dao;
import com.xkrs.model.entity.DataDict;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 10:03
*/
@Component
public interface DataDictDao extends JpaRepository<DataDict,Long>, JpaSpecificationExecutor<DataDict> {
/**
* 通过中文名称查询字典表数据
* @param chineseName
* @return
*/
DataDict findByDictChineseName(String chineseName);
/**
* 通过英文变量查询字典表的数据
* @param englishName
* @return
*/
DataDict findByDictEnglishName(String englishName);
/**
* 根据id查询字典信息
* @param id
* @return
*/
DataDict findById(Integer id);
/**
* 根据id修改字典的信息
* @param id
* @param chineseName
*/
@Modifying(clearAutomatically=true)
@Query(value = "update data_dict set dict_chinese_name = ?2 where id = ?1",nativeQuery = true)
void updateDict(Integer id, String chineseName);
}