com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper Java Examples

The following examples show how to use com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdminChargeStationController.java    From charging_pile_cloud with MIT License 6 votes vote down vote up
/**
 * 删除充电桩
 */
@RequestMapping(value = "/delChargingPileInfo")
@ResponseBody
@LogMenthodName(name = "删除充电桩")
public Map<String,Object> delChargingPileInfo(ChargingPileInfo vo){
    if(vo.getId()==null){
        return ResponseUtil.getNotNormalMap(ResponseMsg.ID_IS_EMPTY);
    }
    //查询是该充电站下是否有充电桩
    ChargingPileInfo pileInfo = chargingPileInfoService.getById(vo.getId());
    if(pileInfo ==null|| pileInfo.getUseStatus()){
        return ResponseUtil.getNotNormalMap("充电桩不存在或正在使用");
    }
    chargingPileInfoService.update(new UpdateWrapper<ChargingPileInfo>()
            .set("is_deleted",1)
            .eq("id",vo.getId()));
    return ResponseUtil.getSuccessMap();
}
 
Example #2
Source File: SysAnnouncementSendController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:更新用户系统消息阅读状态
 * @param json
 * @return
 */
@PutMapping(value = "/editByAnntIdAndUserId")
public Result<SysAnnouncementSend> editById(@RequestBody JSONObject json) {
	Result<SysAnnouncementSend> result = new Result<SysAnnouncementSend>();
	String anntId = json.getString("anntId");
	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 ='"+anntId+"' and user_id ='"+userId+"'");
	SysAnnouncementSend announcementSend = new SysAnnouncementSend();
	sysAnnouncementSendService.update(announcementSend, updateWrapper);
	result.setSuccess(true);
	return result;
}
 
Example #3
Source File: SysUserController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
  * 冻结&解冻用户
 * @param jsonObject
 * @return
 */
@RequestMapping(value = "/frozenBatch", method = RequestMethod.PUT)
public Result<SysUser> frozenBatch(@RequestBody JSONObject jsonObject) {
	Result<SysUser> result = new Result<SysUser>();
	try {
		String ids = jsonObject.getString("ids");
		String status = jsonObject.getString("status");
		String[] arr = ids.split(",");
		for (String id : arr) {
			if(oConvertUtils.isNotEmpty(id)) {
				this.sysUserService.update(new SysUser().setStatus(Integer.parseInt(status)),
						new UpdateWrapper<SysUser>().lambda().eq(SysUser::getId,id));
			}
		}
	} catch (Exception e) {
		log.error(e.getMessage(), e);
		result.error500("操作失败"+e.getMessage());
	}
	result.success("操作成功!");
	return result;

   }
 
Example #4
Source File: SysAnnouncementSendController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:一键已读
 * @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;
}
 
Example #5
Source File: SysRoleServiceImpl.java    From Taroco with Apache License 2.0 6 votes vote down vote up
/**
 * 更新角色
 *
 * @param roleDto 含有部门信息
 * @return 成功、失败
 */
@Transactional(rollbackFor = Exception.class)
@Override
public Boolean updateRoleById(RoleDTO roleDto) {
    //删除原有的角色部门关系
    SysRoleDept condition = new SysRoleDept();
    condition.setRoleId(roleDto.getRoleId());
    sysRoleDeptMapper.delete(new UpdateWrapper<>(condition));

    //更新角色信息
    SysRole sysRole = new SysRole();
    BeanUtils.copyProperties(roleDto, sysRole);
    sysRoleMapper.updateById(sysRole);

    //维护角色部门关系
    SysRoleDept roleDept = new SysRoleDept();
    roleDept.setRoleId(sysRole.getRoleId());
    roleDept.setDeptId(roleDto.getRoleDeptId());
    sysRoleDeptMapper.insert(roleDept);
    return true;
}
 
Example #6
Source File: ChargingRecordServiceImpl.java    From charging_pile_cloud with MIT License 6 votes vote down vote up
/**
 *  避免事务中套事务 抽离方法
 * @param stockUserId
 * @param pileInfo
 * @param stations
 * @return
 */
