From 25ca649eb8eecfcd7e4a340825c85fa3c921f5a7 Mon Sep 17 00:00:00 2001 From: xiejunyu Date: Tue, 15 Feb 2022 10:41:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E7=AE=A1=E7=90=86-=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E9=A1=B9bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OnlCgformTagController.java | 80 +++++---- .../jero/modules/tag/entity/OnlCgformTag.java | 164 ++++++++---------- .../service/impl/OnlCgformTagServiceImpl.java | 7 +- 3 files changed, 127 insertions(+), 124 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/tag/controller/OnlCgformTagController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/tag/controller/OnlCgformTagController.java index c900e4824..f1c70c7a3 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/tag/controller/OnlCgformTagController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/tag/controller/OnlCgformTagController.java @@ -23,7 +23,7 @@ import java.util.Arrays; import java.util.List; - /** +/** * @Description: 标签管理 * @Author: jero-boot * @Date: 2022-02-12 @@ -59,17 +59,17 @@ public class OnlCgformTagController extends JeroController> queryList() { - List list = onlCgformTagService.queryList(); - return Result.OK(list); + List list = onlCgformTagService.queryList(); + return Result.OK(list); } /** @@ -97,13 +97,17 @@ public class OnlCgformTagController extends JeroController edit(@Validated @RequestBody OnlCgformTag onlCgformTag) { - onlCgformTagService.editById(onlCgformTag); - return Result.OK("编辑成功!"); + if(onlCgformTag.getIsReadOnly() == 1 || onlCgformTag.getIsReadOnly()==2){ + return Result.error("固定字段,不可修改"); + }else if(onlCgformTag.getIsReadOnly() == 0){ + onlCgformTagService.editById(onlCgformTag); + return Result.OK("编辑成功!"); + }else return Result.error("数据isReadOnly状态异常,请检查数据库!"); } /** * 通过id删除 - * + *(0非固定字段 1固定字段 2字段固定,内部可配) * @param id * @return */ @@ -111,8 +115,13 @@ public class OnlCgformTagController extends JeroController delete(@RequestParam(name="id",required=true) String id) { - onlCgformTagService.deleteById(id); - return Result.OK("删除成功!"); + OnlCgformTag onlCgformTag = onlCgformTagService.queryById(id); + 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 deleteBatch(@RequestParam(name="ids",required=true) String ids) { - this.onlCgformTagService.deleteByIds(Arrays.asList(ids.split(","))); - return Result.OK("批量删除成功!"); + OnlCgformTag onlCgformTag = onlCgformTagService.queryById(ids); + 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 importExcel(HttpServletRequest request, HttpServletResponse response) { - return super.importExcel(request, response, OnlCgformTag.class); - } + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, OnlCgformTag.class); + } } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/tag/entity/OnlCgformTag.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/tag/entity/OnlCgformTag.java index 35eeff0cb..aef33f139 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/tag/entity/OnlCgformTag.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/tag/entity/OnlCgformTag.java @@ -1,6 +1,7 @@ package com.jero.modules.tag.entity; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; @@ -17,146 +18,133 @@ import java.io.Serializable; /** - * @Description: 标签管理 + * @Description: 标签项管理 * @Author: jero-boot - * @Date: 2022-02-12 + * @Date: 2022-02-14 * @Version: V1.0 */ @Data @TableName("onl_cgform_tag") @Accessors(chain = true) @EqualsAndHashCode(callSuper = false) -@ApiModel(value="onl_cgform_tag对象", description="标签管理") +@ApiModel(value="onl_cgform_tag对象", description="标签项管理") public class OnlCgformTag implements Serializable { private static final long serialVersionUID = 1L; - /**主键*/ - @TableId(type = IdType.ASSIGN_ID) + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) @ApiModelProperty(value = "主键") - private String id; + private java.lang.String id; - /**创建人*/ + /**创建人*/ @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") @ApiModelProperty(value = "创建日期") private java.util.Date createTime; - /**更新人*/ + /**更新人*/ @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") @ApiModelProperty(value = "更新日期") private java.util.Date updateTime; - /**所属部门*/ + /**所属部门*/ @ApiModelProperty(value = "所属部门") - private String sysOrgCode; + private java.lang.String sysOrgCode; - /**所属模块(1文档库,0文档拆分*/ - @Excel(name = "所属模块(1文档库,0文档拆分", width = 15, 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文档拆分") - private String isModel; + /**所属模块(1文档库,0文档拆分)*/ + @Excel(name = "所属模块(1文档库,0文档拆分)", width = 15, dictTable = "onl_cgform_area", dicText = "is_model", dicCode = "is_model") + @Dict(dictTable = "onl_cgform_area", dicText = "is_model", dicCode = "is_model") + @ApiModelProperty(value = "所属模块(1文档库,0文档拆分)") + @TableField("is_model") + private java.lang.String isModel; - /**字段备注*/ - @Excel(name = "字段备注", width = 15) - @javax.validation.constraints.NotNull(message = "不能为空") + /**字段备注*/ + @Excel(name = "字段备注", width = 15) @ApiModelProperty(value = "字段备注") - private String dbFieldTxt; + private java.lang.String dbFieldTxt; - /**字段英文名称描述*/ - @Excel(name = "字段英文名称描述", width = 15) + /**字段英文名称描述*/ + @Excel(name = "字段英文名称描述", width = 15) @ApiModelProperty(value = "字段英文名称描述") - private String dbFieldName; + private java.lang.String dbFieldName; - /**表单控件类型*/ - @Excel(name = "表单控件类型", width = 15, dictTable = "onl_cgform_field", dicText = "属性类型", dicCode = "field_show_type") - @Dict(dictTable = "onl_cgform_field", dicText = "属性类型", dicCode = "field_show_type") - @javax.validation.constraints.NotNull(message = "不能为空") + /**表单控件类型*/ + @Excel(name = "表单控件类型", width = 15, dictTable = "onl_cgform_field", dicText = "field_show_type", dicCode = "field_show_type") + @Dict(dictTable = "onl_cgform_field", dicText = "field_show_type", dicCode = "field_show_type") @ApiModelProperty(value = "表单控件类型") - private String fieldShowType; + private java.lang.String fieldShowType; - /**字典名称*/ - @Excel(name = "字典名称", width = 15, dictTable = "sys_dict", dicText = "选项内容", dicCode = "dict_name") - @Dict(dictTable = "sys_dict", dicText = "选项内容", dicCode = "dict_name") - @javax.validation.constraints.NotNull(message = "不能为空") + /**字典名称*/ + @Excel(name = "字典名称", width = 15, dictTable = "sys_dict", dicText = "dict_name", dicCode = "dict_name") + @Dict(dictTable = "sys_dict", dicText = "dict_name", dicCode = "dict_name") @ApiModelProperty(value = "字典名称") - private String dictName; + private java.lang.String dictName; - /**数据库字段长度*/ - @Excel(name = "数据库字段长度", width = 15) - @javax.validation.constraints.Pattern(regexp = "^-?[1-9]\\d+$",message = "请输入正确的整数") - @javax.validation.constraints.NotNull(message = "不能为空") + /**数据库字段长度*/ + @Excel(name = "数据库字段长度", width = 15) @ApiModelProperty(value = "数据库字段长度") - private Integer dbLength; + private java.lang.Integer dbLength; - /**排序*/ - @Excel(name = "排序", width = 15) - @javax.validation.constraints.Pattern(regexp = "^-?[1-9]\\d+$",message = "请输入正确的整数") - @javax.validation.constraints.NotNull(message = "不能为空") + /**排序*/ + @Excel(name = "排序", width = 15) @ApiModelProperty(value = "排序") - private Integer orderNum; + private java.lang.Integer orderNum; - /**字段是否必填0否 1是*/ - @Excel(name = "字段是否必填0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "是否必填", dicCode = "field_must_input") - @Dict(dictTable = "onl_cgform_field", dicText = "是否必填", dicCode = "field_must_input") - @javax.validation.constraints.NotNull(message = "不能为空") + /**字段是否必填0否 1是*/ + @Excel(name = "字段是否必填0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "field_must_input", dicCode = "field_must_input") + @Dict(dictTable = "onl_cgform_field", dicText = "field_must_input", dicCode = "field_must_input") @ApiModelProperty(value = "字段是否必填0否 1是") - private String fieldMustInput; + private java.lang.String fieldMustInput; - /**表单是否显示0否 1是*/ - @Excel(name = "表单是否显示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "文档库列表展示", dicCode = "is_show_form") - @Dict(dictTable = "onl_cgform_field", dicText = "文档库列表展示", dicCode = "is_show_form") - @javax.validation.constraints.Pattern(regexp = "^-?[1-9]\\d+$",message = "请输入正确的整数") + /**表单是否显示0否 1是*/ + @Excel(name = "表单是否显示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "is_show_form", dicCode = "is_show_form") + @Dict(dictTable = "onl_cgform_field", dicText = "is_show_form", dicCode = "is_show_form") @ApiModelProperty(value = "表单是否显示0否 1是") - private Integer isShowForm; + private java.lang.Integer isShowForm; -/* *//**列表是否显示0否 1是*//* - @Excel(name = "列表是否显示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "", dicCode = "is_show_list") - @Dict(dictTable = "onl_cgform_field", dicText = "", dicCode = "is_show_list") + /**列表是否显示0否 1是*/ + @Excel(name = "列表是否显示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "is_show_list", dicCode = "is_show_list") + @Dict(dictTable = "onl_cgform_field", dicText = "is_show_list", dicCode = "is_show_list") @ApiModelProperty(value = "列表是否显示0否 1是") - private Integer isShowList; + private java.lang.Integer isShowList; - *//*//***是否是只读(1是 0否)*//* - @Excel(name = "是否是只读(1是 0否)", width = 15, dictTable = "onl_cgform_field", dicText = "", dicCode = "is_read_only") - @Dict(dictTable = "onl_cgform_field", dicText = "", dicCode = "is_read_only") - @ApiModelProperty(value = "是否是只读(1是 0否)") - private Integer isReadOnly;*/ + /**是否是只读(2字段固定,内部可配1固定字段 0非固定字段)*/ + @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 = "is_read_only", dicCode = "is_read_only") + @ApiModelProperty(value = "是否是只读(2字段固定,内部可配1固定字段 0非固定字段)") + private java.lang.Integer isReadOnly; - /**展示区域*/ - @Excel(name = "展示区域", width = 15, dictTable = "onl_cgform_area", dicText = "展示区域", dicCode = "show_area") - @Dict(dictTable = "onl_cgform_area", dicText = "展示区域", dicCode = "show_area") - @javax.validation.constraints.NotNull(message = "不能为空") + /**展示区域*/ + @Excel(name = "展示区域", width = 15, dictTable = "onl_cgform_area", dicText = "show_area", dicCode = "show_area") + @Dict(dictTable = "onl_cgform_area", dicText = "show_area", dicCode = "show_area") @ApiModelProperty(value = "展示区域") - private String showArea; + private java.lang.String showArea; - /**是否查询条件0否 1是*/ - @Excel(name = "是否查询条件0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "是否搜索", dicCode = "is_query") - @Dict(dictTable = "onl_cgform_field", dicText = "是否搜索", dicCode = "is_query") - @javax.validation.constraints.NotNull(message = "不能为空") + /**是否查询条件0否 1是*/ + @Excel(name = "是否查询条件0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "is_query", dicCode = "is_query") + @Dict(dictTable = "onl_cgform_field", dicText = "is_query", dicCode = "is_query") @ApiModelProperty(value = "是否查询条件0否 1是") - private Integer isQuery; + private java.lang.Integer isQuery; - /**法规清单是否展示0否 1是*/ - @Excel(name = "法规清单是否展示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "法规清单展示", dicCode = "is_show_laws_list") - @Dict(dictTable = "onl_cgform_field", dicText = "法规清单展示", dicCode = "is_show_laws_list") - @javax.validation.constraints.NotNull(message = "不能为空") + /**法规清单是否展示0否 1是*/ + @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 = "is_show_laws_list", dicCode = "is_show_laws_list") @ApiModelProperty(value = "法规清单是否展示0否 1是") - private Integer isShowLawsList; + private java.lang.Integer isShowLawsList; - /**搜索中心是否展示0否 1是*/ - @Excel(name = "搜索中心是否展示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "搜索中心展示", dicCode = "is_show_search") - @Dict(dictTable = "onl_cgform_field", dicText = "搜索中心展示", dicCode = "is_show_search") - @javax.validation.constraints.NotNull(message = "不能为空") + /**搜索中心是否展示0否 1是*/ + @Excel(name = "搜索中心是否展示0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "is_show_search", dicCode = "is_show_search") + @Dict(dictTable = "onl_cgform_field", dicText = "is_show_search", dicCode = "is_show_search") @ApiModelProperty(value = "搜索中心是否展示0否 1是") - private Integer isShowSearch; + private java.lang.Integer isShowSearch; } diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/tag/service/impl/OnlCgformTagServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/tag/service/impl/OnlCgformTagServiceImpl.java index ff9bc2aac..5f0a083ea 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/tag/service/impl/OnlCgformTagServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/tag/service/impl/OnlCgformTagServiceImpl.java @@ -34,6 +34,7 @@ public class OnlCgformTagServiceImpl extends ServiceImpl queryList() { - return list(); - } + public List queryList() { + return list(); + } /** * 同一“所属模块”下的“属性名称”不能重复