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
master
疯狂的狮子li 4 years ago
commit 2b53e9d86a

@ -38,4 +38,9 @@ public @interface Log
* *
*/ */
public boolean isSaveRequestData() default true; public boolean isSaveRequestData() default true;
/**
*
*/
public boolean isSaveResponseData() default true;
} }

@ -33,7 +33,7 @@ import java.util.Map;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
@Aspect @Aspect
@ -61,7 +61,7 @@ public class LogAspect
/** /**
* *
* *
* @param joinPoint * @param joinPoint
* @param e * @param e
*/ */
@ -91,9 +91,6 @@ public class LogAspect
// 请求的地址 // 请求的地址
String ip = ServletUtils.getClientIP(); String ip = ServletUtils.getClientIP();
operLog.setOperIp(ip); operLog.setOperIp(ip);
// 返回参数
operLog.setJsonResult(JsonUtils.toJsonString(jsonResult));
operLog.setOperUrl(ServletUtils.getRequest().getRequestURI()); operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
if (loginUser != null) if (loginUser != null)
{ {
@ -112,7 +109,7 @@ public class LogAspect
// 设置请求方式 // 设置请求方式
operLog.setRequestMethod(ServletUtils.getRequest().getMethod()); operLog.setRequestMethod(ServletUtils.getRequest().getMethod());
// 处理设置注解上的参数 // 处理设置注解上的参数
getControllerMethodDescription(joinPoint, controllerLog, operLog); getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult);
// 保存数据库 // 保存数据库
SpringUtils.getBean(AsyncService.class).recordOper(operLog); SpringUtils.getBean(AsyncService.class).recordOper(operLog);
} }
@ -127,12 +124,12 @@ public class LogAspect
/** /**
* Controller * Controller
* *
* @param log * @param log
* @param operLog * @param operLog
* @throws Exception * @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动作 // 设置action动作
operLog.setBusinessType(log.businessType().ordinal()); operLog.setBusinessType(log.businessType().ordinal());
@ -146,11 +143,16 @@ public class LogAspect
// 获取参数的信息,传入到数据库中。 // 获取参数的信息,传入到数据库中。
setRequestValue(joinPoint, operLog); setRequestValue(joinPoint, operLog);
} }
// 是否需要保存response参数和值
if (log.isSaveResponseData() && StringUtils.isNotNull(jsonResult))
{
operLog.setJsonResult(StringUtils.substring(JsonUtils.toJsonString(jsonResult), 0, 2000));
}
} }
/** /**
* log * log
* *
* @param operLog * @param operLog
* @throws Exception * @throws Exception
*/ */

@ -13,4 +13,70 @@ import org.apache.ibatis.annotations.CacheNamespace;
*/ */
public interface ${ClassName}Mapper extends BaseMapperPlus<${ClassName}> { 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> <template>
<div> <div>
<template v-for="(item, index) in options"> <template v-for="(item, index) in options">
<template v-if="values.includes(item.dictValue)"> <template v-if="values.includes(item.dictValue)">
<span <span
v-if="item.listClass == 'default' || item.listClass == ''" v-if="item.listClass == 'default' || item.listClass == ''"
:key="item.dictValue" :key="item.dictValue"
:index="index" :index="index"
:class="item.cssClass" :class="item.cssClass"
>{{ item.dictLabel }}</span >{{ item.dictLabel }}</span
> >
<el-tag <el-tag
v-else v-else
:key="item.dictValue" :disable-transitions="true"
:index="index" :key="item.dictValue"
:type="item.listClass == 'primary' ? '' : item.listClass" :index="index"
:class="item.cssClass" :type="item.listClass == 'primary' ? '' : item.listClass"
> :class="item.cssClass"
{{ item.dictLabel }} >
</el-tag> {{ item.dictLabel }}
</template> </el-tag>
</template> </template>
</div> </template>
</template> </div>
</template>
<script>
export default { <script>
name: "DictTag", export default {
props: { name: "DictTag",
options: { props: {
type: Array, options: {
default: null, type: Array,
}, default: null,
value: [Number, String, Array], },
}, value: [Number, String, Array],
computed: { },
values() { computed: {
if (this.value !== null && typeof this.value !== 'undefined') { values() {
return Array.isArray(this.value) ? this.value : [String(this.value)]; if (this.value !== null && typeof this.value !== 'undefined') {
} else { return Array.isArray(this.value) ? this.value : [String(this.value)];
return []; } else {
} return [];
}, }
}, },
}; },
</script> };
<style scoped> </script>
.el-tag + .el-tag { <style scoped>
margin-left: 10px; .el-tag + .el-tag {
} margin-left: 10px;
</style> }
</style>

Loading…
Cancel
Save