/**
 * 文件：OperLogController.java
 * 版本：1.0.0
 * 日期：
 * Copyright &reg;
 * All right reserved.
 */
package com.mortals.xhx.base.system.oper.web;


import com.alibaba.fastjson.JSONObject;
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.xhx.base.system.oper.model.OperLogEntity;
import com.mortals.xhx.base.system.oper.service.OperLogService;
import com.mortals.xhx.common.code.OperTypeEnum;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>Title: 操作日志</p>
 * <p>Description: OperLogController  </p>
 * <p>Copyright: Copyright &reg;  </p>
 * <p>Company: </p>
 *
 * @author
 * @version 1.0.0
 */
@RestController
@RequestMapping("oper/log")
public class OperLogController extends BaseCRUDJsonBodyMappingController<OperLogService, OperLogEntity, Long> {

    public OperLogController() {
        super.setModuleDesc("操作日志");
    }


    @Override
    protected void init(Map<String, Object> model, Context context) {
        Map<String, Object> status = new HashMap<String, Object>(1);
        // 返回日志类型
        status.put("operType", OperTypeEnum.getEnumMap());

        model.put(KEY_RESULT_DICT, status);
    }

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

}