private ChargingRecord insertCommontChargingRecord(Long stockUserId, ChargingPileInfo pileInfo, ChargingStations stations) {
    Date now = DealDateUtil.getNowDate();
    ChargingRecord record = ChargingRecord.builder()
            .address(stations.getAddress())
            .chargeStartTime(now)
            .chargingPileInfoId(pileInfo.getId())
            .chargingStationsId(stations.getId())
            .city(stations.getCity())
            .county(stations.getCounty())
            .createTime(now)
            .price(pileInfo.getPrice())
            .province(stations.getProvince())
            .stockUserId(stockUserId)
            .paymentStatus(false)
            .chargeStatus(0)
            .serviceCharge(pileInfo.getServiceCharge())
            .build();
    baseMapper.insert(record);
    //更新充电桩正在使用中
    chargingPileInfoService.update(new UpdateWrapper<ChargingPileInfo>()
            .set("use_status",1)
            .eq("id",pileInfo.getId()));
    return record;
}
 
Example #7
Source File: SysUserController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
  * 冻结&解冻用户
 * @param jsonObject
 * @return
 */
//@RequiresRoles({"admin"})
@RequestMapping(value = "/frozenBatch", method = RequestMethod.PUT)
public Result<SysUser> frozenBatch(@RequestBody JSONObject jsonObject) {
	Result<SysUser> result = new Result<SysUser>();
	try {
		String ids = jsonObject.getString("ids");
		String status = jsonObject.getString("status");
		String[] arr = ids.split(",");
		for (String id : arr) {
			if(oConvertUtils.isNotEmpty(id)) {
				this.sysUserService.update(new SysUser().setStatus(Integer.parseInt(status)),
						new UpdateWrapper<SysUser>().lambda().eq(SysUser::getId,id));
			}
		}
	} catch (Exception e) {
		log.error(e.getMessage(), e);
		result.error500("操作失败"+e.getMessage());
	}
	result.success("操作成功!");
	return result;

   }
 
Example #8
Source File: AppUserController.java    From charging_pile_cloud with MIT License 6 votes vote down vote up
/**
 * 微信用户手机号信息解密
 */
@RequestMapping(value = "wxPhoneDecode", method = {RequestMethod.POST,RequestMethod.GET})
@ApiOperation(notes = "微信用户手机号信息解密", value = "")
@ResponseBody
public Map<String, Object> wxDecode(StockUserSignInVO vo, HttpServletRequest req,
                                    HttpServletResponse res) throws WxErrorException, UnsupportedEncodingException {
    if(com.util.StringUtils.isBlank(vo.getOpenId(),vo.getEncryptedData(),vo.getIvStr())){
        return  ResponseUtil.getNotNormalMap(ResponseMsg.ERROR_PARAM);
    }
    WxMaJscode2SessionResult sessionResult =JSONObject.toJavaObject(JSONObject.parseObject(userCacheUtil.getAppStockUserWxLoginInfo(vo.getOpenId())),WxMaJscode2SessionResult.class);
    WxMaPhoneNumberInfo p =WxMaConfiguration.getWxMaService().getUserService().getPhoneNoInfo(sessionResult.getSessionKey(),vo.getEncryptedData(),vo.getIvStr());
    stockUserService.update(new UpdateWrapper<StockUser>()
            .set("tel",p.getPurePhoneNumber())
            .eq("open_id",vo.getOpenId()));
    return ResponseUtil.getSuccessMap(p);
}
 
Example #9
Source File: AppUserController.java    From charging_pile_cloud with MIT License 6 votes vote down vote up
/**
 * 不须验证验证码绑定手机号
 * @param vo
 * @param request
 * @param response
 * @return
 * @throws IOException
 */
@RequestMapping(value = "bindPhoneNoCode", method = RequestMethod.POST)
@ApiOperation(notes = "用户手机号绑定 :openId:用户微信openId ;account:手机号;code:验证码", value = "用户手机号绑定")
@ResponseBody
public Map<String, Object> bindPhoneNoCode(StockUserSignInVO vo, HttpServletRequest request, HttpServletResponse response) throws IOException {

    StockUserLoginVO  loginVO =  stockUserService.selectByAccount(vo.getAccount());
    if(loginVO !=null){
        return  ResponseUtil.getNotNormalMap(ResponseMsg.USER_HAS_EXIST);
    }
    boolean success= stockUserService.update(new UpdateWrapper<StockUser>()
            .set("tel",vo.getAccount())
            .eq("open_id",vo.getOpenId()));
    if(success){
        return   ResponseUtil.getSuccessMap();
    }
    return ResponseUtil.getNotNormalMap();
}
 
Example #10
Source File: AppUserController.java    From charging_pile_cloud with MIT License 6 votes vote down vote up
/**
 * 验证验证码 绑定手机号
 *
 * @param vo
 * @param request
 * @param response
 * @return
 * @throws IOException
 */
