package com.mortals.xhx.module.site.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.feign.user.IUserFeign;
import com.mortals.xhx.module.area.service.AreaService;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 站点
 *
 * @author zxfei
 * @date 2022-01-20
 */
@RestController
@RequestMapping("site")
@Slf4j

public class SiteController extends BaseCRUDJsonBodyMappingController<SiteService, SiteEntity, Long> {

    @Autowired
    private ParamService paramService;
    @Autowired
    private ICacheService cacheService;
    @Autowired
    private SiteService siteService;
    @Autowired
    private AreaService areaService;
    @Autowired
    @Lazy
    private IUserFeign userFeign;

    public SiteController() {
        super.setModuleDesc("站点");
    }

    @Override
    protected void init(Map<String, Object> model, Context context) {
        this.addDict(model, "haveSonArea", paramService.getParamBySecondOrganize("Site", "haveSonArea"));
        this.addDict(model, "workday1", paramService.getParamBySecondOrganize("Site", "workday1"));
        this.addDict(model, "workday2", paramService.getParamBySecondOrganize("Site", "workday2"));
        this.addDict(model, "workday3", paramService.getParamBySecondOrganize("Site", "workday3"));
        this.addDict(model, "workday4", paramService.getParamBySecondOrganize("Site", "workday4"));
        this.addDict(model, "workday5", paramService.getParamBySecondOrganize("Site", "workday5"));
        this.addDict(model, "workday6", paramService.getParamBySecondOrganize("Site", "workday6"));
        this.addDict(model, "workday7", paramService.getParamBySecondOrganize("Site", "workday7"));
        this.addDict(model, "level", paramService.getParamBySecondOrganize("Site", "level"));
        this.addDict(model, "building", paramService.getParamBySecondOrganize("Site", "building"));
        this.addDict(model, "isSite", paramService.getParamBySecondOrganize("Site", "isSite"));
        this.addDict(model, "status", paramService.getParamBySecondOrganize("Site", "status"));
        super.init(model, context);
    }



}