Przeglądaj źródła

添加模型指标,使用从数据源测试

wukai 3 miesięcy temu
rodzic
commit
f1ef276778

+ 1 - 1
jjt-admin/src/main/java/com/jjt/web/controller/system/SysIndexController.java

@@ -25,6 +25,6 @@ public class SysIndexController {
      */
     @RequestMapping("/")
     public String index() {
-        return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", jjtConfig.getName(), jjtConfig.getVersion());
+        return StringUtils.format("jy2025 欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", jjtConfig.getName(), jjtConfig.getVersion());
     }
 }

+ 93 - 0
jjt-admin/src/test/java/com/test/JsTest.java

@@ -0,0 +1,93 @@
+package com.test;
+
+import com.jjt.utils.JavaScriptUtil;
+
+import javax.script.Invocable;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+
+/**
+ * JsTest$
+ *
+ * @author wukai
+ * @date 2025/10/21 23:22
+ */
+public class JsTest {
+    public static void main(String[] args) {
+        try {
+            // 创建脚本引擎管理器
+            ScriptEngineManager manager = new ScriptEngineManager();
+
+            // 获取GraalJS引擎
+            ScriptEngine engine = manager.getEngineByName("graal.js");
+
+            if (engine == null) {
+                System.out.println("未找到GraalJS引擎,请确认已添加相关依赖");
+                return;
+            }
+
+            // 示例1: 执行简单的数学运算
+            String jsCode1 = "10 + 20 * 3";
+            Object result1 = engine.eval(jsCode1);
+            System.out.println("数学运算结果: " + result1);
+
+            // 示例2: 使用JavaScript函数
+            String jsCode2 =
+                    "function greet(name) { " +
+                            "    return 'Hello, ' + name + '!'; " +
+                            "} " +
+                            "greet('Java');";
+            Object result2 = engine.eval(jsCode2);
+            System.out.println("函数调用结果: " + result2);
+
+            // 示例3: 数组操作
+            String jsCode3 =
+                    "var arr = [1, 2, 3, 4, 5]; " +
+                            "arr.map(x => x * 2).filter(x => x > 5);";
+            Object result3 = engine.eval(jsCode3);
+            System.out.println("数组操作结果: " + result3);
+        } catch (ScriptException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void test(ScriptEngine engine) throws Exception {
+        // 定义JavaScript函数
+        String jsFunctions =
+                "function add(a, b) { " +
+                        "    return a + b; " +
+                        "} " +
+                        "" +
+                        "function factorial(n) { " +
+                        "    if (n <= 1) return 1; " +
+                        "    return n * factorial(n - 1); " +
+                        "} " +
+                        "" +
+                        "function getUserInfo(name, age) { " +
+                        "    return { " +
+                        "        name: name, " +
+                        "        age: age, " +
+                        "        birthYear: 2024 - age " +
+                        "    }; " +
+                        "}";
+
+        // 执行脚本,注册函数
+        engine.eval(jsFunctions);
+
+        // 转换为Invocable来调用函数
+        Invocable invocable = (Invocable) engine;
+
+        // 调用add函数
+        Object addResult = invocable.invokeFunction("add", 15, 25);
+        System.out.println("15 + 25 = " + addResult);
+
+        // 调用factorial函数
+        Object factorialResult = invocable.invokeFunction("factorial", 5);
+        System.out.println("5! = " + factorialResult);
+
+        // 调用返回对象的函数
+        Object userInfo = invocable.invokeFunction("getUserInfo", "张三", 25);
+        System.out.println("用户信息: " + userInfo);
+    }
+}

+ 15 - 0
jjt-biz/pom.xml

@@ -16,6 +16,21 @@
     </description>
 
     <dependencies>
+        <!-- GraalJS引擎 -->
+        <dependency>
+            <groupId>org.graalvm.js</groupId>
+            <artifactId>js-scriptengine</artifactId>
+            <version>21.3.0</version>
+        </dependency>
+
+        <!-- GraalJS运行时 -->
+        <dependency>
+            <groupId>org.graalvm.js</groupId>
+            <artifactId>js</artifactId>
+            <version>21.3.0</version>
+            <scope>runtime</scope>
+        </dependency>
+
         <dependency>
             <groupId>com.deepoove</groupId>
             <artifactId>poi-tl</artifactId>

+ 112 - 0
jjt-biz/src/main/java/com/jjt/biz/controller/RipaMetricsController.java

@@ -0,0 +1,112 @@
+package com.jjt.biz.controller;
+
+import com.jjt.biz.domain.RipaMetrics;
+import com.jjt.biz.service.IRipaMetricsService;
+import com.jjt.common.annotation.Log;
+import com.jjt.common.core.controller.BaseController;
+import com.jjt.common.core.domain.AjaxResult;
+import com.jjt.common.core.page.TableDataInfo;
+import com.jjt.common.enums.BusinessType;
+import com.jjt.common.utils.poi.ExcelUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 模型指标配置Controller
+ *
+ * @author jjt
+ * @date 2025-10-22
+ */
+@Api(tags = "模型指标配置")
+@RestController
+@RequestMapping("/biz/metrics")
+public class RipaMetricsController extends BaseController {
+    @Resource
+    private IRipaMetricsService ripaMetricsService;
+
+    /**
+     * 查询模型指标配置列表
+     */
+    @ApiOperation("查询模型指标配置列表")
+    //@PreAuthorize("@ss.hasPermi('biz:metrics:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(RipaMetrics ripaMetrics) {
+        startPage();
+        List<RipaMetrics> list = ripaMetricsService.selectRipaMetricsList(ripaMetrics);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询模型指标配置列表
+     */
+    @ApiOperation("查询模型指标配置列表")
+    //@PreAuthorize("@ss.hasPermi('biz:metrics:list')")
+    @GetMapping("/select")
+    public TableDataInfo select(RipaMetrics ripaMetrics) {
+        startPage();
+        List<Map<String,Object>> list = ripaMetricsService.selectRiskMetricsList();
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出模型指标配置列表
+     */
+    @ApiOperation("导出模型指标配置列表")
+    //@PreAuthorize("@ss.hasPermi('biz:metrics:export')")
+    @Log(title = "模型指标配置", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, RipaMetrics ripaMetrics) {
+        List<RipaMetrics> list = ripaMetricsService.selectRipaMetricsList(ripaMetrics);
+        ExcelUtil<RipaMetrics> util = new ExcelUtil<RipaMetrics>(RipaMetrics.class);
+        util.exportExcel(response, list, "模型指标配置数据");
+    }
+
+    /**
+     * 获取模型指标配置详细信息
+     */
+    @ApiOperation("获取模型指标配置详细信息")
+    //@PreAuthorize("@ss.hasPermi('biz:metrics:query')")
+    @GetMapping(value = "/detail")
+    public AjaxResult getInfo(Long autoId) {
+        return success(ripaMetricsService.selectRipaMetricsByAutoId(autoId));
+    }
+
+    /**
+     * 新增模型指标配置
+     */
+    @ApiOperation("新增模型指标配置")
+    //@PreAuthorize("@ss.hasPermi('biz:metrics:add')")
+    @Log(title = "模型指标配置", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody RipaMetrics ripaMetrics) {
+        return toAjax(ripaMetricsService.insertRipaMetrics(ripaMetrics));
+    }
+
+    /**
+     * 修改模型指标配置
+     */
+    @ApiOperation("修改模型指标配置")
+    //@PreAuthorize("@ss.hasPermi('biz:metrics:edit')")
+    @Log(title = "模型指标配置", businessType = BusinessType.UPDATE)
+    @PostMapping("/edit")
+    public AjaxResult edit(@RequestBody RipaMetrics ripaMetrics) {
+        return toAjax(ripaMetricsService.updateRipaMetrics(ripaMetrics));
+    }
+
+    /**
+     * 删除模型指标配置
+     */
+    @ApiOperation("删除模型指标配置")
+    //@PreAuthorize("@ss.hasPermi('biz:metrics:remove')")
+    @Log(title = "模型指标配置", businessType = BusinessType.DELETE)
+    @GetMapping("/del")
+    public AjaxResult remove(Long autoId) {
+        return toAjax(ripaMetricsService.deleteRipaMetricsByAutoId(autoId));
+    }
+}

+ 93 - 0
jjt-biz/src/main/java/com/jjt/biz/domain/RipaMetrics.java

@@ -0,0 +1,93 @@
+package com.jjt.biz.domain;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.jjt.common.annotation.Excel;
+import com.jjt.common.core.domain.BaseEntity;
+
+/**
+ * 模型指标配置对象 ripa_metrics
+ *
+ * @author jjt
+ * @date 2025-10-22
+ */
+@ApiModel(value = "RipaMetrics", description = "模型指标配置")
+public class RipaMetrics extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 自动ID */
+    @ApiModelProperty("自动ID")
+    @TableId
+    private Long autoId;
+
+    /** 模型ID */
+    @ApiModelProperty("模型ID")
+    @Excel(name = "模型ID")
+    private Long modelId;
+
+    /** 指标ID */
+    @ApiModelProperty("指标ID")
+    @Excel(name = "指标ID")
+    private Long objMetricsId;
+
+    /** 指标名称 */
+    @ApiModelProperty("指标名称")
+    @Excel(name = "指标名称")
+    private String metricsName;
+
+    public void setAutoId(Long autoId)
+    {
+        this.autoId = autoId;
+    }
+
+    public Long getAutoId()
+    {
+        return autoId;
+    }
+    public void setModelId(Long modelId)
+    {
+        this.modelId = modelId;
+    }
+
+    public Long getModelId()
+    {
+        return modelId;
+    }
+    public void setObjMetricsId(Long objMetricsId)
+    {
+        this.objMetricsId = objMetricsId;
+    }
+
+    public Long getObjMetricsId()
+    {
+        return objMetricsId;
+    }
+    public void setMetricsName(String metricsName)
+    {
+        this.metricsName = metricsName;
+    }
+
+    public String getMetricsName()
+    {
+        return metricsName;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("autoId", getAutoId())
+            .append("modelId", getModelId())
+            .append("objMetricsId", getObjMetricsId())
+            .append("metricsName", getMetricsName())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("remark", getRemark())
+            .toString();
+    }
+}

+ 73 - 0
jjt-biz/src/main/java/com/jjt/biz/mapper/RipaMetricsMapper.java

@@ -0,0 +1,73 @@
+package com.jjt.biz.mapper;
+
+import java.util.List;
+import java.util.Map;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jjt.biz.domain.RipaMetrics;
+import com.jjt.common.annotation.DataSource;
+import com.jjt.common.enums.DataSourceType;
+
+/**
+ * 模型指标配置Mapper接口
+ *
+ * @author jjt
+ * @date 2025-10-22
+ */
+public interface RipaMetricsMapper extends BaseMapper<RipaMetrics>
+{
+    /**
+     * 查询模型指标配置
+     *
+     * @param autoId 模型指标配置主键
+     * @return 模型指标配置
+     */
+    public RipaMetrics selectRipaMetricsByAutoId(Long autoId);
+
+    /**
+     * 查询模型指标配置列表
+     *
+     * @param ripaMetrics 模型指标配置
+     * @return 模型指标配置集合
+     */
+    public List<RipaMetrics> selectRipaMetricsList(RipaMetrics ripaMetrics);
+
+    /**
+     * 新增模型指标配置
+     *
+     * @param ripaMetrics 模型指标配置
+     * @return 结果
+     */
+    public int insertRipaMetrics(RipaMetrics ripaMetrics);
+
+    /**
+     * 修改模型指标配置
+     *
+     * @param ripaMetrics 模型指标配置
+     * @return 结果
+     */
+    public int updateRipaMetrics(RipaMetrics ripaMetrics);
+
+    /**
+     * 删除模型指标配置
+     *
+     * @param autoId 模型指标配置主键
+     * @return 结果
+     */
+    public int deleteRipaMetricsByAutoId(Long autoId);
+
+    /**
+     * 批量删除模型指标配置
+     *
+     * @param autoIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteRipaMetricsByAutoIds(Long[] autoIds);
+    /**
+     * 查询模型指标配置列表
+     *
+     * @return 模型指标配置集合
+     */
+    @DataSource(value = DataSourceType.SLAVE)
+    List<Map<String, Object>> selectRiskMetricsList();
+}

+ 69 - 0
jjt-biz/src/main/java/com/jjt/biz/service/IRipaMetricsService.java

@@ -0,0 +1,69 @@
+package com.jjt.biz.service;
+
+import com.jjt.biz.domain.RipaMetrics;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 模型指标配置Service接口
+ *
+ * @author jjt
+ * @date 2025-10-22
+ */
+public interface IRipaMetricsService {
+    /**
+     * 查询模型指标配置
+     *
+     * @param autoId 模型指标配置主键
+     * @return 模型指标配置
+     */
+    public RipaMetrics selectRipaMetricsByAutoId(Long autoId);
+
+    /**
+     * 查询模型指标配置列表
+     *
+     * @param ripaMetrics 模型指标配置
+     * @return 模型指标配置集合
+     */
+    public List<RipaMetrics> selectRipaMetricsList(RipaMetrics ripaMetrics);
+
+    /**
+     * 新增模型指标配置
+     *
+     * @param ripaMetrics 模型指标配置
+     * @return 结果
+     */
+    public int insertRipaMetrics(RipaMetrics ripaMetrics);
+
+    /**
+     * 修改模型指标配置
+     *
+     * @param ripaMetrics 模型指标配置
+     * @return 结果
+     */
+    public int updateRipaMetrics(RipaMetrics ripaMetrics);
+
+    /**
+     * 批量删除模型指标配置
+     *
+     * @param autoIds 需要删除的模型指标配置主键集合
+     * @return 结果
+     */
+    public int deleteRipaMetricsByAutoIds(Long[] autoIds);
+
+    /**
+     * 删除模型指标配置信息
+     *
+     * @param autoId 模型指标配置主键
+     * @return 结果
+     */
+    public int deleteRipaMetricsByAutoId(Long autoId);
+
+    /**
+     * 查询模型指标配置列表
+     *
+     * @return 模型指标配置集合
+     */
+    List<Map<String,Object>> selectRiskMetricsList();
+}

+ 101 - 0
jjt-biz/src/main/java/com/jjt/biz/service/impl/RipaMetricsServiceImpl.java

@@ -0,0 +1,101 @@
+package com.jjt.biz.service.impl;
+
+import java.util.List;
+import java.util.Map;
+
+import com.jjt.common.utils.DateUtils;
+import org.springframework.stereotype.Service;
+import com.jjt.biz.mapper.RipaMetricsMapper;
+import com.jjt.biz.domain.RipaMetrics;
+import com.jjt.biz.service.IRipaMetricsService;
+import javax.annotation.Resource;
+
+/**
+ * 模型指标配置Service业务层处理
+ *
+ * @author jjt
+ * @date 2025-10-22
+ */
+@Service
+public class RipaMetricsServiceImpl implements IRipaMetricsService {
+    @Resource
+    private RipaMetricsMapper ripaMetricsMapper;
+
+    /**
+     * 查询模型指标配置
+     *
+     * @param autoId 模型指标配置主键
+     * @return 模型指标配置
+     */
+    @Override
+    public RipaMetrics selectRipaMetricsByAutoId(Long autoId) {
+        return ripaMetricsMapper.selectRipaMetricsByAutoId(autoId);
+    }
+
+    /**
+     * 查询模型指标配置列表
+     *
+     * @param ripaMetrics 模型指标配置
+     * @return 模型指标配置
+     */
+    @Override
+    public List<RipaMetrics> selectRipaMetricsList(RipaMetrics ripaMetrics) {
+        return ripaMetricsMapper.selectRipaMetricsList(ripaMetrics);
+    }
+
+    /**
+     * 新增模型指标配置
+     *
+     * @param ripaMetrics 模型指标配置
+     * @return 结果
+     */
+    @Override
+    public int insertRipaMetrics(RipaMetrics ripaMetrics) {
+                ripaMetrics.setCreateTime(DateUtils.getNowDate());
+            return ripaMetricsMapper.insertRipaMetrics(ripaMetrics);
+    }
+
+    /**
+     * 修改模型指标配置
+     *
+     * @param ripaMetrics 模型指标配置
+     * @return 结果
+     */
+    @Override
+    public int updateRipaMetrics(RipaMetrics ripaMetrics) {
+                ripaMetrics.setUpdateTime(DateUtils.getNowDate());
+        return ripaMetricsMapper.updateRipaMetrics(ripaMetrics);
+    }
+
+    /**
+     * 批量删除模型指标配置
+     *
+     * @param autoIds 需要删除的模型指标配置主键
+     * @return 结果
+     */
+    @Override
+    public int deleteRipaMetricsByAutoIds(Long[] autoIds) {
+        return ripaMetricsMapper.deleteRipaMetricsByAutoIds(autoIds);
+    }
+
+    /**
+     * 删除模型指标配置信息
+     *
+     * @param autoId 模型指标配置主键
+     * @return 结果
+     */
+    @Override
+    public int deleteRipaMetricsByAutoId(Long autoId) {
+        return ripaMetricsMapper.deleteRipaMetricsByAutoId(autoId);
+    }
+
+    /**
+     * 查询模型指标配置列表
+     *
+     * @return 模型指标配置集合
+     */
+    @Override
+    public List<Map<String, Object>> selectRiskMetricsList() {
+        return ripaMetricsMapper.selectRiskMetricsList();
+    }
+}

+ 68 - 0
jjt-biz/src/main/java/com/jjt/utils/JavaScriptUtil.java

@@ -0,0 +1,68 @@
+package com.jjt.utils;
+
+import javax.script.Invocable;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+
+/**
+ * JavaScript工具类
+ *
+ * @author wukai
+ * @date 2025/10/22 01:17
+ */
+public class JavaScriptUtil {
+    public static void main(String[] args) {
+        System.out.println("JavaScriptUtil.main");
+    }
+
+    public static String exec() {
+        try {
+            // 创建脚本引擎管理器
+            ScriptEngineManager manager = new ScriptEngineManager();
+
+            // 获取GraalJS引擎
+            ScriptEngine engine = manager.getEngineByName("graal.js");
+
+            // 定义JavaScript函数
+            String jsFunctions =
+                    "function add(a, b) { " +
+                            "    return a + b; " +
+                            "} " +
+                            "" +
+                            "function factorial(n) { " +
+                            "    if (n <= 1) return 1; " +
+                            "    return n * factorial(n - 1); " +
+                            "} " +
+                            "" +
+                            "function getUserInfo(name, age) { " +
+                            "    return { " +
+                            "        name: name, " +
+                            "        age: age, " +
+                            "        birthYear: 2024 - age " +
+                            "    }; " +
+                            "}";
+
+            // 执行脚本,注册函数
+            engine.eval(jsFunctions);
+
+            // 转换为Invocable来调用函数
+            Invocable invocable = (Invocable) engine;
+
+            // 调用add函数
+            Object addResult = invocable.invokeFunction("add", 15, 25);
+            System.out.println("15 + 25 = " + addResult);
+
+            // 调用factorial函数
+            Object factorialResult = invocable.invokeFunction("factorial", 5);
+            System.out.println("5! = " + factorialResult);
+
+            // 调用返回对象的函数
+            Object userInfo = invocable.invokeFunction("getUserInfo", "张三", 25);
+            System.out.println("用户信息: " + userInfo);
+        } catch (ScriptException | NoSuchMethodException e) {
+            e.printStackTrace();
+        }
+        return "JavaScriptUtil.exec";
+    }
+}

+ 146 - 0
jjt-biz/src/main/resources/mapper/biz/RipaMetricsMapper.xml

@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jjt.biz.mapper.RipaMetricsMapper">
+
+    <resultMap type="RipaMetrics" id="RipaMetricsResult">
+            <result property="autoId" column="AUTO_ID"/>
+            <result property="modelId" column="MODEL_ID"/>
+            <result property="objMetricsId" column="OBJ_METRICS_ID"/>
+            <result property="metricsName" column="METRICS_NAME"/>
+            <result property="createBy" column="CREATE_BY"/>
+            <result property="createTime" column="CREATE_TIME"/>
+            <result property="updateBy" column="UPDATE_BY"/>
+            <result property="updateTime" column="UPDATE_TIME"/>
+            <result property="remark" column="REMARK"/>
+    </resultMap>
+
+    <sql id="selectRipaMetricsVo">
+        select AUTO_ID, MODEL_ID, OBJ_METRICS_ID, METRICS_NAME, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, REMARK
+        from ripa_metrics
+    </sql>
+
+    <select id="selectRipaMetricsList" parameterType="RipaMetrics" resultMap="RipaMetricsResult">
+        <include refid="selectRipaMetricsVo"/>
+        <where>
+                        <if test="modelId != null ">
+                            and MODEL_ID = #{modelId}
+                        </if>
+                        <if test="objMetricsId != null ">
+                            and OBJ_METRICS_ID = #{objMetricsId}
+                        </if>
+                        <if test="metricsName != null  and metricsName != ''">
+                            and METRICS_NAME like concat('%', #{metricsName}, '%')
+                        </if>
+                        <if test="createBy != null  and createBy != ''">
+                            and CREATE_BY = #{createBy}
+                        </if>
+                        <if test="createTime != null ">
+                            and CREATE_TIME = #{createTime}
+                        </if>
+                        <if test="updateBy != null  and updateBy != ''">
+                            and UPDATE_BY = #{updateBy}
+                        </if>
+                        <if test="updateTime != null ">
+                            and UPDATE_TIME = #{updateTime}
+                        </if>
+                        <if test="remark != null  and remark != ''">
+                            and REMARK = #{remark}
+                        </if>
+        </where>
+    </select>
+
+    <select id="selectRipaMetricsByAutoId" parameterType="Long"
+            resultMap="RipaMetricsResult">
+            <include refid="selectRipaMetricsVo"/>
+            where AUTO_ID = #{autoId}
+    </select>
+    <select id="selectRiskMetricsList" resultType="java.util.Map">
+        SELECT a.obj_type,a.obj_name,b.obj_metrics_id,metrics_name FROM biz_obj a,biz_obj_metrics b WHERE a.OBJ_ID=b.OBJ_ID
+    </select>
+
+    <insert id="insertRipaMetrics" parameterType="RipaMetrics" useGeneratedKeys="true"
+            keyProperty="autoId">
+        insert into ripa_metrics
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+                    <if test="modelId != null">MODEL_ID,
+                    </if>
+                    <if test="objMetricsId != null">OBJ_METRICS_ID,
+                    </if>
+                    <if test="metricsName != null">METRICS_NAME,
+                    </if>
+                    <if test="createBy != null">CREATE_BY,
+                    </if>
+                    <if test="createTime != null">CREATE_TIME,
+                    </if>
+                    <if test="updateBy != null">UPDATE_BY,
+                    </if>
+                    <if test="updateTime != null">UPDATE_TIME,
+                    </if>
+                    <if test="remark != null">REMARK,
+                    </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+                    <if test="modelId != null">#{modelId},
+                    </if>
+                    <if test="objMetricsId != null">#{objMetricsId},
+                    </if>
+                    <if test="metricsName != null">#{metricsName},
+                    </if>
+                    <if test="createBy != null">#{createBy},
+                    </if>
+                    <if test="createTime != null">#{createTime},
+                    </if>
+                    <if test="updateBy != null">#{updateBy},
+                    </if>
+                    <if test="updateTime != null">#{updateTime},
+                    </if>
+                    <if test="remark != null">#{remark},
+                    </if>
+        </trim>
+    </insert>
+
+    <update id="updateRipaMetrics" parameterType="RipaMetrics">
+        update ripa_metrics
+        <trim prefix="SET" suffixOverrides=",">
+                    <if test="modelId != null">MODEL_ID =
+                        #{modelId},
+                    </if>
+                    <if test="objMetricsId != null">OBJ_METRICS_ID =
+                        #{objMetricsId},
+                    </if>
+                    <if test="metricsName != null">METRICS_NAME =
+                        #{metricsName},
+                    </if>
+                    <if test="createBy != null">CREATE_BY =
+                        #{createBy},
+                    </if>
+                    <if test="createTime != null">CREATE_TIME =
+                        #{createTime},
+                    </if>
+                    <if test="updateBy != null">UPDATE_BY =
+                        #{updateBy},
+                    </if>
+                    <if test="updateTime != null">UPDATE_TIME =
+                        #{updateTime},
+                    </if>
+                    <if test="remark != null">REMARK =
+                        #{remark},
+                    </if>
+        </trim>
+        where AUTO_ID = #{autoId}
+    </update>
+
+    <delete id="deleteRipaMetricsByAutoId" parameterType="Long">
+        delete
+        from ripa_metrics where AUTO_ID = #{autoId}
+    </delete>
+
+    <delete id="deleteRipaMetricsByAutoIds" parameterType="String">
+        delete from ripa_metrics where AUTO_ID in
+        <foreach item="autoId" collection="array" open="(" separator="," close=")">
+            #{autoId}
+        </foreach>
+    </delete>
+</mapper>