| | |
| | | @Autowired |
| | | ISysViewLogicmapService logicmapService; |
| | | |
| | | /** |
| | | * |
| | | * @description: 获取视图逻辑转换列表 |
| | | * @return: 逻辑转换列表 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/all", method = RequestMethod.GET) |
| | | public Result getList() { |
| | | //获取可有的列表 |
| | | List<SysViewLogic> aciveLogic = logicService.selectList(new EntityWrapper<SysViewLogic>().eq("active", true)); |
| | | return Result.success(aciveLogic); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 获取视图已经使用的逻辑列表 |
| | | * @param parentId 视图id |
| | | * @return: 视图已经使用的逻辑列表 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/allmap/{parentId}", method = RequestMethod.GET) |
| | | public Result allmap(@PathVariable String parentId) { |
| | | //视图已经使用的逻辑列表 |
| | | List<SysViewLogicmap> aciveLogic = logicmapService.selectList(new EntityWrapper<SysViewLogicmap>().eq(Constant.PARENT_ID, parentId)); |
| | | return Result.success(aciveLogic); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 更新视图已经使用的逻辑列表 |
| | | * @param parentId 视图id |
| | | * @return: 是否更新成功已经使用的逻辑列表 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/updateMaps/{parentId}", method = RequestMethod.POST) |
| | | public Result updateMaps(@PathVariable String parentId, @RequestBody List<SysViewLogicmap> logicmaps) { |
| | | //删除原来的mapping关系 |
| | | boolean delete = logicmapService.delete(new EntityWrapper<SysViewLogicmap>().eq(Constant.PARENT_ID, parentId)); |
| | | boolean insert = false; |
| | | //循环创建新的字段和逻辑的mapping关系 |
| | | for (SysViewLogicmap logicmap : logicmaps) { |
| | | insert = logicmap.setId(DbUtils.getUUID()).setParentId(parentId).insert(); |
| | | if (!insert) { |
| | |
| | | return Result.success(null); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 添加视图已经使用的逻辑 |
| | | * @return: 是否添加成功 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/addmap", method = RequestMethod.POST) |
| | | public Result addmap(@RequestBody SysViewLogicmap logicmap) { |
| | | //添加一条逻辑转换关系 |
| | | boolean insert = logicmap.setId(DbUtils.getUUID()).insert(); |
| | | if (insert) { |
| | | return Result.success(insert); |
| | |
| | | return Result.error(CodeMsg.INSERT_ERROR); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 删除视图已经使用的逻辑 |
| | | * @param id mapping 关系的id |
| | | * @return: 是否删除成功 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/deletemap/{id}", method = RequestMethod.POST) |
| | | public Result deletemap(@PathVariable String id) { |
| | | //通过id 删除mapping关系 |
| | | boolean delete = logicmapService.deleteById(id); |
| | | if (delete) { |
| | | return Result.success(CodeMsg.DELETE_SUCCESS); |
| | |
| | | return Result.success(CodeMsg.DELETE_ERROR); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 更新视图已经使用的逻辑 |
| | | * @return: 是否更新成功 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/updatemap", method = RequestMethod.POST) |
| | | public Result updatemap(@RequestBody SysViewLogicmap logicmap) { |
| | | String id = logicmap.getId(); |
| | | //判断id是否存在 |
| | | if (StringUtils.isEmpty(id)) { |
| | | return Result.error(CodeMsg.ERROR_PARAMS_NOT_MATHED); |
| | | } |
| | | //更新记录 |
| | | boolean insert = logicmap.updateById(); |
| | | if (insert) { |
| | | return Result.success(insert); |
| | |
| | | return Result.error(CodeMsg.INSERT_ERROR); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 添加系统中可以使用的逻辑转换类型 |
| | | * @return: 是否添加成功 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/add", method = RequestMethod.POST) |
| | | public Result add(@RequestBody SysViewLogic logic) { |
| | | //添加记录 |
| | | boolean insert = logic.setId(DbUtils.getUUID()).insert(); |
| | | if (insert) { |
| | | return Result.success(insert); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 更新系统中可以使用的逻辑转换类型 |
| | | * @return: 是否更新成功 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/update", method = RequestMethod.POST) |
| | | public Result update(@RequestBody SysViewLogic logic) { |
| | | String id = logic.getId(); |
| | | //判断id是否存在 |
| | | if (StringUtils.isEmpty(id)) { |
| | | return Result.error(CodeMsg.ERROR_PARAMS_NOT_MATHED); |
| | | } |
| | | //更新记录 |
| | | boolean b = logic.updateById(); |
| | | if (b) { |
| | | return Result.success(logic); |