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.CwBdAccsubj;
import com.dhcc.finance.main.model.CwBdAccsubjManage;
import com.dhcc.finance.main.service.CwBdAccsubjService;
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月21日 下午9:32:15
 * @修改日志：
 */
@RestController
@RequestMapping(value = MsConfigConsts.MS_API_PREFIX + CwBdAccsubjController.API_PREFIX, produces = {MediaType.APPLICATION_JSON_UTF8_VALUE }, consumes = { MediaType.APPLICATION_JSON_UTF8_VALUE })
@Api(value = "会计科目controller", tags = { "会计科目操作接口" })
public class CwBdAccsubjController {
	// 会计科目版本操作接口地址前缀
    public static final String API_PREFIX = "/cw_bd_accsubj";
    
    @Autowired
    CwBdAccsubjService cwBdAccsubjService;
    
    /**
     * 功能描述：新增会计科目
     * @param cwBdAccsubj
     * @return RestfulResponse<Object,CurrencyMeta>
     * @author dml
     * @date 2019年3月22日 上午9:46:20
     * @修改日志：
     */
    @ApiOperation(value = "新增会计科目-传递复杂对象", notes = "新增会计科目", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "CwBdAccsubjManage", value = "会计科目加辅助实体", required = true, dataType = "CwBdAccsubjManage")
	@RequestMapping(value = "/addCwBdAccsubj", method = RequestMethod.POST)
    public RestfulResponse<Object, CurrencyMeta> addCwBdAccsubj(@RequestBody CwBdAccsubjManage cwBdAccsubjManage){
    	return cwBdAccsubjService.addCwBdAccsubj(cwBdAccsubjManage);
    }
    
    /**
     * 功能描述：修改会计科目
     * @param cwBdAccsubj
     * @return RestfulResponse<Object,CurrencyMeta>
     * @author dml
     * @date 2019年3月22日 上午9:48:17
     * @修改日志：
     */
    @ApiOperation(value = "修改会计科目-传递复杂对象", notes = "修改会计科目", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "cwBdAccsubj", value = "会计科目对象实体", required = true, dataType = "CwBdAccsubj")
	@RequestMapping(value = "/updateCwBdAccsubjByPk", method = RequestMethod.PUT)
    public RestfulResponse<Object, CurrencyMeta> updateCwBdAccsubjByPk(@RequestBody CwBdAccsubj cwBdAccsubj){
    	return cwBdAccsubjService.updateCwBdAccsubjByPk(cwBdAccsubj);
    }
    
