mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 08:13:44 +08:00 
			
		
		
		
	Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue into dev
Conflicts: ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java ruoyi-generator/src/main/resources/vm/java/mapper.java.vm
This commit is contained in:
		@@ -38,4 +38,9 @@ public @interface Log
 | 
			
		||||
     * 是否保存请求的参数
 | 
			
		||||
     */
 | 
			
		||||
    public boolean isSaveRequestData() default true;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 是否保存响应的参数
 | 
			
		||||
     */
 | 
			
		||||
    public boolean isSaveResponseData() default true;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ import java.util.Map;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 操作日志记录处理
 | 
			
		||||
 *
 | 
			
		||||
 * 
 | 
			
		||||
 * @author ruoyi
 | 
			
		||||
 */
 | 
			
		||||
@Aspect
 | 
			
		||||
@@ -61,7 +61,7 @@ public class LogAspect
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 拦截异常操作
 | 
			
		||||
     *
 | 
			
		||||
     * 
 | 
			
		||||
     * @param joinPoint 切点
 | 
			
		||||
     * @param e 异常
 | 
			
		||||
     */
 | 
			
		||||
@@ -91,9 +91,6 @@ public class LogAspect
 | 
			
		||||
            // 请求的地址
 | 
			
		||||
            String ip = ServletUtils.getClientIP();
 | 
			
		||||
            operLog.setOperIp(ip);
 | 
			
		||||
            // 返回参数
 | 
			
		||||
            operLog.setJsonResult(JsonUtils.toJsonString(jsonResult));
 | 
			
		||||
 | 
			
		||||
            operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
 | 
			
		||||
            if (loginUser != null)
 | 
			
		||||
            {
 | 
			
		||||
@@ -112,7 +109,7 @@ public class LogAspect
 | 
			
		||||
            // 设置请求方式
 | 
			
		||||
            operLog.setRequestMethod(ServletUtils.getRequest().getMethod());
 | 
			
		||||
            // 处理设置注解上的参数
 | 
			
		||||
            getControllerMethodDescription(joinPoint, controllerLog, operLog);
 | 
			
		||||
            getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult);
 | 
			
		||||
            // 保存数据库
 | 
			
		||||
			SpringUtils.getBean(AsyncService.class).recordOper(operLog);
 | 
			
		||||
        }
 | 
			
		||||
