com.baomidou.mybatisplus.mapper.Wrapper.eq()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(507)

本文整理了Java中com.baomidou.mybatisplus.mapper.Wrapper.eq()方法的一些代码示例,展示了Wrapper.eq()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Wrapper.eq()方法的具体详情如下:
包路径:com.baomidou.mybatisplus.mapper.Wrapper
类名称:Wrapper
方法名:eq

Wrapper.eq介绍

暂无

代码示例

代码示例来源:origin: stylefeng/Guns

/**
 * 删除字典
 *
 * @author fengshuonan
 * @Date 2018/12/23 5:25 PM
 */
@Transactional
public void delteDict(Long dictId) {
  //删除这个字典的子词典
  Wrapper<Dict> dictEntityWrapper = new EntityWrapper<>();
  dictEntityWrapper = dictEntityWrapper.eq("PID", dictId);
  dictMapper.delete(dictEntityWrapper);
  //删除这个词典
  dictMapper.deleteById(dictId);
}

代码示例来源:origin: stylefeng/Guns

@Override
public String getDictsByName(String name, String code) {
  Dict temp = new Dict();
  temp.setName(name);
  Dict dict = dictMapper.selectOne(temp);
  if (dict == null) {
    return "";
  } else {
    Wrapper<Dict> wrapper = new EntityWrapper<>();
    wrapper = wrapper.eq("PID", dict.getDictId());
    List<Dict> dicts = dictMapper.selectList(wrapper);
    for (Dict item : dicts) {
      if (item.getCode() != null && item.getCode().equals(code)) {
        return item.getName();
      }
    }
    return "";
  }
}

代码示例来源:origin: leecho/cola-cloud

@Override
public boolean exists(Long resourceId, Long roleId) {
  Wrapper<SysAuthority> wrapper = new EntityWrapper<SysAuthority>();
  wrapper.eq("sys_resource_id", resourceId);
  wrapper.eq("sys_role_id", roleId);
  return CollectionUtils.isEmpty(this.selectList(wrapper));
}

代码示例来源:origin: huangjian888/jeeweb-mybatis-springboot

/**
 * <p>
 * 等同于SQL的"field=value"表达式
 * </p>
 *
 * @param column
 * @param params
 * @return
 */
public Wrapper<T> eq(String column, Object params) {
  return super.eq(handleColumn(column), params);
}

代码示例来源:origin: com.wuyushuo/wuyu-module-stream

@Async
public Future<Boolean> hasFavorited(long appId, long personId, long targetId, int favoriteType) throws Exception {
  if(appId <=0 || personId<=0 || targetId<=0){
    throw new IllegalArgumentException("参数错误");
  }
  EntityWrapper<Favorite> wp = new EntityWrapper<>();
  wp.eq("app_id", appId).eq("user_id", personId).eq("target_id", targetId).eq("type", favoriteType).eq("enabled", EnableEnum.ENABLED.getValue());
  boolean isOk = favoriteService.selectCount(wp) > 0;
  return new AsyncResult<>(isOk);
}

代码示例来源:origin: com.wuyushuo/wuyu-module-stream

@Async
public Future<Boolean> hasSupported(long appId, long personId, long targetId, int supportType) throws Exception {
  if(appId <=0 || personId<=0 || targetId<=0){
    throw new IllegalArgumentException("参数错误");
  }
  EntityWrapper<Support> wrapper = new EntityWrapper<Support>();
  wrapper.eq("app_id", appId).eq("user_id", personId).eq("target_id", targetId).eq("type", supportType)
      .eq("enabled", EnableEnum.ENABLED.getValue());
  boolean isOk = supportService.selectCount(wrapper) > 0;
  return new AsyncResult<>(isOk);
}

代码示例来源:origin: com.wuyushuo/wuyu-module-stream

@Async
public Future<Boolean> hasVisited(long appId, long personId, long targetId, int visitorType) throws Exception {
  if(appId <=0 || personId<=0 || targetId<=0){
    throw new IllegalArgumentException("参数错误");
  }
  EntityWrapper<Visitor> wrapper = new EntityWrapper<Visitor>();
  wrapper.eq("app_id", appId).eq("user_id", personId).eq("target_id", targetId).eq("type", visitorType)
      .eq("enabled", EnableEnum.ENABLED.getValue());
  boolean isOk = visitorService.selectCount(wrapper) > 0;
  return new AsyncResult<>(isOk);
}

代码示例来源:origin: com.wuyushuo/wuyu-module-stream

@Async
public Future<Long> selectVisitedTotal(long appId, long targetId, int visitorType) throws Exception {
  if(appId <=0 || targetId<=0){
    throw new IllegalArgumentException("参数错误");
  }
  EntityWrapper<Visitor> wrapper = new EntityWrapper<Visitor>();
  wrapper.eq("app_id", appId).eq("target_id", targetId).eq("type", visitorType).eq("enabled", EnableEnum.ENABLED.getValue());
  long total = visitorService.selectCount(wrapper);
  return new AsyncResult<>(total);
}

代码示例来源:origin: com.wuyushuo/wuyu-module-stream

@Async
public Future<Long> selectSupportTotal(long appId, long targetId, int supportType) throws Exception {
  if(appId <=0 || targetId<=0){
    throw new IllegalArgumentException("参数错误");
  }
  EntityWrapper<Support> wrapper = new EntityWrapper<Support>();
  wrapper.eq("app_id", appId).eq("target_id", targetId).eq("type", supportType).eq("enabled", EnableEnum.ENABLED.getValue());
  long total = supportService.selectCount(wrapper);
  return new AsyncResult<>(total);
}

