package org.dromara.wflow.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.dromara.wflow.bean.entity.WflowDepartments;
import org.dromara.wflow.bean.vo.OrgTreeVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author : willian fu
 * @date : 2022/6/27
 */
public interface WflowDepartmentsMapper extends BaseMapper<WflowDepartments> {

    @Select("SELECT dept_id id, dept_name `name`, 'dept' AS 'type' FROM sys_dept WHERE del_flag = 0 AND parent_id=#{deptId}")
    List<OrgTreeVo> selectByDept(@Param("deptId") String deptId);

    @Select("SELECT dept_id id, dept_name `name`, 'dept' AS 'type' FROM sys_dept WHERE del_flag = 0 AND parent_id=#{deptId}")
    List<WflowDepartments> selectList(LambdaQueryWrapper<WflowDepartments> queryWrapper);
}
