标签管理-标签项修改&补充

This commit is contained in:
xiejunyu
2022-02-12 17:10:03 +08:00
parent 73eaa05cd6
commit cac1d0b73b
12 changed files with 110 additions and 71 deletions
@@ -13,13 +13,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -1,21 +1,18 @@
package com.jero.modules.document.entity; package com.jero.modules.document.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/** /**
@@ -1,8 +1,8 @@
package com.jero.modules.document.service; package com.jero.modules.document.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@@ -22,12 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -36,7 +36,7 @@ import java.util.List;
public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgformTagService> { public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgformTagService> {
@Autowired @Autowired
private IOnlCgformTagService onlCgformTagService; private IOnlCgformTagService onlCgformTagService;
/** /**
* 分页列表查询 * 分页列表查询
* *
@@ -82,6 +82,7 @@ public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgf
@ApiOperation(value="标签管理-添加", notes="标签管理-添加") @ApiOperation(value="标签管理-添加", notes="标签管理-添加")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<?> add(@Validated @RequestBody OnlCgformTag onlCgformTag) { public Result<?> add(@Validated @RequestBody OnlCgformTag onlCgformTag) {
onlCgformTagService.queryExitData(onlCgformTag);
onlCgformTagService.add(onlCgformTag); onlCgformTagService.add(onlCgformTag);
return Result.OK("添加成功!"); return Result.OK("添加成功!");
} }
@@ -60,21 +60,26 @@ public class OnlCgformArea implements Serializable {
/**展示区域(1基本信息,2文本信息,3关联关系)*/ /**展示区域(1基本信息,2文本信息,3关联关系)*/
@Excel(name = "展示区域(1基本信息,2文本信息,3关联关系)", width = 15) @Excel(name = "展示区域(1基本信息,2文本信息,3关联关系)", width = 15)
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "展示区域(1基本信息,2文本信息,3关联关系)") @ApiModelProperty(value = "展示区域(1基本信息,2文本信息,3关联关系)")
private java.lang.String showArea; private java.lang.String showArea;
/**英文名称*/ /**英文名称*/
@Excel(name = "英文名称", width = 15) @Excel(name = "英文名称", width = 15)
@javax.validation.constraints.Pattern(regexp = "^[A-Za-z]*(\\s[A-Za-z]*)*$",message = "请输入正确的英文名称")
@ApiModelProperty(value = "英文名称") @ApiModelProperty(value = "英文名称")
private java.lang.String enName; private java.lang.String enName;
/**所属模块(1文档库,0文档拆分)*/ /**所属模块(1文档库,0文档拆分)*/
@Excel(name = "所属模块(1文档库,0文档拆分)", width = 15) @Excel(name = "所属模块(1文档库,0文档拆分)", width = 15)
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "所属模块(1文档库,0文档拆分)") @ApiModelProperty(value = "所属模块(1文档库,0文档拆分)")
private java.lang.String isModel; private java.lang.String isModel;
/**排序号*/ /**排序号*/
@Excel(name = "排序号", width = 15) @Excel(name = "排序号", width = 15)
@javax.validation.constraints.Pattern(regexp = "^-?[1-9]\\d+$",message = "请输入正确的整数")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "排序号") @ApiModelProperty(value = "排序号")
private java.lang.Integer sort; private java.lang.Integer sort;
@@ -62,11 +62,13 @@ public class OnlCgformTag implements Serializable {
/**所属模块(1文档库,0文档拆分*/ /**所属模块(1文档库,0文档拆分*/
@Excel(name = "所属模块(1文档库,0文档拆分", width = 15, dictTable = "onl_cgform_area", dicText = "所属模块", dicCode = "is_model") @Excel(name = "所属模块(1文档库,0文档拆分", width = 15, dictTable = "onl_cgform_area", dicText = "所属模块", dicCode = "is_model")
@Dict(dictTable = "onl_cgform_area", dicText = "所属模块", dicCode = "is_model") @Dict(dictTable = "onl_cgform_area", dicText = "所属模块", dicCode = "is_model")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "所属模块(1文档库,0文档拆分") @ApiModelProperty(value = "所属模块(1文档库,0文档拆分")
private String isModel; private String isModel;
/**字段备注*/ /**字段备注*/
@Excel(name = "字段备注", width = 15) @Excel(name = "字段备注", width = 15)
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "字段备注") @ApiModelProperty(value = "字段备注")
private String dbFieldTxt; private String dbFieldTxt;
@@ -78,70 +80,82 @@ public class OnlCgformTag implements Serializable {
/**表单控件类型*/ /**表单控件类型*/
@Excel(name = "表单控件类型", width = 15, dictTable = "onl_cgform_field", dicText = "属性类型", dicCode = "field_show_type") @Excel(name = "表单控件类型", width = 15, dictTable = "onl_cgform_field", dicText = "属性类型", dicCode = "field_show_type")
@Dict(dictTable = "onl_cgform_field", dicText = "属性类型", dicCode = "field_show_type") @Dict(dictTable = "onl_cgform_field", dicText = "属性类型", dicCode = "field_show_type")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "表单控件类型") @ApiModelProperty(value = "表单控件类型")
private String fieldShowType; private String fieldShowType;
/**字典名称*/ /**字典名称*/
@Excel(name = "字典名称", width = 15, dictTable = "sys_dict", dicText = "选项内容", dicCode = "dict_name") @Excel(name = "字典名称", width = 15, dictTable = "sys_dict", dicText = "选项内容", dicCode = "dict_name")
@Dict(dictTable = "sys_dict", dicText = "选项内容", dicCode = "dict_name") @Dict(dictTable = "sys_dict", dicText = "选项内容", dicCode = "dict_name")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "字典名称") @ApiModelProperty(value = "字典名称")
private String dictName; private String dictName;
/**数据库字段长度*/ /**数据库字段长度*/
@Excel(name = "数据库字段长度", width = 15) @Excel(name = "数据库字段长度", width = 15)
@javax.validation.constraints.Pattern(regexp = "^-?[1-9]\\d+$",message = "请输入正确的整数")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "数据库字段长度") @ApiModelProperty(value = "数据库字段长度")
private Integer dbLength; private Integer dbLength;
/**排序*/ /**排序*/
@Excel(name = "排序", width = 15) @Excel(name = "排序", width = 15)
@javax.validation.constraints.Pattern(regexp = "^-?[1-9]\\d+$",message = "请输入正确的整数")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "排序") @ApiModelProperty(value = "排序")
private Integer orderNum; private Integer orderNum;
/**字段是否必填0否 1是*/ /**字段是否必填0否 1是*/
@Excel(name = "字段是否必填0否 1是", width = 15, dicCode = "yn") @Excel(name = "字段是否必填0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "是否必填", dicCode = "field_must_input")
@Dict(dicCode = "yn") @Dict(dictTable = "onl_cgform_field", dicText = "是否必填", dicCode = "field_must_input")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "字段是否必填0否 1是") @ApiModelProperty(value = "字段是否必填0否 1是")
private String fieldMustInput; private String fieldMustInput;
/**表单是否显示0否 1是*/ /**表单是否显示0否 1是*/
@Excel(name = "表单是否显示0否 1是", width = 15, dicCode = "yn") @Excel(name = "表单是否显示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "文档库列表展示", dicCode = "is_show_form")
@Dict(dicCode = "yn") @Dict(dictTable = "onl_cgform_field", dicText = "文档库列表展示", dicCode = "is_show_form")
@javax.validation.constraints.Pattern(regexp = "^-?[1-9]\\d+$",message = "请输入正确的整数")
@ApiModelProperty(value = "表单是否显示0否 1是") @ApiModelProperty(value = "表单是否显示0否 1是")
private Integer isShowForm; private Integer isShowForm;
/**列表是否显示0否 1是*/ /* *//**列表是否显示0否 1是*//*
@Excel(name = "列表是否显示0否 1是", width = 15, dicCode = "yn") @Excel(name = "列表是否显示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "", dicCode = "is_show_list")
@Dict(dicCode = "yn") @Dict(dictTable = "onl_cgform_field", dicText = "", dicCode = "is_show_list")
@ApiModelProperty(value = "列表是否显示0否 1是") @ApiModelProperty(value = "列表是否显示0否 1是")
private Integer isShowList; private Integer isShowList;
/**是否是只读(1是 0否)*/ *//*//***是否是只读(1是 0否)*//*
@Excel(name = "是否是只读(1是 0否)", width = 15, dicCode = "yn") @Excel(name = "是否是只读(1是 0否)", width = 15, dictTable = "onl_cgform_field", dicText = "", dicCode = "is_read_only")
@Dict(dicCode = "yn") @Dict(dictTable = "onl_cgform_field", dicText = "", dicCode = "is_read_only")
@ApiModelProperty(value = "是否是只读(1是 0否)") @ApiModelProperty(value = "是否是只读(1是 0否)")
private Integer isReadOnly; private Integer isReadOnly;*/
/**展示区域*/ /**展示区域*/
@Excel(name = "展示区域", width = 15, dictTable = "onl_cgform_area", dicText = "展示区域", dicCode = "show_area") @Excel(name = "展示区域", width = 15, dictTable = "onl_cgform_area", dicText = "展示区域", dicCode = "show_area")
@Dict(dictTable = "onl_cgform_area", dicText = "展示区域", dicCode = "show_area") @Dict(dictTable = "onl_cgform_area", dicText = "展示区域", dicCode = "show_area")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "展示区域") @ApiModelProperty(value = "展示区域")
private String showArea; private String showArea;
/**是否查询条件0否 1是*/ /**是否查询条件0否 1是*/
@Excel(name = "是否查询条件0否 1是", width = 15, dicCode = "yn") @Excel(name = "是否查询条件0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "是否搜索", dicCode = "is_query")
@Dict(dicCode = "yn") @Dict(dictTable = "onl_cgform_field", dicText = "是否搜索", dicCode = "is_query")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "是否查询条件0否 1是") @ApiModelProperty(value = "是否查询条件0否 1是")
private Integer isQuery; private Integer isQuery;
/**法规清单是否展示0否 1是*/ /**法规清单是否展示0否 1是*/
@Excel(name = "法规清单是否展示0否 1是", width = 15, dicCode = "yn") @Excel(name = "法规清单是否展示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "法规清单展示", dicCode = "is_show_laws_list")
@Dict(dicCode = "yn") @Dict(dictTable = "onl_cgform_field", dicText = "法规清单展示", dicCode = "is_show_laws_list")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "法规清单是否展示0否 1是") @ApiModelProperty(value = "法规清单是否展示0否 1是")
private Integer isShowLawsList; private Integer isShowLawsList;
/**搜索中心是否展示0否 1是*/ /**搜索中心是否展示0否 1是*/
@Excel(name = "搜索中心是否展示0否 1是", width = 15, dicCode = "yn") @Excel(name = "搜索中心是否展示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "搜索中心展示", dicCode = "is_show_search")
@Dict(dicCode = "yn") @Dict(dictTable = "onl_cgform_field", dicText = "搜索中心展示", dicCode = "is_show_search")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "搜索中心是否展示0否 1是") @ApiModelProperty(value = "搜索中心是否展示0否 1是")
private Integer isShowSearch; private Integer isShowSearch;
@@ -1,10 +1,7 @@
package com.jero.modules.tag.mapper; package com.jero.modules.tag.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.jero.modules.tag.entity.OnlCgformTag;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jero.modules.tag.entity.OnlCgformTag;
/** /**
* @Description: 标签管理 * @Description: 标签管理
@@ -1,7 +1,8 @@
package com.jero.modules.tag.service; package com.jero.modules.tag.service;
import com.jero.modules.tag.entity.OnlCgformArea;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.tag.entity.OnlCgformArea;
import java.util.List; import java.util.List;
/** /**
@@ -1,7 +1,9 @@
package com.jero.modules.tag.service; package com.jero.modules.tag.service;
import com.jero.modules.tag.entity.OnlCgformTag;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.common.api.vo.Result;
import com.jero.modules.tag.entity.OnlCgformTag;
import java.util.List; import java.util.List;
/** /**
@@ -58,4 +60,11 @@ public interface IOnlCgformTagService extends IService<OnlCgformTag> {
* @return * @return
*/ */
List<OnlCgformTag> queryList(); List<OnlCgformTag> queryList();
/**
* 同一“所属模块”下的“属性名称”不能重复
*
* @return
*/
Result<?> queryExitData(OnlCgformTag onlCgformTag) ;
} }
@@ -1,12 +1,16 @@
package com.jero.modules.tag.service.impl; package com.jero.modules.tag.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.api.vo.Result;
import com.jero.modules.tag.entity.OnlCgformTag; import com.jero.modules.tag.entity.OnlCgformTag;
import com.jero.modules.tag.mapper.OnlCgformTagMapper; import com.jero.modules.tag.mapper.OnlCgformTagMapper;
import com.jero.modules.tag.service.IOnlCgformTagService; import com.jero.modules.tag.service.IOnlCgformTagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import java.util.List;
/** /**
* @Description: 标签管理 * @Description: 标签管理
@@ -16,6 +20,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
*/ */
@Service @Service
public class OnlCgformTagServiceImpl extends ServiceImpl<OnlCgformTagMapper, OnlCgformTag> implements IOnlCgformTagService { public class OnlCgformTagServiceImpl extends ServiceImpl<OnlCgformTagMapper, OnlCgformTag> implements IOnlCgformTagService {
@Autowired
private OnlCgformTagMapper onlCgformTagMapper;
/** /**
* 保存 * 保存
@@ -24,12 +30,12 @@ public class OnlCgformTagServiceImpl extends ServiceImpl<OnlCgformTagMapper, Onl
* @return * @return
*/ */
@Override @Override
public void add(OnlCgformTag onlCgformTag) { public void add(OnlCgformTag onlCgformTag) {
Date now = new Date(); Date now = new Date();
onlCgformTag.setCreateTime(now); onlCgformTag.setCreateTime(now);
onlCgformTag.setUpdateTime(now); onlCgformTag.setUpdateTime(now);
save(onlCgformTag); save(onlCgformTag);
} }
/** /**
* 更新 * 更新
@@ -38,11 +44,11 @@ public class OnlCgformTagServiceImpl extends ServiceImpl<OnlCgformTagMapper, Onl
* @return * @return
*/ */
@Override @Override
public void editById(OnlCgformTag onlCgformTag) { public void editById(OnlCgformTag onlCgformTag) {
Date now = new Date(); Date now = new Date();
onlCgformTag.setUpdateTime(now); onlCgformTag.setUpdateTime(now);
saveOrUpdate(onlCgformTag); saveOrUpdate(onlCgformTag);
} }
/** /**
* 通过id删除 * 通过id删除
@@ -51,9 +57,9 @@ public class OnlCgformTagServiceImpl extends ServiceImpl<OnlCgformTagMapper, Onl
* @return * @return
*/ */
@Override @Override
public void deleteById(String id) { public void deleteById(String id) {
removeById(id); removeById(id);
} }
/** /**
* 批量删除 * 批量删除
@@ -62,9 +68,9 @@ public class OnlCgformTagServiceImpl extends ServiceImpl<OnlCgformTagMapper, Onl
* @return * @return
*/ */
@Override @Override
public void deleteByIds(List<String> ids) { public void deleteByIds(List<String> ids) {
removeByIds(ids); removeByIds(ids);
} }
/** /**
* 通过id查询 * 通过id查询
@@ -73,11 +79,11 @@ public class OnlCgformTagServiceImpl extends ServiceImpl<OnlCgformTagMapper, Onl
* @return * @return
*/ */
@Override @Override
public OnlCgformTag queryById(String id) { public OnlCgformTag queryById(String id) {
return getById(id); return getById(id);
} }
/** /**
* 列表查询 * 列表查询
* *
* @return * @return
@@ -86,4 +92,21 @@ public class OnlCgformTagServiceImpl extends ServiceImpl<OnlCgformTagMapper, Onl
public List<OnlCgformTag> queryList() { public List<OnlCgformTag> queryList() {
return list(); return list();
} }
/**
* 同一“所属模块”下的“属性名称”不能重复
*
* @return
*/
@Override
public Result<?> queryExitData(OnlCgformTag onlCgformTag) {
QueryWrapper<OnlCgformTag> queryWrapper = new QueryWrapper<>();
queryWrapper.like("isModel",onlCgformTag.getIsModel()).and(wq->wq.like("db_field_txt",onlCgformTag.getDbFieldTxt()));
Integer count = onlCgformTagMapper.selectCount(queryWrapper);
if (count > 0) {
return Result.error("已存在数据,不能重复添加");
}
return Result.OK(onlCgformTag);
}
} }
@@ -2,4 +2,7 @@ spring:
application: application:
name: weilai-system name: weilai-system
profiles: profiles:
active: @profile.name@ active: @profile.name@
mybatis-plus:
mapper-locations: classpath:mappers/*.xml