@RequestMapping(value = "bindPhone", method = RequestMethod.POST)
@ApiOperation(notes = "用户手机号绑定 :openId:用户微信openId ;account:手机号;code:验证码", value = "用户手机号绑定")
@ResponseBody
public Map<String, Object> bindPhone(StockUserSignInVO vo, HttpServletRequest request, HttpServletResponse response) throws IOException {

    StockUserLoginVO  loginVO =  stockUserService.selectByAccount(vo.getAccount());
    if(loginVO !=null){
        return  ResponseUtil.getNotNormalMap(ResponseMsg.USER_HAS_EXIST);
    }
    try {
        commonService.checkTelToken(vo.getAccount(), vo.getCode());
    }catch (Exception e){
        return  ResponseUtil.getNotNormalMap(e.getMessage());
    }
   boolean success= stockUserService.update(new UpdateWrapper<StockUser>()
    .set("tel",vo.getAccount())
    .eq("open_id",vo.getOpenId()));
    if(success){
      return   ResponseUtil.getSuccessMap();
    }
    return ResponseUtil.getNotNormalMap();
}
 
Example #11
Source File: AdminChargeStationController.java    From charging_pile_cloud with MIT License 6 votes vote down vote up
/**
 * 删除充电站
 */
@RequestMapping(value = "/delStations")
@ResponseBody
@LogMenthodName(name = "删除充电站")
public Map<String,Object> delStations(ChargingStations vo){
    if(vo.getId()==null){
        return ResponseUtil.getNotNormalMap(ResponseMsg.ID_IS_EMPTY);
    }
    //查询是该充电站下是否有充电桩
    List<Object> pileInfos = chargingPileInfoService.listObjs(new QueryWrapper<ChargingPileInfo>()
    .eq("is_deleted",0)
    .eq("charging_stations_id",vo.getId()));
    if(!pileInfos.isEmpty()){
        return ResponseUtil.getNotNormalMap("该充电站下有未删除的充电桩");
    }
    chargingStationsService.update(new UpdateWrapper<ChargingStations>()
    .set("is_deleted",1)
    .eq("id",vo.getId()));
    return ResponseUtil.getSuccessMap();
}
 
Example #12
Source File: SysAnnouncementSendController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:更新用户系统消息阅读状态
 * @param json
 * @return
 */
@PutMapping(value = "/editByAnntIdAndUserId")
public Result<SysAnnouncementSend> editById(@RequestBody JSONObject json) {
	Result<SysAnnouncementSend> result = new Result<SysAnnouncementSend>();
	String anntId = json.getString("anntId");
	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 ='"+anntId+"' and user_id ='"+userId+"'");
	SysAnnouncementSend announcementSend = new SysAnnouncementSend();
	sysAnnouncementSendService.update(announcementSend, updateWrapper);
	result.setSuccess(true);
	return result;
}
 
Example #13
Source File: SysAnnouncementSendController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:一键已读
 * @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;
}
 
Example #14
Source File: SysAnnouncementSendController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * @功能:一键已读
 * @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;
}
 
Example #15
Source File: SysAnnouncementSendController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
 * @功能:更新用户系统消息阅读状态
 * @param json
 * @return
 */
@PutMapping(value = "/editByAnntIdAndUserId")
public Result<SysAnnouncementSend> editById(@RequestBody JSONObject json) {
	Result<SysAnnouncementSend> result = new Result<SysAnnouncementSend>();
	String anntId = json.getString("anntId");
	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 ='"+anntId+"' and user_id ='"+userId+"'");
	SysAnnouncementSend announcementSend = new SysAnnouncementSend();
	sysAnnouncementSendService.update(announcementSend, updateWrapper);
	result.setSuccess(true);
	return result;
}
 
Example #16
Source File: SysUserController.java    From jeecg-boot-with-activiti with MIT License 6 votes vote down vote up
/**
  * 冻结&解冻用户
 * @param jsonObject
 * @return
 */
@RequestMapping(value = "/frozenBatch", method = RequestMethod.PUT)
public Result<SysUser> frozenBatch(@RequestBody JSONObject jsonObject) {
	Result<SysUser> result = new Result<SysUser>();
	try {
		String ids = jsonObject.getString("ids");
		String status = jsonObject.getString("status");
		String[] arr = ids.split(",");
		for (String id : arr) {
			if(oConvertUtils.isNotEmpty(id)) {
				this.sysUserService.update(new SysUser().setStatus(Integer.parseInt(status)),
						new UpdateWrapper<SysUser>().lambda().eq(SysUser::getId,id));
			}
		}
	} catch (Exception e) {
		log.error(e.getMessage(), e);
		result.error500("操作失败"+e.getMessage());
	}
	result.success("操作成功!");
	return result;

   }
 
