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

ibizdev提交

上级 969b71ad
......@@ -47,5 +47,89 @@ public class IBZDictResource {
@Autowired
private IIBZDictService ibzdictService;
@ApiOperation(value = "Get", tags = {"IBZDict" }, notes = "Get")
@RequestMapping(method = RequestMethod.GET, value = "/dictapi/ibzdicts/{ibzdict_id}")
public ResponseEntity<IBZDictDTO> get(@PathVariable("ibzdict_id") String ibzdict_id) {
IBZDict domain = ibzdictService.get(ibzdict_id);
IBZDictDTO dto = IBZDictMapping.MAPPER.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "Create", tags = {"IBZDict" }, notes = "Create")
@RequestMapping(method = RequestMethod.POST, value = "/dictapi/ibzdicts")
@Transactional
public ResponseEntity<IBZDictDTO> create(@RequestBody IBZDictDTO ibzdictdto) {
IBZDict domain = IBZDictMapping.MAPPER.toDomain(ibzdictdto);
ibzdictService.create(domain);
IBZDictDTO dto = IBZDictMapping.MAPPER.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "CheckKey", tags = {"IBZDict" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/dictapi/ibzdicts/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody IBZDictDTO ibzdictdto) {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "GetDraft", tags = {"IBZDict" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/dictapi/ibzdicts/getdraft")
@Transactional
public ResponseEntity<IBZDictDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(new IBZDictDTO());
}
@ApiOperation(value = "Update", tags = {"IBZDict" }, notes = "Update")
@RequestMapping(method = RequestMethod.PUT, value = "/dictapi/ibzdicts/{ibzdict_id}")
@Transactional
public ResponseEntity<IBZDictDTO> update(@PathVariable("ibzdict_id") String ibzdict_id, @RequestBody IBZDictDTO ibzdictdto) {
IBZDict domain = IBZDictMapping.MAPPER.toDomain(ibzdictdto);
domain.setDictId(ibzdict_id);
ibzdictService.update(domain);
IBZDictDTO dto = IBZDictMapping.MAPPER.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "Remove", tags = {"IBZDict" }, notes = "Remove")
@RequestMapping(method = RequestMethod.DELETE, value = "/dictapi/ibzdicts/{ibzdict_id}")
@Transactional
public ResponseEntity<Boolean> remove(@PathVariable("ibzdict_id") String ibzdict_id) {
IBZDictDTO ibzdictdto = new IBZDictDTO();
IBZDict domain = new IBZDict();
ibzdictdto.setDictId(ibzdict_id);
domain.setDictId(ibzdict_id);
Boolean rst = ibzdictService.remove(domain.getDictId());
if(rst){
return ResponseEntity.status(HttpStatus.OK).body(rst);
}else{
return ResponseEntity.status(HttpStatus.OK).body(rst);
}
}
//SAVE
@ApiOperation(value = "Save", tags = {"IBZDict" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/dictapi/ibzdicts/{ibzdict_id}/save")
public ResponseEntity<Boolean> save(@RequestBody IBZDictDTO ibzdictdto) {
IBZDict ibzdict = IBZDictMapping.MAPPER.toDomain(ibzdictdto);
Boolean b = ibzdictService.save(ibzdict) ;
return ResponseEntity.status(HttpStatus.OK).body(b);
}
//9
@ApiOperation(value = "获取DEFAULT", tags = {"IBZDict" } ,notes = "获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/dictapi/ibzdicts/fetchdefault")
public ResponseEntity<List<IBZDictDTO>> fetchDefault(IBZDictSearchContext context) {
List<IBZDictDTO> list = new ArrayList<IBZDictDTO>();
Page<IBZDict> domains = ibzdictService.searchDefault(context) ;
for(IBZDict ibzdict : domains.getContent()){
IBZDictDTO dto =IBZDictMapping.MAPPER.toDto(ibzdict);
list.add(dto);
}
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册