Commit e5636366 authored by taabe's avatar taabe

增加查询危险因素关联对象个数接口

parent 9b2de18a
......@@ -22,12 +22,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
......@@ -170,4 +165,10 @@ public class RiskModelController extends BaseController {
Page<HashMap<String, Object>> fmeaList = fmeaService.queryFmeaList(param);
return CommonResponseUtil.success(fmeaList);
}
@ApiOperation(value = "Fmea是否关联对象查询", notes = "Fmea是否关联对象查询")
@GetMapping(value = "/fmea/{ids}/controlObjCount")
public CommonResponse queryFmeaControlObj(@ApiParam(value = "fmea ids") @PathVariable(value = "ids", required = true) String[] ids) {
return CommonResponseUtil.success(fmeaService.queryControlObjCount(ids));
}
}
......@@ -38,4 +38,10 @@ public interface IFmeaDao extends BaseDao<Fmea, Long> {
Fmea findById(Long id);
@Query(value = "SELECT count(1) FROM `f_fmea_point_inputitem` WHERE fmea_id in ?1", nativeQuery = true)
int countAssociatedInputItemByIds(String[] ids);
@Query(value = "SELECT count(1) FROM `f_fmea_equipment_point` WHERE fmea_id in ?1", nativeQuery = true)
int countAssociatedEquipPointByIds(String[] ids);
}
......@@ -109,6 +109,16 @@ public class FmeaServiceImpl implements IFmeaService {
}
@Override
public int queryControlObjCount(String[] ids) {
int count1 = iFmeaDao.countAssociatedEquipPointByIds(ids);
int count2 = iFmeaDao.countAssociatedInputItemByIds(ids);
if (count1 > 0 || count2 > 0) {
return count1 + count2;
}
return 0;//没有关联对象
}
private boolean asymbleWithParent(String bacthNo, List<RiskSource> riskSourceList, String from) throws Exception {
if (!CollectionUtils.isEmpty(riskSourceList)) {
for (RiskSource riskSource : riskSourceList) {
......
......@@ -38,4 +38,12 @@ public interface IFmeaService {
void updateRpniInfo(Long riskSourceId);
/**
* 查询关联的关联对象个数
*
* @param ids
* @return count 关联对象个数
*/
int queryControlObjCount(String[] ids);
}
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