package cn.com.ctop.kuaishou.modules.batch.service.impl;

import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupCreateLog;
import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupCreateLogMapper;
import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupCreateLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;


/**
 * @Description: 快手-批量创建广告组
 * @Author: jeecg-boot
 * @Date: 2019-08-09
 * @Version: V1.0
 */
@Service
public class KuaiShouGroupCreateLogServiceImpl extends ServiceImpl<KuaiShouGroupCreateLogMapper, KuaiShouGroupCreateLog> implements IKuaiShouGroupCreateLogService {

    @Autowired
    private KuaiShouGroupCreateLogMapper createLogMapper;

    @Override
    public Map<String, Object> insert(KuaiShouGroupCreateLog createLog) {
        Map<String, Object> resultMap = new HashMap<>();
        try {
            createLogMapper.insert(createLog);
            resultMap.put("success", true);
            resultMap.put("message", "创建广告组成功");
            resultMap.put("code", 0);
        } catch (Exception e) {
            resultMap.put("success", false);
            resultMap.put("message", "创建广告组失败");
            resultMap.put("code", -1);
        }
        return resultMap;
    }
}
