package easydo.technology.system.mapper;

import java.util.List;

import com.baomidou.mybatisplus.core.metadata.IPage;

import easydo.technology.system.domain.DictDetail;
import easydo.technology.system.dto.DictDetailDto;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import easydo.technology.base.CommonMapper;


/**
* @author jinjin
* @date 2020-09-24
*/
@Repository
public interface DictDetailMapper extends CommonMapper<DictDetail> {

    @Select("SELECT detail.detail_id as id, dict.dict_id as \"dict.id\", detail.* FROM sys_dict_detail detail\n" +
            "LEFT JOIN sys_dict dict ON detail.dict_id = dict.dict_id\n" +
            "WHERE dict.name = #{dictName}\n" +
            "ORDER BY dict_sort ASC")
    List<DictDetailDto> getDictDetailsByDictName(DictDetailDto detailDto);
    @Select("SELECT detail.detail_id as id, dict.dict_id as \"dict.id\", detail.* FROM sys_dict_detail detail\n" +
            "LEFT JOIN sys_dict dict ON detail.dict_id = dict.dict_id\n" +
            "WHERE dict.name = #{dictName}\n" +
            "ORDER BY dict_sort ASC")
    IPage<DictDetailDto> getDictDetailsByDictName(@Param("dictName") String dictName, IPage<DictDetailDto> page);
}
