Commit bf63e70a authored by liuyang's avatar liuyang

finished 日志管理

parent 66150375
package com.qkdata.biz.enums;
public enum QueryLogTypeEnum {
username,operation,method,dayRange
}
package com.qkdata.biz.sys.vo;
import com.qkdata.biz.enums.QueryLogTypeEnum;
import com.qkdata.common.constants.Constants;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class QueryLogModel {
private Integer pageIndex = Constants.DEFAULT_PAGE;
private Integer pageSize = Constants.DEFAULT_PAGE_SIZE;
private String condition;
private LocalDateTime start;
private LocalDateTime end;
private QueryLogTypeEnum type;
}
......@@ -25,7 +25,7 @@ public class LocalDateTimeDeserializer extends JsonDeserializer<LocalDateTime> {
return Instant.ofEpochMilli(p.getLongValue()).atZone(ZoneId.systemDefault()).toLocalDateTime();
} catch (Exception e) {
log.warn("时间转换异常", e);
throw new BusinessException("时间转换异常");
return null;
}
}
......
......@@ -3,9 +3,23 @@
<mapper namespace="com.qkdata.biz.sys.mapper.SysLogMapper">
<select id="queryPageList" resultType="com.qkdata.biz.sys.entity.SysLogPO">
select * from sys_log where 1=1
<if test="p.condition != null and p.condition != ''">
and username like concat('%',#{p.condition},'%') or operation like concat('%',#{p.condition},'%')
</if>
<choose>
<when test="p.type == @com.qkdata.biz.enums.QueryLogTypeEnum@username">
and username like concat('%',#{p.condition},'%')
</when>
<when test="p.type == @com.qkdata.biz.enums.QueryLogTypeEnum@operation">
and operation like concat('%',#{p.condition},'%')
</when>
<when test="p.type == @com.qkdata.biz.enums.QueryLogTypeEnum@method">
and method like concat('%',#{p.condition},'%')
</when>
<when test="p.type == @com.qkdata.biz.enums.QueryLogTypeEnum@dayRange">
and create_time &gt;= #{p.start} and create_time &lt;= #{p.end}
</when>
<otherwise>
and username like concat('%',#{p.condition},'%')
</otherwise>
</choose>
order by create_time desc
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment