Browse Source

考评得分规则列表查询

‘xugp 2 years ago
parent
commit
fc54d19777

+ 30 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/controller/EvaluationScoringRuleController.java

@@ -1,10 +1,20 @@
 package com.ims.eval.controller;
 
 
+import com.ims.eval.dao.result.R;
+import com.ims.eval.entity.DataDictionary;
+import com.ims.eval.entity.EvaluationScoringRule;
+import com.ims.eval.service.IEvaluationScoringRuleService;
+import com.ims.eval.service.impl.EvaluationScoringRuleServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 /**
  * <p>
  * 考评得分规则表 前端控制器
@@ -17,4 +27,24 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("//evaluation-scoring-rule")
 public class EvaluationScoringRuleController {
 
+
+	@Autowired
+	private IEvaluationScoringRuleService iEvaluationScoringRuleService;
+
+	/**
+	 * 查询
+	 *
+	 * @param indicatorUnit       指标单位
+	 * @param type     业务阶段
+	 * @param businessPhase  业务板块
+	 * @return
+	 */
+	@GetMapping(value = "list")
+	public R list(@RequestParam(value = "indicatorUnit", required = false) String indicatorUnit,
+				  @RequestParam(value = "type", required = false) String type,
+				  @RequestParam(value = "businessPhase", required = false) String businessPhase){
+		List<EvaluationScoringRule> list = iEvaluationScoringRuleService.list(indicatorUnit, type, businessPhase);
+		return R.ok().data(list);
+	}
+
 }

+ 6 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/dao/EvaluationScoringRuleMapper.java

@@ -2,6 +2,9 @@ package com.ims.eval.dao;
 
 import com.ims.eval.entity.EvaluationScoringRule;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +16,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface EvaluationScoringRuleMapper extends BaseMapper<EvaluationScoringRule> {
 
+    List<EvaluationScoringRule> list(@Param("id") String id,
+									 @Param("type") String type,
+									 @Param("indicatorId") String indicatorId);
 }

+ 21 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/entity/EvaluationScoringRule.java

@@ -1,9 +1,12 @@
 package com.ims.eval.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.util.List;
+
 /**
  * <p>
  * 考评得分规则表
@@ -29,7 +32,7 @@ public class EvaluationScoringRule extends Model {
     private String indicatorId;
 
     /**
-     * 类型
+     * 业务阶段
      */
     private String type;
 
@@ -48,5 +51,22 @@ public class EvaluationScoringRule extends Model {
      */
     private String parttitionInterval;
 
+	/**
+	 * 业务板块
+	 */
+	private String businessPhase;
+
+	/**
+	 * 指标单位
+	 */
+	private String indicatorUnit;
+
+	/**
+	 * 关联得分区间表
+	 */
+
+	@TableField(exist = false)
+    private List<IntervalScoringTable> intervalScoringTableList;
+
 
 }

+ 4 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/IEvaluationScoringRuleService.java

@@ -3,6 +3,8 @@ package com.ims.eval.service;
 import com.ims.eval.entity.EvaluationScoringRule;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * <p>
  * 考评得分规则表 服务类
@@ -13,4 +15,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IEvaluationScoringRuleService extends IService<EvaluationScoringRule> {
 
+	List<EvaluationScoringRule> list(String indicatorUnit,String type,String businessPhase);
+
 }

+ 40 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/EvaluationScoringRuleServiceImpl.java

@@ -1,11 +1,19 @@
 package com.ims.eval.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ims.common.utils.StringUtils;
+import com.ims.eval.dao.IntervalScoringTableMapper;
 import com.ims.eval.entity.EvaluationScoringRule;
 import com.ims.eval.dao.EvaluationScoringRuleMapper;
+import com.ims.eval.entity.IndicatorDictionary;
+import com.ims.eval.entity.IntervalScoringTable;
 import com.ims.eval.service.IEvaluationScoringRuleService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 考评得分规则表 服务实现类
