Java Code Examples for com.baomidou.mybatisplus.core.conditions.query.QueryWrapper#lambda()

The following examples show how to use com.baomidou.mybatisplus.core.conditions.query.QueryWrapper#lambda() . 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: CodeService.java    From pybbs with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public Code selectNotUsedCode(Integer userId, String email, String mobile) {
    QueryWrapper<Code> wrapper = new QueryWrapper<>();
    LambdaQueryWrapper<Code> lambda = wrapper.lambda();
    if (email != null) {
        lambda.eq(Code::getEmail, email);
        lambda.eq(Code::getUserId, userId);
    } else if (mobile != null) {
        lambda.eq(Code::getMobile, mobile);
    }
    lambda.eq(Code::getUsed, false);
    lambda.gt(Code::getExpireTime, new Date());
    List<Code> codes = codeMapper.selectList(wrapper);
    if (codes.isEmpty()) return null;
    return codes.get(0);
}
 
Example 2
Source File: SysUserServiceImpl.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
@Override
public IPage<SysUser> getUserByDepartIdAndQueryWrapper(Page<SysUser> page, String departId, QueryWrapper<SysUser> queryWrapper) {
	LambdaQueryWrapper<SysUser> lambdaQueryWrapper = queryWrapper.lambda();

	lambdaQueryWrapper.eq(SysUser::getDelFlag, "0");
       lambdaQueryWrapper.inSql(SysUser::getId, "SELECT user_id FROM sys_user_depart WHERE dep_id = '" + departId + "'");

       return userMapper.selectPage(page, lambdaQueryWrapper);
}
 
Example 3
Source File: SysUserServiceImpl.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
@Override
public IPage<SysUser> getUserByDepartIdAndQueryWrapper(Page<SysUser> page, String departId, QueryWrapper<SysUser> queryWrapper) {
	LambdaQueryWrapper<SysUser> lambdaQueryWrapper = queryWrapper.lambda();

	lambdaQueryWrapper.eq(SysUser::getDelFlag, "0");
       lambdaQueryWrapper.inSql(SysUser::getId, "SELECT user_id FROM sys_user_depart WHERE dep_id = '" + departId + "'");

       return userMapper.selectPage(page, lambdaQueryWrapper);
}
 
Example 4
Source File: SysUserServiceImpl.java    From teaching with Apache License 2.0 5 votes vote down vote up
@Override
public IPage<SysUser> getUserByDepartIdAndQueryWrapper(Page<SysUser> page, String departId, QueryWrapper<SysUser> queryWrapper) {
	LambdaQueryWrapper<SysUser> lambdaQueryWrapper = queryWrapper.lambda();

	lambdaQueryWrapper.eq(SysUser::getDelFlag, "0");
       lambdaQueryWrapper.inSql(SysUser::getId, "SELECT user_id FROM sys_user_depart WHERE dep_id = '" + departId + "'");

       return userMapper.selectPage(page, lambdaQueryWrapper);
}
 
Example 5
Source File: SysUserServiceImpl.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
@Override
public IPage<SysUser> getUserByDepartIdAndQueryWrapper(Page<SysUser> page, String departId, QueryWrapper<SysUser> queryWrapper) {
	LambdaQueryWrapper<SysUser> lambdaQueryWrapper = queryWrapper.lambda();

	lambdaQueryWrapper.eq(SysUser::getDelFlag, "0");
       lambdaQueryWrapper.inSql(SysUser::getId, "SELECT user_id FROM sys_user_depart WHERE dep_id = '" + departId + "'");

       return userMapper.selectPage(page, lambdaQueryWrapper);
}
 
Example 6
Source File: CodeService.java    From pybbs with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public Code validateCode(Integer userId, String email, String mobile, String _code) {
    QueryWrapper<Code> wrapper = new QueryWrapper<>();
    LambdaQueryWrapper<Code> lambda = wrapper.lambda();
    if (email != null) {
        lambda.eq(Code::getEmail, email);
        lambda.eq(Code::getUserId, userId);
    } else if (mobile != null) {
        lambda.eq(Code::getMobile, mobile);
    }
    lambda.eq(Code::getCode, _code);
    lambda.eq(Code::getUsed, false);
    lambda.gt(Code::getExpireTime, new Date());
    return codeMapper.selectOne(wrapper);
}