标签管理-标签项bug修改

This commit is contained in:
xiejunyu
2022-02-15 10:41:20 +08:00
parent 055cd4573d
commit 25ca649eb8
3 changed files with 127 additions and 124 deletions
@@ -23,7 +23,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
* @Description: 标签管理 * @Description: 标签管理
* @Author: jero-boot * @Author: jero-boot
* @Date: 2022-02-12 * @Date: 2022-02-12
@@ -59,17 +59,17 @@ public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgf
return Result.OK(pageList); return Result.OK(pageList);
} }
/** /**
* 列表查询 * 列表查询
* *
* @return * @return
*/ */
@AutoLog(value = "标签管理-列表查询") @AutoLog(value = "标签管理-列表查询")
@ApiOperation(value="标签管理-列表查询", notes="标签管理-列表查询") @ApiOperation(value="标签管理-列表查询", notes="标签管理-列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public Result<List<OnlCgformTag>> queryList() { public Result<List<OnlCgformTag>> queryList() {
List<OnlCgformTag> list = onlCgformTagService.queryList(); List<OnlCgformTag> list = onlCgformTagService.queryList();
return Result.OK(list); return Result.OK(list);
} }
/** /**
@@ -97,13 +97,17 @@ public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgf
@ApiOperation(value="标签管理-编辑", notes="标签管理-编辑") @ApiOperation(value="标签管理-编辑", notes="标签管理-编辑")
@PutMapping(value = "/edit") @PutMapping(value = "/edit")
public Result<?> edit(@Validated @RequestBody OnlCgformTag onlCgformTag) { public Result<?> edit(@Validated @RequestBody OnlCgformTag onlCgformTag) {
onlCgformTagService.editById(onlCgformTag); if(onlCgformTag.getIsReadOnly() == 1 || onlCgformTag.getIsReadOnly()==2){
return Result.OK("编辑成功!"); return Result.error("固定字段,不可修改");
}else if(onlCgformTag.getIsReadOnly() == 0){
onlCgformTagService.editById(onlCgformTag);
return Result.OK("编辑成功!");
}else return Result.error("数据isReadOnly状态异常,请检查数据库!");
} }
/** /**
* 通过id删除 * 通过id删除
* *(0非固定字段 1固定字段 2字段固定,内部可配)
* @param id * @param id
* @return * @return
*/ */
@@ -111,8 +115,13 @@ public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgf
@ApiOperation(value="标签管理-通过id删除", notes="标签管理-通过id删除") @ApiOperation(value="标签管理-通过id删除", notes="标签管理-通过id删除")
@DeleteMapping(value = "/delete") @DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) { public Result<?> delete(@RequestParam(name="id",required=true) String id) {
onlCgformTagService.deleteById(id); OnlCgformTag onlCgformTag = onlCgformTagService.queryById(id);
return Result.OK("删除成功!"); if(onlCgformTag.getIsReadOnly() == 1 || onlCgformTag.getIsReadOnly()==2){
return Result.error("固定字段,不可删除");
}else if(onlCgformTag.getIsReadOnly() == 0){
onlCgformTagService.deleteById(id);
return Result.OK("删除成功!");
}else return Result.error("数据isReadOnly状态异常,请检查数据库!");
} }
/** /**
@@ -125,8 +134,13 @@ public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgf
@ApiOperation(value="标签管理-批量删除", notes="标签管理-批量删除") @ApiOperation(value="标签管理-批量删除", notes="标签管理-批量删除")
@DeleteMapping(value = "/deleteBatch") @DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.onlCgformTagService.deleteByIds(Arrays.asList(ids.split(","))); OnlCgformTag onlCgformTag = onlCgformTagService.queryById(ids);
return Result.OK("批量删除成功!"); if(onlCgformTag.getIsReadOnly() == 1 || onlCgformTag.getIsReadOnly()==2){
return Result.error("固定字段,不可删除");
}else if(onlCgformTag.getIsReadOnly() == 0){
this.onlCgformTagService.deleteByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}else return Result.error("数据isReadOnly状态异常,请检查数据库!");
} }
/** /**
@@ -146,27 +160,27 @@ public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgf
return Result.OK(onlCgformTag); return Result.OK(onlCgformTag);
} }
/** /**
* 导出excel * 导出excel
* *
* @param request * @param request
* @param onlCgformTag * @param onlCgformTag
*/ */
@RequestMapping(value = "/exportXls") @RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, OnlCgformTag onlCgformTag) { public ModelAndView exportXls(HttpServletRequest request, OnlCgformTag onlCgformTag) {
return super.exportXls(request, onlCgformTag, OnlCgformTag.class, "标签管理"); return super.exportXls(request, onlCgformTag, OnlCgformTag.class, "标签管理");
} }
/** /**
* 通过excel导入数据 * 通过excel导入数据
* *
* @param request * @param request
* @param response * @param response
* @return * @return
*/ */
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, OnlCgformTag.class); return super.importExcel(request, response, OnlCgformTag.class);
} }
} }
@@ -1,6 +1,7 @@
package com.jero.modules.tag.entity; package com.jero.modules.tag.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
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 com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
@@ -17,146 +18,133 @@ import java.io.Serializable;
/** /**
* @Description: 标签管理 * @Description: 标签管理
* @Author: jero-boot * @Author: jero-boot
* @Date: 2022-02-12 * @Date: 2022-02-14
* @Version: V1.0 * @Version: V1.0
*/ */
@Data @Data
@TableName("onl_cgform_tag") @TableName("onl_cgform_tag")
@Accessors(chain = true) @Accessors(chain = true)
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@ApiModel(value="onl_cgform_tag对象", description="标签管理") @ApiModel(value="onl_cgform_tag对象", description="标签管理")
public class OnlCgformTag implements Serializable { public class OnlCgformTag implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**主键*/ /**主键*/
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键")
private String id; private java.lang.String id;
/**创建人*/ /**创建人*/
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "创建人")
private String createBy; private java.lang.String createBy;
/**创建日期*/ /**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期") @ApiModelProperty(value = "创建日期")
private java.util.Date createTime; private java.util.Date createTime;
/**更新人*/ /**更新人*/
@ApiModelProperty(value = "更新人") @ApiModelProperty(value = "更新人")
private String updateBy; private java.lang.String updateBy;
/**更新日期*/ /**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期") @ApiModelProperty(value = "更新日期")
private java.util.Date updateTime; private java.util.Date updateTime;
/**所属部门*/ /**所属部门*/
@ApiModelProperty(value = "所属部门") @ApiModelProperty(value = "所属部门")
private String sysOrgCode; private java.lang.String sysOrgCode;
/**所属模块(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 = "is_model", dicCode = "is_model")
@Dict(dictTable = "onl_cgform_area", dicText = "所属模块", dicCode = "is_model") @Dict(dictTable = "onl_cgform_area", dicText = "is_model", dicCode = "is_model")
@javax.validation.constraints.NotNull(message = "不能为空") @ApiModelProperty(value = "所属模块(1文档库,0文档拆分)")
@ApiModelProperty(value = "所属模块(1文档库,0文档拆分") @TableField("is_model")
private String isModel; private java.lang.String isModel;
/**字段备注*/ /**字段备注*/
@Excel(name = "字段备注", width = 15) @Excel(name = "字段备注", width = 15)
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "字段备注") @ApiModelProperty(value = "字段备注")
private String dbFieldTxt; private java.lang.String dbFieldTxt;
/**字段英文名称描述*/ /**字段英文名称描述*/
@Excel(name = "字段英文名称描述", width = 15) @Excel(name = "字段英文名称描述", width = 15)
@ApiModelProperty(value = "字段英文名称描述") @ApiModelProperty(value = "字段英文名称描述")
private String dbFieldName; private java.lang.String dbFieldName;
/**表单控件类型*/ /**表单控件类型*/
@Excel(name = "表单控件类型", width = 15, dictTable = "onl_cgform_field", dicText = "属性类型", dicCode = "field_show_type") @Excel(name = "表单控件类型", width = 15, dictTable = "onl_cgform_field", dicText = "field_show_type", dicCode = "field_show_type")
@Dict(dictTable = "onl_cgform_field", dicText = "属性类型", dicCode = "field_show_type") @Dict(dictTable = "onl_cgform_field", dicText = "field_show_type", dicCode = "field_show_type")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "表单控件类型") @ApiModelProperty(value = "表单控件类型")
private String fieldShowType; private java.lang.String fieldShowType;
/**字典名称*/ /**字典名称*/
@Excel(name = "字典名称", width = 15, dictTable = "sys_dict", dicText = "选项内容", dicCode = "dict_name") @Excel(name = "字典名称", width = 15, dictTable = "sys_dict", dicText = "dict_name", dicCode = "dict_name")
@Dict(dictTable = "sys_dict", dicText = "选项内容", dicCode = "dict_name") @Dict(dictTable = "sys_dict", dicText = "dict_name", dicCode = "dict_name")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "字典名称") @ApiModelProperty(value = "字典名称")
private String dictName; private java.lang.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 java.lang.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 java.lang.Integer orderNum;
/**字段是否必填0否 1是*/ /**字段是否必填0否 1是*/
@Excel(name = "字段是否必填0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "是否必填", dicCode = "field_must_input") @Excel(name = "字段是否必填0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "field_must_input", dicCode = "field_must_input")
@Dict(dictTable = "onl_cgform_field", dicText = "是否必填", dicCode = "field_must_input") @Dict(dictTable = "onl_cgform_field", dicText = "field_must_input", dicCode = "field_must_input")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "字段是否必填0否 1是") @ApiModelProperty(value = "字段是否必填0否 1是")
private String fieldMustInput; private java.lang.String fieldMustInput;
/**表单是否显示0否 1是*/ /**表单是否显示0否 1是*/
@Excel(name = "表单是否显示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "文档库列表展示", dicCode = "is_show_form") @Excel(name = "表单是否显示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "is_show_form", dicCode = "is_show_form")
@Dict(dictTable = "onl_cgform_field", dicText = "文档库列表展示", dicCode = "is_show_form") @Dict(dictTable = "onl_cgform_field", dicText = "is_show_form", 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 java.lang.Integer isShowForm;
/* *//**列表是否显示0否 1是*//* /**列表是否显示0否 1是*/
@Excel(name = "列表是否显示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "", dicCode = "is_show_list") @Excel(name = "列表是否显示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "is_show_list", dicCode = "is_show_list")
@Dict(dictTable = "onl_cgform_field", dicText = "", dicCode = "is_show_list") @Dict(dictTable = "onl_cgform_field", dicText = "is_show_list", dicCode = "is_show_list")
@ApiModelProperty(value = "列表是否显示0否 1是") @ApiModelProperty(value = "列表是否显示0否 1是")
private Integer isShowList; private java.lang.Integer isShowList;
*//*//***是否是只读(1是 0否)*//* /**是否是只读(2字段固定,内部可配1固定字段 0非固定字段)*/
@Excel(name = "是否是只读(1是 0否)", width = 15, dictTable = "onl_cgform_field", dicText = "", dicCode = "is_read_only") @Excel(name = "是否是只读(2字段固定,内部可配1固定字段 0非固定字段)", width = 15, dictTable = "onl_cgform_field", dicText = "is_read_only", dicCode = "is_read_only")
@Dict(dictTable = "onl_cgform_field", dicText = "", dicCode = "is_read_only") @Dict(dictTable = "onl_cgform_field", dicText = "is_read_only", dicCode = "is_read_only")
@ApiModelProperty(value = "是否是只读(1是 0否)") @ApiModelProperty(value = "是否是只读(2字段固定,内部可配1固定字段 0非固定字段)")
private Integer isReadOnly;*/ private java.lang.Integer isReadOnly;
/**展示区域*/ /**展示区域*/
@Excel(name = "展示区域", width = 15, dictTable = "onl_cgform_area", dicText = "展示区域", dicCode = "show_area") @Excel(name = "展示区域", width = 15, dictTable = "onl_cgform_area", dicText = "show_area", dicCode = "show_area")
@Dict(dictTable = "onl_cgform_area", dicText = "展示区域", dicCode = "show_area") @Dict(dictTable = "onl_cgform_area", dicText = "show_area", dicCode = "show_area")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "展示区域") @ApiModelProperty(value = "展示区域")
private String showArea; private java.lang.String showArea;
/**是否查询条件0否 1是*/ /**是否查询条件0否 1是*/
@Excel(name = "是否查询条件0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "是否搜索", dicCode = "is_query") @Excel(name = "是否查询条件0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "is_query", dicCode = "is_query")
@Dict(dictTable = "onl_cgform_field", dicText = "是否搜索", dicCode = "is_query") @Dict(dictTable = "onl_cgform_field", dicText = "is_query", dicCode = "is_query")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "是否查询条件0否 1是") @ApiModelProperty(value = "是否查询条件0否 1是")
private Integer isQuery; private java.lang.Integer isQuery;
/**法规清单是否展示0否 1是*/ /**法规清单是否展示0否 1是*/
@Excel(name = "法规清单是否展示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "法规清单展示", dicCode = "is_show_laws_list") @Excel(name = "法规清单是否展示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "is_show_laws_list", dicCode = "is_show_laws_list")
@Dict(dictTable = "onl_cgform_field", dicText = "法规清单展示", dicCode = "is_show_laws_list") @Dict(dictTable = "onl_cgform_field", dicText = "is_show_laws_list", dicCode = "is_show_laws_list")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "法规清单是否展示0否 1是") @ApiModelProperty(value = "法规清单是否展示0否 1是")
private Integer isShowLawsList; private java.lang.Integer isShowLawsList;
/**搜索中心是否展示0否 1是*/ /**搜索中心是否展示0否 1是*/
@Excel(name = "搜索中心是否展示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "搜索中心展示", dicCode = "is_show_search") @Excel(name = "搜索中心是否展示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "is_show_search", dicCode = "is_show_search")
@Dict(dictTable = "onl_cgform_field", dicText = "搜索中心展示", dicCode = "is_show_search") @Dict(dictTable = "onl_cgform_field", dicText = "is_show_search", dicCode = "is_show_search")
@javax.validation.constraints.NotNull(message = "不能为空")
@ApiModelProperty(value = "搜索中心是否展示0否 1是") @ApiModelProperty(value = "搜索中心是否展示0否 1是")
private Integer isShowSearch; private java.lang.Integer isShowSearch;
} }
@@ -34,6 +34,7 @@ public class OnlCgformTagServiceImpl extends ServiceImpl<OnlCgformTagMapper, Onl
Date now = new Date(); Date now = new Date();
onlCgformTag.setCreateTime(now); onlCgformTag.setCreateTime(now);
onlCgformTag.setUpdateTime(now); onlCgformTag.setUpdateTime(now);
onlCgformTag.setIsReadOnly(0);
save(onlCgformTag); save(onlCgformTag);
} }
@@ -89,9 +90,9 @@ public class OnlCgformTagServiceImpl extends ServiceImpl<OnlCgformTagMapper, Onl
* @return * @return
*/ */
@Override @Override
public List<OnlCgformTag> queryList() { public List<OnlCgformTag> queryList() {
return list(); return list();
} }
/** /**
* 同一“所属模块”下的“属性名称”不能重复 * 同一“所属模块”下的“属性名称”不能重复