export
parent
5ce2489495
commit
41de9a96c1
@ -0,0 +1,74 @@
|
||||
package com.anjiplus.template.gaea.business.modules.export.controller;
|
||||
|
||||
import com.anji.plus.gaea.annotation.log.GaeaAuditLog;
|
||||
import com.anji.plus.gaea.bean.ResponseBean;
|
||||
import com.anji.plus.gaea.curd.controller.GaeaBaseController;
|
||||
import com.anji.plus.gaea.curd.service.GaeaBaseService;
|
||||
import com.anji.plus.gaea.utils.GaeaBeanUtils;
|
||||
import com.anjiplus.template.gaea.business.modules.export.controller.dto.GaeaExportDTO;
|
||||
import com.anjiplus.template.gaea.business.modules.export.controller.param.GaeaExportParam;
|
||||
import com.anjiplus.template.gaea.business.modules.export.controller.param.GaeaExportQueryParam;
|
||||
import com.anjiplus.template.gaea.business.modules.export.dao.entity.GaeaExport;
|
||||
import com.anjiplus.template.gaea.business.modules.export.service.GaeaExportService;
|
||||
import com.anji.plus.gaea.export.vo.ExportOperation;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 导出中心(GaeaExport)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2021-02-07 17:12:31
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/export")
|
||||
@Api(value = "/export", tags = "导出中心")
|
||||
public class GaeaExportController extends GaeaBaseController<GaeaExportParam, GaeaExport, GaeaExportDTO> {
|
||||
@Autowired
|
||||
private GaeaExportService gaeaExportService;
|
||||
|
||||
@Override
|
||||
public GaeaBaseService<GaeaExportParam, GaeaExport> getService() {
|
||||
return gaeaExportService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GaeaExport getEntity() {
|
||||
return new GaeaExport();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GaeaExportDTO getDTO() {
|
||||
return new GaeaExportDTO();
|
||||
}
|
||||
|
||||
@PostMapping("/queryAdvanceExport")
|
||||
@GaeaAuditLog(pageTitle = "高级查询")
|
||||
public ResponseBean queryExportInfo(@RequestBody GaeaExportQueryParam param) {
|
||||
Page<GaeaExport> exportList=gaeaExportService.getExportListPage(param);
|
||||
List<GaeaExportDTO> list = exportList.getRecords().stream()
|
||||
.map(entity -> GaeaBeanUtils.copyAndFormatter(entity, getDTO()))
|
||||
.collect(Collectors.toList());
|
||||
Page<GaeaExportDTO> pageDto = new Page<>();
|
||||
pageDto.setCurrent(exportList.getCurrent());
|
||||
pageDto.setRecords(list);
|
||||
pageDto.setPages(exportList.getPages());
|
||||
pageDto.setTotal(exportList.getTotal());
|
||||
pageDto.setSize(exportList.getSize());
|
||||
return responseSuccessWithData(pageDto);
|
||||
}
|
||||
|
||||
@PostMapping("/saveExportLog")
|
||||
public Boolean export(@RequestBody ExportOperation exportOperation) {
|
||||
return gaeaExportService.saveExportLog(exportOperation);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.anjiplus.template.gaea.business.modules.export.controller.param;
|
||||
|
||||
|
||||
import com.anji.plus.gaea.annotation.Query;
|
||||
import com.anji.plus.gaea.constant.QueryEnum;
|
||||
import com.anji.plus.gaea.curd.params.PageParam;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 导出中心(GaeaExport)param
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2021-02-07 17:12:26
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class GaeaExportParam extends PageParam implements Serializable {
|
||||
/**
|
||||
* 文件标题
|
||||
*/
|
||||
@Query(QueryEnum.LIKE)
|
||||
private String fileTitle;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.anjiplus.template.gaea.business.modules.export.dao;
|
||||
|
||||
import com.anjiplus.template.gaea.business.modules.export.controller.param.GaeaExportQueryParam;
|
||||
import com.anjiplus.template.gaea.business.modules.export.dao.entity.GaeaExport;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 导出中心(GaeaExport)Mapper
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2021-02-07 17:12:16
|
||||
*/
|
||||
@Mapper
|
||||
public interface GaeaExportMapper extends GaeaBaseMapper<GaeaExport> {
|
||||
/**
|
||||
* 导出信息的高级查询
|
||||
* @param page
|
||||
* @param bo
|
||||
* @param wrapper
|
||||
* @return
|
||||
*/
|
||||
List<GaeaExport> queryExportInfo(Page<GaeaExport> page, @Param("bo") GaeaExportQueryParam bo, @Param(Constants.WRAPPER) QueryWrapper wrapper);
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package com.anjiplus.template.gaea.business.modules.export.service.impl;
|
||||
|
||||
import com.anjiplus.template.gaea.business.modules.export.dao.GaeaExportMapper;
|
||||
import com.anjiplus.template.gaea.business.modules.export.dao.entity.GaeaExport;
|
||||
import com.anjiplus.template.gaea.business.modules.export.service.GaeaExportService;
|
||||
import com.anjiplus.template.gaea.business.modules.file.dao.GaeaFileMapper;
|
||||
import com.anjiplus.template.gaea.business.modules.file.entity.GaeaFile;
|
||||
import com.anji.plus.gaea.export.vo.ExportOperation;
|
||||
import com.anjiplus.template.gaea.business.modules.export.controller.param.GaeaExportQueryParam;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.anjiplus.template.gaea.common.aop.GaeaQuery;
|
||||
import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 导出中心(GaeaExport)ServiceImpl
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2021-02-07 17:12:24
|
||||
*/
|
||||
@Service
|
||||
public class GaeaExportServiceImpl implements GaeaExportService {
|
||||
@Autowired
|
||||
private GaeaExportMapper gaeaExportMapper;
|
||||
@Autowired
|
||||
private GaeaFileMapper gaeaFileMapper;
|
||||
|
||||
@Override
|
||||
public GaeaBaseMapper<GaeaExport> getMapper() {
|
||||
return gaeaExportMapper;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@GaeaQuery
|
||||
public Page<GaeaExport> getExportListPage(GaeaExportQueryParam queryParam, QueryWrapper... qe) {
|
||||
Page<GaeaExport> page = new Page<>(queryParam.getPageNumber(), queryParam.getPageSize());
|
||||
QueryWrapper queryWrapper = (null != qe && qe.length > 0) ? qe[0] : null;
|
||||
List<GaeaExport> gaeaExports = gaeaExportMapper.queryExportInfo(page, queryParam, queryWrapper);
|
||||
page.setRecords(gaeaExports);
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean saveExportLog(ExportOperation exportOperation) {
|
||||
//需要保存两张表数据 gaea_file ,gaea_export数据
|
||||
Date nowDate = new Date();
|
||||
GaeaFile gaeaFile = new GaeaFile();
|
||||
gaeaFile.setFileId(exportOperation.getFileId());
|
||||
gaeaFile.setFilePath(exportOperation.getFilePath());
|
||||
gaeaFile.setCreateBy(exportOperation.getCreaterUsername());
|
||||
gaeaFile.setCreateTime(nowDate);
|
||||
gaeaFile.setUpdateBy(exportOperation.getCreaterUsername());
|
||||
gaeaFile.setUpdateTime(nowDate);
|
||||
gaeaFileMapper.insert(gaeaFile);
|
||||
GaeaExport export = new GaeaExport();
|
||||
BeanUtils.copyProperties(exportOperation, export);
|
||||
export.setCreateBy(exportOperation.getCreaterUsername());
|
||||
export.setCreateTime(nowDate);
|
||||
export.setUpdateBy(exportOperation.getCreaterUsername());
|
||||
export.setUpdateTime(nowDate);
|
||||
gaeaExportMapper.insert(export);
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue