提交 5167a6b5 编写于 作者: zlt2000's avatar zlt2000

优化代码

上级 2400bbc6
......@@ -103,7 +103,7 @@ public class SuperServiceImpl<M extends BaseMapper<T>, T> extends ServiceImpl<M,
if (null != entity) {
Class<?> cls = entity.getClass();
TableInfo tableInfo = TableInfoHelper.getTableInfo(cls);
if (null != tableInfo && StringUtils.isNotEmpty(tableInfo.getKeyProperty())) {
if (null != tableInfo && StrUtil.isNotEmpty(tableInfo.getKeyProperty())) {
Object idVal = ReflectionKit.getMethodValue(cls, entity, tableInfo.getKeyProperty());
if (StringUtils.checkValNull(idVal) || Objects.isNull(getById((Serializable) idVal))) {
if (StrUtil.isEmpty(msg)) {
......
......@@ -9,12 +9,12 @@ import lombok.extern.slf4j.Slf4j;
*/
@Slf4j
public class PointUtil {
private static final String MSG_PATTERN = "{}|{}|{}";
private PointUtil() {
throw new IllegalStateException("Utility class");
}
public static final String SPLIT = "|";
/**
* 格式为:{时间}|{来源}|{对象id}|{类型}|{对象属性(以&分割)}
* 例子1:2016-07-27 23:37:23|business-center|1|user-login|ip=xxx.xxx.xx&userName=张三&userType=后台管理员
......@@ -25,10 +25,10 @@ public class PointUtil {
* @param message 对象属性
*/
public static void info(String id, String type, String message) {
log.info(id + SPLIT + type + SPLIT + message);
log.info(MSG_PATTERN, id, type, message);
}
public static void debug(String id, String type, String message) {
log.debug(id + SPLIT + type + SPLIT + message);
log.debug(MSG_PATTERN, id, type, message);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册