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.domain.CwBdSubjscheme;
import com.dhcc.finance.main.model.CwBdSubjschemeAdd;
import com.dhcc.finance.main.service.CwBdSubjschemeService;
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;

/**
 * 功能描述：会计科目版本
 * @author dml
 * @date 2019年3月21日 下午5:05:37 
 * @修改日志：
 */
@RestController
@RequestMapping(value = MsConfigConsts.MS_API_PREFIX + CwBdSubjschemeController.API_PREFIX, 
  	          produces = {MediaType.APPLICATION_JSON_UTF8_VALUE }, consumes = { MediaType.APPLICATION_JSON_UTF8_VALUE })
@Api(value = "会计科目版本controller", tags = { "会计科目版本操作接口" })
public class CwBdSubjschemeController {
	// 会计科目版本操作接口地址前缀
	public static final String API_PREFIX = "/cw_bd_subjscheme";
	
	@Autowired
	CwBdSubjschemeService cwBdSubjschemeService;
	
	/**
	 * 功能描述：新增会计科目版本
	 * @param cwBdSubjscheme
	 * @return RestfulResponse<Object,CurrencyMeta>
	 * @author dml
	 * @date 2019年3月21日 下午5:11:10
	 * @修改日志：
	 */
	@ApiOperation(value = "新增会计科目版本-传递复杂对象", notes = "创建会计科目版本", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "cwBdSubjschemeAdd", value = "会计科目版本新增对象实体", required = true, dataType = "CwBdSubjschemeAdd")
	@RequestMapping(value = "/addCwBdSubjscheme", method = RequestMethod.POST)
	public RestfulResponse<Object, CurrencyMeta> addCwBdSubjscheme(@RequestBody CwBdSubjschemeAdd cwBdSubjschemeAdd){
		return cwBdSubjschemeService.addCwBdSubjscheme(cwBdSubjschemeAdd);
	}
	
