package cn.superdesk.uniorder.dubbo.provider.sys;

import cn.superdesk.uniorder.common.numerical.AnBeanUtils;
import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.dao.entity.sys.SysConfig;
import cn.superdesk.uniorder.dto.param.system.SysConfigParam;
import cn.superdesk.uniorder.dubbo.facade.sys.DubboSysConfigService;
import cn.superdesk.uniorder.service.sys.SysConfigService;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;

@Service(version = "1.0.0", retries = -1, timeout = 10000)
public class DubboSysConfigServiceImpl implements DubboSysConfigService {

	@Autowired
	private SysConfigService sysConfigService;


	/****************************************** extends BaseService 部分 start ******************************************/

	@Override
	public void addObj(SysConfigParam param) {

		SysConfig sysConfig = AnBeanUtils.copy(param, SysConfig.class);
		sysConfigService.insertSelective(sysConfig);

	}

	@Override
	public void updateObj(SysConfigParam param) {

		SysConfig sysConfig = AnBeanUtils.copy(param, SysConfig.class);
		sysConfigService.updateByPrimaryKeySelective(sysConfig);
	}

	@Override
	public void deleteObj(Long id) {
		sysConfigService.deleteObj(id);
	}

	@Override
	public SysConfig findById(Long id) {
		return sysConfigService.findById(id);
	}

	@Override
	public PageInfo<SysConfig> findByPaging(Map<String, Object> conditions, Integer pageNun, Integer pageSize) {
		return sysConfigService.findByPaging(conditions, pageNun, pageSize);
	}

	@Override
	public List<SysConfig> findAll(Map<String, Object> queryMap) {

		return sysConfigService.findAll(queryMap);
	}

	/****************************************** extends BaseService 部分   end ******************************************/

	@Override
	public void addSysConfig(SysConfigParam param) {

		SysConfig sysConfig = AnBeanUtils.copy(param, SysConfig.class);
		sysConfigService.addSysConfig(sysConfig);
	}

	@Override
	public void updateSysConfig(SysConfigParam param) {

		SysConfig sysConfig = AnBeanUtils.copy(param, SysConfig.class);
		sysConfigService.updateSysConfig(sysConfig);
	}

	@Override
	public void deleteSysConfig(Long id) {
		sysConfigService.deleteSysConfig(id);
	}

	@Override
	public SysConfig findSysConfigById(Long id) {
		return sysConfigService.findSysConfigById(id);
	}

	@Override
	public R<List<SysConfig>> pageQuery(Map<String, Object> conditions, int pageNun, int pageSize) {
		return sysConfigService.pageQuery(conditions, pageNun, pageSize);

	}


	/****************************************** 自定义 start ******************************************/

	@Override
	public SysConfig findByCode(String code) {

		return sysConfigService.findByCode(code);
	}
	/****************************************** 自定义   end ******************************************/

}
