Bläddra i källkod

* 增加报名信息

chen.cheng 10 månader sedan
förälder
incheckning
af5855d9fb

+ 4 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java

@@ -2,6 +2,8 @@ package com.ruoyi.web.controller.system;
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.common.annotation.Anonymous;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
@@ -24,7 +26,7 @@ import com.ruoyi.system.service.ISysConfigService;
 
 /**
  * 参数配置 信息操作处理
- * 
+ *
  * @author ruoyi
  */
 @RestController
@@ -70,6 +72,7 @@ public class SysConfigController extends BaseController
      * 根据参数键名查询参数值
      */
     @GetMapping(value = "/configKey/{configKey}")
+    @Anonymous
     public AjaxResult getConfigKey(@PathVariable String configKey)
     {
         return success(configService.selectConfigByKey(configKey));

+ 18 - 6
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java

@@ -1,16 +1,17 @@
 package com.ruoyi.system.domain;
 
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.Size;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.annotation.Excel.ColumnType;
 import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.Size;
 
 /**
  * 参数配置表 sys_config
- * 
+ *
  * @author ruoyi
  */
 public class SysConfig extends BaseEntity
@@ -37,6 +38,8 @@ public class SysConfig extends BaseEntity
     @Excel(name = "系统内置", readConverterExp = "Y=是,N=否")
     private String configType;
 
+    private String cfgJson;
+
     public Long getConfigId()
     {
         return configId;
@@ -92,7 +95,16 @@ public class SysConfig extends BaseEntity
     {
         this.configType = configType;
     }
-    
+
+
+    public String getCfgJson() {
+        return cfgJson;
+    }
+
+    public void setCfgJson(String cfgJson) {
+        this.cfgJson = cfgJson;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 47 - 32
ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.system.mapper.SysConfigMapper">
-    
+
     <resultMap type="SysConfig" id="SysConfigResult">
     	<id     property="configId"      column="config_id"      />
         <result property="configName"    column="config_name"    />
@@ -14,13 +14,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="createTime"    column="create_time"    />
         <result property="updateBy"      column="update_by"      />
         <result property="updateTime"    column="update_time"    />
+        <result property="remark" column="remark"/>
+        <result property="cfgJson" column="cfg_json"/>
     </resultMap>
-    
+
     <sql id="selectConfigVo">
-        select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark 
+        select config_id,
+               config_name,
+               config_key,
+               config_value,
+               config_type,
+               cfg_json,
+               create_by,
+               create_time,
+               update_by,
+               update_time,
+               remark
 		from sys_config
     </sql>
-    
+
     <!-- 查询条件 -->
 	<sql id="sqlwhereSearch">
 		<where>
@@ -32,12 +44,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			</if>
 		</where>
 	</sql>
-    
+
     <select id="selectConfig" parameterType="SysConfig" resultMap="SysConfigResult">
         <include refid="selectConfigVo"/>
         <include refid="sqlwhereSearch"/>
     </select>
-    
+
     <select id="selectConfigList" parameterType="SysConfig" resultMap="SysConfigResult">
         <include refid="selectConfigVo"/>
         <where>
@@ -58,39 +70,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			</if>
 		</where>
     </select>
-    
+
     <select id="selectConfigById" parameterType="Long" resultMap="SysConfigResult">
         <include refid="selectConfigVo"/>
         where config_id = #{configId}
     </select>
-	
+
     <select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult">
         <include refid="selectConfigVo"/>
         where config_key = #{configKey} limit 1
     </select>
-    
+
     <insert id="insertConfig" parameterType="SysConfig">
         insert into sys_config (
-			<if test="configName != null and configName != '' ">config_name,</if>
-			<if test="configKey != null and configKey != '' ">config_key,</if>
-			<if test="configValue != null and configValue != '' ">config_value,</if>
-			<if test="configType != null and configType != '' ">config_type,</if>
-			<if test="createBy != null and createBy != ''">create_by,</if>
-			<if test="remark != null and remark != ''">remark,</if>
- 			create_time
+        <if test="configName != null and configName != '' ">config_name,</if>
+        <if test="configKey != null and configKey != '' ">config_key,</if>
+        <if test="configValue != null and configValue != '' ">config_value,</if>
+        <if test="configType != null and configType != '' ">config_type,</if>
+        <if test="createBy != null and createBy != ''">create_by,</if>
+        <if test="remark != null and remark != ''">remark,</if>
+        <if test="cfgJson != null">cfg_json,</if>
+        create_time
         )values(
-			<if test="configName != null and configName != ''">#{configName},</if>
-			<if test="configKey != null and configKey != ''">#{configKey},</if>
-			<if test="configValue != null and configValue != ''">#{configValue},</if>
-			<if test="configType != null and configType != ''">#{configType},</if>
-			<if test="createBy != null and createBy != ''">#{createBy},</if>
-			<if test="remark != null and remark != ''">#{remark},</if>
- 			sysdate()
-		)
+        <if test="configName != null and configName != ''">#{configName},</if>
+        <if test="configKey != null and configKey != ''">#{configKey},</if>
+        <if test="configValue != null and configValue != ''">#{configValue},</if>
+        <if test="configType != null and configType != ''">#{configType},</if>
+        <if test="createBy != null and createBy != ''">#{createBy},</if>
+        <if test="remark != null and remark != ''">#{remark},</if>
+        <if test="cfgJson != null">#{cfgJson},</if>
+        sysdate()
+        )
     </insert>
-	 
+
     <update id="updateConfig" parameterType="SysConfig">
-        update sys_config 
+        update sys_config
         <set>
             <if test="configName != null and configName != ''">config_name = #{configName},</if>
             <if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
@@ -98,20 +112,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="configType != null and configType != ''">config_type = #{configType},</if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
             <if test="remark != null">remark = #{remark},</if>
- 			update_time = sysdate()
+            <if test="cfgJson !=null">cfg_json = #{cfgJson},</if>
+            update_time = sysdate()
         </set>
         where config_id = #{configId}
     </update>
-	
+
     <delete id="deleteConfigById" parameterType="Long">
         delete from sys_config where config_id = #{configId}
     </delete>
-    
+
     <delete id="deleteConfigByIds" parameterType="Long">
-        delete from sys_config where config_id in 
+        delete from sys_config where config_id in
         <foreach item="configId" collection="array" open="(" separator="," close=")">
         	#{configId}
         </foreach>
     </delete>
-    
-</mapper>
+
+</mapper>

BIN
ruoyi-ui/src/assets/logo/logo.png


+ 32 - 3
ruoyi-ui/src/views/system/config/index.vue

@@ -168,6 +168,15 @@
             >{{dict.label}}</el-radio>
           </el-radio-group>
         </el-form-item>
+        <el-form-item label="json配置" prop="cfgJson">
+          <vue-json-editor
+              v-model="cfgJson"
+              :showBtns="false"
+              mode="code"
+              lang="zh"
+              :expanded-on-start="true"
+          />
+        </el-form-item>
         <el-form-item label="备注" prop="remark">
           <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
         </el-form-item>
@@ -181,10 +190,12 @@
 </template>
 
 <script>
-import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config";
+import { addConfig, delConfig, getConfig, listConfig, refreshCache, updateConfig } from '@/api/system/config';
+import vueJsonEditor from 'vue-json-editor';
 
 export default {
   name: "Config",
+  components: { vueJsonEditor },
   dicts: ['sys_yes_no'],
   data() {
     return {
@@ -208,6 +219,7 @@ export default {
       open: false,
       // 日期范围
       dateRange: [],
+      cfgJson: {},
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -228,10 +240,21 @@ export default {
         ],
         configValue: [
           { required: true, message: "参数键值不能为空", trigger: "blur" }
-        ]
+        ],
       }
     };
   },
+  watch: {
+    cfgJson: {
+      handler(val) {
+        if (val) {
+          this.form.cfgJson = JSON.stringify(val);
+        }
+
+      },
+      deep: true,
+    },
+  },
   created() {
     this.getList();
   },
@@ -253,13 +276,15 @@ export default {
     },
     // 表单重置
     reset() {
+      this.cfgJson = {};
       this.form = {
         configId: undefined,
         configName: undefined,
         configKey: undefined,
         configValue: undefined,
         configType: "Y",
-        remark: undefined
+        remark: undefined,
+        cfgJson: {},
       };
       this.resetForm("form");
     },
@@ -293,6 +318,9 @@ export default {
       getConfig(configId).then(response => {
         this.form = response.data;
         this.open = true;
+        if (response.data?.cfgJson) {
+          this.cfgJson = JSON.parse(response.data?.cfgJson);
+        }
         this.title = "修改参数";
       });
     },
@@ -301,6 +329,7 @@ export default {
       this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.form.configId != undefined) {
+            debugger
             updateConfig(this.form).then(response => {
               this.$modal.msgSuccess("修改成功");
               this.open = false;