package com.yihu.jw.base.dao.menu;

import com.yihu.jw.entity.base.menu.BaseLinkDictDO;
import com.yihu.jw.entity.base.menu.BaseMenuDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

public interface BaseLinkDictDao extends PagingAndSortingRepository<BaseLinkDictDO, String>, JpaSpecificationExecutor<BaseLinkDictDO> {
    @Query( value = "select max(t.link_sort) AS \"zuida\" from base_link_dict t where t.is_del='1'",nativeQuery = true)
    Integer getMaxSort();
    @Query( value = "select min(t.link_sort) AS \"zuixiao\" from base_link_dict t  where t.is_del='1'",nativeQuery = true)
    Integer getMinSort();

    @Modifying
    @Query("update BaseLinkDictDO p set p.status=?2 where p.id=?1")
    void updateStatus(String id,String status);

    @Modifying
    @Query("update BaseLinkDictDO p set p.isShow=?2 where p.id=?1")
    void updateShow(String id,String status);

    @Modifying
    @Query("update BaseLinkDictDO p set p.isDel=?2 where p.id=?1")
    void updateDel(String id,String status);
}
