Search in sources :

Example 6 with UpdateWrapper

use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project GMall by 18391713434.

the class OrderServiceImpl method updateOrderStatus.

@Override
public void updateOrderStatus(String out_trade_no) {
    // 发送订单已支付的队列提供给库存
    Connection connection = null;
    Session session = null;
    try {
        connection = activeMQUtil.getConnectionFactory().createConnection();
        session = connection.createSession(true, Session.SESSION_TRANSACTED);
    } catch (Exception e) {
        e.printStackTrace();
    }
    try {
        OmsOrder omsOrder = new OmsOrder();
        omsOrder.setStatus(1);
        orderMapper.update(omsOrder, new UpdateWrapper<OmsOrder>().eq("out_trade_no", out_trade_no));
        // 调用mq发送支付成功的消息
        Queue order_pay_quene = session.createQueue("ORDER_PAY_QUENE");
        MessageProducer producer = session.createProducer(order_pay_quene);
        // 字符串文本
        TextMessage textMessage = new ActiveMQTextMessage();
        // hash结构
        MapMessage mapMessage = new ActiveMQMapMessage();
        mapMessage.setString("out_trade_no", out_trade_no);
        session.commit();
    } catch (Exception e) {
        // 消息回滚
        try {
            session.rollback();
        } catch (Exception e1) {
            e1.printStackTrace();
        }
    } finally {
        try {
            connection.close();
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
}
Also used : ActiveMQMapMessage(org.apache.activemq.command.ActiveMQMapMessage) UpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper) OmsOrder(com.xatu.gmall.entity.OmsOrder) ActiveMQMapMessage(org.apache.activemq.command.ActiveMQMapMessage) ActiveMQTextMessage(org.apache.activemq.command.ActiveMQTextMessage) ActiveMQTextMessage(org.apache.activemq.command.ActiveMQTextMessage)

Example 7 with UpdateWrapper

use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project kms by mahonelau.

the class SysBaseApiImpl method updateSysAnnounReadFlag.

@Override
public void updateSysAnnounReadFlag(String busType, String busId) {
    SysAnnouncement announcement = sysAnnouncementMapper.selectOne(new QueryWrapper<SysAnnouncement>().eq("bus_type", busType).eq("bus_id", busId));
    if (announcement != null) {
        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = sysUser.getId();
        LambdaUpdateWrapper<SysAnnouncementSend> updateWrapper = new UpdateWrapper().lambda();
        updateWrapper.set(SysAnnouncementSend::getReadFlag, CommonConstant.HAS_READ_FLAG);
        updateWrapper.set(SysAnnouncementSend::getReadTime, new Date());
        updateWrapper.last("where annt_id ='" + announcement.getId() + "' and user_id ='" + userId + "'");
        SysAnnouncementSend announcementSend = new SysAnnouncementSend();
        sysAnnouncementSendMapper.update(announcementSend, updateWrapper);
    }
}
Also used : UpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper) LambdaUpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper)

Example 8 with UpdateWrapper

use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project kykms by mahonelau.

the class SysBaseApiImpl method updateSysAnnounReadFlag.

@Override
public void updateSysAnnounReadFlag(String busType, String busId) {
    SysAnnouncement announcement = sysAnnouncementMapper.selectOne(new QueryWrapper<SysAnnouncement>().eq("bus_type", busType).eq("bus_id", busId));
    if (announcement != null) {
        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String userId = sysUser.getId();
        LambdaUpdateWrapper<SysAnnouncementSend> updateWrapper = new UpdateWrapper().lambda();
        updateWrapper.set(SysAnnouncementSend::getReadFlag, CommonConstant.HAS_READ_FLAG);
        updateWrapper.set(SysAnnouncementSend::getReadTime, new Date());
        updateWrapper.last("where annt_id ='" + announcement.getId() + "' and user_id ='" + userId + "'");
        SysAnnouncementSend announcementSend = new SysAnnouncementSend();
        sysAnnouncementSendMapper.update(announcementSend, updateWrapper);
    }
}
Also used : UpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper) LambdaUpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper)

Example 9 with UpdateWrapper

use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project kykms by mahonelau.

the class SysAnnouncementSendController method readAll.

/**
 * @功能:一键已读
 * @return
 */
@PutMapping(value = "/readAll")
public Result<SysAnnouncementSend> readAll() {
    Result<SysAnnouncementSend> result = new Result<SysAnnouncementSend>();
    LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
    String userId = sysUser.getId();
    LambdaUpdateWrapper<SysAnnouncementSend> updateWrapper = new UpdateWrapper().lambda();
    updateWrapper.set(SysAnnouncementSend::getReadFlag, CommonConstant.HAS_READ_FLAG);
    updateWrapper.set(SysAnnouncementSend::getReadTime, new Date());
    updateWrapper.last("where user_id ='" + userId + "'");
    SysAnnouncementSend announcementSend = new SysAnnouncementSend();
    sysAnnouncementSendService.update(announcementSend, updateWrapper);
    result.setSuccess(true);
    result.setMessage("全部已读");
    return result;
}
Also used : SysAnnouncementSend(org.jeecg.modules.system.entity.SysAnnouncementSend) UpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper) LambdaUpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper) LoginUser(org.jeecg.common.system.vo.LoginUser) Date(java.util.Date) Result(org.jeecg.common.api.vo.Result) PutMapping(org.springframework.web.bind.annotation.PutMapping)

Example 10 with UpdateWrapper

use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project springboot-cli by liangqiding.

the class UserServiceImpl method updUser.

@Override
public boolean updUser(User user) {
    StrUtil.isNotBlank(user.getPassword());
    UpdateWrapper<User> set = new UpdateWrapper<User>().eq("user_id", user.getUserId()).set(StrUtil.isNotBlank(user.getPassword()), "password", user.getPassword()).set(StrUtil.isNotBlank(user.getUsername()), "username", user.getUsername()).set("updated_date", new Date());
    return this.update(set);
}
Also used : User(com.springboot.cli.domain.User) UpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper) Date(java.util.Date)

Aggregations

UpdateWrapper (com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper)97 Transactional (org.springframework.transaction.annotation.Transactional)41 QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)40 UserRolesVo (top.hcode.hoj.pojo.vo.UserRolesVo)34 StatusFailException (top.hcode.hoj.common.exception.StatusFailException)28 Session (org.apache.shiro.session.Session)24 StatusForbiddenException (top.hcode.hoj.common.exception.StatusForbiddenException)21 Judge (top.hcode.hoj.pojo.entity.judge.Judge)17 LambdaUpdateWrapper (com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper)16 HttpSession (javax.servlet.http.HttpSession)14 Problem (top.hcode.hoj.pojo.entity.problem.Problem)14 RequiresAuthentication (org.apache.shiro.authz.annotation.RequiresAuthentication)13 StatusNotFoundException (top.hcode.hoj.common.exception.StatusNotFoundException)11 Group (top.hcode.hoj.pojo.entity.group.Group)11 Date (java.util.Date)10 Discussion (top.hcode.hoj.pojo.entity.discussion.Discussion)10 Contest (top.hcode.hoj.pojo.entity.contest.Contest)8 User (com.baomidou.mybatisplus.samples.wrapper.entity.User)5 Result (org.jeecg.common.api.vo.Result)5 LoginUser (org.jeecg.common.system.vo.LoginUser)5