package com.njcn.msgpush.module.system.dal.mysql.dept;

import com.njcn.msgpush.framework.mybatis.core.mapper.BaseMapperX;
import com.njcn.msgpush.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.njcn.msgpush.module.system.dal.dataobject.dept.OrgLeaderRelationDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface OrgLeaderRelationMapper extends BaseMapperX<OrgLeaderRelationDO> {

    default List<OrgLeaderRelationDO> selectListByDeptId(Long deptId) {
        return selectList(new LambdaQueryWrapperX<OrgLeaderRelationDO>()
                .eq(OrgLeaderRelationDO::getDeptId, deptId)
                .orderByDesc(OrgLeaderRelationDO::getId));
    }

    default List<OrgLeaderRelationDO> selectListByDeptIdAndUserId(Long deptId, Long userId) {
        return selectList(new LambdaQueryWrapperX<OrgLeaderRelationDO>()
                .eq(OrgLeaderRelationDO::getDeptId, deptId)
                .eq(OrgLeaderRelationDO::getUserId, userId)
                .orderByDesc(OrgLeaderRelationDO::getId));
    }

}
