YiDunServiceImpl.java 1.4 KB
package com.cnlive.shenhe.serviceImpl;

import com.cnlive.shenhe.entity.ShyYidun;
import com.cnlive.shenhe.mapper.ShyYidunMapper;
import com.cnlive.shenhe.utils.CommonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: xujincheng
 * @Date: 2020/3/27 17:31
 */
@Service
public class YiDunServiceImpl {

    private static Logger logger = LoggerFactory.getLogger(YiDunServiceImpl.class);


    @Autowired
    ShyYidunMapper shyYidunMapper;

    public boolean addYiDunMsg(ShyYidun shyYidun) {
        int result = shyYidunMapper.insert(shyYidun);
        if (result == 0) {
            return false;
        }
        return true;
    }

    public ShyYidun getidunMsgByContentId(ShyYidun shyYidun) {
        List<ShyYidun> shyContentList = shyYidunMapper.select(shyYidun);
        if (CommonUtils.isNotNull(shyContentList) && shyContentList.size() > 0) {
            return shyContentList.get(0);
        }
        return null;
    }

    public ShyYidun getYiDunMsg(String dataId) {
        return shyYidunMapper.selectByPrimaryKey(dataId);
    }

    public boolean updateYiDunMsg(ShyYidun shyYidun) {
        int result = shyYidunMapper.updateByPrimaryKeySelective(shyYidun);
        if (result == 0) {
            return false;
        }
        return true;

    }
}