package com.hfkj.service.impl;

import com.hfkj.dao.BsTradeOrderMsgMapper;
import com.hfkj.entity.BsTradeOrderMsg;
import com.hfkj.service.BsTradeOrderMsgService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

@Service("tradeOrderMsgService")
public class BsTradeOrderMsgServiceImpl implements BsTradeOrderMsgService {

    @Resource
    private BsTradeOrderMsgMapper tradeOrderMsgMapper;

    @Override
    public void editTradeOrderMsg(BsTradeOrderMsg tradeOrderMsg) {
        if (tradeOrderMsg.getId() == null) {
            tradeOrderMsg.setCreateTime(new Date());
            tradeOrderMsg.setUpdateTime(new Date());
            tradeOrderMsgMapper.insert(tradeOrderMsg);
        } else {
            tradeOrderMsg.setUpdateTime(new Date());
            tradeOrderMsgMapper.updateByPrimaryKey(tradeOrderMsg);
        }
    }
}
