package com.engine.organization.wrapper;

import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.organization.entity.TreeData;
import com.engine.organization.entity.postion.po.PostPO;
import com.engine.organization.service.PostService;
import com.engine.organization.service.impl.PostServiceImpl;
import org.apache.ibatis.annotations.Param;
import weaver.hrm.User;

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

/**
 * @description:
 * @author:dxfeng
 * @createTime: 2022/05/13
 * @version: 1.0
 */
public class PostWrapper extends Service {
    private PostService getPostService(User user) {
        return ServiceUtil.getService(PostServiceImpl.class, user);
    }

    /**
     * 新增职务分类
     *
     * @param postPO
     * @return
     */
    public int savePost(PostPO postPO) {
        return getPostService(user).savePost(postPO);
    }

    /**
     * 更新职务分类
     *
     * @param postPO
     * @return
     */
    public int updatePost(PostPO postPO) {
        return getPostService(user).updatePost(postPO);
    }

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

    /**
     * 获取新增表单
     *
     * @param params
     * @return
     */
    public Map<String, Object> getPostForm(Map<String, Object> params) {
        return getPostService(user).getPostForm(params);
    }

    /**
     * 获取左侧树
     * @return
     */
    public TreeData getTreeData() {
        return getPostService(user).getTreeData();
    }

}
