1.创建一个vo
SkAwardsVo
package org.jeecg.modules.sk.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecg.modules.sk.entity.SkAwards;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Description: 获奖情况表
* @Author: jeecg-boot
* @Date: 2020-03-31
* @Version: V1.0
*/
@Data
public class SkAwardsVo {
/**个人获奖数组形式*/
@Excel(name = "获奖类型数组", width = 15)
@ApiModelProperty(value = "获奖类型数组")
private String arrayOne;
List<SkAwards> list;
}
2.Controller层
list
@GetMapping(value = "/listnew")
@ApiOperation(value = "获奖情况表-分页列表查询", notes = "获奖情况表-分页列表查询")
/* @RequiresPermissions("skAwards:list")*/
public Result<?> queryPageListlistnew(SkAwards skAwards,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<SkAwards> queryWrapper = QueryGenerator.initQueryWrapper(skAwards, req.getParameterMap());
Page<SkAwards> page = new Page<SkAwards>(pageNo, pageSize);
//IPage<SkAwards> pageList = skAwardsService.page(page, queryWrapper);
QueryWrapper<SkAwards> queryWrappernew = new QueryWrapper();
queryWrappernew.eq("individual_awards", "2");//学生
List<SkAwards> skAwardsList = skAwardsService.list(queryWrappernew);
List<SkAwardsVo> skAwardslist = new ArrayList<>();
SkAwardsVo skAwardsVo = new SkAwardsVo();
skAwardsVo.setList(skAwardsList);
skAwardsVo.setArrayOne("学生获奖");
skAwardslist.add(skAwardsVo);
QueryWrapper<SkAwards> queryWrappernew1 = new QueryWrapper();
queryWrappernew1.eq("individual_awards", "1");//个人
List<SkAwards> skAwardsList1 = skAwardsService.list(queryWrappernew1);
List<SkAwardsVo> skAwardslist1 = new ArrayList<>();
SkAwardsVo skAwardsVo1 = new SkAwardsVo();
skAwardsVo1.setList(skAwardsList1);
skAwardsVo1.setArrayOne("个人获奖");
skAwardslist1.add(skAwardsVo1);
skAwardslist1.add(skAwardsVo);
return Result.ok(skAwardslist1);
}