BusinessServiceImpl.java 1.38 KB
package com.bsth.service.impl;

import com.bsth.common.ResponseCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bsth.entity.Business;
import com.bsth.repository.BusinessRepository;
import com.bsth.service.BusinessService;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.Map;

/**
 * 
 * @ClassName: BusinessServiceImpl(公司service业务层实现类)
 * 
 * @Extends : BaseService
 * 
 * @Description: TODO(公司service业务层)
 * 
 * @Author bsth@lq
 * 
 * @Date 2016-4-28 9:21:17
 *
 * @Version 公交调度系统BS版 0.1
 * 
 */

@Service
public class BusinessServiceImpl extends BaseServiceImpl<Business, Integer> implements BusinessService{
	@Autowired
	private BusinessRepository businessRepository;
	@Override
	public long getCompCode() {
		// TODO Auto-generated method stub
		return businessRepository.getMaxId();
	}

	@Transactional
	@Override
	public Map<String, Object> update(Business b) {
		Map<String, Object> map = new HashMap<>();
		int status = businessRepository.update(b.getBusinessName(), b.getUpCode(), b.getUpdateDate(),
				b.getBusinessCode());
		if (status==1) {
			map.put("status", ResponseCode.SUCCESS);
		} else {
			map.put("status", ResponseCode.ERROR);
		}

		return map;
	}

}