Commit d750eed8 authored by mcb's avatar mcb

commit

parent cd138596
......@@ -50,97 +50,114 @@ public class DmpNavigationTreeController {
public DmpNavigationTree selectOne(Integer id) {
return this.dmpNavigationTreeService.queryById(id);
}
/**列表查询DMP资源导航树
* @param dmpNavigationTreeRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/findList")
@ApiOperation(value = "列表查询DMP资源导航树", notes = "列表查询DMP资源导航树")
public BaseBeanResponse<DmpNavigationTreeDto> findList(@RequestBody DmpNavigationTreeRequest dmpNavigationTreeRequest, HttpServletRequest httpRequest){
BaseBeanResponse<DmpNavigationTreeDto> baseBeanResponse = new BaseBeanResponse<DmpNavigationTreeDto>();
try {
baseBeanResponse = dmpNavigationTreeService.findList(dmpNavigationTreeRequest, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("查询失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**新增DMP资源导航树
* @param dmpNavigationTreeRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/add")
@ApiOperation(value = "新增DMP资源导航树", notes = "新增DMP资源导航树")
public BaseBeanResponse<DmpNavigationTree> add(@RequestBody DmpNavigationTree dmpNavigationTree, HttpServletRequest httpRequest){
BaseBeanResponse<DmpNavigationTree> baseBeanResponse = new BaseBeanResponse<DmpNavigationTree>();
try {
DmpNavigationTree dmpNavigationTreeDb = dmpNavigationTreeService.insert(dmpNavigationTree);
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("新增成功");
baseBeanResponse.setData(dmpNavigationTreeDb);
} catch (Exception e) {
baseBeanResponse.setMessage("新增失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**删除DMP资源导航树
* @param id
* @return
*/
@MethodCallLogPrint
@RequestMapping(method = RequestMethod.GET, value = "/deleteById")
@ApiOperation(value = "删除DMP资源导航树", notes = "删除DMP资源导航树")
@ApiImplicitParam(name = "id", value = "DMP资源导航树主键")
public BaseResponse deleteById(@RequestParam(name = "id", required = true ) Integer id, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse();
try {
boolean flag = dmpNavigationTreeService.deleteById(id);
if (flag) {
baseResponse.setMessage("删除成功");
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
} else {
baseResponse.setMessage("删除失败");
baseResponse.setCode(StatuConstant.FAILURE_CODE);
}
} catch (Exception e) {
baseResponse.setMessage("删除失败");
baseResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseResponse;
}
/**修改DMP资源导航树
* @param dmpNavigationTreeRequest
* @return
*/
@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;
}
/**
* 列表查询DMP资源导航树
*
* @param dmpNavigationTreeRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/findList")
@ApiOperation(value = "列表查询DMP资源导航树", notes = "列表查询DMP资源导航树")
public BaseBeanResponse<DmpNavigationTreeDto> findList(@RequestBody DmpNavigationTreeRequest dmpNavigationTreeRequest, HttpServletRequest httpRequest) {
BaseBeanResponse<DmpNavigationTreeDto> baseBeanResponse = new BaseBeanResponse<DmpNavigationTreeDto>();
try {
baseBeanResponse = dmpNavigationTreeService.findList(dmpNavigationTreeRequest, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("查询失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**
* 新增DMP资源导航树
*
* @param dmpNavigationTreeRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/add")
@ApiOperation(value = "新增DMP资源导航树", notes = "新增DMP资源导航树")
public BaseBeanResponse<DmpNavigationTree> add(@RequestBody DmpNavigationTree dmpNavigationTree, HttpServletRequest httpRequest) throws Exception {
BaseBeanResponse<DmpNavigationTree> baseBeanResponse = new BaseBeanResponse<DmpNavigationTree>();
//树名称去重
DmpNavigationTreeRequest dmpNavigationTreeRequest = new DmpNavigationTreeRequest();
dmpNavigationTreeRequest.setName(dmpNavigationTree.getName());
BaseBeanResponse<DmpNavigationTreeDto> baseBeanResponseRe = dmpNavigationTreeService.findList(dmpNavigationTreeRequest, httpRequest);
if (baseBeanResponseRe.getDatas() != null && baseBeanResponseRe.getDatas().size() > 0) {
baseBeanResponse.setCode(StatuConstant.CODE_ERROR_PARAMETER);
baseBeanResponse.setMessage("树名称不能重复");
return baseBeanResponse;
}
try {
DmpNavigationTree dmpNavigationTreeDb = dmpNavigationTreeService.insert(dmpNavigationTree);
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("新增成功");
baseBeanResponse.setData(dmpNavigationTreeDb);
} catch (Exception e) {
baseBeanResponse.setMessage("新增失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**
* 删除DMP资源导航树
*
* @param id
* @return
*/
@MethodCallLogPrint
@RequestMapping(method = RequestMethod.GET, value = "/deleteById")
@ApiOperation(value = "删除DMP资源导航树", notes = "删除DMP资源导航树")
@ApiImplicitParam(name = "id", value = "DMP资源导航树主键")
public BaseResponse deleteById(@RequestParam(name = "id", required = true) Integer id, HttpServletRequest httpRequest) {
BaseResponse baseResponse = new BaseResponse();
try {
boolean flag = dmpNavigationTreeService.deleteById(id);
if (flag) {
baseResponse.setMessage("删除成功");
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
} else {
baseResponse.setMessage("删除失败");
baseResponse.setCode(StatuConstant.FAILURE_CODE);
}
} catch (Exception e) {
baseResponse.setMessage("删除失败");
baseResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseResponse;
}
/**
* 修改DMP资源导航树
*
* @param dmpNavigationTreeRequest
* @return
*/
@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
List<DmpNavigationTree> list = dmpNavigationTreeDao.queryAll(dmpNavigationTree);
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.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