package com.xintong.visualinspection.service.impl;

import java.util.List;

import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.xintong.visualinspection.bean.CheckItem;
import com.xintong.visualinspection.bean.CheckRule;
import com.xintong.visualinspection.dao.master.CheckRuleItemDao;
import com.xintong.visualinspection.service.BaseService;
import com.xintong.visualinspection.service.CheckRuleItemService;

/**
 * 文件名：UserServiceImpl
 * 版本信息：日期：2017/3/30 Copyright 江苏省交通规划设计院 Corporation 2017 版权所有.
 */
@Service
public class CheckRuleItemServiceImpl extends BaseService implements CheckRuleItemService {

    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(CheckRuleItemServiceImpl.class);

    @Autowired
    private CheckRuleItemDao checkRuleItemDao ;
	

	@Override
	public void delete(CheckItem checkItem) {
		// TODO Auto-generated method stub
		checkRuleItemDao.delete(checkItem);
		
	}


	@Override
	public String insert(CheckItem checkItem) {
		// TODO Auto-generated method stub
		// 避免插入数据重复
		Integer hasCount = checkRuleItemDao.selectItemCount(checkItem) ;
		if(hasCount >0){
			return "数据已存在";
		}
		checkRuleItemDao.insert(checkItem);
		return null ;
	}


	@Override
	public String insertList(List<CheckItem> checkItems) {
		for(CheckItem obj : checkItems){
			String error = insert(obj) ;
		}
		return null;
	}
  
}