Example #17
Source File: SysAnnouncementSendController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:一键已读
 * @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;
}
 
Example #18
Source File: SysAnnouncementSendController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * @功能:更新用户系统消息阅读状态
 * @param json
 * @return
 */
@PutMapping(value = "/editByAnntIdAndUserId")
public Result<SysAnnouncementSend> editById(@RequestBody JSONObject json) {
	Result<SysAnnouncementSend> result = new Result<SysAnnouncementSend>();
	String anntId = json.getString("anntId");
	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 ='"+anntId+"' and user_id ='"+userId+"'");
	SysAnnouncementSend announcementSend = new SysAnnouncementSend();
	sysAnnouncementSendService.update(announcementSend, updateWrapper);
	result.setSuccess(true);
	return result;
}
 
Example #19
Source File: SysUserController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
  * 冻结&解冻用户
 * @param jsonObject
 * @return
 */
//@RequiresRoles({"admin"})
@RequestMapping(value = "/frozenBatch", method = RequestMethod.PUT)
public Result<SysUser> frozenBatch(@RequestBody JSONObject jsonObject) {
	Result<SysUser> result = new Result<SysUser>();
	try {
		String ids = jsonObject.getString("ids");
		String status = jsonObject.getString("status");
		String[] arr = ids.split(",");
		for (String id : arr) {
			if(oConvertUtils.isNotEmpty(id)) {
				this.sysUserService.update(new SysUser().setStatus(Integer.parseInt(status)),
						new UpdateWrapper<SysUser>().lambda().eq(SysUser::getId,id));
			}
		}
	} catch (Exception e) {
		log.error(e.getMessage(), e);
		result.error500("操作失败"+e.getMessage());
	}
	result.success("操作成功!");
	return result;

   }
 
Example #20
Source File: CategoryController.java    From My-Blog-layui with Apache License 2.0 6 votes vote down vote up
/**
 * 修改分类信息
 *
 * @param blogCategory
 * @return com.site.blog.dto.Result
 * @date 2019/8/30 14:55
 */
@ResponseBody
@PostMapping("/v1/category/update")
public Result<String> updateCategory(BlogCategory blogCategory) {
    BlogCategory sqlCategory = blogCategoryService.getById(blogCategory.getCategoryId());
    boolean flag = sqlCategory.getCategoryName().equals(blogCategory.getCategoryName());
    if (flag) {
        blogCategoryService.updateById(blogCategory);
    } else {
        BlogInfo blogInfo = new BlogInfo()
                .setBlogCategoryId(blogCategory.getCategoryId())
                .setBlogCategoryName(blogCategory.getCategoryName());
        UpdateWrapper<BlogInfo> updateWrapper = new UpdateWrapper<>();
        updateWrapper.lambda().eq(BlogInfo::getBlogCategoryId, blogCategory.getCategoryId());
        blogInfoService.update(blogInfo, updateWrapper);
        blogCategoryService.updateById(blogCategory);
    }
    return ResultGenerator.getResultByHttp(HttpStatusEnum.OK);
}
 
Example #21
Source File: AppUserController.java    From charging_pile_cloud with MIT License 5 votes vote down vote up
/**
 * 用户获取openId (小程序登陆授权)
 */
@RequestMapping(value = "wxOpenId", method = {RequestMethod.POST,RequestMethod.GET})
@ApiOperation(notes = "用户登录 :account账号; code:微信code", value = "用户登录")
@ResponseBody
public Map<String, Object> wxOpenId(StockUserSignInVO vo, HttpServletRequest req,
                                     HttpServletResponse res) throws WxErrorException, UnsupportedEncodingException {
    if(com.util.StringUtils.isBlank(vo.getCode())){
        return  ResponseUtil.getNotNormalMap(ResponseMsg.ERROR_PARAM);
    }
    WxMaJscode2SessionResult sessionResult = WxMaConfiguration.getWxMaService().jsCode2SessionInfo(vo.getCode());
    StockUserLoginVO  loginVO =  stockUserService.wxLogin(sessionResult);
    stockUserService.update(new UpdateWrapper<StockUser>()
    .set("last_login_time", DealDateUtil.getNowDate()));
    userCacheUtil.storeAppStockUserWxLoginInfo(sessionResult.getOpenid(),JSONObject.toJSONString(sessionResult));
    /**
     * 生成token 存储
     */
    String token = AuthSign.tokenSign(loginVO.getId(), JSONObject.parseObject(JSONObject.toJSONString(loginVO)));

    /**
     * 设置sessionId
     */
    userCacheUtil.storeAppStockUserLoginInfo(loginVO.getId(),token);
    loginVO.setSessionId(token);
    loginVO.setSessionResult(sessionResult);
    return ResponseUtil.getSuccessMap(loginVO);
}
 
