コード例 #1
0
  @SuppressWarnings("unchecked")
  @RequestMapping(
      value = "/pieceworkConfigs/clone/list",
      method = {RequestMethod.GET, RequestMethod.POST})
  @ResponseBody
  public Object clonePieceworkConfigsEntitys(@RequestBody IdLongsBean bean) {

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

    for (PieceworkConfigEntity _clone_entity : clone_entities) {
      PieceworkConfigEntity has = null;

      has = new PieceworkConfigEntity();
      has.setConditionScript(_clone_entity.getConditionScript());
      has.setFname(_clone_entity.getFname());
      has.setUsageScript(_clone_entity.getUsageScript());
      has.setPieceworkComponentEntity(componentEntity);
      componentEntity.getPieceworkConfigEntities().add(has);
      baseService.saveEntity(has);
    }

    return bean;
  }
コード例 #2
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;
  }
コード例 #3
0
 @SuppressWarnings("unchecked")
 private void findComponentTree(List<PieceworkComponentEntity> result, Long componentId) {
   List<PieceworkComponentEntity> componentEntities =
       baseService.getlist(
           "from PieceworkComponentEntity pieceworkComponentEntity where pieceworkComponentEntity.super_id = "
               + componentId);
   for (PieceworkComponentEntity _entity : componentEntities) {
     result.add(_entity);
     findComponentTree(result, _entity.getId());
   }
 }
コード例 #4
0
 @SuppressWarnings("unchecked")
 @RequestMapping(
     value = "/department/group/list",
     method = {RequestMethod.GET, RequestMethod.POST})
 @ResponseBody
 public Object getT_departments_group() {
   List<AreaComponentEntity> componentEntities =
       baseService.getlist("from AreaComponentEntity entity group by entity.name");
   Map<String, StrObjData> maps = new ConcurrentHashMap<String, StrObjData>();
   for (AreaComponentEntity _component : componentEntities) {
     String name = _component.getName();
     if (maps.get(name) == null) {
       maps.put(name, new StrObjData(_component.getName(), _component.getName()));
     }
   }
   return maps.values();
 }