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

The following examples show how to use com.baomidou.mybatisplus.mapper.EntityWrapper#in() . 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: AttachServiceImpl.java    From Ffast-Java with MIT License 5 votes vote down vote up
@Override
protected ServiceResult deleteAfter(String ids) {
    EntityWrapper<Attach> ew = new EntityWrapper<>();
    ew.in("id", ids);
    List<Attach> attachList = selectList(ew);
    for (Attach attach : attachList) {
        FileUtil.deleteFile(BASE_PATH + attach.getPath());
    }
    return null;
}
 
Example 2
Source File: RoleServiceImpl.java    From Ffast-Java with MIT License 5 votes vote down vote up
@Override
protected ServiceResult deleteBefore(String ids, EntityWrapper<Role> ew) {
    EntityWrapper selectEw = new EntityWrapper<Role>();
    selectEw.in("id", ids);
    List<Role> roles = baseMapper.selectList(selectEw);
    for (Role role : roles) {
        if (new Integer(1).equals(role.getIsSys())) {
            return new ServiceResult(false).setMessage("无法删除系统角色:" + role.getName());
        }
    }
    return null;
}
 
Example 3
Source File: RoleServiceImpl.java    From Ffast-Java with MIT License 5 votes vote down vote up
@Override
protected ServiceResult deleteAfter(String ids) {
    // 删除账号角色
    EntityWrapper deleteEw = new EntityWrapper<UserRole>();
    deleteEw.in("role_id", ids);
    userRoleMapper.delete(deleteEw);
    return null;
}
 
Example 4
Source File: ScheduleJobServiceImpl.java    From Ffast-Java with MIT License 5 votes vote down vote up
private void updateStatus(Long[] jobIds, int value) {
    EntityWrapper ew = new EntityWrapper<ScheduleJob>();
    ScheduleJob scheduleJob = new ScheduleJob();
    scheduleJob.setStatus(value);
    ew.in("id", jobIds);
    baseMapper.update(scheduleJob, ew);
}
 
Example 5
Source File: ResServiceImpl.java    From Ffast-Java with MIT License 5 votes vote down vote up
@Override
protected ServiceResult deleteBefore(String ids, EntityWrapper<Res> ew) {
    EntityWrapper selectEw = new EntityWrapper<RoleRes>();
    selectEw.in("res_id", ids);
    roleResMapper.delete(selectEw);
    return null;
}
 
Example 6
Source File: CrudServiceImpl.java    From Ffast-Java with MIT License 5 votes vote down vote up
@Log("删除记录")
@Override
public ServiceResult mulDelete(String ids) {
    ServiceResult result = new ServiceResult(false);
    String[] idArray = FStringUtil.split(ids);
    if (ArrayUtils.isEmpty(idArray)) {
        result.setMessage("请选择要删除的数据行");
    } else {
        EntityWrapper ew = new EntityWrapper<T>();
        ServiceResult beforeResult = deleteBefore(ids, ew);
        if (beforeResult != null) {
            return beforeResult;
        }

        try {
            ew.in("id", ids);
            if (delete(ew)) {
                ServiceResult afterResult = deleteAfter(ids);
                if (afterResult != null) {
                    return afterResult;
                }
                result.setSuccess(true);
            } else {
                result.setMessage("删除失败");
            }
        } catch (Exception e) {
            result.setMessage("删除数据异常!");
            logger.error(e.getMessage());
            e.printStackTrace();
        }
    }
    return result;
}
 
Example 7
Source File: InParser.java    From cola-cloud with MIT License 5 votes vote down vote up
private void doParse(CriteriaContext<In> criteriaContext, EntityWrapper entityWrapper, String[] columns, Object[] values) {
    boolean reverse = criteriaContext.getType().reverse();
    for (String column : columns) {
        if (reverse) {
            entityWrapper.notIn(column, values);
        } else {
            entityWrapper.in(column, values);
        }
    }
}
 
Example 8
Source File: InParser.java    From cola-cloud with MIT License 5 votes vote down vote up
private void doParse(CriteriaContext<In> criteriaContext, EntityWrapper entityWrapper, String[] columns, Collection<?> values) {
    boolean reverse = criteriaContext.getType().reverse();
    for (String column : columns) {
        if (reverse) {
            entityWrapper.notIn(column, values);
        } else {
            entityWrapper.in(column, values);
        }
    }
}