铺货消息推送
parent
7e6cfe4e0a
commit
cf24159a9b
@ -0,0 +1,10 @@
|
||||
package com.ms.api.dto.dfapi.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SupplyCenterMessage {
|
||||
private String tag;
|
||||
private String msgId;
|
||||
private String data;
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.ms.api.dto.dfapi.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SupplyCenterMessageRequestDao {
|
||||
private List<SupplyCenterMessage> messages;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.ms.api.dto.dfapi.response;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CommonResponseDTO {
|
||||
@JSONField(name = "code")
|
||||
protected String code;
|
||||
|
||||
@JSONField(name = "message")
|
||||
protected String message;
|
||||
|
||||
@JSONField(name = "result")
|
||||
protected String result;
|
||||
|
||||
@JSONField(name = "reason")
|
||||
protected String reason;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return "success".equals(result);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
package com.ms.biz.quque.consumer;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.jinritemai.cloud.base.core.util.LogUtils;
|
||||
import com.ms.biz.quque.ConsumerListener;
|
||||
import com.ms.biz.quque.Group;
|
||||
import com.ms.biz.quque.Topic;
|
||||
import com.ms.biz.quque.message.SupplyCenterMessage;
|
||||
import com.ms.biz.service.SupplyCenterService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
|
||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
|
||||
import org.apache.rocketmq.common.message.MessageExt;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@ConsumerListener(consumerGroup = Group.GROUP_SUPPLY_CENTER_MESSAGE, topic = Topic.TOPIC_SUPPLY_CENTER_MESSAGE)
|
||||
@Component
|
||||
public class SupplyCenterMessageConsumer extends BaseConsumer {
|
||||
@Autowired
|
||||
private SupplyCenterService supplyCenterService;
|
||||
|
||||
@Override
|
||||
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> list, ConsumeConcurrentlyContext consumeConcurrentlyContext) {
|
||||
LogUtils.setLogId(LogUtils.generateLogId());
|
||||
log.info("SupplyCenterMessageConsumer Receive New Messages: {}", JSON.toJSONString(list));
|
||||
for (MessageExt message: list) {
|
||||
try {
|
||||
log.info("consume message: {}", new String(message.getBody()));
|
||||
SupplyCenterMessage supplyCenterMessage = JSON.parseObject(new String(message.getBody()), SupplyCenterMessage.class);
|
||||
supplyCenterService.processMessage(supplyCenterMessage.getMsgId());
|
||||
} catch (Throwable e) {
|
||||
log.error("SupplyCenterMessageConsumerError", e);
|
||||
}
|
||||
}
|
||||
log.info("SupplyCenterMessageConsumer consumeMessage success");
|
||||
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.ms.biz.quque.message;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class SupplyCenterMessage extends BaseMessage {
|
||||
private String msgId;
|
||||
private Long shopId;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.ms.biz.service;
|
||||
|
||||
import com.ms.dal.entity.DdSupplyCenterMsg;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public interface DdSupplyCenterMsgService {
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(DdSupplyCenterMsg record);
|
||||
|
||||
int insertSelective(DdSupplyCenterMsg record);
|
||||
|
||||
DdSupplyCenterMsg selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByPrimaryKeySelective(DdSupplyCenterMsg record);
|
||||
|
||||
int updateByPrimaryKey(DdSupplyCenterMsg record);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.ms.biz.service;
|
||||
|
||||
|
||||
import com.ms.api.dto.dfapi.request.SupplyCenterMessageRequestDao;
|
||||
import com.ms.api.dto.dfapi.response.CommonResponseDTO;
|
||||
|
||||
public interface DfApiService {
|
||||
CommonResponseDTO receiverDdSupplyCenterMsg(SupplyCenterMessageRequestDao request);
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.ms.biz.service;
|
||||
|
||||
public interface SupplyCenterService {
|
||||
void processMessage(String msgId);
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.ms.biz.service.impl;
|
||||
|
||||
import com.ms.dal.entity.DdSupplyCenterMsg;
|
||||
import com.ms.dal.mapper.DdSupplyCenterMsgMapper;
|
||||
import com.ms.biz.service.DdSupplyCenterMsgService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class DdSupplyCenterMsgServiceImpl implements DdSupplyCenterMsgService{
|
||||
|
||||
@Autowired
|
||||
private DdSupplyCenterMsgMapper ddSupplyCenterMsgMapper;
|
||||
|
||||
@Override
|
||||
public int deleteByPrimaryKey(Long id) {
|
||||
return ddSupplyCenterMsgMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(DdSupplyCenterMsg record) {
|
||||
return ddSupplyCenterMsgMapper.insert(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertSelective(DdSupplyCenterMsg record) {
|
||||
return ddSupplyCenterMsgMapper.insertSelective(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DdSupplyCenterMsg selectByPrimaryKey(Long id) {
|
||||
return ddSupplyCenterMsgMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateByPrimaryKeySelective(DdSupplyCenterMsg record) {
|
||||
return ddSupplyCenterMsgMapper.updateByPrimaryKeySelective(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateByPrimaryKey(DdSupplyCenterMsg record) {
|
||||
return ddSupplyCenterMsgMapper.updateByPrimaryKey(record);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,64 @@
|
||||
package com.ms.biz.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ms.api.dto.dfapi.request.SupplyCenterMessageRequestDao;
|
||||
import com.ms.api.dto.dfapi.response.CommonResponseDTO;
|
||||
import com.ms.api.dto.dsapi.request.OperateInfoDTO;
|
||||
import com.ms.biz.consts.CommonConst;
|
||||
import com.ms.biz.service.DfApiService;
|
||||
import com.ms.biz.tool.DfJsonRequestTemplate;
|
||||
import com.ms.biz.tool.SecurityTool;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class DfApiServiceImpl implements DfApiService {
|
||||
private DfJsonRequestTemplate dfJsonRequestTemplate;
|
||||
|
||||
@Override
|
||||
public CommonResponseDTO receiverDdSupplyCenterMsg(SupplyCenterMessageRequestDao request) {
|
||||
String resp = execute("/api/open/supply_center/message/receiver_dd_supply_center_msg", objectToMap(request));
|
||||
return JSON.parseObject(resp, CommonResponseDTO.class);
|
||||
}
|
||||
|
||||
private Map<String, Object> objectToMap(Object obj) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Class<?> clazz = obj.getClass();
|
||||
System.out.println(clazz);
|
||||
try {
|
||||
for (Field field : clazz.getDeclaredFields()) {
|
||||
field.setAccessible(true);
|
||||
String fieldName = field.getName();
|
||||
Object value = field.get(obj);
|
||||
map.put(fieldName, value);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("参数解析错误");
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
private String execute(String url, Map<String, Object> params) {
|
||||
log.info("DsApiURL:" + url);
|
||||
log.info("DsApiRequest:" + params);
|
||||
try {
|
||||
String response = dfJsonRequestTemplate.execute(url, params);
|
||||
log.info("DsApiResponse:" + response);
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("DsApiException", e);
|
||||
throw new RuntimeException("请求异常" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private OperateInfoDTO createOperateInfo(Long shopId) {
|
||||
return new OperateInfoDTO(SecurityTool.encodeByAES(String.valueOf(shopId)));
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.ms.biz.service.impl;
|
||||
|
||||
import com.ms.api.dto.dfapi.request.SupplyCenterMessage;
|
||||
import com.ms.api.dto.dfapi.request.SupplyCenterMessageRequestDao;
|
||||
import com.ms.api.dto.dfapi.response.CommonResponseDTO;
|
||||
import com.ms.biz.consts.StatusConst;
|
||||
import com.ms.biz.service.DfApiService;
|
||||
import com.ms.biz.service.SupplyCenterService;
|
||||
import com.ms.dal.entity.DdSupplyCenterMsg;
|
||||
import com.ms.dal.mapper.DdSupplyCenterMsgMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SupplyCenterServiceImpl implements SupplyCenterService {
|
||||
|
||||
@Autowired
|
||||
private DfApiService dfApiService;
|
||||
|
||||
@Autowired
|
||||
private DdSupplyCenterMsgMapper ddSupplyCenterMsgMapper;
|
||||
|
||||
@Override
|
||||
public void processMessage(String msgId) {
|
||||
DdSupplyCenterMsg msg = ddSupplyCenterMsgMapper.selectByMsgId(msgId);
|
||||
List<SupplyCenterMessage> messages = new ArrayList<>();
|
||||
SupplyCenterMessage message = new SupplyCenterMessage();
|
||||
message.setTag(msg.getTag().toString());
|
||||
message.setMsgId(msg.getMsgId());
|
||||
message.setData(msg.getData());
|
||||
messages.add(message);
|
||||
SupplyCenterMessageRequestDao request = new SupplyCenterMessageRequestDao();
|
||||
request.setMessages(messages);
|
||||
CommonResponseDTO response = dfApiService.receiverDdSupplyCenterMsg(request);
|
||||
if (response.isSuccess()) {
|
||||
msg.setStatus(StatusConst.success);
|
||||
} else {
|
||||
msg.setStatus(StatusConst.fail);
|
||||
msg.setReason(response.getReason());
|
||||
}
|
||||
ddSupplyCenterMsgMapper.updateByMsgIdSelective(msg);
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.ms.biz.tool;
|
||||
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DfJsonRequestTemplate {
|
||||
@Autowired
|
||||
private CloudRequestTemplate cloudRequestTemplate;
|
||||
|
||||
@Value("${jx.df.host-prod}")
|
||||
private String dfHostProd;
|
||||
|
||||
@Value("${jx.df.host-test}")
|
||||
private String dfHostTest;
|
||||
|
||||
@Value("${jx.df.token-prod}")
|
||||
private String dfTokenProd;
|
||||
|
||||
@Value("${jx.df.token-test}")
|
||||
private String dfTokenTest;
|
||||
|
||||
private String dfHost;
|
||||
private String dfToken;
|
||||
|
||||
public String execute(String url, Map<String, Object> body) throws Exception {
|
||||
// 选择环境
|
||||
if (StringUtils.isEmpty(dfHost)) {
|
||||
if (SystemTool.isProdEnv()) {
|
||||
// 当前为生产环境
|
||||
dfHost = dfHostProd;
|
||||
dfToken = dfTokenProd;
|
||||
} else {
|
||||
dfHost = dfHostTest;
|
||||
dfToken = dfTokenTest;
|
||||
}
|
||||
}
|
||||
System.out.println(dfHost + url);
|
||||
|
||||
// 构建头部
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
// 微应用固定传msddMicro
|
||||
headers.set("x-app-name", "msddMicro");
|
||||
// 使用json方式更符合外部服务管理
|
||||
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||
HashMap<String,Object> params = (HashMap<String,Object>)body;
|
||||
// 构建签名
|
||||
Set<String> keySet = params.keySet();
|
||||
String[] keyArray = keySet.toArray(new String[0]);
|
||||
Arrays.sort(keyArray);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(dfToken);
|
||||
for (String s : keyArray) {
|
||||
if (!Objects.isNull(params.get(s))) {
|
||||
String value = JSON.toJSONString(params.get(s), SerializerFeature.MapSortField);
|
||||
value = CommonTool.removeQuotes(value);
|
||||
sb.append(s).append(value);
|
||||
}
|
||||
}
|
||||
log.info("req url:" + dfHost + url);
|
||||
sb.append(dfToken);
|
||||
log.info("row str:" + sb);
|
||||
String sign = SecureUtil.md5(sb.toString());
|
||||
log.info("sign str:" + sign);
|
||||
headers.set("x-dd-micro-app-sign", sign);
|
||||
log.info("body str:" + JSON.toJSONString(params, SerializerFeature.MapSortField));
|
||||
return cloudRequestTemplate.executePost(dfHost + url, JSON.toJSONString(params, SerializerFeature.MapSortField), headers);
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.ms.dal.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 抖店订单消息
|
||||
* @TableName dd_supply_center_msg
|
||||
*/
|
||||
@Data
|
||||
public class DdSupplyCenterMsg implements Serializable {
|
||||
/**
|
||||
* 自增id
|
||||
*/
|
||||
private Long ddSupplyCenterMsgId;
|
||||
|
||||
/**
|
||||
* 官方的消息id
|
||||
*/
|
||||
private String msgId;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 消息类型
|
||||
*/
|
||||
private Integer tag;
|
||||
|
||||
/**
|
||||
* 消息内容 json
|
||||
*/
|
||||
private String data;
|
||||
|
||||
/**
|
||||
* 消息处理状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 消息处理失败原因
|
||||
*/
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date gmtCreate;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date gmtModified;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.ms.dal.mapper;
|
||||
|
||||
import com.ms.dal.entity.DdSupplyCenterMsg;
|
||||
import com.ms.dal.entity.DdTradeMsg;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Entity com.ms.dal.entity.DdSupplyCenterMsg
|
||||
*/
|
||||
@Mapper
|
||||
public interface DdSupplyCenterMsgMapper {
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(DdSupplyCenterMsg record);
|
||||
|
||||
int insertOrUpdate(DdSupplyCenterMsg record);
|
||||
|
||||
int insertSelective(DdSupplyCenterMsg record);
|
||||
|
||||
DdSupplyCenterMsg selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByPrimaryKeySelective(DdSupplyCenterMsg record);
|
||||
|
||||
int updateByPrimaryKey(DdSupplyCenterMsg record);
|
||||
|
||||
int insertBatch(List<DdSupplyCenterMsg> list);
|
||||
|
||||
List<DdSupplyCenterMsg> selectByMsgIds(@Param("msgIds") List<String> msgIds);
|
||||
|
||||
DdSupplyCenterMsg selectByMsgId(String msgId);
|
||||
|
||||
int updateByMsgIdSelective(DdSupplyCenterMsg record);
|
||||
}
|
@ -0,0 +1,226 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ms.dal.mapper.DdSupplyCenterMsgMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ms.dal.entity.DdSupplyCenterMsg">
|
||||
<id property="ddSupplyCenterMsgId" column="dd_supply_center_msg_id" jdbcType="BIGINT"/>
|
||||
<result property="msgId" column="msg_id" jdbcType="VARCHAR"/>
|
||||
<result property="shopId" column="shop_id" jdbcType="BIGINT"/>
|
||||
<result property="tag" column="tag" jdbcType="SMALLINT"/>
|
||||
<result property="data" column="data" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="VARCHAR"/>
|
||||
<result property="reason" column="reason" jdbcType="VARCHAR"/>
|
||||
<result property="gmtCreate" column="gmt_create" jdbcType="TIMESTAMP"/>
|
||||
<result property="gmtModified" column="gmt_modified" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
dd_supply_center_msg_id,msg_id,shop_id,
|
||||
tag,data,status,
|
||||
reason,gmt_create,gmt_modified
|
||||
</sql>
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from dd_supply_center_msg
|
||||
where dd_supply_center_msg_id = #{ddSupplyCenterMsgId,jdbcType=BIGINT}
|
||||
</select>
|
||||
|
||||
<select id="selectByMsgIds" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from dd_supply_center_msg
|
||||
where msg_id in
|
||||
<foreach collection="msgIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="selectByMsgId" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from dd_supply_center_msg
|
||||
where msg_id = #{msgId,jdbcType=VARCHAR}
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from dd_supply_center_msg
|
||||
where dd_supply_center_msg_id = #{ddSupplyCenterMsgId,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<insert id="insert" keyColumn="dd_supply_center_msg_id" keyProperty="ddSupplyCenterMsgId" parameterType="com.ms.dal.entity.DdSupplyCenterMsg" useGeneratedKeys="true">
|
||||
insert into dd_supply_center_msg
|
||||
( dd_supply_center_msg_id,msg_id,shop_id
|
||||
,tag,data,status
|
||||
,reason,gmt_create,gmt_modified
|
||||
)
|
||||
values (#{ddSupplyCenterMsgId,jdbcType=BIGINT},#{msgId,jdbcType=VARCHAR},#{shopId,jdbcType=BIGINT}
|
||||
,#{tag,jdbcType=SMALLINT},#{data,jdbcType=VARCHAR},#{status,jdbcType=VARCHAR}
|
||||
,#{reason,jdbcType=VARCHAR},#{gmtCreate,jdbcType=TIMESTAMP},#{gmtModified,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</insert>
|
||||
<update id="insertOrUpdate" keyColumn="dd_supply_center_msg_id" keyProperty="ddSupplyCenterMsgId" parameterType="com.ms.dal.entity.DdSupplyCenterMsg"
|
||||
useGeneratedKeys="true">
|
||||
insert into dd_supply_center_msg
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="ddSupplyCenterMsgId != null">dd_supply_center_msg_id,</if>
|
||||
<if test="msgId != null">msg_id,</if>
|
||||
<if test="shopId != null">shop_id,</if>
|
||||
<if test="tag != null">tag,</if>
|
||||
<if test="data != null">data,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="reason != null">reason,</if>
|
||||
<if test="gmtCreate != null">gmt_create,</if>
|
||||
<if test="gmtModified != null">gmt_modified,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="ddSupplyCenterMsgId != null">#{ddSupplyCenterMsgId,jdbcType=BIGINT},</if>
|
||||
<if test="msgId != null">#{msgId,jdbcType=VARCHAR},</if>
|
||||
<if test="shopId != null">#{shopId,jdbcType=BIGINT},</if>
|
||||
<if test="tag != null">#{tag,jdbcType=SMALLINT},</if>
|
||||
<if test="data != null">#{data,jdbcType=VARCHAR},</if>
|
||||
<if test="status != null">#{status,jdbcType=VARCHAR},</if>
|
||||
<if test="reason != null">#{reason,jdbcType=VARCHAR},</if>
|
||||
<if test="gmtCreate != null">#{gmtCreate,jdbcType=TIMESTAMP},</if>
|
||||
<if test="gmtModified != null">#{gmtModified,jdbcType=TIMESTAMP},</if>
|
||||
</trim>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
<trim suffixOverrides=",">
|
||||
<if test="msgId != null">
|
||||
msg_id = #{msgId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="tag != null">
|
||||
tag = #{tag,jdbcType=SMALLINT},
|
||||
</if>
|
||||
<if test="data != null">
|
||||
data = #{data,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="reason != null">
|
||||
reason = #{reason,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="gmtCreate != null">
|
||||
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="gmtModified != null">
|
||||
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</update>
|
||||
<insert id="insertSelective" keyColumn="dd_supply_center_msg_id" keyProperty="ddSupplyCenterMsgId" parameterType="com.ms.dal.entity.DdSupplyCenterMsg" useGeneratedKeys="true">
|
||||
insert into dd_supply_center_msg
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="ddSupplyCenterMsgId != null">dd_supply_center_msg_id,</if>
|
||||
<if test="msgId != null">msg_id,</if>
|
||||
<if test="shopId != null">shop_id,</if>
|
||||
<if test="tag != null">tag,</if>
|
||||
<if test="data != null">data,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="reason != null">reason,</if>
|
||||
<if test="gmtCreate != null">gmt_create,</if>
|
||||
<if test="gmtModified != null">gmt_modified,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="ddSupplyCenterMsgId != null">#{ddSupplyCenterMsgId,jdbcType=BIGINT},</if>
|
||||
<if test="msgId != null">#{msgId,jdbcType=VARCHAR},</if>
|
||||
<if test="shopId != null">#{shopId,jdbcType=BIGINT},</if>
|
||||
<if test="tag != null">#{tag,jdbcType=SMALLINT},</if>
|
||||
<if test="data != null">#{data,jdbcType=VARCHAR},</if>
|
||||
<if test="status != null">#{status,jdbcType=VARCHAR},</if>
|
||||
<if test="reason != null">#{reason,jdbcType=VARCHAR},</if>
|
||||
<if test="gmtCreate != null">#{gmtCreate,jdbcType=TIMESTAMP},</if>
|
||||
<if test="gmtModified != null">#{gmtModified,jdbcType=TIMESTAMP},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertBatch" useGeneratedKeys="true" keyColumn="dd_supply_center_msg_id" keyProperty="list.ddSupplyCenterMsgId" parameterType="java.util.List">
|
||||
insert into dd_supply_center_msg
|
||||
(dd_supply_center_msg_id,msg_id,shop_id
|
||||
,tag,data,status
|
||||
,reason,gmt_create,gmt_modified
|
||||
)
|
||||
values
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
(#{item.ddSupplyCenterMsgId,jdbcType=BIGINT},#{item.msgId,jdbcType=VARCHAR},#{item.shopId,jdbcType=BIGINT}
|
||||
,#{item.tag,jdbcType=SMALLINT},#{item.data,jdbcType=VARCHAR},#{item.status,jdbcType=VARCHAR}
|
||||
,#{item.reason,jdbcType=VARCHAR},#{item.gmtCreate,jdbcType=TIMESTAMP},#{item.gmtModified,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.ms.dal.entity.DdSupplyCenterMsg">
|
||||
update dd_supply_center_msg
|
||||
<set>
|
||||
<if test="msgId != null">
|
||||
msg_id = #{msgId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="tag != null">
|
||||
tag = #{tag,jdbcType=SMALLINT},
|
||||
</if>
|
||||
<if test="data != null">
|
||||
data = #{data,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="reason != null">
|
||||
reason = #{reason,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="gmtCreate != null">
|
||||
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="gmtModified != null">
|
||||
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where dd_supply_center_msg_id = #{ddSupplyCenterMsgId,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.ms.dal.entity.DdSupplyCenterMsg">
|
||||
update dd_supply_center_msg
|
||||
set
|
||||
msg_id = #{msgId,jdbcType=VARCHAR},
|
||||
shop_id = #{shopId,jdbcType=BIGINT},
|
||||
tag = #{tag,jdbcType=SMALLINT},
|
||||
data = #{data,jdbcType=VARCHAR},
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
reason = #{reason,jdbcType=VARCHAR},
|
||||
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
|
||||
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}
|
||||
where dd_supply_center_msg_id = #{ddSupplyCenterMsgId,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByMsgIdSelective" parameterType="com.ms.dal.entity.DdSupplyCenterMsg">
|
||||
update dd_supply_center_msg
|
||||
<set>
|
||||
<if test="shopId != null">
|
||||
shop_id = #{shopId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="tag != null">
|
||||
tag = #{tag,jdbcType=SMALLINT},
|
||||
</if>
|
||||
<if test="data != null">
|
||||
data = #{data,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="reason != null">
|
||||
reason = #{reason,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="gmtCreate != null">
|
||||
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="gmtModified != null">
|
||||
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where msg_id = #{msgId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
Loading…
Reference in New Issue