Java Code Examples for com.baomidou.mybatisplus.mapper.EntityWrapper#ne()

The following examples show how to use com.baomidou.mybatisplus.mapper.EntityWrapper#ne() . 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: StaffController.java    From express-ssm with Apache License 2.0 6 votes vote down vote up
/**
 * 获取所有职员
 * @author jitwxs
 * @since 2018/5/2 16:50
 */
@GetMapping("/list")
public Map listStaff(Integer rows, Integer page, SysUserSelectWrapper usw) {
    // Get请求中文编码
    try {
        usw.setName(globalFunction.iso8859ToUtf8(usw.getName()));
        usw.setAddress(globalFunction.iso8859ToUtf8(usw.getAddress()));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    // 得到筛选条件
    EntityWrapper<SysUser> userWrapper = globalFunction.getSysUserWrapper(usw);
    // 不显示admin角色
    userWrapper.ne("role_id", RoleEnum.ADMIN.getIndex());
    Page<SysUser> selectPage = userService.selectPage(new Page<>(page, rows), userWrapper);

    List<SysUserDto> list = globalFunction.sysUser2dto(selectPage.getRecords());

    Map<String,Object> map = new HashMap<>();
    map.put("total", selectPage.getTotal());
    map.put("rows", list);

    return map;
}
 
Example 2
Source File: DictServiceImpl.java    From cola-cloud with MIT License 5 votes vote down vote up
private boolean check(Dict dict) {
    EntityWrapper<Dict> wrapper = new EntityWrapper<Dict>();
    wrapper.eq("code", dict.getCode());
    if (dict.getId() != null) {
        wrapper.ne("id", dict.getId());
    }
    return this.selectList(wrapper).size() == 0;
}
 
Example 3
Source File: SysPostServiceImpl.java    From cola-cloud with MIT License 5 votes vote down vote up
/**
 * 检查配置项是否有重复
 *
 * @param sysPost
 * @return
 */
private boolean check(SysPost sysPost) {
    EntityWrapper<SysPost> wrapper = new EntityWrapper<SysPost>();
    wrapper.eq("code", sysPost.getCode());
    if (sysPost.getId() != null) {
        wrapper.ne("id", sysPost.getId());
    }
    return this.selectList(wrapper).size() == 0;
}
 
Example 4
Source File: SysResourceServiceImpl.java    From cola-cloud with MIT License 5 votes vote down vote up
/**
 * 检查配置项是否有重复
 *
 * @param sysResource
 * @return
 */
private boolean check(SysResource sysResource) {
    EntityWrapper<SysResource> wrapper = new EntityWrapper<SysResource>();
    wrapper.eq("code", sysResource.getCode());
    if (sysResource.getId() != null) {
        wrapper.ne("id", sysResource.getId());
    }
    return this.selectList(wrapper).size() == 0;
}
 
Example 5
Source File: SysRoleServiceImpl.java    From cola-cloud with MIT License 5 votes vote down vote up
/**
 * 检查配置项是否有重复
 * @param sysRole
 * @return
 */
private boolean check(SysRole sysRole){
    EntityWrapper<SysRole> wrapper = new EntityWrapper<SysRole>();
    wrapper.eq("code",sysRole.getCode());
    if(sysRole.getId() != null){
        wrapper.ne("id",sysRole.getId());
    }
    return this.selectList(wrapper).size() == 0;
}
 
Example 6
Source File: SysTenantServiceImpl.java    From cola-cloud with MIT License 5 votes vote down vote up
private void assertDuplication(SysTenant sysTenant){
    EntityWrapper<SysTenant> wrapper = this.newEntityWrapper();
    wrapper.eq("code",sysTenant.getCode());
    if(sysTenant.getId() != null){
        wrapper.ne("id",sysTenant.getId());
    }
    Assert.isTrue(CollectionUtils.isEmpty(this.selectList(wrapper)),"租户编号已存在");
}
 
Example 7
Source File: EqParser.java    From cola-cloud with MIT License 5 votes vote down vote up
@Override
public void doParse(CriteriaContext<Eq> criteriaContext, EntityWrapper entityWrapper, String column) {
    if (criteriaContext.getType().reverse()) {
        entityWrapper.ne(column, criteriaContext.getValue());
    } else {
        entityWrapper.eq(column, criteriaContext.getValue());
    }
}