资料导出
This commit is contained in:
+1
-2
@@ -167,7 +167,6 @@ public class JeroController<T, S extends IService<T>> {
|
||||
// Step.1 组装查询条件
|
||||
// Step.2 获取导出数据
|
||||
List<T> pageList = service.list(queryWrapper);
|
||||
|
||||
// Step.3 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
//此处设置的filename无效 ,前端会重更新设置一下
|
||||
@@ -181,7 +180,7 @@ public class JeroController<T, S extends IService<T>> {
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过excel获取导入数据
|
||||
*
|
||||
|
||||
+30
-5
@@ -8,6 +8,7 @@ import javax.validation.Valid;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
@@ -16,13 +17,19 @@ import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.data.entity.DTO.PayCaseCommitteeDTO;
|
||||
import com.jero.data.entity.DTO.PayCaseCommitteeUpdateDTO;
|
||||
import com.jero.data.entity.PayCaseCommittee;
|
||||
import com.jero.data.entity.PayCaseCommitteeExcel;
|
||||
import com.jero.data.entity.VO.payCaseCommitteeSubitemVO;
|
||||
import com.jero.data.mapper.PayCaseCommitteeSubitemMapper;
|
||||
import com.jero.data.service.IPayCaseCommitteeService;
|
||||
import com.jero.data.entity.PayCaseCommitteeSubitem;
|
||||
import com.jero.data.service.IPayCaseCommitteeSubitemService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
@@ -40,8 +47,12 @@ import io.swagger.annotations.ApiOperation;
|
||||
@RequestMapping("/payCaseCommittee/payCaseCommittee")
|
||||
@Slf4j
|
||||
public class PayCaseCommitteeController extends JeroController<PayCaseCommittee, IPayCaseCommitteeService> {
|
||||
@Value("${jero.path.upload}")
|
||||
private String upLoadPath;
|
||||
|
||||
@Autowired
|
||||
private IPayCaseCommitteeService payCaseCommitteeService;
|
||||
|
||||
@Autowired
|
||||
private IPayCaseCommitteeSubitemService payCaseCommitteeSubitemService;
|
||||
|
||||
@@ -142,15 +153,29 @@ public class PayCaseCommitteeController extends JeroController<PayCaseCommittee,
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param payCaseCommittee
|
||||
*
|
||||
*/
|
||||
@AutoLog(value = "分标委表-导出")
|
||||
@ApiOperation(value="分标委表-导出", notes="分标委表-导出")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, PayCaseCommittee payCaseCommittee) {
|
||||
return super.exportXls(request, payCaseCommittee, PayCaseCommittee.class, "分标委表");
|
||||
@GetMapping(value = "/exportXls",produces = "text/text;charset=utf-8")
|
||||
public ModelAndView customExportXlsList() {
|
||||
QueryWrapper<PayCaseCommitteeSubitem> queryWrapper = Wrappers.query();
|
||||
List<PayCaseCommitteeExcel> list = payCaseCommitteeSubitemMapper.listExcel(queryWrapper);
|
||||
// Step.3 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "分标委表"); //此处设置的filename无效 ,前端会重更新设置一下
|
||||
mv.addObject(NormalExcelConstants.CLASS, PayCaseCommitteeExcel.class);
|
||||
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
|
||||
ExportParams exportParams=new ExportParams("分标委表", "分标委表");
|
||||
exportParams.setImageBasePath(upLoadPath);
|
||||
//update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
|
||||
mv.addObject(NormalExcelConstants.PARAMS,exportParams);
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, list);
|
||||
return mv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * 批量删除
|
||||
// *
|
||||
|
||||
+5
@@ -2,9 +2,11 @@ package com.jero.data.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.data.entity.PayCaseCommitteeExcel;
|
||||
import com.jero.data.entity.PayCaseCommitteeSubitem;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.data.entity.VO.payCaseCommitteeSubitemVO;
|
||||
@@ -25,5 +27,8 @@ public interface PayCaseCommitteeSubitemMapper extends BaseMapper<PayCaseCommitt
|
||||
Page<FindByName> list (IPage<PayCaseCommitteeSubitem> page, @Param(Constants.WRAPPER) Wrapper<PayCaseCommitteeSubitem> wrapper);
|
||||
|
||||
List<payCaseCommitteeSubitemVO> list2 (@Param(Constants.WRAPPER) Wrapper<PayCaseCommitteeSubitem> wrapper);
|
||||
|
||||
List<PayCaseCommitteeExcel> listExcel(@Param(Constants.WRAPPER) QueryWrapper<PayCaseCommitteeSubitem> queryWrapper);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+9
@@ -30,4 +30,13 @@
|
||||
left JOIN pay_contacts_management pt on (pm.contacts_id = pt.id)
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="listExcel" resultType="com.jero.data.entity.PayCaseCommitteeExcel">
|
||||
SELECT pe.name as name,pt.name as peopleName,pm.company_name as companyName,pt.post as post,pt.phone as phone
|
||||
from
|
||||
pay_case_committee pe
|
||||
right JOIN pay_case_committee_subitem pm on (pe.id = pm.committee_id)
|
||||
left JOIN pay_contacts_management pt on (pm.contacts_id = pt.id)
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user