feat system基础数据操作接口
parent
6dc33d9fbc
commit
cb6f165a02
|
@ -25,80 +25,53 @@ public interface ICommonData<T extends Id<ID>, ID> {
|
|||
/**
|
||||
* 通过ID取数据
|
||||
*/
|
||||
default T findById(ID id) {
|
||||
return null;
|
||||
|
||||
}
|
||||
T findById(ID id);
|
||||
|
||||
/**
|
||||
* 通过ID取数据
|
||||
*/
|
||||
default List<T> findByIds(Collection<ID> id) {
|
||||
return Collections.EMPTY_LIST;
|
||||
|
||||
}
|
||||
List<T> findByIds(Collection<ID> id);
|
||||
|
||||
|
||||
/**
|
||||
* 保存数据,id不为空更新,否则添加
|
||||
*/
|
||||
default T save(T data) {
|
||||
return data;
|
||||
|
||||
}
|
||||
T save(T data) ;
|
||||
|
||||
|
||||
/**
|
||||
* 批量保存数据
|
||||
*/
|
||||
default void batchSave(List<T> data) {
|
||||
}
|
||||
|
||||
void batchSave(List<T> data) ;
|
||||
/**
|
||||
* 按id删除
|
||||
*/
|
||||
default void deleteById(ID id) {
|
||||
}
|
||||
|
||||
void deleteById(ID id) ;
|
||||
/**
|
||||
* 按id批量删除
|
||||
*/
|
||||
default void deleteByIds(Collection<ID> ids) {
|
||||
}
|
||||
|
||||
void deleteByIds(Collection<ID> ids) ;
|
||||
/**
|
||||
* 总数统计
|
||||
*/
|
||||
default long count() {
|
||||
return 0L;
|
||||
}
|
||||
|
||||
long count();
|
||||
/**
|
||||
* 取所有数据
|
||||
*/
|
||||
default List<T> findAll() {
|
||||
return null;
|
||||
}
|
||||
List<T> findAll() ;
|
||||
|
||||
/**
|
||||
* 分页获取所有信息
|
||||
*/
|
||||
default Paging<T> findAll(PageRequest<T> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
Paging<T> findAll(PageRequest<T> pageRequest) ;
|
||||
|
||||
/**
|
||||
* 按条件查询多个结果
|
||||
*/
|
||||
default List<T> findAllByCondition(T data) {
|
||||
return Collections.EMPTY_LIST;
|
||||
|
||||
}
|
||||
List<T> findAllByCondition(T data);
|
||||
|
||||
/**
|
||||
* 按条件查询单个结果
|
||||
*/
|
||||
default T findOneByCondition(T data) {
|
||||
return data;
|
||||
}
|
||||
T findOneByCondition(T data);
|
||||
}
|
||||
|
|
|
@ -14,11 +14,8 @@ import java.util.List;
|
|||
*/
|
||||
public interface ISysDeptData extends ICommonData<SysDept, Long> {
|
||||
|
||||
/**
|
||||
* 按条件分页查询
|
||||
*/
|
||||
Paging<SysDept> findByConditions(Long parentId, String deptName,
|
||||
String status, int page, int size);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 复合备件查询
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: xw2sy@163.com
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
package cc.iotkit.data.dao;
|
||||
|
||||
import cc.iotkit.data.model.TbSysRole;
|
||||
import cc.iotkit.data.model.TbSysRoleDept;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
|
||||
|
||||
public interface SysRoleDeptRepository extends JpaRepository<TbSysRoleDept, Long>, QuerydslPredicateExecutor<TbSysRoleDept> {
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 奇特物联 2021-2022 All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed 未经许可不能去掉「奇特物联」相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: xw2sy@163.com
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
package cc.iotkit.data.dao;
|
||||
|
||||
import cc.iotkit.data.model.TbSysRoleDept;
|
||||
import cc.iotkit.data.model.TbSysRoleMenu;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
|
||||
|
||||
public interface SysRoleMenuRepository extends JpaRepository<TbSysRoleMenu, Long>, QuerydslPredicateExecutor<TbSysRoleMenu> {
|
||||
|
||||
}
|
|
@ -66,30 +66,7 @@ public class SysConfigDataImpl implements ISysConfigData, IJPACommData<SysConfig
|
|||
return MapstructUtils.convert(IteratorUtils.toList(iterator), SysConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<SysConfig> data) {
|
||||
throw new BizException(ErrCode.UNSUPPORTED_OPERATION_EXCEPTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(Long aLong) {
|
||||
throw new BizException(ErrCode.UNSUPPORTED_OPERATION_EXCEPTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(Collection<Long> longs) {
|
||||
throw new BizException(ErrCode.UNSUPPORTED_OPERATION_EXCEPTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
throw new BizException(ErrCode.UNSUPPORTED_OPERATION_EXCEPTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysConfig> findAll() {
|
||||
throw new BizException(ErrCode.UNSUPPORTED_OPERATION_EXCEPTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<SysConfig> findAll(PageRequest<SysConfig> pageRequest) {
|
||||
|
|
|
@ -4,7 +4,9 @@ import cc.iotkit.common.api.Paging;
|
|||
import cc.iotkit.common.constant.UserConstants;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.common.utils.StringUtils;
|
||||
import cc.iotkit.data.dao.IJPACommData;
|
||||
import cc.iotkit.data.dao.SysDeptRepository;
|
||||
import cc.iotkit.data.model.TbSysDept;
|
||||
import cc.iotkit.data.system.ISysDeptData;
|
||||
import cc.iotkit.data.util.PredicateBuilder;
|
||||
import cc.iotkit.model.system.SysDept;
|
||||
|
@ -13,6 +15,7 @@ import com.querydsl.jpa.impl.JPAQueryFactory;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -28,18 +31,25 @@ import static cc.iotkit.data.model.QTbSysDept.tbSysDept;
|
|||
@Primary
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SysDeptDataImpl implements ISysDeptData {
|
||||
public class SysDeptDataImpl implements ISysDeptData, IJPACommData<SysDept, Long> {
|
||||
|
||||
@Autowired
|
||||
private SysDeptRepository deptRepository;
|
||||
|
||||
private final JPAQueryFactory jpaQueryFactory;
|
||||
|
||||
|
||||
@Override
|
||||
public Paging<SysDept> findByConditions(Long parentId, String deptName, String status, int page, int size) {
|
||||
return null;
|
||||
public JpaRepository getBaseRepository() {
|
||||
return deptRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getJpaRepositoryClass() {
|
||||
return TbSysDept.class;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<SysDept> findDepts(SysDept dept) {
|
||||
PredicateBuilder predicateBuilder = PredicateBuilder.instance()
|
||||
|
|
|
@ -3,14 +3,21 @@ package cc.iotkit.data.service;
|
|||
import cc.iotkit.common.api.Paging;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.common.utils.StringUtils;
|
||||
import cc.iotkit.data.dao.IJPACommData;
|
||||
import cc.iotkit.data.dao.SysLogininforRepository;
|
||||
import cc.iotkit.data.model.TbSysConfig;
|
||||
import cc.iotkit.data.model.TbSysLogininfor;
|
||||
import cc.iotkit.data.system.ISysLogininforData;
|
||||
import cc.iotkit.data.util.PageBuilder;
|
||||
import cc.iotkit.data.util.PredicateBuilder;
|
||||
import cc.iotkit.model.system.SysConfig;
|
||||
import cc.iotkit.model.system.SysLogininfor;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -25,27 +32,43 @@ import static cc.iotkit.data.model.QTbSysLogininfor.tbSysLogininfor;
|
|||
@Primary
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SysLogininfoDataImpl implements ISysLogininforData {
|
||||
public class SysLogininfoDataImpl implements ISysLogininforData, IJPACommData<SysLogininfor, Long> {
|
||||
|
||||
private SysLogininforRepository logininfoRepository;
|
||||
|
||||
|
||||
private final JPAQueryFactory jpaQueryFactory;
|
||||
|
||||
|
||||
@Override
|
||||
public JpaRepository getBaseRepository() {
|
||||
return logininfoRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getJpaRepositoryClass() {
|
||||
return TbSysLogininfor.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysLogininfor> findByConditions(SysLogininfor data) {
|
||||
List<TbSysLogininfor> ret=jpaQueryFactory.selectFrom(tbSysLogininfor).where(PredicateBuilder.instance()
|
||||
.and(StringUtils.isNotBlank(data.getIpaddr()),()->tbSysLogininfor.ipaddr.like(data.getIpaddr()))
|
||||
.and(StringUtils.isNotBlank(data.getStatus()),()->tbSysLogininfor.status.eq(data.getStatus()))
|
||||
.and(StringUtils.isNotBlank(data.getUserName()),()->tbSysLogininfor.userName.like(data.getUserName()))
|
||||
.build())
|
||||
List<TbSysLogininfor> ret=jpaQueryFactory.selectFrom(tbSysLogininfor).where(genPredicate(data))
|
||||
.orderBy(tbSysLogininfor.id.desc()).fetch();
|
||||
return MapstructUtils.convert(ret, SysLogininfor.class);
|
||||
}
|
||||
|
||||
private static Predicate genPredicate(SysLogininfor data) {
|
||||
return PredicateBuilder.instance()
|
||||
.and(StringUtils.isNotBlank(data.getIpaddr()), () -> tbSysLogininfor.ipaddr.like(data.getIpaddr()))
|
||||
.and(StringUtils.isNotBlank(data.getStatus()), () -> tbSysLogininfor.status.eq(data.getStatus()))
|
||||
.and(StringUtils.isNotBlank(data.getUserName()), () -> tbSysLogininfor.userName.like(data.getUserName()))
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<SysLogininfor> findByConditions(SysLogininfor cond, int page, int size) {
|
||||
return null;
|
||||
Page<TbSysLogininfor> all = logininfoRepository.findAll(genPredicate(cond), PageBuilder.buildPageable(page, size));
|
||||
return PageBuilder.toPaging(all, SysConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,6 +81,8 @@ public class SysLogininfoDataImpl implements ISysLogininforData {
|
|||
logininfoRepository.deleteAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteByIds(Collection<Long> longs) {
|
||||
logininfoRepository.deleteAllByIdInBatch(longs);
|
||||
|
|
|
@ -7,6 +7,7 @@ import cc.iotkit.common.enums.ErrCode;
|
|||
import cc.iotkit.common.exception.BizException;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.common.utils.StringUtils;
|
||||
import cc.iotkit.data.dao.IJPACommData;
|
||||
import cc.iotkit.data.dao.SysMenuRepository;
|
||||
import cc.iotkit.data.model.QTbSysMenu;
|
||||
import cc.iotkit.data.model.TbSysMenu;
|
||||
|
@ -18,6 +19,7 @@ import com.querydsl.core.types.Projections;
|
|||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -40,12 +42,22 @@ import static cc.iotkit.data.model.QTbSysUserRole.tbSysUserRole;
|
|||
@Primary
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SysMenuDataImpl implements ISysMenuData {
|
||||
public class SysMenuDataImpl implements ISysMenuData, IJPACommData<SysMenu, Long> {
|
||||
|
||||
private final SysMenuRepository sysMenuRepository;
|
||||
|
||||
private final JPAQueryFactory jpaQueryFactory;
|
||||
|
||||
@Override
|
||||
public JpaRepository getBaseRepository() {
|
||||
return sysMenuRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getJpaRepositoryClass() {
|
||||
return TbSysMenu.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysMenu findById(Long id) {
|
||||
TbSysMenu tbSysMenu = sysMenuRepository.findById(id).orElseThrow(() ->
|
||||
|
@ -81,30 +93,7 @@ public class SysMenuDataImpl implements ISysMenuData {
|
|||
sysMenuRepository.deleteAllByIdInBatch(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysMenu> findAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<SysMenu> findAll(PageRequest<SysMenu> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysMenu> findAllByCondition(SysMenu data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysMenu findOneByCondition(SysMenu data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysMenu> selectMenuList(SysMenu menu, Long userId, boolean isSuperAdmin) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package cc.iotkit.data.service;
|
|||
import cc.iotkit.common.api.Paging;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.common.utils.StringUtils;
|
||||
import cc.iotkit.data.dao.IJPACommData;
|
||||
import cc.iotkit.data.dao.SysOperLogRepository;
|
||||
import cc.iotkit.data.model.TbSysOperLog;
|
||||
import cc.iotkit.data.system.ISysOperLogData;
|
||||
|
@ -12,6 +13,7 @@ import cn.hutool.core.util.ArrayUtil;
|
|||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -27,13 +29,23 @@ import static cc.iotkit.data.model.QTbSysOperLog.tbSysOperLog;
|
|||
@Primary
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SysOperLogDataImpl implements ISysOperLogData {
|
||||
public class SysOperLogDataImpl implements ISysOperLogData, IJPACommData<SysOperLog, Long> {
|
||||
|
||||
private SysOperLogRepository operLogRepository;
|
||||
|
||||
|
||||
private final JPAQueryFactory jpaQueryFactory;
|
||||
|
||||
@Override
|
||||
public JpaRepository getBaseRepository() {
|
||||
return operLogRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getJpaRepositoryClass() {
|
||||
return TbSysOperLog.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<SysOperLog> findByConditions(String tenantId, String title, Integer businessType, Integer status, int page, int size) {
|
||||
return null;
|
||||
|
@ -49,6 +61,7 @@ public class SysOperLogDataImpl implements ISysOperLogData {
|
|||
operLogRepository.deleteAll();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteByIds(Collection<Long> longs) {
|
||||
operLogRepository.deleteAllByIdInBatch(longs);
|
||||
|
|
|
@ -2,6 +2,7 @@ package cc.iotkit.data.service;
|
|||
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.common.utils.StringUtils;
|
||||
import cc.iotkit.data.dao.IJPACommData;
|
||||
import cc.iotkit.data.dao.SysPostRepository;
|
||||
import cc.iotkit.data.model.TbSysPost;
|
||||
import cc.iotkit.data.system.ISysPostData;
|
||||
|
@ -11,6 +12,7 @@ import com.querydsl.core.types.Projections;
|
|||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -28,13 +30,23 @@ import static cc.iotkit.data.model.QTbSysUserPost.tbSysUserPost;
|
|||
@Primary
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SysPostDataImpl implements ISysPostData {
|
||||
public class SysPostDataImpl implements ISysPostData, IJPACommData<SysPost, Long> {
|
||||
|
||||
private SysPostRepository postRepository;
|
||||
|
||||
|
||||
private final JPAQueryFactory jpaQueryFactory;
|
||||
|
||||
@Override
|
||||
public JpaRepository getBaseRepository() {
|
||||
return postRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getJpaRepositoryClass() {
|
||||
return TbSysPost.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysPost> findAll() {
|
||||
return MapstructUtils.convert(postRepository.findAll(),SysPost.class);
|
||||
|
@ -81,6 +93,8 @@ public class SysPostDataImpl implements ISysPostData {
|
|||
return Objects.isNull(ret);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public SysPost findById(Long aLong) {
|
||||
return MapstructUtils.convert(postRepository.findById(aLong),SysPost.class);
|
||||
|
|
|
@ -2,6 +2,7 @@ package cc.iotkit.data.service;
|
|||
|
||||
import cc.iotkit.common.constant.UserConstants;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.data.dao.IJPACommData;
|
||||
import cc.iotkit.data.dao.SysRoleRepository;
|
||||
import cc.iotkit.data.model.TbSysRole;
|
||||
import cc.iotkit.data.system.ISysRoleData;
|
||||
|
@ -13,6 +14,7 @@ import com.querydsl.jpa.impl.JPAQueryFactory;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -33,12 +35,22 @@ import static cc.iotkit.data.model.QTbSysUserRole.tbSysUserRole;
|
|||
@Primary
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SysRoleDataImpl implements ISysRoleData {
|
||||
public class SysRoleDataImpl implements ISysRoleData, IJPACommData<SysRole, Long> {
|
||||
|
||||
private final SysRoleRepository sysRoleRepository;
|
||||
|
||||
private final JPAQueryFactory jpaQueryFactory;
|
||||
|
||||
@Override
|
||||
public JpaRepository getBaseRepository() {
|
||||
return sysRoleRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getJpaRepositoryClass() {
|
||||
return TbSysRole.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysRole findById(Long id) {
|
||||
return MapstructUtils.convert(sysRoleRepository.findById(id), SysRole.class);
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.data.dao.IJPACommData;
|
||||
import cc.iotkit.data.dao.SysRoleDeptRepository;
|
||||
import cc.iotkit.data.model.TbSysDept;
|
||||
import cc.iotkit.data.model.TbSysRoleDept;
|
||||
import cc.iotkit.data.system.ISysRoleDeptData;
|
||||
import cc.iotkit.data.util.PredicateBuilder;
|
||||
import cc.iotkit.model.system.SysRoleDept;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -20,8 +25,10 @@ import static cc.iotkit.data.model.QTbSysRoleDept.tbSysRoleDept;
|
|||
@Primary
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SysRoleDeptDataImpl implements ISysRoleDeptData {
|
||||
public class SysRoleDeptDataImpl implements ISysRoleDeptData, IJPACommData<SysRoleDept, Long> {
|
||||
|
||||
|
||||
private final SysRoleDeptRepository sysRoleDeptRepository;
|
||||
private final JPAQueryFactory jpaQueryFactory;
|
||||
|
||||
@Override
|
||||
|
@ -33,4 +40,14 @@ public class SysRoleDeptDataImpl implements ISysRoleDeptData {
|
|||
public long insertBatch(List<SysRoleDept> list) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaRepository getBaseRepository() {
|
||||
return sysRoleDeptRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getJpaRepositoryClass() {
|
||||
return TbSysRoleDept.class;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.data.dao.IJPACommData;
|
||||
import cc.iotkit.data.dao.SysRoleMenuRepository;
|
||||
import cc.iotkit.data.model.QTbSysRoleMenu;
|
||||
import cc.iotkit.data.model.TbSysRoleMenu;
|
||||
import cc.iotkit.data.model.TbSysUserRole;
|
||||
|
@ -10,6 +12,7 @@ import cc.iotkit.model.system.SysRoleMenu;
|
|||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -24,10 +27,22 @@ import static cc.iotkit.data.model.QTbSysRoleMenu.tbSysRoleMenu;
|
|||
@Primary
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SysRoleMenuDataImpl implements ISysRoleMenuData {
|
||||
public class SysRoleMenuDataImpl implements ISysRoleMenuData, IJPACommData<SysRoleMenu, Long> {
|
||||
|
||||
|
||||
private final SysRoleMenuRepository sysRoleMenuRepository;
|
||||
private final JPAQueryFactory jpaQueryFactory;
|
||||
|
||||
@Override
|
||||
public JpaRepository getBaseRepository() {
|
||||
return sysRoleMenuRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getJpaRepositoryClass() {
|
||||
return TbSysRoleMenu.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkMenuExistRole(Long menuId) {
|
||||
TbSysRoleMenu tbSysRoleMenu = jpaQueryFactory
|
||||
|
@ -48,4 +63,6 @@ public class SysRoleMenuDataImpl implements ISysRoleMenuData {
|
|||
public long deleteByRoleId(List<Long> ids) {
|
||||
return jpaQueryFactory.delete(tbSysRoleMenu).where(tbSysRoleMenu.roleId.in(ids)).execute();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package cc.iotkit.data.service;
|
|||
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.common.utils.StringUtils;
|
||||
import cc.iotkit.data.dao.IJPACommData;
|
||||
import cc.iotkit.data.dao.SysTenantRepository;
|
||||
import cc.iotkit.data.model.TbSysTenant;
|
||||
import cc.iotkit.data.system.ISysTenantData;
|
||||
|
@ -10,6 +11,7 @@ import cc.iotkit.model.system.SysTenant;
|
|||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -24,36 +26,27 @@ import static cc.iotkit.data.model.QTbSysTenant.tbSysTenant;
|
|||
@Primary
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SysTenantDataImpl implements ISysTenantData {
|
||||
public class SysTenantDataImpl implements ISysTenantData, IJPACommData<SysTenant, Long> {
|
||||
|
||||
private SysTenantRepository sysTenantRepository;
|
||||
private final SysTenantRepository sysTenantRepository;
|
||||
|
||||
private final JPAQueryFactory jpaQueryFactory;
|
||||
|
||||
@Override
|
||||
public JpaRepository getBaseRepository() {
|
||||
return sysTenantRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getJpaRepositoryClass() {
|
||||
return TbSysTenant.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysTenant findById(Long aLong) {
|
||||
return MapstructUtils.convert(sysTenantRepository.findById(aLong),SysTenant.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysTenant save(SysTenant data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<SysTenant> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(Long aLong) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(Collection<Long> longs) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysTenant> findAllByCondition(SysTenant data) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import cc.iotkit.common.constant.UserConstants;
|
|||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.common.utils.StreamUtils;
|
||||
import cc.iotkit.common.utils.StringUtils;
|
||||
import cc.iotkit.data.dao.IJPACommData;
|
||||
import cc.iotkit.data.dao.SysUserRepository;
|
||||
import cc.iotkit.data.model.TbSysUser;
|
||||
import cc.iotkit.data.system.ISysDeptData;
|
||||
|
@ -18,6 +19,7 @@ import com.querydsl.core.types.Projections;
|
|||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -35,7 +37,7 @@ import static cc.iotkit.data.model.QTbSysUser.tbSysUser;
|
|||
@Primary
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SysUserDataImpl implements ISysUserData {
|
||||
public class SysUserDataImpl implements ISysUserData, IJPACommData<SysUser, Long> {
|
||||
|
||||
private SysUserRepository userRepository;
|
||||
|
||||
|
@ -43,6 +45,18 @@ public class SysUserDataImpl implements ISysUserData {
|
|||
|
||||
private JPAQueryFactory jpaQueryFactory;
|
||||
|
||||
|
||||
@Override
|
||||
public JpaRepository getBaseRepository() {
|
||||
return userRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getJpaRepositoryClass() {
|
||||
return TbSysUser.class;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long countByDeptId(Long aLong) {
|
||||
return 0;
|
||||
|
@ -78,50 +92,26 @@ public class SysUserDataImpl implements ISysUserData {
|
|||
return Objects.isNull(ret);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SysUser findById(Long aLong) {
|
||||
return MapstructUtils.convert(userRepository.findById(aLong),SysUser.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> findByIds(Collection<Long> collection) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SysUser save(SysUser sysUser) {
|
||||
return MapstructUtils.convert(userRepository.save(MapstructUtils.convert(sysUser,TbSysUser.class)),SysUser.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<SysUser> list) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(Long aLong) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(Collection<Long> collection) {
|
||||
userRepository.deleteAllByIdInBatch(collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return userRepository.count();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> findAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<SysUser> findAll(PageRequest<SysUser> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> findAllByCondition(SysUser user) {
|
||||
|
@ -145,8 +135,4 @@ public class SysUserDataImpl implements ISysUserData {
|
|||
return MapstructUtils.convert(users, SysUser.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUser findOneByCondition(SysUser sysUser) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.data.dao.IJPACommData;
|
||||
import cc.iotkit.data.dao.SysUserPostRepository;
|
||||
import cc.iotkit.data.model.TbSysUserPost;
|
||||
import cc.iotkit.data.system.ISysUserPostData;
|
||||
import cc.iotkit.model.system.SysUserPost;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -13,7 +15,7 @@ import java.util.List;
|
|||
* @Author:tfd
|
||||
* @Date:2023/5/30 17:04
|
||||
*/
|
||||
public class SysUserPostDataImpl implements ISysUserPostData {
|
||||
public class SysUserPostDataImpl implements ISysUserPostData, IJPACommData<SysUserPost, Long> {
|
||||
|
||||
@Autowired
|
||||
private SysUserPostRepository sysUserPostRepository;
|
||||
|
@ -23,6 +25,16 @@ public class SysUserPostDataImpl implements ISysUserPostData {
|
|||
return sysUserPostRepository.deleteAllByUserId(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaRepository getBaseRepository() {
|
||||
return sysUserPostRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getJpaRepositoryClass() {
|
||||
return TbSysUserPost.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<SysUserPost> data) {
|
||||
sysUserPostRepository.saveAll(MapstructUtils.convert(data, TbSysUserPost.class));
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.data.dao.IJPACommData;
|
||||
import cc.iotkit.data.dao.SysUserRoleRepository;
|
||||
import cc.iotkit.data.model.TbSysUserRole;
|
||||
import cc.iotkit.data.system.ISysUserRoleData;
|
||||
|
@ -9,6 +10,7 @@ import cc.iotkit.model.system.SysUserRole;
|
|||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
@ -22,11 +24,21 @@ import static cc.iotkit.data.model.QTbSysUserRole.tbSysUserRole;
|
|||
* @Date:2023/5/30 16:36
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class SysUserRoleDataImpl implements ISysUserRoleData {
|
||||
public class SysUserRoleDataImpl implements ISysUserRoleData, IJPACommData<SysUserRole, Long> {
|
||||
@Autowired
|
||||
private final SysUserRoleRepository sysUserRoleRepository;
|
||||
private final JPAQueryFactory jpaQueryFactory;
|
||||
|
||||
@Override
|
||||
public JpaRepository getBaseRepository() {
|
||||
return sysUserRoleRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getJpaRepositoryClass() {
|
||||
return TbSysUserRole.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByUserId(Long userId) {
|
||||
return sysUserRoleRepository.deleteAllByUserId(userId);
|
||||
|
@ -49,4 +61,5 @@ public class SysUserRoleDataImpl implements ISysUserRoleData {
|
|||
.and(tbSysUserRole.userId.in(userIds))
|
||||
.build()).execute();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.data.dao.IJPACommData;
|
||||
import cc.iotkit.data.manager.ITaskInfoData;
|
||||
import cc.iotkit.data.dao.TaskInfoRepository;
|
||||
import cc.iotkit.data.model.TbTaskInfo;
|
||||
|
@ -21,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -29,7 +31,7 @@ import java.util.UUID;
|
|||
|
||||
@Primary
|
||||
@Service
|
||||
public class TaskInfoDataImpl implements ITaskInfoData {
|
||||
public class TaskInfoDataImpl implements ITaskInfoData, IJPACommData<TaskInfo, String> {
|
||||
|
||||
@Autowired
|
||||
private TaskInfoRepository taskInfoRepository;
|
||||
|
@ -52,15 +54,22 @@ public class TaskInfoDataImpl implements ITaskInfoData {
|
|||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaRepository getBaseRepository() {
|
||||
return taskInfoRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getJpaRepositoryClass() {
|
||||
return TbTaskInfo.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskInfo findById(String s) {
|
||||
return TaskInfoMapper.toDtoFix(taskInfoRepository.findById(s).orElse(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskInfo> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TaskInfo save(TaskInfo data) {
|
||||
|
@ -72,47 +81,7 @@ public class TaskInfoDataImpl implements ITaskInfoData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<TaskInfo> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
taskInfoRepository.deleteById(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return taskInfoRepository.count();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskInfo> findAll() {
|
||||
return TaskInfoMapper.toDto(taskInfoRepository.findAll());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<TaskInfo> findAll(PageRequest<TaskInfo> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskInfo> findAllByCondition(TaskInfo data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskInfo findOneByCondition(TaskInfo data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -10,14 +10,17 @@
|
|||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.data.dao.IJPACommData;
|
||||
import cc.iotkit.data.manager.IThingModelData;
|
||||
import cc.iotkit.data.dao.ThingModelRepository;
|
||||
import cc.iotkit.data.model.TbThingModel;
|
||||
import cc.iotkit.data.service.convert.ThingModelMapper;
|
||||
import cc.iotkit.common.api.Paging;
|
||||
import cc.iotkit.model.product.ThingModel;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -26,20 +29,26 @@ import java.util.UUID;
|
|||
|
||||
@Primary
|
||||
@Service
|
||||
public class ThingModelDataImpl implements IThingModelData {
|
||||
public class ThingModelDataImpl implements IThingModelData, IJPACommData<ThingModel, String> {
|
||||
|
||||
@Autowired
|
||||
private ThingModelRepository thingModelRepository;
|
||||
|
||||
@Override
|
||||
public JpaRepository getBaseRepository() {
|
||||
return thingModelRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getJpaRepositoryClass() {
|
||||
return TbThingModel.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThingModel findById(String s) {
|
||||
return ThingModelMapper.toDtoFix(thingModelRepository.findById(s).orElse(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThingModel> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThingModel save(ThingModel data) {
|
||||
|
@ -50,46 +59,14 @@ public class ThingModelDataImpl implements IThingModelData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<ThingModel> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
thingModelRepository.deleteById(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThingModel> findAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<ThingModel> findAll(PageRequest<ThingModel> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThingModel> findAllByCondition(ThingModel data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThingModel findOneByCondition(ThingModel data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.data.dao.IJPACommData;
|
||||
import cc.iotkit.data.manager.IUserInfoData;
|
||||
import cc.iotkit.data.dao.UserInfoRepository;
|
||||
import cc.iotkit.data.model.TbUserInfo;
|
||||
|
@ -21,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -29,7 +31,7 @@ import java.util.UUID;
|
|||
|
||||
@Primary
|
||||
@Service
|
||||
public class UserInfoDataImpl implements IUserInfoData {
|
||||
public class UserInfoDataImpl implements IUserInfoData, IJPACommData<UserInfo, String> {
|
||||
|
||||
@Autowired
|
||||
private UserInfoRepository userInfoRepository;
|
||||
|
@ -49,6 +51,16 @@ public class UserInfoDataImpl implements IUserInfoData {
|
|||
return UserInfoMapper.toDto(userInfoRepository.findByTypeAndOwnerId(type, ownerId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaRepository getBaseRepository() {
|
||||
return userInfoRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getJpaRepositoryClass() {
|
||||
return TbUserInfo.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserInfo findById(String s) {
|
||||
return UserInfoMapper.toDtoFix(userInfoRepository.findById(s).orElse(null));
|
||||
|
@ -69,46 +81,20 @@ public class UserInfoDataImpl implements IUserInfoData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<UserInfo> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
userInfoRepository.deleteById(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return userInfoRepository.count();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserInfo> findAll() {
|
||||
return UserInfoMapper.toDto(userInfoRepository.findAll());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<UserInfo> findAll(PageRequest<UserInfo> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserInfo> findAllByCondition(UserInfo data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserInfo findOneByCondition(UserInfo data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.data.dao.IJPACommData;
|
||||
import cc.iotkit.data.manager.IVirtualDeviceData;
|
||||
import cc.iotkit.data.dao.VirtualDeviceMappingRepository;
|
||||
import cc.iotkit.data.dao.VirtualDeviceRepository;
|
||||
|
@ -24,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
@ -33,7 +35,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
@Primary
|
||||
@Service
|
||||
public class VirtualDeviceDataImpl implements IVirtualDeviceData {
|
||||
public class VirtualDeviceDataImpl implements IVirtualDeviceData, IJPACommData<VirtualDevice, String> {
|
||||
|
||||
@Autowired
|
||||
private VirtualDeviceRepository virtualDeviceRepository;
|
||||
|
@ -41,6 +43,17 @@ public class VirtualDeviceDataImpl implements IVirtualDeviceData {
|
|||
@Autowired
|
||||
private VirtualDeviceMappingRepository virtualDeviceMappingRepository;
|
||||
|
||||
|
||||
@Override
|
||||
public JpaRepository getBaseRepository() {
|
||||
return virtualDeviceRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getJpaRepositoryClass() {
|
||||
return TbVirtualDevice.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VirtualDevice> findByUid(String uid) {
|
||||
return VirtualDeviceMapper.toDto(virtualDeviceRepository.findByUid(uid));
|
||||
|
@ -81,10 +94,6 @@ public class VirtualDeviceDataImpl implements IVirtualDeviceData {
|
|||
return dto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VirtualDevice> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<String> getVirtualDeviceIds(String virtualId) {
|
||||
List<TbVirtualDeviceMapping> deviceMappings = virtualDeviceMappingRepository.findByVirtualId(virtualId);
|
||||
|
@ -112,10 +121,6 @@ public class VirtualDeviceDataImpl implements IVirtualDeviceData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<VirtualDevice> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
|
@ -124,36 +129,12 @@ public class VirtualDeviceDataImpl implements IVirtualDeviceData {
|
|||
virtualDeviceMappingRepository.deleteByVirtualId(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return virtualDeviceRepository.count();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VirtualDevice> findAll() {
|
||||
return VirtualDeviceMapper.toDto(virtualDeviceRepository.findAll());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<VirtualDevice> findAll(PageRequest<VirtualDevice> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VirtualDevice> findAllByCondition(VirtualDevice data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualDevice findOneByCondition(VirtualDevice data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import cc.iotkit.data.model.TbSysConfig;
|
|||
import cc.iotkit.model.product.Product;
|
||||
import cc.iotkit.model.system.SysConfig;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.querydsl.core.types.OrderSpecifier;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
@ -64,12 +65,16 @@ public class PageBuilder {
|
|||
return orders;
|
||||
}
|
||||
|
||||
public static Paging<SysConfig> toPaging(Page all, Class clz) {
|
||||
public static Paging toPaging(Page all, Class clz) {
|
||||
return new Paging<>(all.getTotalElements(),
|
||||
MapstructUtils.convert(all.getContent(), clz));
|
||||
}
|
||||
|
||||
public static Paging<SysConfig> toPaging(Page all) {
|
||||
public static Paging<?> toPaging(Page all) {
|
||||
return new Paging<>(all.getTotalElements(), all.getContent());
|
||||
}
|
||||
|
||||
public static Pageable buildPageable(int page, int size) {
|
||||
return org.springframework.data.domain.PageRequest.of(page, size);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ import cc.iotkit.common.excel.utils.ExcelUtil;
|
|||
import cc.iotkit.common.log.annotation.Log;
|
||||
import cc.iotkit.common.log.enums.BusinessType;
|
||||
import cc.iotkit.common.web.core.BaseController;
|
||||
import cc.iotkit.system.dto.SysUserRole;
|
||||
|
||||
import cc.iotkit.model.system.SysUserRole;
|
||||
import cc.iotkit.system.dto.bo.SysDeptBo;
|
||||
import cc.iotkit.system.dto.bo.SysRoleBo;
|
||||
import cc.iotkit.system.dto.bo.SysUserBo;
|
||||
|
|
Loading…
Reference in New Issue