    /**
     * 功能描述：逻辑删除会计科目
     * @param pkAccsubj
     * @return RestfulResponse<Object,CurrencyMeta>
     * @author dml
     * @date 2019年3月22日 上午9:50:15
     * @修改日志：
     */
    @ApiOperation(value = "逻辑删除会计科目", notes = "删除会计科目", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
    	@ApiImplicitParam(name = "pkAccsubj", value = "科目主键", required = true, dataType = "String"),
    	@ApiImplicitParam(name = "pkSubjscheme", value = "科目版本", required = true, dataType = "String"),
    }) 
	@RequestMapping(value = "/deleteCwBdAccsubj", method = RequestMethod.DELETE , consumes = MediaType.ALL_VALUE)
    public RestfulResponse<Object, CurrencyMeta> deleteCwBdAccsubjByPk(@RequestParam String pkAccsubj,@RequestParam String pkSubjscheme){
    	return cwBdAccsubjService.deleteCwBdAccsubjByPk(pkAccsubj,pkSubjscheme);
    }
    
    /**
     * 功能描述：获取全部会计科目信息列表
     * @param pkSubjscheme
     * @param pageNum
     * @param pageSize
     * @param navigatePages
     * @return RestfulResponse<PageInfo<CwBdAccsubj>,CurrencyMeta>
     * @author dml
     * @date 2019年3月22日 上午9:53:15
     * @修改日志：
     */
    @ApiOperation(value = "获取全部会计科目信息列表", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@ApiImplicitParam(name = "pkSubjscheme", value = "版本编码", required = true, dataType = "String", paramType="query")
	@RequestMapping(value = { "/searchCwBdAccsubjAll" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<List<CwBdAccsubj>, CurrencyMeta> searchCwBdAccsubjAllData(@RequestParam("pkSubjscheme") String pkSubjscheme){
	   return cwBdAccsubjService.searchCwBdAccsubjAllData(pkSubjscheme);
    }
    
    /**
     * 功能描述：查询节点和该节点下所有会计科目信息
     * @param pkSubjscheme
     * @param pageNum
     * @param pageSize
     * @param navigatePages
     * @return RestfulResponse<PageInfo<CwBdAccsubj>,CurrencyMeta>
     * @author dml
     * @date 2019年3月22日 上午9:53:15
     * @修改日志：
     */
    @ApiOperation(value = "查询节点和该节点下所有会计科目信息", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@ApiImplicitParams({
		@ApiImplicitParam(name = "pkSubjscheme", value = "版本编码", required = true, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "subjcode", value = "节点编码", required = true, dataType = "String", paramType="query"),
        @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 = { "/searchCwBdAccsubjByNode" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
   public RestfulResponse<PageInfo<CwBdAccsubj>, CurrencyMeta> searchCwBdAccsubjByNode(
		   @RequestParam("pkSubjscheme") String pkSubjscheme,
		   @RequestParam("subjcode") String subjcode,
		   @RequestParam("pageNum") int pageNum, 
		   @RequestParam("pageSize") int pageSize, 
		   @RequestParam("navigatePages") int navigatePages){
	   return cwBdAccsubjService.searchCwBdAccsubjByNode(pkSubjscheme, subjcode, pageNum, pageSize, navigatePages);
   }
    /**
     * 功能描述：查询节点和该节点下所有会计科目信息
     * @param pkSubjscheme
     * @param pageNum
     * @param pageSize
     * @param navigatePages
     * @return RestfulResponse<PageInfo<CwBdAccsubj>,CurrencyMeta>
     * @author huangpeng
     * @date 2019年3月22日 上午9:53:15
     * @修改日志：
     */
    @ApiOperation(value = "查询节点和该节点下所有会计科目信息", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@ApiImplicitParams({
		@ApiImplicitParam(name = "pkSubjscheme", value = "版本编码", required = true, dataType = "String", paramType="query"),
		@ApiImplicitParam(name = "subjname", value = "节点名称", required = true, dataType = "String", paramType="query"),
        @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 = { "/searchCwBdAccsubjByName" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
   public RestfulResponse<PageInfo<CwBdAccsubj>, CurrencyMeta> searchCwBdAccsubjByName(
		   @RequestParam("pkSubjscheme") String pkSubjscheme,
		   @RequestParam("subjname") String subjname,
		   @RequestParam("pageNum") int pageNum, 
		   @RequestParam("pageSize") int pageSize, 
		   @RequestParam("navigatePages") int navigatePages){
	   return cwBdAccsubjService.searchCwBdAccsubjByName(pkSubjscheme, subjname, pageNum, pageSize, navigatePages);
   }
    
    /**
     * 功能描述：查询现在正启用的版本下的所有科目
     * @return RestfulResponse<List<CwBdAccsubj>,CurrencyMeta>
     * @author dml
     * @date 2019年4月2日 下午4:30:30
     * @修改日志：
     */
    @ApiOperation(value = "查询现在正启用的版本下的所有科目", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
	@RequestMapping(value = { "/selectNowUseCwBdAccsubj" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<List<CwBdAccsubj>, CurrencyMeta> selectNowUseCwBdAccsubj(){
    	return cwBdAccsubjService.selectNowUseCwBdAccsubj();
    }
    /**
     * 查询该科目主键的信息
     * @param pkAccsubj
     * @return RestfulResponse<List<CwBdAccsubj>,CurrencyMeta>
     *@author huangpeng
     *@date 2019年4月28日 下午5:26:39
     *@修改日志：
     */
    @ApiOperation(value = "查询该科目主键的信息", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.ALL_VALUE)
    @ApiImplicitParam(name = "pkAccsubj", value = "科目主键", required = true, dataType = "String", paramType="query")
    @RequestMapping(value = { "/selectCwBdAccsubjByPk" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
    public RestfulResponse<CwBdAccsubj, CurrencyMeta> selectCwBdAccsubjByPk( @RequestParam("pkAccsubj") String pkAccsubj){
    	return cwBdAccsubjService.selectCwBdAccsubjByPk(pkAccsubj);
    }
    
}
