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

import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.OrderCol;
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.app.model.AppEntity;
import com.mortals.xhx.module.app.service.AppService;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
/**
* AppController
*
* 应用信息 控制器
*
* @author zxfei
* @date 2021-11-12
*/
@RestController
@RequestMapping("app")
public class AppController extends BaseCRUDJsonMappingController<AppService,AppForm,AppEntity,Long> {

    @Autowired
    private ParamService paramService;

    public AppController(){
        super.setFormClass(AppForm.class);
        super.setModuleDesc( "应用信息");
    }

    @Override
    protected void init(HttpServletRequest request, HttpServletResponse response, AppForm form, Map<String, Object> model, Context context) {
        super.init(request, response, form, model, context);
    }

    @Override
    protected void doListBefore(HttpServletRequest request, HttpServletResponse response, AppForm form, Map<String, Object> model, Context context) throws AppException {
        super.doListBefore(request, response, form, model, context);
        form.getQuery().setOrderColList(Arrays.asList(new OrderCol("id","desc")));

    }
}