Example #22
Source File: SysMenuServiceImpl.java    From Taroco with Apache License 2.0 5 votes vote down vote up
@Override
public Boolean deleteMenu(Integer id) {
    // 删除当前节点
    SysMenu condition1 = new SysMenu();
    condition1.setId(id);
    condition1.setDelFlag(CommonConstant.STATUS_DEL);
    this.updateById(condition1);

    // 删除父节点为当前节点的节点
    SysMenu conditon2 = new SysMenu();
    conditon2.setParentId(id);
    SysMenu sysMenu = new SysMenu();
    sysMenu.setDelFlag(CommonConstant.STATUS_DEL);
    return this.update(sysMenu, new UpdateWrapper<>(conditon2));
}
 
Example #23
Source File: SysBaseApiImpl.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
@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);
	}
}
 
Example #24
Source File: SysBaseApiImpl.java    From teaching with Apache License 2.0 5 votes vote down vote up
@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);
	}
}
 
Example #25
Source File: StockUserChargeServiceImpl.java    From charging_pile_cloud with MIT License 5 votes vote down vote up
/**
 * 付款成功
 *
 * @param stockUserCharge
 */
@Override
@Transactional(rollbackFor = {})
public void withdrawStatusSuccess(StockUserCharge stockUserCharge) {
    stockUserCharge.setWithdrawStatus(WithdrawStatusEnum.STATUS_2.getCode().intValue());
    int b= baseMapper.update(stockUserCharge,new UpdateWrapper<StockUserCharge>()
    .eq("id",stockUserCharge.getId())
    .eq("withdraw_status",WithdrawStatusEnum.STATUS_4.getCode().intValue()));
   if(b>0){
       //更新用户资产
       StockUserCapitalFund stockUserCapitalFund = stockUserCapitalFundService.getOne(new QueryWrapper<StockUserCapitalFund>()
               .eq("stock_user_id",stockUserCharge.getStockUserId()));

        //更新账户资产
       int j =  stockUserCapitalFundService.updateRechargeByCodeId(stockUserCapitalFund.getId(),stockUserCharge.getFee());
       //资产流水
       if(j>0) {
           stockUserMoneyDetailService.addUserMoneyDetail(
                   stockUserCapitalFund.getStockUserId(),
                   stockUserCharge.getFee(),
                   stockUserCapitalFund.getUsableFund(),
                   WaterTypeEnum.STATUS_2.getCode(),
                   FinancialTypeEnum.TYPE_2, "用户微信充值",
                   stockUserCharge.getId(),
                   stockUserCapitalFund.getStockCode());
       }
   }
}
 
Example #26
Source File: Uart1CommunicationController.java    From charging_pile_cloud with MIT License 5 votes vote down vote up
/**
 *  Uart1 通信结束充电
 *
 * @param pileNum
 * @param isIcCard
 */
void endCharge(String pileNum, String isIcCard){
    ChargingPileInfo pileInfo = chargingPileInfoService.getOne(new QueryWrapper<ChargingPileInfo>()
            .eq("serial_number",pileNum)
            .eq("is_deleted",0));
    if(pileInfo !=null){
        //查询充电记录
        ChargingRecord record = chargingRecordService.getOne(new QueryWrapper<ChargingRecord>()
                .eq("charging_pile_info_id",pileInfo.getId())
                .ne("charge_status",2));
        //记录存在,并且是充电未结束
        if(record!=null){
            String walletType = WalletTypeEnum.STATUS_1.getCode();
            if(Integer.valueOf(isIcCard)==0){
                walletType = WalletTypeEnum.STATUS_2.getCode();
            }
            StockUserCapitalFund fund = stockUserCapitalFundService.getOne(new QueryWrapper<StockUserCapitalFund>()
            .eq("stock_user_id",record.getStockUserId())
            .eq("stock_code",walletType));
            if(fund !=null){
                chargingRecordService.endCharge(record, fund.getStockCode());
            }
        }else {
            chargingPileInfoService.update(new UpdateWrapper<ChargingPileInfo>()
                    .set("use_status",0)
                    .eq("serial_number",pileNum));
        }
    }
}
 
