@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; }
@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; }
@SuppressWarnings("unchecked") @RequestMapping( value = "/component/save", method = {RequestMethod.GET, RequestMethod.POST}) @ResponseBody public Object saveComponent(@RequestBody PieceworkComponentEntity componentEntity) { if (componentEntity.getId() == null) { DoorTemplateEntity doorTemplateEntity = (DoorTemplateEntity) baseService.getObject( DoorTemplateEntity.class, componentEntity.getDoor_template_id()); componentEntity.setDoorTemplateEntity(doorTemplateEntity); doorTemplateEntity.getPieceworkComponentEntities().add(componentEntity); baseService.saveEntity(componentEntity); } else { PieceworkComponentEntity entity = (PieceworkComponentEntity) baseService.getObject(PieceworkComponentEntity.class, componentEntity.getId()); entity.setName(componentEntity.getName()); entity.setFnumber(componentEntity.getFnumber()); baseService.updateEntity(entity); } return componentEntity; }
@SuppressWarnings("unchecked") @RequestMapping( value = "/pieceworkConfigs/save", method = {RequestMethod.GET, RequestMethod.POST}) @ResponseBody public Object savePieceworkConfigs(@RequestBody PieceworkConfigEntity _entity) { if (_entity.getId() == null) { PieceworkComponentEntity componentEntity = (PieceworkComponentEntity) baseService.getObject(PieceworkComponentEntity.class, _entity.getComponent_id()); _entity.setPieceworkComponentEntity(componentEntity); baseService.saveEntity(_entity); } else { PieceworkConfigEntity entity = (PieceworkConfigEntity) baseService.getObject(PieceworkConfigEntity.class, _entity.getId()); entity.setFname(_entity.getFname()); baseService.updateEntity(entity); } return _entity; }
@SuppressWarnings("unchecked") @RequestMapping( value = "/areaMaterialConfigs/save", method = {RequestMethod.GET, RequestMethod.POST}) @ResponseBody public Object saveMaterialConfigs(@RequestBody AreaMaterialsConfigEntity _entity) { if (_entity.getId() == null) { AreaComponentEntity componentEntity = (AreaComponentEntity) baseService.getObject(AreaComponentEntity.class, _entity.getComponent_id()); _entity.setAreaComponentEntity(componentEntity); baseService.saveEntity(_entity); } else { AreaMaterialsConfigEntity entity = (AreaMaterialsConfigEntity) baseService.getObject(AreaMaterialsConfigEntity.class, _entity.getId()); entity.setFname(_entity.getFname()); entity.setQuerySqlId(_entity.getQuerySqlId()); baseService.updateEntity(entity); } return _entity; }