提交 bdc4979d 编写于 作者: ibizdev's avatar ibizdev

ibizdev提交

上级 9df56bfa
......@@ -136,9 +136,8 @@ public class IBZDictItemResource {
@ApiOperation(value = "Get", tags = {"IBZDictItem" }, notes = "Get")
@RequestMapping(method = RequestMethod.GET, value = "/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems/{ibzdictitem_id}")
public ResponseEntity<IBZDictItemDTO> getByIBZDict(@PathVariable("ibzdict_id") String ibzdict_id, @PathVariable("ibzdictitem_id") String ibzdictitem_id) {
IBZDictItemDTO dto = new IBZDictItemDTO();
IBZDictItem domain = ibzdictitemService.get(ibzdictitem_id);
dto.fromDO(domain);
IBZDictItemDTO dto = IBZDictItemMapping.MAPPER.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -147,9 +146,9 @@ public class IBZDictItemResource {
@Transactional
public ResponseEntity<IBZDictItemDTO> getDraftByIBZDict(@PathVariable("ibzdict_id") String ibzdict_id, @PathVariable("ibzdictitem_id") String ibzdictitem_id, @RequestBody IBZDictItemDTO ibzdictitemdto) {
//8
IBZDictItem ibzdictitem = ibzdictitemdto.toDO();
IBZDictItem ibzdictitem = IBZDictItemMapping.MAPPER.toDomain(ibzdictitemdto);
ibzdictitem = ibzdictitemService.getDraft(ibzdictitem) ;
ibzdictitemdto.fromDO(ibzdictitem);
ibzdictitemdto = IBZDictItemMapping.MAPPER.toDto(ibzdictitem);
return ResponseEntity.status(HttpStatus.OK).body(ibzdictitemdto);
}
......@@ -157,7 +156,7 @@ public class IBZDictItemResource {
@RequestMapping(method = RequestMethod.POST, value = "/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems/save")
public ResponseEntity<Boolean> saveByIBZDict(@PathVariable("ibzdict_id") String ibzdict_id, @RequestBody IBZDictItemDTO ibzdictitemdto) {
//6
IBZDictItem domain = ibzdictitemdto.toDO();
IBZDictItem domain = IBZDictItemMapping.MAPPER.toDomain(ibzdictitemdto);
domain.setDictId(ibzdict_id);
Boolean b = ibzdictitemService.save(domain) ;
return ResponseEntity.status(HttpStatus.OK).body(b);
......@@ -190,10 +189,10 @@ public class IBZDictItemResource {
public ResponseEntity<IBZDictItemDTO> createByIBZDict(@PathVariable("ibzdict_id") String ibzdict_id, @RequestBody IBZDictItemDTO ibzdictitemdto) {
//4
IBZDictItemDTO dto = new IBZDictItemDTO();
IBZDictItem domain = ibzdictitemdto.toDO();
IBZDictItem domain = IBZDictItemMapping.MAPPER.toDomain(ibzdictitemdto);
domain.setDictId(ibzdict_id);
ibzdictitemService.create(domain);
dto.fromDO(domain);
IBZDictItemDTO dto = IBZDictItemMapping.MAPPER.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -202,12 +201,11 @@ public class IBZDictItemResource {
@Transactional
public ResponseEntity<IBZDictItemDTO> updateByIBZDict(@PathVariable("ibzdict_id") String ibzdict_id, @PathVariable("ibzdictitem_id") String ibzdictitem_id, @RequestBody IBZDictItemDTO ibzdictitemdto) {
//5
IBZDictItem domain = ibzdictitemdto.toDO();
IBZDictItem domain = IBZDictItemMapping.MAPPER.toDomain(ibzdictitemdto);
domain.setDictId(ibzdict_id);
domain.setItemId(ibzdictitem_id);
ibzdictitemService.update(domain);
IBZDictItemDTO dto = new IBZDictItemDTO();
dto.fromDO(domain);
IBZDictItemDTO dto = IBZDictItemMapping.MAPPER.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -220,8 +218,7 @@ public class IBZDictItemResource {
context.setN_dictid_eq(ibzdict_id);
Page<IBZDictItem> domains = ibzdictitemService.searchDefault(context) ;
for(IBZDictItem ibzdictitem : domains.getContent()){
IBZDictItemDTO dto = new IBZDictItemDTO();
dto.fromDO(ibzdictitem);
IBZDictItemDTO dto = IBZDictItemMapping.MAPPER.toDto(ibzdictitem);
list.add(dto);
}
return ResponseEntity.status(HttpStatus.OK).body(new PageImpl(list,context.getPageable(),domains.getTotalElements()));
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册