package com.cyksj.service.midjourney.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cyksj.common.exception.BusinessRuntimeException;
import com.cyksj.mapper.MidjourneyPaintingPlazaMapper;
import com.cyksj.model.entity.MidjourneyPaintingPlaza;
import com.cyksj.service.midjourney.MidjourneyPaintingPlazaService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 项目名: yhlxj
 * 文件名: MidjourneyPaintingPlazaServiceImpl
 * 创建者: JavaZou
 * 创建时间:2024/6/3 17:32
 */
@Service
@RequiredArgsConstructor
public class MidjourneyPaintingPlazaServiceImpl extends ServiceImpl<MidjourneyPaintingPlazaMapper, MidjourneyPaintingPlaza> implements MidjourneyPaintingPlazaService {
	@Override
	public void saveOrUpdatePainting(MidjourneyPaintingPlaza midjourneyPaintingPlaza) {
		String tips = midjourneyPaintingPlaza.getTips();
		if (StrUtil.isEmpty(tips)) {
			throw BusinessRuntimeException.getInstance("请输入对应的关键词");
		}
		String img = midjourneyPaintingPlaza.getImg();
		if (StrUtil.isEmpty(img)) {
			throw BusinessRuntimeException.getInstance("图片不为空");
		}
		this.saveOrUpdate(midjourneyPaintingPlaza);
	}
}