@@ -127,12 +124,12 @@ public class LogAspect
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取注解中对方法的描述信息 用于Controller层注解
 | 
			
		||||
     *
 | 
			
		||||
     * 
 | 
			
		||||
     * @param log 日志
 | 
			
		||||
     * @param operLog 操作日志
 | 
			
		||||
     * @throws Exception
 | 
			
		||||
     */
 | 
			
		||||
    public void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysOperLog operLog) throws Exception
 | 
			
		||||
    public void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysOperLog operLog, Object jsonResult) throws Exception
 | 
			
		||||
    {
 | 
			
		||||
        // 设置action动作
 | 
			
		||||
        operLog.setBusinessType(log.businessType().ordinal());
 | 
			
		||||
@@ -146,11 +143,16 @@ public class LogAspect
 | 
			
		||||
            // 获取参数的信息,传入到数据库中。
 | 
			
		||||
            setRequestValue(joinPoint, operLog);
 | 
			
		||||
        }
 | 
			
		||||
        // 是否需要保存response,参数和值
 | 
			
		||||
        if (log.isSaveResponseData() && StringUtils.isNotNull(jsonResult))
 | 
			
		||||
        {
 | 
			
		||||
            operLog.setJsonResult(StringUtils.substring(JsonUtils.toJsonString(jsonResult), 0, 2000));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取请求的参数,放到log中
 | 
			
		||||
     *
 | 
			
		||||
     * 
 | 
			
		||||
     * @param operLog 操作日志
 | 
			
		||||
     * @throws Exception 异常
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -13,4 +13,70 @@ import org.apache.ibatis.annotations.CacheNamespace;
 | 
			
		||||
 */
 | 
			
		||||
public interface ${ClassName}Mapper extends BaseMapperPlus<${ClassName}> {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询${functionName}列表
 | 
			
		||||
     * 
 | 
			
		||||
     * @param ${className} ${functionName}
 | 
			
		||||
     * @return ${functionName}集合
 | 
			
		||||
     */
 | 
			
		||||
    public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 新增${functionName}
 | 
			
		||||
     * 
 | 
			
		||||
     * @param ${className} ${functionName}
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public int insert${ClassName}(${ClassName} ${className});
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 修改${functionName}
 | 
			
		||||
     * 
 | 
			
		||||
     * @param ${className} ${functionName}
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public int update${ClassName}(${ClassName} ${className});
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除${functionName}
 | 
			
		||||
     * 
 | 
			
		||||
     * @param ${pkColumn.javaField} ${functionName}主键
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 批量删除${functionName}
 | 
			
		||||
     * 
 | 
			
		||||
     * @param ${pkColumn.javaField}s 需要删除的数据主键集合
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
 | 
			
		||||
#if($table.sub)
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 批量删除${subTable.functionName}
 | 
			
		||||
     * 
 | 
			
		||||
     * @param ${pkColumn.javaField}s 需要删除的数据主键集合
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public int delete${subClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * 批量新增${subTable.functionName}
 | 
			
		||||
     * 
 | 
			
		||||
     * @param ${subclassName}List ${subTable.functionName}列表
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public int batch${subClassName}(List<${subClassName}> ${subclassName}List);
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 通过${functionName}主键删除${subTable.functionName}信息
 | 
			
		||||
     * 
 | 
			
		||||
     * @param ${pkColumn.javaField} ${functionName}ID
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField});
 | 
			
		||||
#end
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,51 +1,52 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div>
 | 
			
		||||
    <template v-for="(item, index) in options">
 | 
			
		||||
      <template v-if="values.includes(item.dictValue)">
 | 
			
		||||
        <span
 | 
			
		||||
          v-if="item.listClass == 'default' || item.listClass == ''"
 | 
			
		||||
          :key="item.dictValue"
 | 
			
		||||
          :index="index"
 | 
			
		||||
          :class="item.cssClass"
 | 
			
		||||
          >{{ item.dictLabel }}</span
 | 
			
		||||
        >
 | 
			
		||||
        <el-tag
 | 
			
		||||
          v-else
 | 
			
		||||
          :key="item.dictValue"
 | 
			
		||||
          :index="index"
 | 
			
		||||
          :type="item.listClass == 'primary' ? '' : item.listClass"
 | 
			
		||||
          :class="item.cssClass"
 | 
			
		||||
        >
 | 
			
		||||
          {{ item.dictLabel }}
 | 
			
		||||
        </el-tag>
 | 
			
		||||
      </template>
 | 
			
		||||
    </template>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
  name: "DictTag",
 | 
			
		||||
  props: {
 | 
			
		||||
    options: {
 | 
			
		||||
      type: Array,
 | 
			
		||||
      default: null,
 | 
			
		||||
    },
 | 
			
		||||
    value: [Number, String, Array],
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
    values() {
 | 
			
		||||
      if (this.value !== null && typeof this.value !== 'undefined') {
 | 
			
		||||
        return Array.isArray(this.value) ? this.value : [String(this.value)];
 | 
			
		||||
      } else {
 | 
			
		||||
        return [];
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style scoped>
 | 
			
		||||
.el-tag + .el-tag {
 | 
			
		||||
  margin-left: 10px;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
<template>
 | 
			
		||||
  <div>
 | 
			
		||||
    <template v-for="(item, index) in options">
 | 
			
		||||
      <template v-if="values.includes(item.dictValue)">
 | 
			
		||||
        <span
 | 
			
		||||
          v-if="item.listClass == 'default' || item.listClass == ''"
 | 
			
		||||
          :key="item.dictValue"
 | 
			
		||||
          :index="index"
 | 
			
		||||
          :class="item.cssClass"
 | 
			
		||||
          >{{ item.dictLabel }}</span
 | 
			
		||||
        >
 | 
			
		||||
        <el-tag
 | 
			
		||||
          v-else
 | 
			
		||||
          :disable-transitions="true"
 | 
			
		||||
          :key="item.dictValue"
 | 
			
		||||
          :index="index"
 | 
			
		||||
          :type="item.listClass == 'primary' ? '' : item.listClass"
 | 
			
		||||
          :class="item.cssClass"
 | 
			
		||||
        >
 | 
			
		||||
          {{ item.dictLabel }}
 | 
			
		||||
        </el-tag>
 | 
			
		||||
      </template>
 | 
			
		||||
    </template>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
export default {
 | 
			
		||||
  name: "DictTag",
 | 
			
		||||
  props: {
 | 
			
		||||
    options: {
 | 
			
		||||
      type: Array,
 | 
			
		||||
      default: null,
 | 
			
		||||
    },
 | 
			
		||||
    value: [Number, String, Array],
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
    values() {
 | 
			
		||||
      if (this.value !== null && typeof this.value !== 'undefined') {
 | 
			
		||||
        return Array.isArray(this.value) ? this.value : [String(this.value)];
 | 
			
		||||
      } else {
 | 
			
		||||
        return [];
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style scoped>
 | 
			
		||||
.el-tag + .el-tag {
 | 
			
		||||
  margin-left: 10px;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user