行业清单
This commit is contained in:
parent
3e13b54e3c
commit
57a892fbca
|
|
@ -3,6 +3,8 @@ package com.rzyc.mapper.ent;
|
|||
import com.rzyc.model.ent.InListItem;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 行业清单项 Mapper 接口
|
||||
|
|
@ -13,4 +15,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
*/
|
||||
public interface InListItemMapper extends BaseMapper<InListItem> {
|
||||
|
||||
List<String> SelectContents();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
package com.rzyc.model.dto;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
@TableName("in_list")
|
||||
@ApiModel(value="InList对象", description="行业清单")
|
||||
public class InListAddDto {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "清单名")
|
||||
@TableId("name")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "清单排序")
|
||||
@TableId("sort_id")
|
||||
private Integer sortId;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getSortId() {
|
||||
return sortId;
|
||||
}
|
||||
|
||||
public void setSortId(Integer sortId) {
|
||||
this.sortId = sortId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "InListAddDto{" +
|
||||
"name='" + name + '\'' +
|
||||
", sortId=" + sortId +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +1,39 @@
|
|||
package com.rzyc.model.dto;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
@TableName("in_list")
|
||||
@ApiModel(value="InList对象", description="行业清单")
|
||||
public class InListDto {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "主键id")
|
||||
@TableId("list_id")
|
||||
private String listId;
|
||||
|
||||
@ApiModelProperty(value = "清单名")
|
||||
@TableId("name")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "行业清单id")
|
||||
private String list_id;
|
||||
|
||||
@ApiModelProperty(value = "清单排序")
|
||||
private Integer sort_id;
|
||||
@TableId("sort_id")
|
||||
private Integer sortId;
|
||||
|
||||
@ApiModelProperty(value = "删除状态 1:正常 2:已删除")
|
||||
@TableId("del_state")
|
||||
private Integer delState;
|
||||
|
||||
public String getListId() {
|
||||
return listId;
|
||||
}
|
||||
|
||||
public void setListId(String listId) {
|
||||
this.listId = listId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
|
|
@ -24,19 +43,29 @@ public class InListDto {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public String getList_id() {
|
||||
return list_id;
|
||||
public Integer getSortId() {
|
||||
return sortId;
|
||||
}
|
||||
|
||||
public void setList_id(String list_id) {
|
||||
this.list_id = list_id;
|
||||
public void setSortId(Integer sortId) {
|
||||
this.sortId = sortId;
|
||||
}
|
||||
|
||||
public Integer getSort_id() {
|
||||
return sort_id;
|
||||
public Integer getDelState() {
|
||||
return delState;
|
||||
}
|
||||
|
||||
public void setSort_id(Integer sort_id) {
|
||||
this.sort_id = sort_id;
|
||||
public void setDelState(Integer delState) {
|
||||
this.delState = delState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "InListDto{" +
|
||||
"listId='" + listId + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", sortId=" + sortId +
|
||||
", delState=" + delState +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ public class InListItemAddDto {
|
|||
@ApiModelProperty(value = "行业id")
|
||||
private String industryId;
|
||||
|
||||
@ApiModelProperty(value = "清单标题")
|
||||
private String itemTitle;
|
||||
|
||||
@ApiModelProperty(value = "清单内容")
|
||||
private String itemContent;
|
||||
|
||||
|
|
@ -50,6 +53,13 @@ public class InListItemAddDto {
|
|||
private String itemLaw;
|
||||
|
||||
|
||||
public String getItemTitle() {
|
||||
return itemTitle;
|
||||
}
|
||||
|
||||
public void setItemTitle(String itemTitle) {
|
||||
this.itemTitle = itemTitle;
|
||||
}
|
||||
|
||||
public String getItemId() {
|
||||
return itemId;
|
||||
|
|
@ -138,6 +148,7 @@ public class InListItemAddDto {
|
|||
"itemId='" + itemId + '\'' +
|
||||
", listId='" + listId + '\'' +
|
||||
", industryId='" + industryId + '\'' +
|
||||
", itemTitle='" + itemTitle + '\'' +
|
||||
", itemContent='" + itemContent + '\'' +
|
||||
", standard=" + standard +
|
||||
", frequency=" + frequency +
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
package com.rzyc.model.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @版本号
|
||||
* @Author qcl
|
||||
* @date 2022/9/28&10:45
|
||||
*/
|
||||
public class InListPageDto extends InListItemDto {
|
||||
|
||||
@NotNull(message = "页码不为空")
|
||||
@ApiModelProperty(value = "页码",required = true,example = "1")
|
||||
private Integer page;
|
||||
|
||||
@NotNull(message = "每页条数不为空")
|
||||
@ApiModelProperty(value = "每页条数",required = true,example = "1")
|
||||
private Integer pageSize;
|
||||
|
||||
public Integer getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(Integer page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
}
|
||||
|
|
@ -54,6 +54,13 @@ public class InList implements Serializable {
|
|||
@TableField("modify_by")
|
||||
private String modifyBy;
|
||||
|
||||
public Integer getDelState() {
|
||||
return delState;
|
||||
}
|
||||
|
||||
public void setDelState(Integer delState) {
|
||||
this.delState = delState;
|
||||
}
|
||||
|
||||
public String getListId() {
|
||||
return listId;
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ public class InListItem implements Serializable {
|
|||
@TableField("modify_by")
|
||||
private String modifyBy;
|
||||
|
||||
|
||||
public String getItemTitle() {
|
||||
return itemTitle;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,4 +29,8 @@
|
|||
item_basis, item_proof, item_law, sort_id, del_state,create_time, create_by, modify_time, modify_by
|
||||
</sql>
|
||||
|
||||
<select id="SelectContents" resultMap="BaseResultMap">
|
||||
select item_content from in_list_item;
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.rzyc.controller;
|
|||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.common.utils.DateUtils;
|
||||
import com.common.utils.RandomNumber;
|
||||
import com.common.utils.StringUtils;
|
||||
import com.common.utils.TypeConversion;
|
||||
|
|
@ -9,10 +10,9 @@ import com.common.utils.model.MultiResult;
|
|||
import com.common.utils.model.Pager;
|
||||
import com.common.utils.model.SingleResult;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.rzyc.mapper.ent.InListMapper;
|
||||
import com.rzyc.model.dto.InListDto;
|
||||
import com.rzyc.model.dto.InListItemAddDto;
|
||||
import com.rzyc.model.dto.InListItemDto;
|
||||
import com.rzyc.model.dto.*;
|
||||
import com.rzyc.model.ent.BaseInClass;
|
||||
import com.rzyc.model.ent.InList;
|
||||
import com.rzyc.model.ent.InListItem;
|
||||
|
|
@ -25,10 +25,20 @@ import springfox.documentation.service.ApiListing;
|
|||
|
||||
import javax.swing.*;
|
||||
import javax.validation.Valid;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @版本号
|
||||
* @Author qcl
|
||||
* @date 2022/9/20&14:59
|
||||
*/
|
||||
|
||||
|
||||
@Api(tags = "行业清单")
|
||||
@CrossOrigin("*")
|
||||
@RequestMapping("industryList")
|
||||
|
|
@ -82,6 +92,27 @@ public class IndustryListController extends BaseController{
|
|||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增行业清单分类", notes = "新增行业清单分类")
|
||||
@PostMapping("/industryListAdd")
|
||||
@ResponseBody
|
||||
public MultiResult<String> industryListAdd(@Valid @RequestBody InListAddDto inListAddDto){
|
||||
|
||||
MultiResult<String> result = new MultiResult<>();
|
||||
InList inList = new InList();
|
||||
//前端数据拷贝至对象
|
||||
BeanUtils.copyProperties(inListAddDto,inList);
|
||||
if(StringUtils.isBlank(inList.getListId())){
|
||||
//补全对象其余字段
|
||||
inList.setListId(RandomNumber.getUUid());
|
||||
inList.setDelState(1);
|
||||
inList.setCreateTime(new Date());
|
||||
//TODO:创建人取父级id,但是行业父级表与清单表未关联
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询行业清单的所属清单项
|
||||
|
|
@ -89,6 +120,18 @@ public class IndustryListController extends BaseController{
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
// @ApiOperation(value = "所属清单项列表", notes = "所属清单项列表")
|
||||
// @GetMapping("/industryListItemSelect")
|
||||
// @ResponseBody
|
||||
// public SingleResult<Pager<String>> industryListItemSelect(@RequestBody InListPageDto inListPageDto){
|
||||
// SingleResult<Pager<String>> result = new SingleResult<>();
|
||||
// Pager<String> pager = new Pager<>();
|
||||
// PageHelper.startPage(inListPageDto.getPage(),inListPageDto.getPageSize());
|
||||
// Page<String> page = (Page<String>)inListItemMapper.SelectContents();
|
||||
// getDatePage(pager,page);
|
||||
// result.setData(pager);
|
||||
// return result;
|
||||
// }
|
||||
@ApiOperation(value = "所属清单项列表", notes = "所属清单项列表")
|
||||
@GetMapping("/industryListItemSelect")
|
||||
@ResponseBody
|
||||
|
|
@ -97,7 +140,7 @@ public class IndustryListController extends BaseController{
|
|||
ArrayList<String> contentList = new ArrayList<>();
|
||||
LambdaQueryWrapper<InListItem> lambdaQueryWrapper = new LambdaQueryWrapper();
|
||||
LambdaQueryWrapper<InListItem> queryWrapper = lambdaQueryWrapper
|
||||
.eq(InListItem::getListId, inListDto.getList_id());
|
||||
.eq(InListItem::getListId, inListDto.getListId());
|
||||
List<InListItem> inListItems = inListItemMapper.selectList(queryWrapper);
|
||||
|
||||
//取出对象的content字段放入集合
|
||||
|
|
@ -108,6 +151,8 @@ public class IndustryListController extends BaseController{
|
|||
result.setData(contentList);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除清单项
|
||||
* @param inListItemDto
|
||||
|
|
@ -122,11 +167,11 @@ public class IndustryListController extends BaseController{
|
|||
}
|
||||
|
||||
/**
|
||||
* 新增清单项
|
||||
* 新增或修改清单项
|
||||
* @param inListItemAddDto
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "新增清单项", notes = "新增清单项")
|
||||
@ApiOperation(value = "新增或修改清单项", notes = "新增或修改清单项")
|
||||
@PostMapping("/insertInListItem")
|
||||
@ResponseBody
|
||||
public SingleResult<String> insertInListItem(@Valid @RequestBody InListItemAddDto inListItemAddDto)throws Exception{
|
||||
|
|
@ -141,13 +186,21 @@ public class IndustryListController extends BaseController{
|
|||
return result;
|
||||
}
|
||||
if(StringUtils.isBlank(inListItem.getItemId())){
|
||||
//id为空就新增数据
|
||||
inListItem.setItemId(RandomNumber.getUUid());
|
||||
inListItem.setCreateTime(new Date());
|
||||
inListItem.setCreateBy(inList.getListId());
|
||||
inListItem.setDelState(1);
|
||||
inListItem.setIndustryId(baseInClass.getBaseinclassid());
|
||||
|
||||
inListItemMapper.insert(inListItem);
|
||||
}else {
|
||||
//TODO:修改id如何传入,传谁问题
|
||||
//不为空就修改
|
||||
inListItem.setModifyTime(new Date());
|
||||
inListItem.setModifyBy(inList.getListId());
|
||||
//inListItem.setIndustryId(baseInClass.getBaseinclassid());
|
||||
inListItemMapper.updateById(inListItem);
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -155,4 +208,39 @@ public class IndustryListController extends BaseController{
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param is
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "上传文件", notes = "上传文件")
|
||||
@PostMapping("/uploadFile")
|
||||
public static String uploadFile(InputStream is, String name, String fileHeader, String fileLocation)throws Exception{
|
||||
String url = fileHeader;
|
||||
String time = DateUtils.getNowDateTimeStr("yyyyMMdd");
|
||||
FileOutputStream fos = null;
|
||||
String folder = fileLocation+time;
|
||||
|
||||
File secondFolder = new File(folder);
|
||||
if(!secondFolder.exists()){
|
||||
secondFolder.mkdirs();
|
||||
}
|
||||
String suffix = name.substring(name.lastIndexOf(".")+1,name.length());
|
||||
String fileName = RandomNumber.randomUUidPK()+"."+suffix;
|
||||
String timeandfilename=time+"/"+fileName;
|
||||
url+=time+"/"+fileName;
|
||||
String fileAddress = folder+"/"+fileName;
|
||||
fos = new FileOutputStream(fileAddress);
|
||||
byte buffer[]=new byte[4*1024];
|
||||
int len = 0;
|
||||
while((len = is.read(buffer)) != -1)
|
||||
{
|
||||
fos.write(buffer,0,len);
|
||||
}
|
||||
fos.close();
|
||||
is.close();
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user