Search in sources :

Example 1 with Unit

use of com.topcom.cms.domain.Unit in project topcom-cloud by 545314690.

the class AbbreviationController method update.

/**
 * 根据输入的实体对象信息,修改指定id的实体对象
 *
 * @param id
 * @param model
 * @return 实体对象
 */
@RequestMapping(value = "/getTree/{id}", method = RequestMethod.PUT, produces = "application/json", consumes = "application/json")
@ResponseBody
public Abbreviation update(@PathVariable int id, @RequestBody Abbreviation model) {
    Abbreviation abb = this.manager.findById(Long.valueOf(id));
    Unit unit = abb.getUnit();
    abb.setShortName(model.getShortName());
    unit.setUnitName(model.getUnit().getUnitName());
    abb.setFlag(model.getFlag());
    abb.setUnit(unit);
    this.model = this.manager.save(abb);
    return this.model;
}
Also used : Abbreviation(com.topcom.cms.domain.Abbreviation) Unit(com.topcom.cms.domain.Unit) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

Abbreviation (com.topcom.cms.domain.Abbreviation)1 Unit (com.topcom.cms.domain.Unit)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1