package com.izouma.awesomeadmin.service.impl;

import java.util.*;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.izouma.awesomeadmin.constant.AppConstant;
import com.izouma.awesomeadmin.dto.Page;
import com.izouma.awesomeadmin.model.LandMarkVersion;
import com.izouma.awesomeadmin.service.LandMarkVersionService;
import com.izouma.awesomeadmin.dao.LandMarkVersionMapper;

/**
*  service接口实现类
*/
@Service
public class LandMarkVersionServiceImpl implements LandMarkVersionService{

    private static Logger logger = Logger.getLogger(LandMarkVersionServiceImpl.class);

    @Autowired
    private LandMarkVersionMapper landMarkVersionMapper;

    @Override
    public List<LandMarkVersion> getLandMarkVersionList(LandMarkVersion record) {

        logger.info("getLandMarkVersionList");
        try {

        return landMarkVersionMapper.queryAllLandMarkVersion(record);
        } catch (Exception e) {
        logger.error("getLandMarkVersionList", e);
        }

        return null;
    }
    @Override
    public List<LandMarkVersion> getLandMarkVersionByPage(Page page, LandMarkVersion record) {

        logger.info("getLandMarkVersionByPage");
        try {

        Map<String, Object> parameter = new HashMap<String, Object>();
        parameter.put("record", record);
        parameter.put(AppConstant.PAGE, page);

        return landMarkVersionMapper.queryLandMarkVersionByPage(parameter);
        } catch (Exception e) {
        logger.error("getLandMarkVersionByPage", e);
        }

        return null;
    }

    @Override
    public LandMarkVersion getLandMarkVersionById(String id) {

        logger.info("getLandMarkVersionyId");
        try {

            return landMarkVersionMapper.selectByPrimaryKey(Integer.valueOf(id));
        } catch (Exception e) {
        logger.error("getLandMarkVersionById", e);
        }

        return null;
    }

    @Override
    public LandMarkVersion getLandMarkVersion(LandMarkVersion record) {

        logger.info("getLandMarkVersion");
        try {

            return landMarkVersionMapper.queryLandMarkVersion(record);
        } catch (Exception e) {
        logger.error("getLandMarkVersion", e);
        }

        return null;
    }

    @Override
    public boolean createLandMarkVersion(LandMarkVersion record) {

        logger.info("createLandMarkVersion");
        try {

            int updates = landMarkVersionMapper.insertSelective(record);

            if (updates > 0) {
                 return true;
            }
        } catch (Exception e) {
            logger.error("createLandMarkVersion", e);
        }

        return false;
    }

    @Override
    public boolean deleteLandMarkVersion(LandMarkVersion record) {

        logger.info("deleteLandMarkVersion");
        try {

             int updates = landMarkVersionMapper.delete(record);

            if (updates > 0) {
                 return true;
            }
        } catch (Exception e) {
             logger.error("deleteLandMarkVersion", e);
        }

        return false;
    }

    @Override
    public boolean updateLandMarkVersion(LandMarkVersion record) {

        logger.info("updateLandMarkVersion");
        try {

            int updates = landMarkVersionMapper.updateByPrimaryKeySelective(record);

            if (updates > 0) {
                 return true;
            }
        } catch (Exception e) {
             logger.error("updateLandMarkVersion", e);
        }

        return false;
    }

}

