package com.engine.organization.wrapper;

import com.api.browser.bean.SearchConditionGroup;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.organization.entity.company.param.CompSearchParam;
import com.engine.organization.entity.department.param.DepartmentMoveParam;
import com.engine.organization.service.CompService;
import com.engine.organization.service.impl.CompServiceImpl;
import weaver.hrm.User;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * @description:
 * @author:dxfeng
 * @createTime: 2022/05/16
 * @version: 1.0
 */
public class CompWrapper extends Service {
    private CompService getCompService(User user) {
        return ServiceUtil.getService(CompServiceImpl.class, user);
    }

    /**
     * 列表
     *
     * @param params
     * @return
     */
    public Map<String, Object> listPage(CompSearchParam params) {
        return getCompService(user).listPage(params);
    }


    /**
     * 保存公司/分部基础信息
     *
     * @param params
     * @return
     */
    public Long saveBaseComp(Map<String, Object> params) {
        return getCompService(user).saveBaseComp(params);
    }

    /**
     * 更新禁用标记
     *
     * @param params
     */
    public int updateForbiddenTagById(CompSearchParam params) {
        return getCompService(user).updateForbiddenTagById(params);
    }

    /**
     * 更新分部主表、拓展表、明细表
     *
     * @param params
     * @return
     */
    public Long updateComp(Map<String, Object> params) {
        return getCompService(user).updateComp(params);
    }

    /**
     * 根据ID批量删除
     *
     * @param ids
     */
    public int deleteByIds(Collection<Long> ids) {
        return getCompService(user).deleteByIds(ids);
    }

    /**
     * 获取搜索条件
     *
     * @param params
     * @return
     */
    public Map<String, Object> getSearchCondition(Map<String, Object> params) {
        return getCompService(user).getSearchCondition(params);
    }

    /**
     * 获取列表页面按钮信息
     *
     * @return
     */
    public Map<String, Object> getHasRight() {
        return getCompService(user).getHasRight();
    }

    /**
     * 获取基本信息表单
     *
     * @param params
     * @return
     */
    public Map<String, Object> getCompBaseForm(Map<String, Object> params) {
        return getCompService(user).getCompBaseForm(params);
    }

    /**
     * 新增表单
     *
     * @return
     */
    public Map<String, Object> getCompSaveForm() {
        return getCompService(user).getCompSaveForm();
    }

    /**
     * 转移分部
     *
     * @param moveParam
     * @return
     */
    public int moveCompany(DepartmentMoveParam moveParam) {
        return getCompService(user).moveCompany(moveParam);
    }

    public List<SearchConditionGroup> getMoveForm() {
        return getCompService(user).getMoveForm();
    }

}
