| | |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @description 字段接口 |
| | | * @author kimi |
| | | * @since 2019-12-16 |
| | | */ |
| | |
| | | @Autowired |
| | | AntianaphylaxisClient antianaphylaxisClient; |
| | | |
| | | /** |
| | | * |
| | | * @description: 通过表名获取字段列表 |
| | | * @param tableName 表名 |
| | | * @return: 字段列表 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/{tableName}", method = RequestMethod.GET) |
| | | public Result getFields(@PathVariable String tableName, HttpServletRequest request){ |
| | | //请求头获取使用者包装类 |
| | | Character character = DbUtils.getCharacter(request); |
| | | String maintainId = request.getParameter("maintainId"); |
| | | if (StringUtils.isEmpty(maintainId)) { |
| | | //通过表名获取字段列表 |
| | | List<SysField> fieldList = fieldService.getFieldByTable(tableName); |
| | | String isDataIO = request.getParameter("isDataIO"); |
| | | if (StringUtils.isEmpty(isDataIO) && !Boolean.valueOf(isDataIO)) { |
| | | |
| | | return Result.success(fieldList); |
| | | } |
| | | //给上传下载使用 组合好待脱敏的数据返回 |
| | | antianaphylaxisClient.getHelpfulFieldBySysField(fieldList, tableName); |
| | | return Result.success(fieldList); |
| | | }else { |
| | | //BY 版本获取字段 |
| | | List<SysField> field = masterAuthorService.getField(character, maintainId); |
| | | //List<SysField> fieldList = fieldService.getFieldByMaintain(maintainId); |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 通过表名分页获取字段列表 |
| | | * @param tableName 表名 |
| | | * @param pageNo 页数 |
| | | * @return: 字段列表 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "total/{tableName}/{pageNo}", method = RequestMethod.GET) |
| | | public Result getTotalFields(@PathVariable String tableName,@PathVariable Integer pageNo, HttpServletRequest request){ |
| | | //isTotal 是否走权限, pageSize 每页数据数 |
| | | String totalStr = request.getParameter("isTotal"); |
| | | String pageSize = request.getParameter("pageSize"); |
| | | |
| | |
| | | if (StringUtils.isEmpty(maintainId)){ |
| | | return Result.error(CodeMsg.ERROR_PARAMS_NOT_MATHED); |
| | | } |
| | | //获取用户 |
| | | TUser user = DbUtils.getUser(request); |
| | | List<SysField> field = masterAuthorService.getField(user, maintainId); |
| | | Integer size; |
| | |
| | | return fieldService.getPagedDataByList(field, pageNo, size); |
| | | |
| | | } |
| | | |
| | | //获取字段列表 |
| | | if(StringUtils.isEmpty(pageSize)){ |
| | | return fieldService.getTotalFields(tableName, pageNo, 15); |
| | | }else { |
| | | return fieldService.getTotalFields(tableName, pageNo, Integer.valueOf(pageSize)); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 通过表名获取当前系统中各种状态的字段列表 |
| | | * @param tableName 表名 |
| | | * @return: 字段列表 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "fix/{tableName}", method = RequestMethod.GET) |
| | | public Result fix(@PathVariable String tableName, HttpServletRequest request){ |
| | | Result totalFields = fieldService.getTotalFields(tableName); |
| | |
| | | return totalFields; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @description: 通过主题获取字段里输入表 |
| | | * @param id 主题id |
| | | * @return: 字段列表 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/menu/{id}", method = RequestMethod.GET) |
| | | public Result getFieldByMenu(@PathVariable String id){ |
| | | MenuMapping menuMapping = menuMappingService.selectOne(new EntityWrapper<MenuMapping>().eq("menu_id", id)); |
| | | if (menuMapping == null) { |
| | | return Result.error(CodeMsg.ERROR_PARAMS_NOT_MATHED); |
| | | } |
| | | //通过主题获获取表名 |
| | | String tableName = menuMapping.getTableName(); |
| | | if (StringUtils.isEmpty(tableName)) { |
| | | return Result.error(CodeMsg.ERROR_PARAMS_NOT_MATHED); |
| | |
| | | List<SysField> fieldList = fieldService.getFieldByTable(tableName); |
| | | return Result.success(fieldList); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 更新字段数据 |
| | | * @return: 更新是否成功 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/update", method = RequestMethod.GET) |
| | | public Result update(@RequestParam String json) { |
| | | try { |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 更新基础参数 |
| | | * @param id sys_field 数据id |
| | | * @return: 是否更新完成 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/updateCommon/{id}", method = RequestMethod.GET) |
| | | public Result addOrUpdate(@PathVariable String id, HttpServletRequest request) { |
| | | //更新基础参数不需要关联版本 |
| | |
| | | if (sysField == null) { |
| | | return Result.error(CodeMsg.ERROR_PARAMS_NOT_MATHED); |
| | | } |
| | | //可直接更新的参数 |
| | | String width = request.getParameter("width"); |
| | | String align = request.getParameter("align"); |
| | | String orderNoStr = request.getParameter("orderNo"); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 上传后生成的字段保存入库 |
| | | * @return: 是否保存成功 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/loadFields", method = RequestMethod.POST) |
| | | public Result loadFields(@RequestBody String fieldListStr, HttpServletRequest request) { |
| | | log.info(fieldListStr); |
| | |
| | | |
| | | return Result.success(null); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 修改字段 |
| | | * @return: 修改后的字段 |
| | | * |
| | | */ |
| | | @RequestMapping(value = "/change", method = RequestMethod.POST) |
| | | public Result addOrUpdate(@RequestBody SysField sysField, HttpServletRequest request) { |
| | | |