package com.pjilisense.flxai.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.pjilisense.flxai.base.service.impl.CrudServiceImpl;
import com.pjilisense.flxai.dao.MyDigitalHumanDao;
import com.pjilisense.flxai.dto.MyDigitalHumanDTO;
import com.pjilisense.flxai.entity.MyDigitalHumanEntity;
import com.pjilisense.flxai.service.MyDigitalHumanService;
import cn.hutool.core.util.StrUtil;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * ${comments}
 *
 * @author liushujing liushujing@philisense.com
 * @since 1.0.0 2025-02-26
 */
@Service
public class MyDigitalHumanServiceImpl extends CrudServiceImpl<MyDigitalHumanDao, MyDigitalHumanEntity, MyDigitalHumanDTO> implements MyDigitalHumanService {

    @Override
    public QueryWrapper<MyDigitalHumanEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");

        QueryWrapper<MyDigitalHumanEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StrUtil.isNotBlank(id), "id", id);

        return wrapper;
    }


    @Override
    public MyDigitalHumanDTO genVideo(MyDigitalHumanDTO dto) {

        //TODO:gen video code here
        if(dto.getId()!=null&&dto.getId().length()>0){
            update(dto);
        } else {
            save(dto);
        }
        return dto;
    }
}