use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project GMall by 18391713434.
the class AttrServiceImpl method saveAttrInfo.
public String saveAttrInfo(PmsBaseAttrInfo pmsBaseAttrInfo) {
Long id = pmsBaseAttrInfo.getId();
if (id == null) {
// id为空,直接插入数据
// 保存属性
attrInfoMapper.insert(pmsBaseAttrInfo);
// 保存属性值
List<PmsBaseAttrValue> attrValueList = pmsBaseAttrInfo.getAttrValueList();
for (PmsBaseAttrValue pmsBaseAttrValue : attrValueList) {
pmsBaseAttrValue.setAttrId(pmsBaseAttrInfo.getId());
attrValueMapper.insert(pmsBaseAttrValue);
}
} else {
attrInfoMapper.update(pmsBaseAttrInfo, new UpdateWrapper<PmsBaseAttrInfo>().eq("id", id));
// id不为空,修改数据:先删除后插入
attrValueMapper.delete(new QueryWrapper<PmsBaseAttrValue>().eq("attr_id", id));
List<PmsBaseAttrValue> attrValueList = pmsBaseAttrInfo.getAttrValueList();
for (PmsBaseAttrValue pmsBaseAttrValue : attrValueList) {
pmsBaseAttrValue.setAttrId(pmsBaseAttrInfo.getId());
attrValueMapper.insert(pmsBaseAttrValue);
}
}
return "success";
}
use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project GMall by 18391713434.
the class PaymentServiceImpl method updatePaymentInfo.
@Override
public void updatePaymentInfo(PaymentInfo paymentInfo) {
// 进行幂等性检查
PaymentInfo paymentInfoResult = paymentMapper.selectOne(new QueryWrapper<PaymentInfo>().eq("alipay_trade_no", paymentInfo.getOrderSn()));
if (StringUtils.isNotBlank(paymentInfoResult.getPaymentStatus()) && paymentInfoResult.getPaymentStatus().equals("已支付")) {
return;
} else {
Connection connection = null;
Session session = null;
try {
connection = activeMQUtil.getConnectionFactory().createConnection();
session = connection.createSession(true, Session.SESSION_TRANSACTED);
} catch (Exception e) {
e.printStackTrace();
}
try {
paymentMapper.update(paymentInfo, new UpdateWrapper<PaymentInfo>().eq("order_sn", paymentInfo.getOrderSn()));
// 支付成功后,引起的系统服务,订单服务的更新 --》库存服务 --》物流服务
// 调用mq发送支付成功的消息
Queue payment_success_quene = session.createQueue("PAYMENT_SUCCESS_QUENE");
MessageProducer producer = session.createProducer(payment_success_quene);
// 字符串文本
TextMessage textMessage = new ActiveMQTextMessage();
// hash结构
MapMessage mapMessage = new ActiveMQMapMessage();
mapMessage.setString("out_trade_no", paymentInfo.getOrderSn());
session.commit();
} catch (Exception e) {
// 消息回滚
try {
session.rollback();
} catch (Exception e1) {
e1.printStackTrace();
}
} finally {
try {
connection.close();
} catch (JMSException e) {
e.printStackTrace();
}
}
}
}
use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project lilishop by lilishop.
the class MemberNoticeManagerController method readAll.
@ApiOperation(value = "阅读全部")
@PostMapping("/read/all")
public ResultMessage<Object> readAll() {
UpdateWrapper updateWrapper = new UpdateWrapper();
updateWrapper.in("member_id", UserContext.getCurrentUser().getId());
updateWrapper.set("is_read", true);
memberNoticeService.update(updateWrapper);
return ResultUtil.success();
}
use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project lilishop by lilishop.
the class PurchaseOrderServiceImpl method close.
@Override
@Transactional(rollbackFor = Exception.class)
public boolean close(String id) {
PurchaseOrder purchaseOrder = this.getById(id);
purchaseOrder.setStatus("CLOSE");
UpdateWrapper<PurchaseOrder> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", id);
updateWrapper.set("status", "CLOSE");
return this.update(updateWrapper);
}
use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project lilishop by lilishop.
the class GoodsServiceImpl method updateStoreDetail.
@Override
@Transactional(rollbackFor = Exception.class)
public void updateStoreDetail(Store store) {
UpdateWrapper updateWrapper = new UpdateWrapper<>().eq("store_id", store.getId()).set("store_name", store.getStoreName()).set("self_operated", store.getSelfOperated());
this.update(updateWrapper);
goodsSkuService.update(updateWrapper);
}
Aggregations