package com.ruoyi.common.core.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * Entity基类
 */
@Data
public class DataEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    //部门名称
    @TableField(exist = false)
    private String deptName;

    //场所名称
    @TableField(exist = false)
    private String placeName;

    //隶属海关
    @TableField(exist = false)
    private String customName;

    //海关编码
    @TableField(exist = false)
    private String customCode;

    //通道名称
    @TableField(exist = false)
    private String channelName;

    //通道号
    @TableField(exist = false)
    private String channelCode;

    //开始日期
    @TableField(exist = false)
    private String dateBegin;

    //结束日期
    @TableField(exist = false)
    private String dateEnd;

    @TableField(exist = false)
    private Map<String, Object> params;


    public Map<String, Object> getParams() {
        if (params == null) {
            params = new HashMap<>();
            params.put("common","(p.dept_id = #{deptId} OR p.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))");
        }
        return params;
    }

    public void setParams(Map<String, Object> params) {
        this.params = params;
    }
}
