com.didiglobal.logi.security.dao.impl.PermissionDaoImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of logi-security-spring-boot-starter Show documentation
Show all versions of logi-security-spring-boot-starter Show documentation
logi-security 提供项目大多都需要的一些基础功能(用户、角色、权限、登录、注册、操作记录)
package com.didiglobal.logi.security.dao.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.didiglobal.logi.security.common.constant.FieldConstant;
import com.didiglobal.logi.security.common.entity.Permission;
import com.didiglobal.logi.security.common.po.PermissionPO;
import com.didiglobal.logi.security.dao.PermissionDao;
import com.didiglobal.logi.security.dao.mapper.PermissionMapper;
import com.didiglobal.logi.security.util.CopyBeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.List;
/**
* @author cjm
*/
@Component
public class PermissionDaoImpl extends BaseDaoImpl implements PermissionDao {
@Autowired
private PermissionMapper permissionMapper;
@Override
public List selectAllAndAscOrderByLevel() {
QueryWrapper queryWrapper = getQueryWrapperWithAppName();
queryWrapper.orderByAsc( FieldConstant.LEVEL);
return CopyBeanUtil.copyList(permissionMapper.selectList(queryWrapper), Permission.class);
}
@Override
public void insertBatch(List permissionList) {
if(CollectionUtils.isEmpty(permissionList)) {
return;
}
List permissionPOList = CopyBeanUtil.copyList(permissionList, PermissionPO.class);
for(PermissionPO permissionPO : permissionPOList) {
permissionPO.setAppName(logiSecurityProper.getAppName());
permissionMapper.insert(permissionPO);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy