SystemLogMapper.java 1.6 KB
package com.uccc.log.mapper;

import com.uccc.pretty.common.SystemLog;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

/**
 * Created by bert on 2021-09-15 13:20
 */
public interface SystemLogMapper {

    static final String TABLE_NAME = "system_log";

    @Insert({
            "<script>",
            "insert into " + TABLE_NAME,
            "(",
            "cts",
            "<when test='systemLog.operatorId!=null'>",
            ",operator_id",
            "</when>",
            "<when test='systemLog.action!=null'>",
            ",action",
            "</when>",
            "<when test='systemLog.remark!=null'>",
            ",remark",
            "</when>",
            "<when test='systemLog.extra!=null'>",
            ",extra",
            "</when>",
            "<when test='systemLog.ip!=null'>",
            ",ip",
            "</when>",
            ")",
            "values",
            "(",
            "now()",
            "<when test='systemLog.operatorId!=null'>",
            ",#{systemLog.operatorId}",
            "</when>",
            "<when test='systemLog.action!=null'>",
            ",#{systemLog.action}",
            "</when>",
            "<when test='systemLog.remark!=null'>",
            ",#{systemLog.remark}",
            "</when>",
            "<when test='systemLog.extra!=null'>",
            ",#{systemLog.extra}",
            "</when>",
            "<when test='systemLog.ip!=null'>",
            ",#{systemLog.ip}",
            "</when>",

            ")",
            "</script>"
    })
    int insertLog(@Param("systemLog") SystemLog systemLog);
}