Przeglądaj źródła

健康度明细指标管理

wukai 9 miesięcy temu
rodzic
commit
dda8d74c08

+ 48 - 33
jjt-biz/src/main/java/com/jjt/hl/controller/HlMetricsController.java

@@ -1,28 +1,24 @@
 package com.jjt.hl.controller;
 
-import java.util.List;
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 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 com.jjt.hl.domain.HlClass;
 import com.jjt.hl.domain.HlMetrics;
+import com.jjt.hl.service.IHlClassService;
 import com.jjt.hl.service.IHlMetricsService;
-import com.jjt.common.utils.poi.ExcelUtil;
-import com.jjt.common.core.page.TableDataInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 业务模型健康度指标Controller
@@ -30,13 +26,38 @@ import com.jjt.common.core.page.TableDataInfo;
  * @author jjt
  * @date 2024-09-05
  */
-@Api(tags="业务模型健康度指标")
+@Api(tags = "业务模型健康度指标")
 @RestController
 @RequestMapping("/hl/hm")
-public class HlMetricsController extends BaseController
-{
+public class HlMetricsController extends BaseController {
     @Resource
     private IHlMetricsService hlMetricsService;
+    @Resource
+    private IHlClassService hlClassService;
+
+    @ApiOperation("根据分类ID查询指标")
+    @GetMapping("/list/{hlClassId}")
+    public AjaxResult list(@PathVariable("hlClassId") Long hlClassId) {
+        HlMetrics hlMetrics = new HlMetrics();
+        hlMetrics.setHlClassId(hlClassId);
+        List<HlMetrics> list = hlMetricsService.selectHlMetricsList(hlMetrics);
+        return AjaxResult.success(list);
+    }
+
+    @ApiOperation("根据分类ID查询选择指标列表")
+    @GetMapping("/select/{hlClassId}")
+    public AjaxResult select(@PathVariable("hlClassId") Long hlClassId) {
+        HlClass hlClass = hlClassService.selectHlClassByHlClassId(hlClassId);
+        List<HlMetrics> list = hlMetricsService.selectHlMetricsList4ModelId(hlClass.getModelId(), hlClass.getObjType());
+        return AjaxResult.success(list);
+    }
+
+    @ApiOperation("添加指标")
+    @GetMapping("/add/{hlClassId}")
+    public AjaxResult objAdd(@ApiParam(value = "分类ID", required = true) @PathVariable("hlClassId") Long hlClassId, @ApiParam(value = "指标ID数组", required = true) Long[] ids) {
+        return success(hlMetricsService.insertMetrics(hlClassId, ids));
+    }
+
 
     /**
      * 查询业务模型健康度指标列表
@@ -44,8 +65,7 @@ public class HlMetricsController extends BaseController
     @ApiOperation("查询业务模型健康度指标列表")
     @PreAuthorize("@ss.hasPermi('hl:hm:list')")
     @GetMapping("/list")
-    public TableDataInfo list(HlMetrics hlMetrics)
-    {
+    public TableDataInfo list(HlMetrics hlMetrics) {
         startPage();
         List<HlMetrics> list = hlMetricsService.selectHlMetricsList(hlMetrics);
         return getDataTable(list);
@@ -58,8 +78,7 @@ public class HlMetricsController extends BaseController
     @PreAuthorize("@ss.hasPermi('hl:hm:export')")
     @Log(title = "业务模型健康度指标", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, HlMetrics hlMetrics)
-    {
+    public void export(HttpServletResponse response, HlMetrics hlMetrics) {
         List<HlMetrics> list = hlMetricsService.selectHlMetricsList(hlMetrics);
         ExcelUtil<HlMetrics> util = new ExcelUtil<HlMetrics>(HlMetrics.class);
         util.exportExcel(response, list, "业务模型健康度指标数据");
@@ -71,8 +90,7 @@ public class HlMetricsController extends BaseController
     @ApiOperation("获取业务模型健康度指标详细信息")
     @PreAuthorize("@ss.hasPermi('hl:hm:query')")
     @GetMapping(value = "/{hlMetricsId}")
-    public AjaxResult getInfo(@PathVariable("hlMetricsId") Long hlMetricsId)
-    {
+    public AjaxResult getInfo(@PathVariable("hlMetricsId") Long hlMetricsId) {
         return success(hlMetricsService.selectHlMetricsByHlMetricsId(hlMetricsId));
     }
 
@@ -83,8 +101,7 @@ public class HlMetricsController extends BaseController
     @PreAuthorize("@ss.hasPermi('hl:hm:add')")
     @Log(title = "业务模型健康度指标", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody HlMetrics hlMetrics)
-    {
+    public AjaxResult add(@RequestBody HlMetrics hlMetrics) {
         return toAjax(hlMetricsService.insertHlMetrics(hlMetrics));
     }
 
@@ -95,8 +112,7 @@ public class HlMetricsController extends BaseController
     @PreAuthorize("@ss.hasPermi('hl:hm:edit')")
     @Log(title = "业务模型健康度指标", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody HlMetrics hlMetrics)
-    {
+    public AjaxResult edit(@RequestBody HlMetrics hlMetrics) {
         return toAjax(hlMetricsService.updateHlMetrics(hlMetrics));
     }
 
@@ -106,9 +122,8 @@ public class HlMetricsController extends BaseController
     @ApiOperation("删除业务模型健康度指标")
     @PreAuthorize("@ss.hasPermi('hl:hm:remove')")
     @Log(title = "业务模型健康度指标", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{hlMetricsIds}")
-    public AjaxResult remove(@PathVariable Long[] hlMetricsIds)
-    {
+    @DeleteMapping("/{hlMetricsIds}")
+    public AjaxResult remove(@PathVariable Long[] hlMetricsIds) {
         return toAjax(hlMetricsService.deleteHlMetricsByHlMetricsIds(hlMetricsIds));
     }
 }

+ 1 - 1
jjt-biz/src/main/java/com/jjt/hl/controller/HlObjController.java

@@ -69,7 +69,7 @@ public class HlObjController extends BaseController {
 
     @ApiOperation("添加对象")
     @GetMapping("/add/{hlClassId}")
-    public AjaxResult objAdd(@ApiParam(value = "模型ID", required = true) @PathVariable("hlClassId") Long hlClassId, @ApiParam(value = "对象ID数组", required = true) Long[] objIds) {
+    public AjaxResult objAdd(@ApiParam(value = "分类ID", required = true) @PathVariable("hlClassId") Long hlClassId, @ApiParam(value = "对象ID数组", required = true) Long[] objIds) {
         return success(hlObjService.insertObj(hlClassId, objIds));
     }
 

+ 26 - 73
jjt-biz/src/main/java/com/jjt/hl/domain/HlMetrics.java

@@ -1,12 +1,11 @@
 package com.jjt.hl.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;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 /**
  * 业务模型健康度指标对象 hl_metrics
@@ -15,94 +14,48 @@ import com.jjt.common.core.domain.BaseEntity;
  * @date 2024-09-05
  */
 @ApiModel(value = "HlMetrics", description = "业务模型健康度指标")
-public class HlMetrics extends BaseEntity
-{
+@Data
+public class HlMetrics extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 指标明细ID */
+    /**
+     * 指标明细ID
+     */
     @ApiModelProperty("指标明细ID")
     @TableId
     private Long hlMetricsId;
 
-    /** 健康度分类ID */
+    /**
+     * 健康度分类ID
+     */
     @ApiModelProperty("健康度分类ID")
     @Excel(name = "健康度分类ID")
     private Long hlClassId;
 
-    /** 指标ID */
+    /**
+     * 指标ID
+     */
     @ApiModelProperty("指标ID")
     @Excel(name = "指标ID")
     private Long metricsId;
 
-    /** 健康度分值 */
+    @ApiModelProperty("指标名称")
+    private String metricsName;
+
+    @ApiModelProperty("指标编码")
+    private String metricsCode;
+
+    /**
+     * 健康度分值
+     */
     @ApiModelProperty("健康度分值")
     @Excel(name = "健康度分值")
     private String hlScore;
 
-    /** 评分标准 */
+    /**
+     * 评分标准
+     */
     @ApiModelProperty("评分标准")
     @Excel(name = "评分标准")
     private String hlStand;
-
-    public void setHlMetricsId(Long hlMetricsId)
-    {
-        this.hlMetricsId = hlMetricsId;
-    }
-
-    public Long getHlMetricsId()
-    {
-        return hlMetricsId;
-    }
-    public void setHlClassId(Long hlClassId)
-    {
-        this.hlClassId = hlClassId;
-    }
-
-    public Long getHlClassId()
-    {
-        return hlClassId;
-    }
-    public void setMetricsId(Long metricsId)
-    {
-        this.metricsId = metricsId;
-    }
-
-    public Long getMetricsId()
-    {
-        return metricsId;
-    }
-    public void setHlScore(String hlScore)
-    {
-        this.hlScore = hlScore;
-    }
-
-    public String getHlScore()
-    {
-        return hlScore;
-    }
-    public void setHlStand(String hlStand)
-    {
-        this.hlStand = hlStand;
-    }
-
-    public String getHlStand()
-    {
-        return hlStand;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("hlMetricsId", getHlMetricsId())
-            .append("hlClassId", getHlClassId())
-            .append("metricsId", getMetricsId())
-            .append("hlScore", getHlScore())
-            .append("hlStand", getHlStand())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
-    }
 }

+ 20 - 10
jjt-biz/src/main/java/com/jjt/hl/mapper/HlMetricsMapper.java

@@ -1,20 +1,21 @@
 package com.jjt.hl.mapper;
 
-import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.jjt.hl.domain.HlMetrics;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 业务模型健康度指标Mapper接口
- * 
+ *
  * @author jjt
  * @date 2024-09-05
  */
-public interface HlMetricsMapper extends BaseMapper<HlMetrics>
-{
+public interface HlMetricsMapper extends BaseMapper<HlMetrics> {
     /**
      * 查询业务模型健康度指标
-     * 
+     *
      * @param hlMetricsId 业务模型健康度指标主键
      * @return 业务模型健康度指标
      */
@@ -22,7 +23,7 @@ public interface HlMetricsMapper extends BaseMapper<HlMetrics>
 
     /**
      * 查询业务模型健康度指标列表
-     * 
+     *
      * @param hlMetrics 业务模型健康度指标
      * @return 业务模型健康度指标集合
      */
@@ -30,7 +31,7 @@ public interface HlMetricsMapper extends BaseMapper<HlMetrics>
 
     /**
      * 新增业务模型健康度指标
-     * 
+     *
      * @param hlMetrics 业务模型健康度指标
      * @return 结果
      */
@@ -38,7 +39,7 @@ public interface HlMetricsMapper extends BaseMapper<HlMetrics>
 
     /**
      * 修改业务模型健康度指标
-     * 
+     *
      * @param hlMetrics 业务模型健康度指标
      * @return 结果
      */
@@ -46,7 +47,7 @@ public interface HlMetricsMapper extends BaseMapper<HlMetrics>
 
     /**
      * 删除业务模型健康度指标
-     * 
+     *
      * @param hlMetricsId 业务模型健康度指标主键
      * @return 结果
      */
@@ -54,9 +55,18 @@ public interface HlMetricsMapper extends BaseMapper<HlMetrics>
 
     /**
      * 批量删除业务模型健康度指标
-     * 
+     *
      * @param hlMetricsIds 需要删除的数据主键集合
      * @return 结果
      */
     public int deleteHlMetricsByHlMetricsIds(Long[] hlMetricsIds);
+
+    /**
+     * 查询指标列表
+     *
+     * @param modelId 模型ID
+     * @param objType 对象类型
+     * @return 结果
+     */
+    List<HlMetrics> selectHlMetricsList4ModelId(@Param("modelId") Long modelId, @Param("objType") String objType);
 }

+ 25 - 8
jjt-biz/src/main/java/com/jjt/hl/service/IHlMetricsService.java

@@ -1,19 +1,20 @@
 package com.jjt.hl.service;
 
 import java.util.List;
+
 import com.jjt.hl.domain.HlMetrics;
 
 /**
  * 业务模型健康度指标Service接口
- * 
+ *
  * @author jjt
  * @date 2024-09-05
  */
-public interface IHlMetricsService 
+public interface IHlMetricsService
 {
     /**
      * 查询业务模型健康度指标
-     * 
+     *
      * @param hlMetricsId 业务模型健康度指标主键
      * @return 业务模型健康度指标
      */
@@ -21,7 +22,7 @@ public interface IHlMetricsService
 
     /**
      * 查询业务模型健康度指标列表
-     * 
+     *
      * @param hlMetrics 业务模型健康度指标
      * @return 业务模型健康度指标集合
      */
@@ -29,7 +30,7 @@ public interface IHlMetricsService
 
     /**
      * 新增业务模型健康度指标
-     * 
+     *
      * @param hlMetrics 业务模型健康度指标
      * @return 结果
      */
@@ -37,7 +38,7 @@ public interface IHlMetricsService
 
     /**
      * 修改业务模型健康度指标
-     * 
+     *
      * @param hlMetrics 业务模型健康度指标
      * @return 结果
      */
@@ -45,7 +46,7 @@ public interface IHlMetricsService
 
     /**
      * 批量删除业务模型健康度指标
-     * 
+     *
      * @param hlMetricsIds 需要删除的业务模型健康度指标主键集合
      * @return 结果
      */
@@ -53,9 +54,25 @@ public interface IHlMetricsService
 
     /**
      * 删除业务模型健康度指标信息
-     * 
+     *
      * @param hlMetricsId 业务模型健康度指标主键
      * @return 结果
      */
     public int deleteHlMetricsByHlMetricsId(Long hlMetricsId);
+
+    /**
+     * 查询指标列表
+     * @param modelId 模型ID
+     * @param objType 对象类型
+     * @return
+     */
+    List<HlMetrics> selectHlMetricsList4ModelId(Long modelId, String objType);
+
+    /**
+     * 添加指标
+     * @param hlClassId 分类ID
+     * @param ids 指标IDS
+     * @return 结果
+     */
+    int insertMetrics(Long hlClassId, Long[] ids);
 }

+ 41 - 7
jjt-biz/src/main/java/com/jjt/hl/service/impl/HlMetricsServiceImpl.java

@@ -1,12 +1,13 @@
 package com.jjt.hl.service.impl;
 
-import java.util.List;
-        import com.jjt.common.utils.DateUtils;
-import org.springframework.stereotype.Service;
-import com.jjt.hl.mapper.HlMetricsMapper;
+import com.jjt.common.utils.DateUtils;
 import com.jjt.hl.domain.HlMetrics;
+import com.jjt.hl.mapper.HlMetricsMapper;
 import com.jjt.hl.service.IHlMetricsService;
+import org.springframework.stereotype.Service;
+
 import javax.annotation.Resource;
+import java.util.List;
 
 /**
  * 业务模型健康度指标Service业务层处理
@@ -49,8 +50,8 @@ public class HlMetricsServiceImpl implements IHlMetricsService {
      */
     @Override
     public int insertHlMetrics(HlMetrics hlMetrics) {
-                hlMetrics.setCreateTime(DateUtils.getNowDate());
-            return hlMetricsMapper.insertHlMetrics(hlMetrics);
+        hlMetrics.setCreateTime(DateUtils.getNowDate());
+        return hlMetricsMapper.insertHlMetrics(hlMetrics);
     }
 
     /**
@@ -61,7 +62,7 @@ public class HlMetricsServiceImpl implements IHlMetricsService {
      */
     @Override
     public int updateHlMetrics(HlMetrics hlMetrics) {
-                hlMetrics.setUpdateTime(DateUtils.getNowDate());
+        hlMetrics.setUpdateTime(DateUtils.getNowDate());
         return hlMetricsMapper.updateHlMetrics(hlMetrics);
     }
 
@@ -86,4 +87,37 @@ public class HlMetricsServiceImpl implements IHlMetricsService {
     public int deleteHlMetricsByHlMetricsId(Long hlMetricsId) {
         return hlMetricsMapper.deleteHlMetricsByHlMetricsId(hlMetricsId);
     }
+
+    /**
+     * 查询指标列表
+     *
+     * @param modelId 模型ID
+     * @param objType 对象类型
+     * @return 结果
+     */
+    @Override
+    public List<HlMetrics> selectHlMetricsList4ModelId(Long modelId, String objType) {
+        return hlMetricsMapper.selectHlMetricsList4ModelId(modelId, objType);
+    }
+
+    /**
+     * 添加指标
+     *
+     * @param hlClassId 分类ID
+     * @param ids    指标IDS
+     * @return 结果
+     */
+    @Override
+    public int insertMetrics(Long hlClassId, Long[] ids) {
+        if (ids.length == 0) {
+            return 1;
+        }
+        for (Long objId : ids) {
+            HlMetrics metrics = new HlMetrics();
+            metrics.setHlClassId(hlClassId);
+            metrics.setMetricsId(objId);
+            insertHlMetrics(metrics);
+        }
+        return 0;
+    }
 }

+ 124 - 105
jjt-biz/src/main/resources/mapper/hl/HlMetricsMapper.xml

@@ -5,144 +5,163 @@
 <mapper namespace="com.jjt.hl.mapper.HlMetricsMapper">
 
     <resultMap type="HlMetrics" id="HlMetricsResult">
-            <result property="hlMetricsId" column="HL_METRICS_ID"/>
-            <result property="hlClassId" column="HL_CLASS_ID"/>
-            <result property="metricsId" column="METRICS_ID"/>
-            <result property="hlScore" column="HL_SCORE"/>
-            <result property="hlStand" column="HL_STAND"/>
-            <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"/>
+        <result property="hlMetricsId" column="HL_METRICS_ID"/>
+        <result property="hlClassId" column="HL_CLASS_ID"/>
+        <result property="metricsId" column="METRICS_ID"/>
+        <result property="hlScore" column="HL_SCORE"/>
+        <result property="hlStand" column="HL_STAND"/>
+        <result property="metricsName" column="METRICS_NAME"/>
+        <result property="metricsCode" column="METRICS_CODE"/>
+        <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="selectHlMetricsVo">
-        select HL_METRICS_ID, HL_CLASS_ID, METRICS_ID, HL_SCORE, HL_STAND, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, REMARK
-        from hl_metrics
+        select *
+        from (select a.*, b.METRICS_NAME, b.METRICS_CODE
+              from hl_metrics a,
+                   metrics_def b
+              where a.METRICS_ID = b.METRICS_ID) t
     </sql>
 
     <select id="selectHlMetricsList" parameterType="HlMetrics" resultMap="HlMetricsResult">
         <include refid="selectHlMetricsVo"/>
         <where>
-                        <if test="hlClassId != null ">
-                            and HL_CLASS_ID = #{hlClassId}
-                        </if>
-                        <if test="metricsId != null ">
-                            and METRICS_ID = #{metricsId}
-                        </if>
-                        <if test="hlScore != null  and hlScore != ''">
-                            and HL_SCORE = #{hlScore}
-                        </if>
-                        <if test="hlStand != null  and hlStand != ''">
-                            and HL_STAND = #{hlStand}
-                        </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>
+            <if test="hlClassId != null ">
+                and HL_CLASS_ID = #{hlClassId}
+            </if>
+            <if test="metricsId != null ">
+                and METRICS_ID = #{metricsId}
+            </if>
+            <if test="hlScore != null  and hlScore != ''">
+                and HL_SCORE = #{hlScore}
+            </if>
+            <if test="hlStand != null  and hlStand != ''">
+                and HL_STAND = #{hlStand}
+            </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="selectHlMetricsByHlMetricsId" parameterType="Long"
             resultMap="HlMetricsResult">
-            <include refid="selectHlMetricsVo"/>
-            where HL_METRICS_ID = #{hlMetricsId}
+        <include refid="selectHlMetricsVo"/>
+        where HL_METRICS_ID = #{hlMetricsId}
+    </select>
+    <select id="selectHlMetricsList4ModelId" resultType="com.jjt.hl.domain.HlMetrics">
+        SELECT metrics_id, metrics_name, metrics_code
+        FROM metrics_def
+        WHERE metrics_id IN (SELECT metrics_id
+                             from biz_obj_metrics
+                             WHERE obj_id in (SELECT a.obj_id
+                                              FROM biz_model_detail a,
+                                                   biz_obj b
+                                              WHERE a.obj_id = b.obj_id
+                                                AND b.obj_type = #{objType}
+                                                AND a.MODEL_ID = #{modelId})
+                             group BY metrics_id)
     </select>
 
     <insert id="insertHlMetrics" parameterType="HlMetrics" useGeneratedKeys="true"
             keyProperty="hlMetricsId">
         insert into hl_metrics
         <trim prefix="(" suffix=")" suffixOverrides=",">
-                    <if test="hlClassId != null">HL_CLASS_ID,
-                    </if>
-                    <if test="metricsId != null">METRICS_ID,
-                    </if>
-                    <if test="hlScore != null">HL_SCORE,
-                    </if>
-                    <if test="hlStand != null">HL_STAND,
-                    </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>
+            <if test="hlClassId != null">HL_CLASS_ID,
+            </if>
+            <if test="metricsId != null">METRICS_ID,
+            </if>
+            <if test="hlScore != null">HL_SCORE,
+            </if>
+            <if test="hlStand != null">HL_STAND,
+            </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="hlClassId != null">#{hlClassId},
-                    </if>
-                    <if test="metricsId != null">#{metricsId},
-                    </if>
-                    <if test="hlScore != null">#{hlScore},
-                    </if>
-                    <if test="hlStand != null">#{hlStand},
-                    </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>
+            <if test="hlClassId != null">#{hlClassId},
+            </if>
+            <if test="metricsId != null">#{metricsId},
+            </if>
+            <if test="hlScore != null">#{hlScore},
+            </if>
+            <if test="hlStand != null">#{hlStand},
+            </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="updateHlMetrics" parameterType="HlMetrics">
         update hl_metrics
         <trim prefix="SET" suffixOverrides=",">
-                    <if test="hlClassId != null">HL_CLASS_ID =
-                        #{hlClassId},
-                    </if>
-                    <if test="metricsId != null">METRICS_ID =
-                        #{metricsId},
-                    </if>
-                    <if test="hlScore != null">HL_SCORE =
-                        #{hlScore},
-                    </if>
-                    <if test="hlStand != null">HL_STAND =
-                        #{hlStand},
-                    </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>
+            <if test="hlClassId != null">HL_CLASS_ID =
+                #{hlClassId},
+            </if>
+            <if test="metricsId != null">METRICS_ID =
+                #{metricsId},
+            </if>
+            <if test="hlScore != null">HL_SCORE =
+                #{hlScore},
+            </if>
+            <if test="hlStand != null">HL_STAND =
+                #{hlStand},
+            </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 HL_METRICS_ID = #{hlMetricsId}
     </update>
 
     <delete id="deleteHlMetricsByHlMetricsId" parameterType="Long">
         delete
-        from hl_metrics where HL_METRICS_ID = #{hlMetricsId}
+        from hl_metrics
+        where HL_METRICS_ID = #{hlMetricsId}
     </delete>
 
     <delete id="deleteHlMetricsByHlMetricsIds" parameterType="String">