Commit 6c9514ae authored by zhangweitian's avatar zhangweitian

0717 修改导出EXCEL、根据姓名查询、重名判断

parent dd34250a
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="CheckStyle-IDEA-Module">
<option name="configuration">
<map />
</option>
</component>
<component name="FacetManager"> <component name="FacetManager">
<facet type="jpa" name="JPA"> <facet type="jpa" name="JPA">
<configuration> <configuration>
<setting name="validation-enabled" value="true" /> <setting name="validation-enabled" value="true" />
<datasource-mapping> <datasource-mapping />
<factory-entry name="hmit-admin" />
</datasource-mapping>
<naming-strategy-map /> <naming-strategy-map />
</configuration> </configuration>
</facet> </facet>
......
...@@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -64,17 +65,31 @@ public class WlUploadInfoController { ...@@ -64,17 +65,31 @@ public class WlUploadInfoController {
return new Result<WlUploadInfoDTO>().ok(data); return new Result<WlUploadInfoDTO>().ok(data);
} }
@GetMapping("{name}")
@ApiOperation("信息")
//@RequiresPermissions("competition:wluploadinfo:info")
public Result<List<WlUploadInfoDTO>> selectInfo(@PathVariable("name") String name){
List<WlUploadInfoDTO> data = wlUploadInfoService.selectInfo(name);
return new Result<List<WlUploadInfoDTO>>().ok(data);
}
@PostMapping @PostMapping
@ApiOperation("保存") @ApiOperation("保存")
@LogOperation("保存") @LogOperation("保存")
@RequiresPermissions("competition:wluploadinfo:save") //@RequiresPermissions("competition:wluploadinfo:save")
public Result save(@RequestBody WlUploadInfoDTO dto){ public Result save(@RequestBody WlUploadInfoDTO dto){
//校验数据 //校验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
boolean flag = wlUploadInfoService.isName(dto.getName());
if(flag){
wlUploadInfoService.save(dto);
wlUploadInfoService.save(dto); return new Result();
}else {
return new Result().error();
}
return new Result();
} }
@PutMapping @PutMapping
...@@ -103,14 +118,24 @@ public class WlUploadInfoController { ...@@ -103,14 +118,24 @@ public class WlUploadInfoController {
return new Result(); return new Result();
} }
@GetMapping("export") // @GetMapping("export")
// @ApiOperation("导出")
// @LogOperation("导出")
// @RequiresPermissions("competition:wluploadinfo:export")
// public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
// List<WlUploadInfoDTO> list = wlUploadInfoService.list(params);
// ExcelUtils.exportExcelToTarget(response, "比赛数据", list, WlUploadInfoExcel.class);
// }
@PostMapping("export")
@ApiOperation("导出") @ApiOperation("导出")
@LogOperation("导出") @LogOperation("导出")
@RequiresPermissions("competition:wluploadinfo:export") @RequiresPermissions("competition:wluploadinfo:export")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { public void export(@RequestBody List<Long> checklist, HttpServletResponse response) throws Exception {
List<WlUploadInfoDTO> list = wlUploadInfoService.list(params); List<WlUploadInfoDTO> list = new ArrayList<>();
for(int i=0;i<checklist.size();i++){
ExcelUtils.exportExcelToTarget(response, null, list, WlUploadInfoExcel.class); list.add(wlUploadInfoService.get(checklist.get(i)));
}
ExcelUtils.exportExcelToTarget(response, "比赛数据", list, WlUploadInfoExcel.class);
} }
} }
\ No newline at end of file
package io.hmit.modules.competition.dao; package io.hmit.modules.competition.dao;
import io.hmit.common.dao.BaseDao; import io.hmit.common.dao.BaseDao;
import io.hmit.modules.competition.dto.WlUploadInfoDTO;
import io.hmit.modules.competition.entity.WlUploadInfoEntity; import io.hmit.modules.competition.entity.WlUploadInfoEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 比赛人员信息 * 比赛人员信息
* *
...@@ -12,5 +15,8 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -12,5 +15,8 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface WlUploadInfoDao extends BaseDao<WlUploadInfoEntity> { public interface WlUploadInfoDao extends BaseDao<WlUploadInfoEntity> {
List<WlUploadInfoEntity> selectByName(String name);
int isName(String name);
} }
\ No newline at end of file
...@@ -25,6 +25,9 @@ public class WlUploadInfoDTO implements Serializable { ...@@ -25,6 +25,9 @@ public class WlUploadInfoDTO implements Serializable {
@ApiModelProperty(value = "姓名") @ApiModelProperty(value = "姓名")
private String name; private String name;
@ApiModelProperty(value = "性别")
private String sex;
@ApiModelProperty(value = "工作单位") @ApiModelProperty(value = "工作单位")
private String employer; private String employer;
...@@ -52,9 +55,6 @@ public class WlUploadInfoDTO implements Serializable { ...@@ -52,9 +55,6 @@ public class WlUploadInfoDTO implements Serializable {
@ApiModelProperty(value = "体重") @ApiModelProperty(value = "体重")
private String weight; private String weight;
@ApiModelProperty(value = "衣服型号")
private String ctModel;
@ApiModelProperty(value = "就餐") @ApiModelProperty(value = "就餐")
private String dinner; private String dinner;
......
...@@ -23,6 +23,10 @@ public class WlUploadInfoEntity extends BaseEntity { ...@@ -23,6 +23,10 @@ public class WlUploadInfoEntity extends BaseEntity {
* 姓名 * 姓名
*/ */
private String name; private String name;
/**
* 性别
*/
private String sex;
/** /**
* 工作单位 * 工作单位
*/ */
...@@ -59,10 +63,6 @@ public class WlUploadInfoEntity extends BaseEntity { ...@@ -59,10 +63,6 @@ public class WlUploadInfoEntity extends BaseEntity {
* 体重 * 体重
*/ */
private String weight; private String weight;
/**
* 衣服型号
*/
private String ctModel;
/** /**
* 就餐 * 就餐
*/ */
......
...@@ -17,6 +17,8 @@ public class WlUploadInfoExcel { ...@@ -17,6 +17,8 @@ public class WlUploadInfoExcel {
private Long id; private Long id;
@Excel(name = "姓名") @Excel(name = "姓名")
private String name; private String name;
@Excel(name = "性别")
private String sex;
@Excel(name = "工作单位") @Excel(name = "工作单位")
private String employer; private String employer;
@Excel(name = "职称") @Excel(name = "职称")
...@@ -35,13 +37,11 @@ public class WlUploadInfoExcel { ...@@ -35,13 +37,11 @@ public class WlUploadInfoExcel {
private String height; private String height;
@Excel(name = "体重") @Excel(name = "体重")
private String weight; private String weight;
@Excel(name = "衣服型号")
private String ctModel;
@Excel(name = "就餐") @Excel(name = "就餐")
private String dinner; private String dinner;
@Excel(name = "创建时间") // @Excel(name = "创建时间")
private Date createTime; // private Date createTime;
@Excel(name = "修改时间") // @Excel(name = "修改时间")
private Date updateTime; // private Date updateTime;
} }
\ No newline at end of file
...@@ -4,6 +4,8 @@ import io.hmit.common.service.CrudService; ...@@ -4,6 +4,8 @@ import io.hmit.common.service.CrudService;
import io.hmit.modules.competition.dto.WlUploadInfoDTO; import io.hmit.modules.competition.dto.WlUploadInfoDTO;
import io.hmit.modules.competition.entity.WlUploadInfoEntity; import io.hmit.modules.competition.entity.WlUploadInfoEntity;
import java.util.List;
/** /**
* 比赛人员信息 * 比赛人员信息
* *
...@@ -12,4 +14,7 @@ import io.hmit.modules.competition.entity.WlUploadInfoEntity; ...@@ -12,4 +14,7 @@ import io.hmit.modules.competition.entity.WlUploadInfoEntity;
*/ */
public interface WlUploadInfoService extends CrudService<WlUploadInfoEntity, WlUploadInfoDTO> { public interface WlUploadInfoService extends CrudService<WlUploadInfoEntity, WlUploadInfoDTO> {
List<WlUploadInfoDTO> selectInfo(String name);
boolean isName(String name);
} }
\ No newline at end of file
...@@ -2,13 +2,18 @@ package io.hmit.modules.competition.service.impl; ...@@ -2,13 +2,18 @@ package io.hmit.modules.competition.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl; import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.ConvertUtils;
import io.hmit.modules.activiti.dto.HistoryDetailDTO;
import io.hmit.modules.competition.dao.WlUploadInfoDao; import io.hmit.modules.competition.dao.WlUploadInfoDao;
import io.hmit.modules.competition.dto.WlUploadInfoDTO; import io.hmit.modules.competition.dto.WlUploadInfoDTO;
import io.hmit.modules.competition.entity.WlUploadInfoEntity; import io.hmit.modules.competition.entity.WlUploadInfoEntity;
import io.hmit.modules.competition.service.WlUploadInfoService; import io.hmit.modules.competition.service.WlUploadInfoService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -31,4 +36,27 @@ public class WlUploadInfoServiceImpl extends CrudServiceImpl<WlUploadInfoDao, Wl ...@@ -31,4 +36,27 @@ public class WlUploadInfoServiceImpl extends CrudServiceImpl<WlUploadInfoDao, Wl
} }
@Override
public List<WlUploadInfoDTO> selectInfo(String name) {
List<WlUploadInfoEntity> wlList =baseDao.selectByName(name);
List<WlUploadInfoDTO> finallist =new ArrayList<>();
// ConvertUtils.sourceToTarget(finallist,WlUploadInfoEntity.class);
for(WlUploadInfoEntity wlUploadInfoEntity:wlList){
WlUploadInfoDTO wlInfo = new WlUploadInfoDTO();
BeanUtils.copyProperties(wlUploadInfoEntity,wlInfo);
finallist.add(wlInfo);
}
return finallist;
}
@Override
public boolean isName(String name) {
int count = baseDao.isName(name);
System.out.println(count);
if(count==0){
return true;
}else {
return false;
}
}
} }
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<resultMap type="io.hmit.modules.competition.entity.WlUploadInfoEntity" id="wlUploadInfoMap"> <resultMap type="io.hmit.modules.competition.entity.WlUploadInfoEntity" id="wlUploadInfoMap">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="name" column="name"/> <result property="name" column="name"/>
<result property="sex" column="sex"/>
<result property="employer" column="employer"/> <result property="employer" column="employer"/>
<result property="job" column="job"/> <result property="job" column="job"/>
<result property="email" column="email"/> <result property="email" column="email"/>
...@@ -15,11 +16,15 @@ ...@@ -15,11 +16,15 @@
<result property="phone" column="phone"/> <result property="phone" column="phone"/>
<result property="height" column="height"/> <result property="height" column="height"/>
<result property="weight" column="weight"/> <result property="weight" column="weight"/>
<result property="ctModel" column="ct_model"/>
<result property="dinner" column="dinner"/> <result property="dinner" column="dinner"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
</resultMap> </resultMap>
<select id="selectByName" resultMap="wlUploadInfoMap">
select * from wl_upload_info where name like concat('%',#{name},'%')
</select>
<select id="isName" resultType="java.lang.Integer">
select count(*) from wl_upload_info where name = #{name}
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="CheckStyle-IDEA-Module">
<option name="configuration">
<map />
</option>
</component>
<component name="FacetManager"> <component name="FacetManager">
<facet type="Spring" name="Spring"> <facet type="Spring" name="Spring">
<configuration /> <configuration />
......
...@@ -67,13 +67,19 @@ public class WlUploadInfoController { ...@@ -67,13 +67,19 @@ public class WlUploadInfoController {
@PostMapping @PostMapping
@ApiOperation("保存") @ApiOperation("保存")
@LogOperation("保存") @LogOperation("保存")
//@RequiresPermissions("competition:wluploadinfo:save")
public Result save(@RequestBody WlUploadInfoDTO dto){ public Result save(@RequestBody WlUploadInfoDTO dto){
//校验数据 //校验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
boolean flag = wlUploadInfoService.isName(dto.getName());
if(flag){
wlUploadInfoService.save(dto);
wlUploadInfoService.save(dto); return new Result();
}else {
return new Result().error();
}
return new Result();
} }
@PutMapping @PutMapping
......
...@@ -12,5 +12,6 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -12,5 +12,6 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface WlUploadInfoDao extends BaseDao<WlUploadInfoEntity> { public interface WlUploadInfoDao extends BaseDao<WlUploadInfoEntity> {
int isName(String name);
} }
\ No newline at end of file
...@@ -25,6 +25,9 @@ public class WlUploadInfoDTO implements Serializable { ...@@ -25,6 +25,9 @@ public class WlUploadInfoDTO implements Serializable {
@ApiModelProperty(value = "姓名") @ApiModelProperty(value = "姓名")
private String name; private String name;
@ApiModelProperty(value = "性别")
private String sex;
@ApiModelProperty(value = "工作单位") @ApiModelProperty(value = "工作单位")
private String employer; private String employer;
...@@ -52,8 +55,6 @@ public class WlUploadInfoDTO implements Serializable { ...@@ -52,8 +55,6 @@ public class WlUploadInfoDTO implements Serializable {
@ApiModelProperty(value = "体重") @ApiModelProperty(value = "体重")
private String weight; private String weight;
@ApiModelProperty(value = "衣服型号")
private String ctModel;
@ApiModelProperty(value = "就餐") @ApiModelProperty(value = "就餐")
private String dinner; private String dinner;
......
...@@ -23,6 +23,10 @@ public class WlUploadInfoEntity extends BaseEntity { ...@@ -23,6 +23,10 @@ public class WlUploadInfoEntity extends BaseEntity {
* 姓名 * 姓名
*/ */
private String name; private String name;
/**
* 性别
*/
private String sex;
/** /**
* 工作单位 * 工作单位
*/ */
...@@ -59,10 +63,6 @@ public class WlUploadInfoEntity extends BaseEntity { ...@@ -59,10 +63,6 @@ public class WlUploadInfoEntity extends BaseEntity {
* 体重 * 体重
*/ */
private String weight; private String weight;
/**
* 衣服型号
*/
private String ctModel;
/** /**
* 就餐 * 就餐
*/ */
......
...@@ -12,4 +12,5 @@ import io.hmit.entity.WlUploadInfoEntity; ...@@ -12,4 +12,5 @@ import io.hmit.entity.WlUploadInfoEntity;
*/ */
public interface WlUploadInfoService extends CrudService<WlUploadInfoEntity, WlUploadInfoDTO> { public interface WlUploadInfoService extends CrudService<WlUploadInfoEntity, WlUploadInfoDTO> {
boolean isName(String name);
} }
\ No newline at end of file
...@@ -31,4 +31,14 @@ public class WlUploadInfoServiceImpl extends CrudServiceImpl<WlUploadInfoDao, Wl ...@@ -31,4 +31,14 @@ public class WlUploadInfoServiceImpl extends CrudServiceImpl<WlUploadInfoDao, Wl
} }
@Override
public boolean isName(String name) {
int count = baseDao.isName(name);
System.out.println(count);
if(count==0){
return true;
}else {
return false;
}
}
} }
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<resultMap type="io.hmit.entity.WlUploadInfoEntity" id="wlUploadInfoMap"> <resultMap type="io.hmit.entity.WlUploadInfoEntity" id="wlUploadInfoMap">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="name" column="name"/> <result property="name" column="name"/>
<result property="sex" column="sex"/>
<result property="employer" column="employer"/> <result property="employer" column="employer"/>
<result property="job" column="job"/> <result property="job" column="job"/>
<result property="email" column="email"/> <result property="email" column="email"/>
...@@ -15,11 +16,13 @@ ...@@ -15,11 +16,13 @@
<result property="phone" column="phone"/> <result property="phone" column="phone"/>
<result property="height" column="height"/> <result property="height" column="height"/>
<result property="weight" column="weight"/> <result property="weight" column="weight"/>
<result property="ctModel" column="ct_model"/>
<result property="dinner" column="dinner"/> <result property="dinner" column="dinner"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
</resultMap> </resultMap>
<select id="isName" resultType="java.lang.Integer">
select count(*) from wl_upload_info where name = #{name}
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment