Commit b96343a4 by zhangkb

添加根据指标id获取指标详情接口

parent a44beb64
......@@ -43,6 +43,12 @@ public class IndicatorsDefCtrl {
baseIndDefService.delete(indId);
}
@ApiOperation(value = "根据id查询基础指标详情", notes = "根据id查询基础指标详情")
@PostMapping(value = "/getBaseIndById")
public BaseIndDef getBaseIndById(@RequestParam String indId) throws Exception{
return baseIndDefService.getById(indId);
}
@ApiOperation(value = "根据关键字查询基础指标", notes = "根据关键字查询基础指标")
@PostMapping(value = "/getByPageAndKeyword")
public Map<String,Object> getByPageAndKeyword(@RequestParam Integer catalogId,
......@@ -65,6 +71,18 @@ public class IndicatorsDefCtrl {
driveIndDefService.delete(indId);
}
@ApiOperation(value = "根据考核指标id获取指标详情", notes = "根据考核指标id获取指标详情")
@PostMapping(value = "/getDrivedefById")
public DriveIndDef getDrivedefById(@RequestParam String indId) throws Exception{
return driveIndDefService.getById(indId);
}
@ApiOperation(value = "根据考核指标id获取指标详情(包含短板筛选规则信息)", notes = "根据考核指标id获取指标详情(包含短板筛选规则信息)")
@PostMapping(value = "/getDrivedefDetailById")
public Map<String,Object> getDrivedefDetailById(@RequestParam String indId) throws Exception{
return driveIndDefService.getDetailById(indId);
}
@ApiOperation(value = "根据关键字查询考核指标", notes = "根据关键字查询考核指标")
@PostMapping(value = "/getDriveByPageAndKeyword")
public Map<String,Object> getDriveByPageAndKeyword(@RequestParam Integer catalogId,
......
......@@ -17,8 +17,10 @@ import com.google.common.collect.Maps;
import com.googlecode.aviator.AviatorEvaluator;
import com.keymobile.indicators.model.entity.indicators.DriveIndDef;
import com.keymobile.indicators.model.entity.shortboard.ShortboardDriveIndRel;
import com.keymobile.indicators.model.entity.shortboard.ShortboardRule;
import com.keymobile.indicators.model.mapper.indicators.DriveIndDefMapper;
import com.keymobile.indicators.model.mapper.indmapper.ShortboardDriveIndRelMapper;
import com.keymobile.indicators.model.mapper.indmapper.ShortboardRuleMapper;
import com.keymobile.indicators.utils.CalculateUtils;
@Service
......@@ -31,6 +33,8 @@ public class DriveIndDefService {
private BaseIndDataService baseIndDataService;
@Autowired
private ShortboardDriveIndRelMapper shortboardDriveIndRelMapper;
@Autowired
private ShortboardRuleMapper shortboardRuleMapper;
public String saveOrUpdate(DriveIndDef driveIndDef,Integer catalogId,String catalogIdPath,
String user,String shortboardIds)throws Exception{
......@@ -90,6 +94,28 @@ public class DriveIndDefService {
return driveIndDefMapper.selectOne(driveIndDef);
}
public Map<String,Object> getDetailById(String indId) throws Exception{
Map<String,Object> result = new HashMap<>();
DriveIndDef driveIndDef = new DriveIndDef();
driveIndDef.setIndId(indId);
driveIndDef = driveIndDefMapper.selectOne(driveIndDef);
if(driveIndDef!=null) {
result.put("driveIndDef", driveIndDef);
//查找考核指标之前关联的短板筛选规则
List<ShortboardDriveIndRel> relations = shortboardDriveIndRelMapper.
findByDriveIndDefId(driveIndDef.getIndId());
List<ShortboardRule> rules = new ArrayList<>();
for(ShortboardDriveIndRel relation : relations) {
ShortboardRule rule = shortboardRuleMapper.selectByPrimaryKey(relation.getShortboardRuleId());
if(rule!=null) {
rules.add(rule);
}
}
result.put("shortboardRules", rules);
}
return result;
}
public void delete(String indId) throws Exception{
driveIndDefMapper.deleteByPrimaryKey(indId);
}
......
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