	/**
	 * 功能描述：查询全部版本数据
	 * @param pageNum
	 * @param pageSize
	 * @param navigatePages
	 * @return RestfulResponse<PageInfo<CwBdSubjscheme>,CurrencyMeta>
	 * @author dml
	 * @date 2019年3月21日 下午7:42:03
	 * @修改日志：
	 */
	@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"),
        @ApiImplicitParam(name = "nameLike", value = "查询条件", required = false, dataType = "String", paramType="query")
    }) 
	@RequestMapping(value = { "/searchCwBdSubjschemeAll" }, method = RequestMethod.GET, consumes = MediaType.ALL_VALUE)
	public RestfulResponse<PageInfo<CwBdSubjscheme>, CurrencyMeta> searchCwBdSubjschemeAllData(
			@RequestParam("pageNum") int pageNum,
    		@RequestParam("pageSize") int pageSize,
    		@RequestParam("navigatePages") int navigatePages,
    		@RequestParam(value="nameLike",required=false) String nameLike){
		return cwBdSubjschemeService.searchCwBdSubjschemeAllData(pageNum, pageSize, navigatePages,nameLike);
	}
	
	/**
	 * 功能描述：修改会计科目版本
	 * @param cwBdSubjscheme
	 * @return RestfulResponse<Object,CurrencyMeta>
	 * @author dml
	 * @date 2019年3月21日 下午8:12:54
	 * @修改日志：
	 */
	@ApiOperation(value = "修改会计科目版本-传递复杂对象", notes = "修改会计科目版本", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "cwBdSubjscheme", value = "会计科目版本对象实体", required = true, dataType = "CwBdSubjscheme")
	@RequestMapping(value = "/updateCwBdSubjschemeByPk", method = RequestMethod.PUT)
	public RestfulResponse<Object, CurrencyMeta> updateCwBdSubjschemeByPk(@RequestBody CwBdSubjscheme cwBdSubjscheme){
		return cwBdSubjschemeService.updateCwBdSubjschemeByPk(cwBdSubjscheme);
	}
	
	/**
	 * 功能描述：逻辑删除计科目版本
	 * @param cwBdSubjscheme
	 * @return RestfulResponse<Object,CurrencyMeta>
	 * @author dml
	 * @date 2019年3月21日 下午8:12:54
	 * @修改日志：
	 */
	@ApiOperation(value = "逻辑删除版本", notes = "删除会计科目版本", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "pkSubjscheme", value = "科目版本编号", required = true, dataType = "String")
	@RequestMapping(value = "/deleteCwBdSubjschemeByPk", method = RequestMethod.DELETE , consumes = MediaType.ALL_VALUE)
	public RestfulResponse<Object, CurrencyMeta> deleteCwBdSubjschemeByPk(@RequestParam("pkSubjscheme") String pkSubjscheme){
		return cwBdSubjschemeService.deleteCwBdSubjschemeByPk(pkSubjscheme);
	}
	
	/**
	 * 功能描述：启动会计科目版本
	 * @param cwBdSubjscheme
	 * @return RestfulResponse<Integer,CurrencyMeta>
	 * @author dml
	 * @date 2019年3月23日 上午11:52:39
	 * @修改日志：
	 */
	@ApiOperation(value = "启动会计科目版本-传递复杂对象", notes = "启动会计科目版本", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	@ApiImplicitParam(name = "cwBdSubjscheme", value = "会计科目版本对象实体", required = true, dataType = "CwBdSubjscheme")
	@RequestMapping(value = "/updateEnablestate", method = RequestMethod.PUT)
	RestfulResponse<Integer, CurrencyMeta> updateEnablestate(@RequestBody CwBdSubjscheme cwBdSubjscheme){
		return cwBdSubjschemeService.updateEnablestate(cwBdSubjscheme);
	}
	/**
	 * 获取全部版本信息
	 * @return RestfulResponse<Object,CurrencyMeta>
	 *@author huangpeng
	 *@date 2019年3月27日 下午1:54:25
	 *@修改日志：
	 */
	@ApiOperation(value = "获取全部版本信息", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,consumes = MediaType.ALL_VALUE)
	@RequestMapping(value = "/searchCwBdSubjschemePKandCode", method = RequestMethod.GET,consumes = MediaType.ALL_VALUE)
	public RestfulResponse<List<CwBdSubjscheme>, CurrencyMeta> searchCwBdSubjschemePKandCode() {
		return cwBdSubjschemeService.searchCwBdSubjschemePKandCode();
	}
	/**
	 * 获取正在启动科目的数目
	 * Title: searchCwBdSubjschemePKandCode <br/>  
	 * Description: TODO <br/>
	 * @author lipeng 
	 * @return RestfulResponse<List<CwBdSubjscheme>,CurrencyMeta>
	 * @date 2019年7月11日 下午3:09:21
	 */
	@ApiOperation(value = "获取正在启动科目的数目", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,consumes = MediaType.ALL_VALUE)
	@RequestMapping(value = "/selectNumByEnablestate", method = RequestMethod.GET,consumes = MediaType.ALL_VALUE)
	public RestfulResponse<Object, CurrencyMeta> selectNumByEnablestate() {
		return cwBdSubjschemeService.selectNumByEnablestate();
	}
	/**
	 * @Title: selectAllSubjCode
	 * @Description: TODO(查询所有的科目编)
	 * @author lipeng
	 * @param @return
	 * @return RestfulResponse<List<String>,CurrencyMeta>
	 * @see
	 * @throws
	 */
	@ApiOperation(value = "查询所有的科目编号", notes = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,consumes = MediaType.ALL_VALUE)
	@RequestMapping(value = "/selectAllSubjCode", method = RequestMethod.GET,consumes = MediaType.ALL_VALUE)
	public RestfulResponse<List<CwBdAccsubj>, CurrencyMeta> selectAllSubjCode() {
		return cwBdSubjschemeService.selectAllSubjCode();
	}
    
}
