package com.ym.mec.web.controller;

import com.ym.mec.biz.dal.entity.SysUserCashAccountLog;
import com.ym.mec.biz.dal.page.AccountLogQueryInfo;
import com.ym.mec.biz.service.OrganizationService;
import com.ym.mec.biz.service.SysUserCashAccountLogService;
import com.ym.mec.common.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("userCashAccountLog")
@Api(tags = "用户账户退费记录")
@RestController
public class SysUserCashAccountLogController extends BaseController {

	@Autowired
	private SysUserCashAccountLogService sysUserCashAccountLogService;
	@Autowired
	private OrganizationService organizationService;

	@ApiOperation(value = "获取退费详情")
	@GetMapping("/get")
	@PreAuthorize("@pcs.hasPermissions('userCashAccountLog/get')")
	public Object get(Long id) {
		return succeed(sysUserCashAccountLogService.get(id));
	}

	@ApiOperation(value = "修改")
	@GetMapping("/update")
	@PreAuthorize("@pcs.hasPermissions('userCashAccountLog/update')")
	public Object update(SysUserCashAccountLog sysUserCashAccountLog) {
		return succeed(sysUserCashAccountLogService.update(sysUserCashAccountLog));
	}

	@ApiOperation(value = "分页查询收费类型列表")
	@GetMapping("/queryPage")
	@PreAuthorize("@pcs.hasPermissions('userCashAccountLog/queryPage')")
	public Object queryPage(AccountLogQueryInfo queryInfo) {
		queryInfo.setOrganId(organizationService.getEmployeeOrgan(queryInfo.getOrganId()));
		return succeed(sysUserCashAccountLogService.queryPage(queryInfo));
	}
}