代码示例来源:origin: com.wuyushuo/wuyu-module-stream

@Async
public Future<Pagination<Comment>> selectComments(long appId, long sourceId, int type, int page, int size) throws Exception {
  if(appId <=0 || sourceId<=0 || page <=0 || size <=0){
    throw new IllegalArgumentException("参数错误");
  }
  EntityWrapper<Comment> wp = new EntityWrapper<>();
  wp.eq("app_id", appId).eq("source_id", sourceId).eq("type", type).eq("enabled", EnableEnum.ENABLED.getValue());
  Pagination<Comment> pagination = commentService.selectPagination(new Page<>(page, size), wp);
  return new AsyncResult<>(pagination);
}

代码示例来源:origin: com.wuyushuo/wuyu-module-stream

@Async
public Future<Datum> selectDatum(long appId, long datumId){
  if(appId <=0 || datumId<=0 ){
    throw new IllegalArgumentException("参数错误");
  }
  EntityWrapper<Datum> wrapper = new EntityWrapper<Datum>();
  wrapper.eq("app_id", appId).eq("id", datumId).eq("enabled", EnableEnum.ENABLED.getValue());
  Datum datum = datumService.selectOne(wrapper);
  return new AsyncResult<>(datum);
}

代码示例来源:origin: com.wuyushuo/wuyu-module-stream

@Async
public Future<Pagination<Friender>> getFrienders(long appId, long personId, int pageNum, int size) throws Exception {
  if(appId <=0 || personId <=0 || pageNum<=0 || size<0){
    throw new IllegalArgumentException("参数错误");
  }
  EntityWrapper<Friender> wp = new EntityWrapper<Friender>();
  wp.eq("app_id", appId).eq("user_id", personId).eq("enabled", EnableEnum.ENABLED.getValue());
  Pagination<Friender> pagination = frienderService.selectPagination(new Page<Friender>(pageNum, size), wp);
  return new AsyncResult<>(pagination);
}

代码示例来源:origin: leecho/cola-cloud

@Override
  public void delete(Long userId, Long roleId) {
    this.validateRole(roleId);
    Wrapper<SysAuthorize> wrapper = new EntityWrapper<SysAuthorize>();
    wrapper.eq("authorize_target", userId);
    wrapper.eq("sys_role_id", roleId);
    SysAuthorize authority = this.selectOne(wrapper);
    if (authority != null) {
      this.deleteById(authority.getId());
    }
  }
}

代码示例来源:origin: com.wuyushuo/wuyu-module-stream

@Async
public Future<Pagination<Follower>> getFollowers(long appId, long personId, int pageNum, int size) throws Exception {
  if(appId <=0 || personId <=0){
    throw new ApiException("参数错误");
  }
  EntityWrapper<Follower> wp = new EntityWrapper<Follower>();
  wp.eq("app_id", appId).eq("user_id", personId).eq("enabled", EnableEnum.ENABLED.getValue());
  Pagination<Follower> pagination = followerService.selectPagination(new Page<Follower>(pageNum, size), wp);
  return new AsyncResult<>(pagination);
}

代码示例来源:origin: leecho/cola-cloud

@Override
public List<Attachment> listByBizIdAndBizCode(String bizId, String bizCode) {
  EntityWrapper<Attachment> wrapper = new EntityWrapper<>();
  wrapper.eq("biz_id",bizId).eq("biz_code",bizCode);
  return this.selectList(wrapper);
}

代码示例来源:origin: leecho/cola-cloud

@Override
@Transactional(rollbackFor = Exception.class)
public String saveAndClear(InputStream input, String fileName, String contentType, String bizId, String bizCode, Long size){
  //清除原来的附件
  EntityWrapper<Attachment> wrapper = this.newEntityWrapper();
  wrapper.eq("biz_id",bizId).eq("biz_code",bizCode);
  this.delete(wrapper);
  return this.save(input, fileName, contentType, bizId, bizCode, size);
}

代码示例来源:origin: leecho/cola-cloud

@Override
  public Attachment getByBizIdAndBizCode(String bizId, String bizCode) {
    EntityWrapper<Attachment> wrapper = new EntityWrapper<>();
    wrapper.eq("biz_id",bizId).eq("biz_code",bizCode);
    return this.selectOne(wrapper);
  }
}

代码示例来源:origin: qiurunze123/GEEKQ-CM

@Override
public void delteDict(Integer dictId) {
  //删除这个字典的子词典
  Wrapper<Dict> dictEntityWrapper = new EntityWrapper<>();
  dictEntityWrapper = dictEntityWrapper.eq("pid", dictId);
  dictMapper.delete(dictEntityWrapper);
  //删除这个词典
  dictMapper.deleteById(dictId);
}

代码示例来源:origin: com.wuyushuo/wuyu-module-stream

@Async
public Future<Long> getFrienderTotal(long appId, long personId) throws Exception {
  if(appId <=0 || personId <=0){
    throw new IllegalArgumentException("参数错误");
  }
  long total = frienderService.selectCount(new EntityWrapper<Friender>().eq("user_id", personId).eq("enabled", EnableEnum.ENABLED.getValue()));
  return new AsyncResult<>(total);
}

代码示例来源:origin: com.wuyushuo/wuyu-module-bureau

@Async
  public Future<Applet> selectByAppKey(String appKey) {
    EntityWrapper<Applet> wp = new EntityWrapper<>();
    wp.eq("app_key", appKey).eq("enabled", EnableEnum.ENABLED.getValue());
    Applet applet = appletService.selectOne(wp);
    return new AsyncResult<>(applet);
  }
}

相关文章