一 、前端全选之后,导出所勾选的数据的word
easypoi 4.1.2
二、 项目结构
三、word模板
四、代码实现
1、controller层
@ApiOperation(value = "批量导出word", notes = "批量导出word") @PostMapping("/exportDocs") public void exportDocs(HttpServletResponse response,@RequestBody Long[] ids) { actorService.exportDocs(response,ids); }
2、service层
void exportDocs(HttpServletResponse response,Long[] ids);
3.serviceimpl层
@Override @Transactional public void exportDocs(HttpServletResponse response,Long[] ids) { Listlist= baseMapper.batchEduActor(Arrays.asList(ids)); Map map = new HashMap (); for(int i =0;i 4.mapper层
ListbatchEduActor(List ids); 5.xml
select * from edu_actor id in ( #{id} )6.entity
@Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @ApiModel(value="EduActor对象", description="演员") public class EduActor implements Serializable { private static final long serialVersionUID = 1L; @Excel(name = "演员ID") @ApiModelProperty(value = "演员ID") @JsonSerialize(using= ToStringSerializer.class) @TableId(type = IdType.ID_WORKER) private Long id; @Excel(name = "演员姓名") @ApiModelProperty(value = "演员姓名") private String name; @Excel(name = "演员简介") @ApiModelProperty(value = "演员简介") private String intro; @Excel(name = "演员资历") @ApiModelProperty(value = "演员资历,一句话说明演员") private String career; @Excel(name = "头衔") @ApiModelProperty(value = "头衔 1高级演员 2首席演员") private Integer level; @Excel(name = "演员头像") @ApiModelProperty(value = "演员头像") private String avatar; @Excel(name = "排序") @ApiModelProperty(value = "排序") private Integer sort; @Excel(name = "逻辑删除") @ApiModelProperty(value = "逻辑删除 1(true)已删除, 0(false)未删除") @TableLogic // @TableField(fill = FieldFill.INSERT) private Integer isDeleted; @Excel(name = "创建时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8") @ApiModelProperty(value = "创建时间") private LocalDateTime gmtCreate; @Excel(name = "更新时间") // @TableField(fill = FieldFill.INSERT_UPDATE) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8") @ApiModelProperty(value = "更新时间") private LocalDateTime gmtModified; }五、测试
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)