@@ -17,4 +25,36 @@ import org.springframework.stereotype.Service;
 @Service
 public class EvaluationScoringRuleServiceImpl extends ServiceImpl<EvaluationScoringRuleMapper, EvaluationScoringRule> implements IEvaluationScoringRuleService {
 
+
+	@Autowired
+	private EvaluationScoringRuleMapper evaluationScoringRuleMapper;
+
+	@Autowired
+	private IntervalScoringTableMapper intervalScoringTableMapper;
+
+
+	@Override
+	public List<EvaluationScoringRule> list(String indicatorUnit,String type,String businessPhase){
+
+		QueryWrapper<EvaluationScoringRule> qw = new QueryWrapper<>();
+
+		if (StringUtils.isNotEmpty(indicatorUnit)) {
+			qw.lambda().eq(EvaluationScoringRule::getIndicatorUnit, indicatorUnit);
+		}
+		if (StringUtils.isNotEmpty(businessPhase)) {
+			qw.lambda().eq(EvaluationScoringRule::getBusinessPhase, businessPhase);
+		}
+		if (StringUtils.isNotEmpty(type)) {
+			qw.lambda().eq(EvaluationScoringRule::getType, type);
+		}
+		List<EvaluationScoringRule> evaluationScoringRules = evaluationScoringRuleMapper.selectList(qw);
+		for (EvaluationScoringRule evaluationScoringRule: evaluationScoringRules){
+			QueryWrapper<IntervalScoringTable> qw1 = new QueryWrapper<>();
+			qw1.eq("rule_id",evaluationScoringRule.getId());
+			List<IntervalScoringTable> intervalScoringTables = intervalScoringTableMapper.selectList(qw1);
+			evaluationScoringRule.setIntervalScoringTableList(intervalScoringTables);
+		}
+		return evaluationScoringRules;
+	}
+
 }

+ 45 - 0
ims-service/ims-eval/src/main/resources/mappings/ims/eval/EvaluationScoringRuleDao.xml

@@ -0,0 +1,45 @@
+<?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.ims.eval.dao.EvaluationScoringRuleMapper">
+
+    <sql id="EvaluationScoringRuleColumns">
+        a.id AS "id",
+		a.indicator_id AS "indicatorId",
+		a.type AS "type",
+		a.departid AS "departid",
+		a.describe AS "describe",
+		a.parttition_interval AS "parttitionInterval"
+    </sql>
+
+    <!--
+
+    b.id As "id",
+        b.rule_id As "ruleId",
+        b.range As "range",
+        b.rule_description As "ruleDescription",
+        b.regular_expression As "regularExpression",
+        b.enabled As "enabled",
+        b.create_time As "createTime",
+        b.create_by As "createBy",
+        b.update_time As "updateTime",
+        b.update_by As "updateBy",
+    -->
+    <select id="list" resultType="EvaluationScoringRule">
+        SELECT
+        <include refid="EvaluationScoringRuleColumns"/>
+        FROM evaluation_scoring_rule a left join  interval_scoring_table b on a.id = b.rule_id
+        <where>
+            <if test="id != null and  id  != ''">
+                AND a.id = #{id}
+            </if>
+            <if test="type != null and  type  != ''">
+                AND a.type = #{type}
+            </if>
+            <if test="indicatorId != null and  indicatorId  != ''">
+                AND a.indicator_id = #{indicatorId}
+            </if>
+        </where>
+    </select>
+
+
+</mapper>

+ 2 - 2
ims-service/ims-eval/src/main/resources/mappings/ims/eval/IndicatorDictionaryDao.xml

@@ -47,7 +47,7 @@
 	<select id="get" resultType="IndicatorDictionary">
 		SELECT
 			<include refid="indicatorDictionaryColumns"/>
-		FROM public.{table.name} a
+		FROM indicator_dictionary a
 
 		WHERE a.id = #{id}
 	</select>
@@ -192,4 +192,4 @@
 		</choose>
 	</update>
 
-</mapper>
+</mapper>