package com.mortals.xhx.module.device.web;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.service.DeviceService;
import java.util.Map;
/**
* DeviceController
*
* 设备 控制器
*
* @author zxfei
* @date 2021-11-19
*/
@RestController
@RequestMapping("device")
public class DeviceController extends BaseCRUDJsonMappingController<DeviceService,DeviceForm,DeviceEntity,Long> {

    @Autowired
    private ParamService paramService;

    public DeviceController(){
        super.setFormClass(DeviceForm.class);
        super.setModuleDesc( "设备");
    }

    @Override
    protected void init(HttpServletRequest request, HttpServletResponse response, DeviceForm form, Map<String, Object> model, Context context) {
        this.addDict(model, "connectStatus", paramService.getParamByFirstOrganize("connectStatus"));
        this.addDict(model, "useStatus", paramService.getParamByFirstOrganize("useStatus"));
        super.init(request, response, form, model, context);
    }
}