package com.changhu.support.mybatisplus.handler.permission.psProjectMapper;

import com.changhu.common.utils.UserUtil;
import com.changhu.support.mybatisplus.handler.permission.AbstractDataPermissionHandler;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.LongValue;
import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
import net.sf.jsqlparser.schema.Column;
import net.sf.jsqlparser.schema.Table;

/**
 * @author 20252
 * @createTime 2024/8/13 下午3:01
 * @desc GetMyProjectListPermissionHandler...
 */
public class GetMyProjectListPermissionHandler implements AbstractDataPermissionHandler {
    @Override
    public Expression apply(Table table, Expression where, String mappedStatementId) {
        var b = false;
        if (b) {
            return null;
        }
        return sqlFragment();
    }

    @Override
    public Expression sqlFragment() {
        return new EqualsTo(new Column("responsible_user_id"), new LongValue(UserUtil.getUserId()));
    }
}
