package cc.smtweb.system.bpm.web.sys.user.menuPlan;

import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.mvc.service.AbstractHandler;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageService;

/**
 * Created by 1 at 2022-08-01 18:08:28
 * 页面【[菜单方案]的服务类
 */
@SwService
public class MenuPlanService extends DynPageService {
    public final static String TYPE_CUST = "cust";

    @Override
    protected AbstractHandler createHandler(String type) {
        switch (type) {
            case TYPE_CUST:
                return new MenuPlanHandler.MenuCustHandler();
            case TYPE_LOAD:
                return new MenuPlanHandler.MenuLoadHandler();
        }
        return super.createHandler(type);
    }

    //保存方案明细
    public R savePlanItem(@SwBody SwMap params, UserSession us) {
        return pageHandler(params, us, TYPE_CUST, handler -> ((MenuPlanHandler.MenuCustHandler) handler).savePlanItem());
    }

    // 删除方案明细
    public R delPlanItem(@SwBody SwMap params, UserSession us) {
        return pageHandler(params, us, TYPE_CUST, handler -> ((MenuPlanHandler.MenuCustHandler) handler).delPlanItem());
    }
}
