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

import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.util.NumberUtil;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageLoadHandler;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageSaveHandler;

/**
 * Created by Akmm at 2022/7/1 15:47
 * 区划保存
 */
public class AreaHandler {
    static class AreaSaveHandler extends DynPageSaveHandler {
        @Override
        protected void checkBean(DefaultEntity bean) {
            super.checkBean(bean);
            if (bean instanceof Area) {
                Area area = (Area) bean;
                area.setEntityId(NumberUtil.getLongIgnoreErr(area.getCode()));
            }
        }
    }

    static class AreaLoadHandler extends DynPageLoadHandler {
        @Override
        protected void afterAddBean(PageDataset dataset, SwMap bean) {
            super.afterAddBean(dataset, bean);
            Area area = new Area();
            area.setData(bean);
//            area.setSeq();
        }
    }
}
