Exemplo n.º 1
0
  @SuppressWarnings("unchecked")
  @RequestMapping(
      value = "/areaMaterialConfigs/clone/list",
      method = {RequestMethod.GET, RequestMethod.POST})
  @ResponseBody
  public Object cloneMaterialConfigsEntitys(@RequestBody IdLongsBean bean) {

    if (bean.getId() == null || bean.getId() == 0L) {
      return bean;
    }
    AreaComponentEntity componentEntity =
        (AreaComponentEntity) baseService.getObject(AreaComponentEntity.class, bean.getId());
    //    	List<AreaMaterialsConfigEntity> old_entities =
    // componentEntity.getAreaMaterialsConfigEntities();
    String hql = "from AreaMaterialsConfigEntity entity where entity.id in(:ids)";
    Map<String, Object> params = new ConcurrentHashMap<String, Object>();
    params.put("ids", bean.getLongs());
    List<AreaMaterialsConfigEntity> clone_entities = baseService.getlist(hql, params);

    for (AreaMaterialsConfigEntity _clone_entity : clone_entities) {
      AreaMaterialsConfigEntity has = null;
      has = new AreaMaterialsConfigEntity();
      has.setUsageScript(_clone_entity.getUsageScript());
      has.setHelpCodeScript(_clone_entity.getHelpCodeScript());
      has.setParamScript(_clone_entity.getParamScript());
      has.setConditionScript(_clone_entity.getConditionScript());
      has.setQuerySqlId(_clone_entity.getQuerySqlId());
      has.setFname(_clone_entity.getFname());
      has.setAreaComponentEntity(componentEntity);
      componentEntity.getAreaMaterialsConfigEntities().add(has);
      baseService.saveEntity(has);
    }

    return bean;
  }
Exemplo n.º 2
0
 @SuppressWarnings("unchecked")
 @RequestMapping(
     value = "/component/areaMaterials/{componentId}",
     method = {RequestMethod.GET, RequestMethod.POST})
 @ResponseBody
 public Object getAreaMaterialConfigs(@PathVariable Long componentId) {
   AreaComponentEntity componentEntity =
       (AreaComponentEntity) baseService.getObject(AreaComponentEntity.class, componentId);
   List<AreaMaterialsConfigEntity> materialsConfigEntities =
       componentEntity.getAreaMaterialsConfigEntities();
   //		for(AreaMaterialsConfigEntity materialsConfigEntity : materialsConfigEntities){
   //			MaterialBean bean =
   // materialListManager.getEntityByFNumber(materialsConfigEntity.getFNumber());
   //			if(bean == null){
   //				continue;
   //			}
   //			materialsConfigEntity.setFname(bean.getFname());
   //			materialsConfigEntity.setFmodel(bean.getFmodel());
   //			materialsConfigEntity.setUnit(bean.getUnit());
   //		}
   return materialsConfigEntities;
 }