Example #27
Source File: AuthRestApi.java    From mogu_blog_v2 with Apache License 2.0 5 votes vote down vote up
@OperationLogger(value = "更新管理员密码")
@ApiOperation(value = "更新管理员密码", notes = "更新管理员密码")
@PostMapping("/updatePassWord")
public String updatePassWord(HttpServletRequest request,
                             @ApiParam(name = "userInfo", value = "管理员账户名", required = true) @RequestParam(name = "userInfo", required = true) String userInfo,
                             @ApiParam(name = "passWord", value = "管理员旧密码", required = true) @RequestParam(name = "passWord", required = true) String passWord,
                             @ApiParam(name = "newPassWord", value = "管理员新密码", required = true) @RequestParam(name = "newPassWord", required = true) String newPassWord) {
    QueryWrapper<Admin> queryWrapper = new QueryWrapper<>();
    if (CheckUtils.checkEmail(userInfo)) {
        queryWrapper.eq(SQLConf.EMAIL, userInfo);
    } else if (CheckUtils.checkMobileNumber(userInfo)) {
        queryWrapper.eq(SQLConf.MOBILE, userInfo);
    } else {
        queryWrapper.eq(SQLConf.USER_NAME, userInfo);
    }
    Admin admin = adminService.getOne(queryWrapper);
    if (admin == null) {
        return ResultUtil.result(SysConf.ERROR, "管理员不存在");
    }
    if (StringUtils.isEmpty(passWord)) {
        return ResultUtil.result(SysConf.ERROR, "旧密码不能为空");
    }
    if (StringUtils.isEmpty(newPassWord)) {
        return ResultUtil.result(SysConf.ERROR, "新密码不能为空");
    }
    String uid = admin.getUid();

    PasswordEncoder encoder = new BCryptPasswordEncoder();
    boolean isPassword = encoder.matches(passWord, admin.getPassWord());
    if (isPassword) {
        admin.setPassWord(encoder.encode(newPassWord));
        UpdateWrapper<Admin> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq(SQLConf.UID, uid);
        admin.setUpdateTime(new Date());
        adminService.update(admin, updateWrapper);
        return ResultUtil.result(SysConf.SUCCESS, "密码更新成功");
    }
    return ResultUtil.result(SysConf.ERROR, "旧密码错误");
}
 
Example #28
Source File: AdminAgentUserController.java    From charging_pile_cloud with MIT License 5 votes vote down vote up
/**
 * 代理商禁用启用
 */
@RequestMapping(value = "/disableAgentUser", method = RequestMethod.POST)
@ResponseBody
@LogMenthodName(name = "代理商禁用启用")
public Map<String, Object> disableAgentUser(AgentUser vo, HttpServletRequest req, PageUtil pageUtil) throws UnsupportedEncodingException {
    if(vo.getId() ==null || vo.getIsDisable() == null){
        return ResponseUtil.getNotNormalMap(ResponseMsg.ID_IS_EMPTY);
    }
    agentUserService.update(new UpdateWrapper<AgentUser>()
            .set("is_disable",vo.getIsDisable())
            .eq("id",vo.getId()));
    //存储更新后的信息
    redisUtils.setStorageAgentUser(vo.getId(), JSONObject.toJSON(agentUserService.getById(vo.getId())).toString());
    return ResponseUtil.getSuccessMap();
}
 
Example #29
Source File: AdminAgentUserController.java    From charging_pile_cloud with MIT License 5 votes vote down vote up
/**
 * 代理商删除
 */
@RequestMapping(value = "/delAgentUser", method = RequestMethod.POST)
@ResponseBody
@LogMenthodName(name = "代理商删除")
public Map<String, Object> delAgentUser(AgentUser vo, HttpServletRequest req, PageUtil pageUtil) throws UnsupportedEncodingException {
    if(vo.getId() ==null){
        return ResponseUtil.getNotNormalMap(ResponseMsg.ID_IS_EMPTY);
    }
    agentUserService.update(new UpdateWrapper<AgentUser>()
    .set("is_deleted",1)
    .eq("id",vo.getId()));
    return ResponseUtil.getSuccessMap();
}
 
Example #30
Source File: SysBaseApiImpl.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
@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);
	}
}