package com.agileboot.system.dept.dto;

import com.agileboot.common.mybatis.core.page.PageQuery;
import com.agileboot.system.dept.entity.SysDept;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author valarchie
 */
@Data
@NoArgsConstructor
public class DeptQuery extends PageQuery<SysDept> {

    private Long deptId;

    private Long parentId;

    @Override
    public LambdaQueryWrapper<SysDept> toQueryWrapper() {
        return Wrappers.lambdaQuery(SysDept.class)
                .eq(parentId != null, SysDept::getParentId, parentId);
    }
}
