package com.mortals.xhx.module.base.web;

import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.base.model.BaseAreaEntity;
import com.mortals.xhx.module.base.service.BaseAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 区域
 *
 * @author zxfei
 * @date 2022-11-22
 */
@RestController
@RequestMapping("base/area")
public class BaseAreaController extends BaseCRUDJsonBodyMappingController<BaseAreaService, BaseAreaEntity, Long> {

    @Autowired
    private ParamService paramService;
    @Autowired
    private ICacheService cacheService;

    public BaseAreaController() {
        super.setModuleDesc("区域");
    }

    @Override
    protected void init(Map<String, Object> model, Context context) {
        this.addDict(model, "haveSonArea", paramService.getParamBySecondOrganize("BaseArea", "haveSonArea"));
        this.addDict(model, "haveSonDept", paramService.getParamBySecondOrganize("BaseArea", "haveSonDept"));
        this.addDict(model, "haveGetDept", paramService.getParamBySecondOrganize("BaseArea", "haveGetDept"));
        this.addDict(model, "haveGetMatterList", paramService.getParamBySecondOrganize("BaseArea", "haveGetMatterList"));
        this.addDict(model, "areaLevel", paramService.getParamBySecondOrganize("BaseArea", "areaLevel"));
        this.addDict(model, "status", paramService.getParamBySecondOrganize("BaseArea", "status"));
        super.init(model, context);
    }


}