package com.ruoyi.system.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.domain.SysSdgsat1Introduction;
import com.ruoyi.system.mapper.SysSdgsat1IntroductionMapper;
import com.ruoyi.system.service.ISysSdgsat1IntroductionService;

/**
 * SDGSAT-1 简介服务实现
 * 
 * @author ruoyi
 */
@Service
public class SysSdgsat1IntroductionServiceImpl implements ISysSdgsat1IntroductionService
{
    @Autowired
    private SysSdgsat1IntroductionMapper introductionMapper;

    @Override
    public SysSdgsat1Introduction selectIntroduction()
    {
        SysSdgsat1Introduction introduction = introductionMapper.selectIntroduction();
        if (introduction == null)
        {
            // 如果不存在，创建默认数据
            introduction = new SysSdgsat1Introduction();
            introduction.setTitle("SDGSAT-1 简介");
            introduction.setContent("<p>欢迎使用 SDGSAT-1 专区</p>");
            introductionMapper.insertIntroduction(introduction);
            return introduction;
        }
        return introduction;
    }

    @Override
    public int updateIntroduction(SysSdgsat1Introduction introduction)
    {
        return introductionMapper.updateIntroduction(introduction);
    }
}