Commit d750eed8 authored by mcb's avatar mcb

commit

parent cd138596
...@@ -50,97 +50,114 @@ public class DmpNavigationTreeController { ...@@ -50,97 +50,114 @@ public class DmpNavigationTreeController {
public DmpNavigationTree selectOne(Integer id) { public DmpNavigationTree selectOne(Integer id) {
return this.dmpNavigationTreeService.queryById(id); return this.dmpNavigationTreeService.queryById(id);
} }
/**列表查询DMP资源导航树 /**
* @param dmpNavigationTreeRequest * 列表查询DMP资源导航树
* @return *
*/ * @param dmpNavigationTreeRequest
@RequestMapping(method = RequestMethod.POST, value = "/findList") * @return
@ApiOperation(value = "列表查询DMP资源导航树", notes = "列表查询DMP资源导航树") */
public BaseBeanResponse<DmpNavigationTreeDto> findList(@RequestBody DmpNavigationTreeRequest dmpNavigationTreeRequest, HttpServletRequest httpRequest){ @RequestMapping(method = RequestMethod.POST, value = "/findList")
BaseBeanResponse<DmpNavigationTreeDto> baseBeanResponse = new BaseBeanResponse<DmpNavigationTreeDto>(); @ApiOperation(value = "列表查询DMP资源导航树", notes = "列表查询DMP资源导航树")
try { public BaseBeanResponse<DmpNavigationTreeDto> findList(@RequestBody DmpNavigationTreeRequest dmpNavigationTreeRequest, HttpServletRequest httpRequest) {
baseBeanResponse = dmpNavigationTreeService.findList(dmpNavigationTreeRequest, httpRequest); BaseBeanResponse<DmpNavigationTreeDto> baseBeanResponse = new BaseBeanResponse<DmpNavigationTreeDto>();
} catch (Exception e) { try {
baseBeanResponse.setMessage("查询失败"); baseBeanResponse = dmpNavigationTreeService.findList(dmpNavigationTreeRequest, httpRequest);
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE); } catch (Exception e) {
e.printStackTrace(); baseBeanResponse.setMessage("查询失败");
} baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
return baseBeanResponse; }
}
return baseBeanResponse;
/**新增DMP资源导航树 }
* @param dmpNavigationTreeRequest
* @return /**
*/ * 新增DMP资源导航树
@RequestMapping(method = RequestMethod.POST, value = "/add") *
@ApiOperation(value = "新增DMP资源导航树", notes = "新增DMP资源导航树") * @param dmpNavigationTreeRequest
public BaseBeanResponse<DmpNavigationTree> add(@RequestBody DmpNavigationTree dmpNavigationTree, HttpServletRequest httpRequest){ * @return
BaseBeanResponse<DmpNavigationTree> baseBeanResponse = new BaseBeanResponse<DmpNavigationTree>(); */
try { @RequestMapping(method = RequestMethod.POST, value = "/add")
DmpNavigationTree dmpNavigationTreeDb = dmpNavigationTreeService.insert(dmpNavigationTree); @ApiOperation(value = "新增DMP资源导航树", notes = "新增DMP资源导航树")
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE); public BaseBeanResponse<DmpNavigationTree> add(@RequestBody DmpNavigationTree dmpNavigationTree, HttpServletRequest httpRequest) throws Exception {
baseBeanResponse.setMessage("新增成功"); BaseBeanResponse<DmpNavigationTree> baseBeanResponse = new BaseBeanResponse<DmpNavigationTree>();
baseBeanResponse.setData(dmpNavigationTreeDb); //树名称去重
} catch (Exception e) { DmpNavigationTreeRequest dmpNavigationTreeRequest = new DmpNavigationTreeRequest();
baseBeanResponse.setMessage("新增失败"); dmpNavigationTreeRequest.setName(dmpNavigationTree.getName());
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE); BaseBeanResponse<DmpNavigationTreeDto> baseBeanResponseRe = dmpNavigationTreeService.findList(dmpNavigationTreeRequest, httpRequest);
e.printStackTrace(); if (baseBeanResponseRe.getDatas() != null && baseBeanResponseRe.getDatas().size() > 0) {
} baseBeanResponse.setCode(StatuConstant.CODE_ERROR_PARAMETER);
baseBeanResponse.setMessage("树名称不能重复");
return baseBeanResponse; return baseBeanResponse;
} }
try {
/**删除DMP资源导航树 DmpNavigationTree dmpNavigationTreeDb = dmpNavigationTreeService.insert(dmpNavigationTree);
* @param id baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
* @return baseBeanResponse.setMessage("新增成功");
*/ baseBeanResponse.setData(dmpNavigationTreeDb);
@MethodCallLogPrint } catch (Exception e) {
@RequestMapping(method = RequestMethod.GET, value = "/deleteById") baseBeanResponse.setMessage("新增失败");
@ApiOperation(value = "删除DMP资源导航树", notes = "删除DMP资源导航树") baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
@ApiImplicitParam(name = "id", value = "DMP资源导航树主键") e.printStackTrace();
public BaseResponse deleteById(@RequestParam(name = "id", required = true ) Integer id, HttpServletRequest httpRequest){ }
BaseResponse baseResponse = new BaseResponse();
try { return baseBeanResponse;
boolean flag = dmpNavigationTreeService.deleteById(id); }
if (flag) {
baseResponse.setMessage("删除成功"); /**
baseResponse.setCode(StatuConstant.SUCCESS_CODE); * 删除DMP资源导航树
} else { *
baseResponse.setMessage("删除失败"); * @param id
baseResponse.setCode(StatuConstant.FAILURE_CODE); * @return
} */
} catch (Exception e) { @MethodCallLogPrint
baseResponse.setMessage("删除失败"); @RequestMapping(method = RequestMethod.GET, value = "/deleteById")
baseResponse.setCode(StatuConstant.FAILURE_CODE); @ApiOperation(value = "删除DMP资源导航树", notes = "删除DMP资源导航树")
e.printStackTrace(); @ApiImplicitParam(name = "id", value = "DMP资源导航树主键")
} public BaseResponse deleteById(@RequestParam(name = "id", required = true) Integer id, HttpServletRequest httpRequest) {
BaseResponse baseResponse = new BaseResponse();
return baseResponse; try {
} boolean flag = dmpNavigationTreeService.deleteById(id);
if (flag) {
/**修改DMP资源导航树 baseResponse.setMessage("删除成功");
* @param dmpNavigationTreeRequest baseResponse.setCode(StatuConstant.SUCCESS_CODE);
* @return } else {
*/ baseResponse.setMessage("删除失败");
@MethodCallLogPrint baseResponse.setCode(StatuConstant.FAILURE_CODE);
@RequestMapping(method = RequestMethod.POST, value = "/edit") }
@ApiOperation(value = "修改DMP资源导航树", notes = "修改DMP资源导航树") } catch (Exception e) {
public BaseBeanResponse<DmpNavigationTree> edit(@RequestBody DmpNavigationTree dmpNavigationTree, HttpServletRequest httpRequest){ baseResponse.setMessage("删除失败");
BaseBeanResponse<DmpNavigationTree> baseBeanResponse = new BaseBeanResponse<DmpNavigationTree>(); baseResponse.setCode(StatuConstant.FAILURE_CODE);
try { e.printStackTrace();
DmpNavigationTree dmpNavigationTreeDb = dmpNavigationTreeService.update(dmpNavigationTree); }
baseBeanResponse.setMessage("修改成功");
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE); return baseResponse;
baseBeanResponse.setData(dmpNavigationTreeDb); }
} catch (Exception e) {
baseBeanResponse.setMessage("修改失败"); /**
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE); * 修改DMP资源导航树
e.printStackTrace(); *
} * @param dmpNavigationTreeRequest
* @return
return baseBeanResponse; */
} @MethodCallLogPrint
@RequestMapping(method = RequestMethod.POST, value = "/edit")
@ApiOperation(value = "修改DMP资源导航树", notes = "修改DMP资源导航树")
public BaseBeanResponse<DmpNavigationTree> edit(@RequestBody DmpNavigationTree dmpNavigationTree, HttpServletRequest httpRequest) {
BaseBeanResponse<DmpNavigationTree> baseBeanResponse = new BaseBeanResponse<DmpNavigationTree>();
try {
DmpNavigationTree dmpNavigationTreeDb = dmpNavigationTreeService.update(dmpNavigationTree);
baseBeanResponse.setMessage("修改成功");
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setData(dmpNavigationTreeDb);
} catch (Exception e) {
baseBeanResponse.setMessage("修改失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
} }
\ No newline at end of file
...@@ -164,8 +164,10 @@ public class DmpNavigationTreeServiceImpl extends BaseService implements DmpNavi ...@@ -164,8 +164,10 @@ public class DmpNavigationTreeServiceImpl extends BaseService implements DmpNavi
List<DmpNavigationTree> list = dmpNavigationTreeDao.queryAll(dmpNavigationTree); List<DmpNavigationTree> list = dmpNavigationTreeDao.queryAll(dmpNavigationTree);
List<DmpNavigationTreeDto> dtos = MyDmpNavigationTreeConverter.INSTANCE().domain2dto(list); List<DmpNavigationTreeDto> dtos = MyDmpNavigationTreeConverter.INSTANCE().domain2dto(list);
dtos = dmpArrangeTree(dmpNavigationTreeRequest.getParentId(), dtos); if (dmpNavigationTreeRequest.getParentId()!=null){
dtos = dmpArrangeTree(dmpNavigationTreeRequest.getParentId(), dtos);
}
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE); baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("查询成功"); baseBeanResponse.setMessage("查询成功");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment