src/main/java/org/edgegallery/appstore/infrastructure/persistence/message/MessageRepository.java
public void addMessage(Message message) {
        try {
            MessagePo messagePo = messageMapper.getOneMessage(message.getMessageId());
            if (messagePo != null) {
                LOGGER.error("message {} has existed", message.getMessageId());
                throw new AppException(String.format("message %s has existed", message.getMessageId()),
                    ResponseConst.RET_MESSAGE_EXISTED);
            }
            messageMapper.insert(MessagePo.of(message));
        } catch (Exception e) {
            LOGGER.error("add message to db error: {}", e.getMessage());
            throw new AppException("db operate error", ResponseConst.RET_DB_ERROR);
        }

    }
/**
     * add a message to db.
     *
     * @param message message obj
     */
add a message to db.
@param message message obj
add a message to db . @param message message obj
public void addMessage(Message message) {
        try {
            MessagePo messagePo = messageMapper.getOneMessage(message.getMessageId());
            if (messagePo != null) {
                LOGGER.error("message {} has existed", message.getMessageId());
                throw new AppException(String.format("message %s has existed", message.getMessageId()),
                    ResponseConst.RET_MESSAGE_EXISTED);
            }
            messageMapper.insert(MessagePo.of(message));
        } catch (Exception e) {
            LOGGER.error("add message to db error: {}", e.getMessage());
            throw new AppException("db operate error", ResponseConst.RET_DB_ERROR);
        }
    }
public void addMessage ( Message message ) { try { MessagePo messagePo = messageMapper . getOneMessage ( message . getMessageId ( ) ) ; if ( messagePo != null ) { LOGGER . error ( "message {} has existed" , message . getMessageId ( ) ) ; throw new AppException ( String . format ( "message %s has existed" , message . getMessageId ( ) ) , ResponseConst . RET_MESSAGE_EXISTED ) ; } messageMapper . insert ( MessagePo . of ( message ) ) ; } catch ( Exception e ) { LOGGER . error ( "add message to db error: {}" , e . getMessage ( ) ) ; throw new AppException ( "db operate error" , ResponseConst . RET_DB_ERROR ) ; } }
add a message to db.
add a message to db .