This commit is contained in:
zhouwentao 2024-06-23 20:52:10 +08:00
parent c02f75057e
commit b74b7346cd
5 changed files with 30 additions and 26 deletions

View File

@ -190,39 +190,17 @@ public class YxSchoolController extends JeecgController<YxSchool, IYxSchoolServi
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// 过滤选中数据
String selections = request.getParameter("selections");
List<String> selectionList = new ArrayList<>();
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
queryWrapper.select(YxSchool::getId);
queryWrapper.select(YxSchool::getSchoolName);
queryWrapper.in(YxSchool::getId,selectionList);
selectionList = Arrays.asList(selections.split(","));
}
List<YxSchool> exportList = service.list(queryWrapper);
Map<String, String> schoolIdMap = exportList.stream().collect(Collectors.toMap(YxSchool::getId, YxSchool::getSchoolName));
List<SchoolExportDTO> schoolExportDTOList =new ArrayList<>();
if (CollectionUtil.isNotEmpty(exportList)) {
List<String> schoolIdList = exportList.stream().map(YxSchool::getId).collect(Collectors.toList());
LambdaQueryWrapper<YxSchoolChild> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(YxSchoolChild::getSchoolId,schoolIdList);
lambdaQueryWrapper.orderByDesc(YxSchoolChild::getSchoolCode);
lambdaQueryWrapper.select(YxSchoolChild::getSchoolId,YxSchoolChild::getSchoolName,YxSchoolChild::getSchoolCode);
List<YxSchoolChild> schoolChildList = yxSchoolChildService.list(lambdaQueryWrapper);
SchoolExportDTO schoolExportDTO = null;
for (YxSchoolChild yxSchoolChild : schoolChildList) {
schoolExportDTO = new SchoolExportDTO();
schoolExportDTO.setSchoolName(yxSchoolChild.getSchoolName());
schoolExportDTO.setSchoolCode(yxSchoolChild.getSchoolCode());
schoolExportDTO.setMasterSchoolName(schoolIdMap.get(yxSchoolChild.getSchoolId()));
schoolExportDTOList.add(schoolExportDTO);
}
}
List<SchoolExportDTO> exportList = yxSchoolService.exportList(selectionList);
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, title);
mv.addObject(NormalExcelConstants.CLASS, SchoolExportDTO.class);
ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
mv.addObject(NormalExcelConstants.PARAMS,exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, schoolExportDTOList);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}

View File

@ -9,6 +9,7 @@ import org.jeecg.modules.web.dto.ArtHotSchoolDTO;
import org.jeecg.modules.web.dto.ArtSchoolDTO;
import org.jeecg.modules.web.vo.QueryRecommendMajorVO;
import org.jeecg.modules.mini.dto.MiniSchoolDTO;
import org.jeecg.modules.yx.dto.SchoolExportDTO;
import org.jeecg.modules.yx.dto.YxSchoolDTO;
import org.jeecg.modules.yx.entity.YxSchool;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -58,4 +59,6 @@ public interface YxSchoolMapper extends BaseMapper<YxSchool> {
List<ArtHotSchoolDTO> artSchoolListBySchoolCodeList(@Param("schoolCodeList") List<String> schoolCodeList);
IPage<YxSchool> queryPageList(@Param("page") Page<YxSchool> page, @Param("qvo") QueryRecommendMajorVO queryRecommendMajorVO);
List<SchoolExportDTO> exportList(List<String> schoolIdList);
}

View File

@ -488,4 +488,18 @@
</where>
ORDER BY s.create_time,s.update_time DESC
</select>
<select id="exportList" resultType="org.jeecg.modules.yx.dto.SchoolExportDTO">
SELECT s.id,
s.school_name as master_school_name,
sc.school_code,sc.school_name
FROM yx_school s
LEFT JOIN yx_school_child sc ON sc.school_id = s.id
<where>
<if test="schoolIdList!=null and schoolIdList.size>0">
AND sc.school_id in
<foreach collection="schoolIdList" index="index" item="b" open="(" separator="," close=")">#{b}</foreach>
</if>
</where>
</select>
</mapper>

View File

@ -6,6 +6,7 @@ import org.jeecg.modules.web.dto.ArtHotSchoolDTO;
import org.jeecg.modules.web.dto.ArtSchoolDTO;
import org.jeecg.modules.web.vo.QueryRecommendMajorVO;
import org.jeecg.modules.mini.dto.MiniSchoolDTO;
import org.jeecg.modules.yx.dto.SchoolExportDTO;
import org.jeecg.modules.yx.dto.YxSchoolDTO;
import org.jeecg.modules.yx.entity.YxSchool;
import com.baomidou.mybatisplus.extension.service.IService;
@ -41,5 +42,7 @@ public interface IYxSchoolService extends IService<YxSchool> {
IPage<YxSchool> queryPageList(Page<YxSchool> page, QueryRecommendMajorVO queryRecommendMajorVO);
List<SchoolExportDTO> exportList(List<String> schoolIdList);
//小程序代码=================================================
}

View File

@ -12,6 +12,7 @@ import org.jeecg.modules.web.dto.ArtHotSchoolDTO;
import org.jeecg.modules.web.dto.ArtSchoolDTO;
import org.jeecg.modules.web.vo.QueryRecommendMajorVO;
import org.jeecg.modules.mini.dto.MiniSchoolDTO;
import org.jeecg.modules.yx.dto.SchoolExportDTO;
import org.jeecg.modules.yx.dto.YxSchoolDTO;
import org.jeecg.modules.yx.entity.*;
import org.jeecg.modules.yx.mapper.YxSchoolMapper;
@ -157,6 +158,11 @@ public class YxSchoolServiceImpl extends ServiceImpl<YxSchoolMapper, YxSchool> i
return baseMapper.queryPageList(page,queryRecommendMajorVO);
}
@Override
public List<SchoolExportDTO> exportList(List<String> schoolIdList) {
return baseMapper.exportList(schoolIdList);
}
///==========================PC端
@Override
public IPage<ArtSchoolDTO> search(QueryRecommendMajorVO queryRecommendMajorVO) {