package com.mortals.xhx.modules.data.web;

import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.common.pdu.ApiRespPdu;
import com.mortals.xhx.modules.data.model.DataAreaEntity;
import com.mortals.xhx.modules.data.service.DataAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.mortals.framework.web.BaseCRUDJsonMappingController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;


/**
* <p>Title: 地区表</p>
* <p>Description: DataAreaController  </p>
* <p>Copyright: Copyright &reg;  </p>
* <p>Company: </p>
* @author zxfei
* @version 1.0.0
*/
@RestController
@RequestMapping("data/area")
public class DataAreaController extends BaseCRUDJsonMappingController<DataAreaService,DataAreaForm, DataAreaEntity,Long> {

    @Autowired
    private DataAreaService dataAreaService;

    public DataAreaController(){
        super.setFormClass(DataAreaForm.class);
        super.setModuleDesc("地区表");
    }

    @RequestMapping(value = "/queryArea",method = RequestMethod.GET)
    public ApiRespPdu queryArea(Long id){
        ApiRespPdu cityList=dataAreaService.queryArea(id);
        return cityList;
    }


    @Override
    protected void doListBefore(HttpServletRequest request, HttpServletResponse response, DataAreaForm form, Map<String, Object> model, Context context) throws AppException {
        form.getPageInfo().setPrePageResult(-1);
        super.doListBefore(request, response, form, model, context);
    }

}