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

import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.framework.web.BasePhpCRUDJsonMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.window.model.WindowMatterEntity;
import com.mortals.xhx.module.window.service.WindowMatterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Map;

/**
 *
 * 窗口事项
 *
 * @author zxfei
 * @date 2022-01-20
 */
@RestController
@RequestMapping("window/matter")
public class WindowMatterController extends BaseCRUDJsonBodyMappingController<WindowMatterService,WindowMatterEntity,Long> {

    @Autowired
    private ParamService paramService;

    public WindowMatterController(){
        super.setFormClass(WindowMatterForm.class);
        super.setModuleDesc( "窗口事项");
    }


    @Override
    protected void doListBefore(WindowMatterEntity query, Map<String, Object> model, Context context) throws AppException {
        query.setOrderColList(new ArrayList<OrderCol>() {
            {
                add(new OrderCol("a.sort", OrderCol.ASCENDING));
            }
        });
        super.doListBefore(query, model, context);
    }
}