package com.dhcc.finance.main.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.dhcc.common.model.CurrencyMeta;
import com.dhcc.common.model.response.RestfulResponse;
import com.dhcc.finance.constant.MsConfigConsts;
import com.dhcc.finance.main.domain.CwGlDetail;
import com.dhcc.finance.main.domain.CwGlVoucher;
import com.dhcc.finance.main.model.CwGlDetailLike;
import com.dhcc.finance.main.model.CwGlVoucherAndDetailWeb;
import com.dhcc.finance.main.service.CwGlDetailService;
import com.github.pagehelper.PageInfo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
 * 功能描述：凭证分录信息Controller
 * @author dml
 * @date 2019年3月28日 下午8:05:18
 * @修改日志：
 */
@RestController
@RequestMapping(value = MsConfigConsts.MS_API_PREFIX + CwGlDetailController.API_PREFIX, produces = {
		MediaType.APPLICATION_JSON_UTF8_VALUE }, consumes = { MediaType.APPLICATION_JSON_UTF8_VALUE })
@Api(value = "凭证分录信息controller", tags = { "凭证分录信息操作接口" })
public class CwGlDetailController {
	// 凭证分录信息接口地址前缀
	public static final String API_PREFIX = "/cw_gl_detail";
	
	@Autowired
	CwGlDetailService cwGlDetailService;
	
	/**
	 * 功能描述：查询全部凭证分录信息
	 * @param pageNum
	 * @param pageSize
	 * @param navigatePages
	 * @return RestfulResponse<PageInfo<CwGlDetail>,CurrencyMeta>
	 * @author dml
	 * @date 2019年3月28日 下午8:08:49
	 * @修改日志：
	 */
	@ApiOperation(value = "获取全部凭证分录信息", notes = "获取全部凭证分录信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@ApiImplicitParams({
        @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pageSize", value = "每页显示数量", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "navigatePages", value = "需要连续显示的页码数量", required = true, dataType = "String", paramType="query")
    }) 
	@RequestMapping(value = { "/searchCwGlDetailAllData" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public 	RestfulResponse<PageInfo<CwGlDetail>, CurrencyMeta> searchCwGlDetailAllData(
			@RequestParam("pageNum") int pageNum,
    		@RequestParam("pageSize") int pageSize,
    		@RequestParam("navigatePages") int navigatePages){
		return cwGlDetailService.searchCwGlDetailAllData(pageNum, pageSize, navigatePages);
	}

	/**
	 * 功能描述：新增凭证分录信息
	 * @param cwGlDetail
	 * @return RestfulResponse<Object,CurrencyMeta>
	 * @author dml
	 * @date 2019年3月28日 下午8:10:38
	 * @修改日志：
	 */
	@ApiOperation(value = "新增凭证分录信息-传递复杂对象", notes = "新增凭证分录信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "cwGlDetail", value = "凭证分录信息对象实体", required = true, dataType = "CwGlDetail")
	@RequestMapping(value = "/addCwGlDetail", method = RequestMethod.POST)
	public RestfulResponse<Object, CurrencyMeta> addCwGlDetail(@RequestBody CwGlDetail cwGlDetail){
		return cwGlDetailService.addCwGlDetail(cwGlDetail);
	}

	/**
	 * 功能描述：修改凭证分录信息
	 * @param cwGlDetail
	 * @return RestfulResponse<Object,CurrencyMeta>
	 * @author dml
	 * @date 2019年3月28日 下午8:12:03
	 * @修改日志：
	 */
	@ApiOperation(value = "修改凭证分录信息-传递复杂对象", notes = "修改凭证分录信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "cwGlDetail", value = "凭证分录信息对象实体", required = true, dataType = "CwGlDetail")
	@RequestMapping(value = "/updateCwGlDetailByPk", method = RequestMethod.PUT)
	public RestfulResponse<Object, CurrencyMeta> updateCwGlDetailByPk(@RequestBody CwGlDetail cwGlDetail){
		return cwGlDetailService.updateCwGlDetailByPk(cwGlDetail);
	}

	/**
	 * 功能描述：逻辑删除凭证分录信息
	 * @param pkDetail
	 * @return RestfulResponse<Object,CurrencyMeta>
	 * @author dml
	 * @date 2019年3月28日 下午8:13:43
	 * @修改日志：
	 */
	@ApiOperation(value = "逻辑删除凭证分录信息", notes = "删除凭证分录信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "pkDetail", value = "凭证分录信息主键", required = true, dataType = "String")
	@RequestMapping(value = "/deleteCwGlDetailByPk", method = RequestMethod.DELETE , consumes = MediaType.ALL_VALUE)
	public RestfulResponse<Object, CurrencyMeta> deleteCwGlDetailByPk(@RequestParam("pkDetail") String pkDetail){
		return cwGlDetailService.deleteCwGlDetailByPk(pkDetail);
	}
	
	/**
	 * 功能描述  获取恢复分录查询
	 *@param pageNum
	 *@param pageSize
	 *@param navigatePages
	 *@param cwGlVoucherAndDetailWeb
	 *@return RestfulResponse<PageInfo<CwGlVoucherAndDetailWeb>,CurrencyMeta>
	 *@author huangpeng
	 *@date 2019年12月13日 上午11:07:17
	 *修改日志:
	 */
	@ApiOperation(value = "获取恢复分录查询", notes = "获取恢复分录查询", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParams({
        @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "pageSize", value = "每页显示数量", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "navigatePages", value = "需要连续显示的页码数量", required = true, dataType = "String", paramType="query"),
        @ApiImplicitParam(name = "cwGlDetailLike", value = "分录恢复相关实体类",required = false, dataType = "CwGlDetailLike")
    }) 
	@RequestMapping(value = { "/searchCwGlVoucherAndDetailWeb" }, method = RequestMethod.PUT)
	public RestfulResponse<PageInfo<CwGlVoucherAndDetailWeb>, CurrencyMeta> searchCwGlVoucherAndDetailWeb(
			@RequestParam("pageNum") int pageNum,
    		@RequestParam("pageSize") int pageSize,
    		@RequestParam("navigatePages") int navigatePages,
    		@RequestBody CwGlDetailLike cwGlDetailLike){
		return cwGlDetailService.searchCwGlVoucherAndDetailWeb(pageNum, pageSize, navigatePages,cwGlDetailLike);
	}
	/**
	 * 功能描述  批量恢复分录信息
	 *@param cwGlVoucherAndDetailWeb
	 *@return RestfulResponse<Object,CurrencyMeta>
	 *@author huangpeng
	 *@date 2019年12月13日 下午2:56:55
	 *修改日志:
	 */
	@ApiOperation(value = "批量恢复分录信息", notes = "批量恢复分录信息", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "CwGlVoucherAndDetailWeb", value = "数据表名", required = true, dataType = "List")
	@RequestMapping(value = "/updateCwGlVoucherAndDetailWebForBatch", method = RequestMethod.PUT)
	public RestfulResponse<Object, CurrencyMeta> updateCwGlVoucherAndDetailWebForBatch(@RequestBody List<CwGlVoucherAndDetailWeb> cwGlVoucherAndDetailWeb ) {
		return cwGlDetailService.updateCwGlVoucherAndDetailWebForBatch(cwGlVoucherAndDetailWeb);
	}
	
	
	
	
	

}
