/**
* 文件：OperLogController.java
* 版本：1.0.0
* 日期：
* Copyright &reg; 
* All right reserved.
*/
package com.mortals.xhx.base.system.oper.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.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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

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.setFormClass(OperLogForm.class);
		super.setModuleDesc("操作日志");
	}


	@Override
	protected void init(Map<String, Object> model, Context context) {
		// 返回日志类型
		this.addDict(model,"operType", OperTypeEnum.getEnumMap());
		super.init(model, context);
	}

	@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"));
			}
		});
	}

}