com.didiglobal.logi.security.service.impl.OplogServiceImpl 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.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.didiglobal.logi.security.common.PagingData;
import com.didiglobal.logi.security.common.dto.oplog.OplogDTO;
import com.didiglobal.logi.security.common.entity.Oplog;
import com.didiglobal.logi.security.common.dto.oplog.OplogQueryDTO;
import com.didiglobal.logi.security.common.vo.oplog.OplogVO;
import com.didiglobal.logi.security.dao.OplogDao;
import com.didiglobal.logi.security.service.OplogService;
import com.didiglobal.logi.security.util.CopyBeanUtil;
import com.didiglobal.logi.security.util.NetworkUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @author cjm
*/
@Service("logiSecurityOplogServiceImpl")
public class OplogServiceImpl implements OplogService {
@Autowired
private OplogDao oplogDao;
@Override
public PagingData getOplogPage(OplogQueryDTO queryDTO) {
// 分页查询
IPage pageInfo = oplogDao.selectPageWithoutDetail(queryDTO);
List oplogVOList = new ArrayList<>();
for(Oplog oplog : pageInfo.getRecords()) {
OplogVO oplogVO = CopyBeanUtil.copy(oplog, OplogVO.class);
oplogVO.setCreateTime(oplog.getCreateTime());
oplogVO.setUpdateTime(oplog.getUpdateTime());
oplogVOList.add(oplogVO);
}
return new PagingData<>(oplogVOList, pageInfo);
}
@Override
public OplogVO getOplogDetailByOplogId(Integer oplogId) {
Oplog oplog = oplogDao.selectByOplogId(oplogId);
if(oplog == null) {
return null;
}
OplogVO oplogVO = CopyBeanUtil.copy(oplog, OplogVO.class);
oplogVO.setCreateTime(oplog.getCreateTime());
oplogVO.setUpdateTime(oplog.getUpdateTime());
return oplogVO;
}
@Override
public List listTargetType() {
return oplogDao.listTargetType();
}
@Override
public Integer saveOplog(OplogDTO oplogDTO) {
Oplog oplog = CopyBeanUtil.copy(oplogDTO, Oplog.class);
String realIpAddress = NetworkUtil.getRealIpAddress();
oplog.setOperatorIp(realIpAddress);
oplogDao.insert(oplog);
return oplog.getId();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy