package com.yc.ship.module.marketing.api.params;

import com.yc.ship.framework.common.pojo.CommonResult;
import com.yc.ship.framework.common.util.object.BeanUtils;
import com.yc.ship.module.marketing.api.params.dot.MarketingParamsDto;
import com.yc.ship.module.marketing.dal.dataobject.params.MarketingParamsDO;
import com.yc.ship.module.marketing.dal.mysql.params.MarketingParamsMapper;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController // 提供 RESTfull API 接口，给 Feign 调用
@Validated
public class MarketingParamsAPiImpl implements MarketingParamsApi{

    @Resource
    private MarketingParamsMapper marketingParamsMapper;
    @Override
    public CommonResult<Long> create(MarketingParamsDto reqDto) {
        MarketingParamsDO marketingParamsDO = BeanUtils.toBean(reqDto, MarketingParamsDO.class);
        marketingParamsMapper.insert(marketingParamsDO);
        return CommonResult.success(marketingParamsDO.getId());
    }
}
