All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.didiglobal.logi.security.dao.impl.PermissionDaoImpl Maven / Gradle / Ivy

The newest version!
package com.didiglobal.logi.security.dao.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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 = getQueryWrapper();
        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) {
            permissionMapper.insert(permissionPO);
        }

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy