From 684c97f7c6ba1b5f2fff7a08410b385a3f0c4a8b Mon Sep 17 00:00:00 2001 From: shicf <shi_chongfu@163.com> Date: 星期二, 11 三月 2025 09:24:22 +0800 Subject: [PATCH] 通用MVC --- src/main/java/com/product/mobile/core/controller/CommonMVCController.java | 95 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 95 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/product/mobile/core/controller/CommonMVCController.java b/src/main/java/com/product/mobile/core/controller/CommonMVCController.java new file mode 100644 index 0000000..ad82496 --- /dev/null +++ b/src/main/java/com/product/mobile/core/controller/CommonMVCController.java @@ -0,0 +1,95 @@ +package com.product.mobile.core.controller; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import com.product.admin.service.PublicService; +import com.product.core.config.CoreConst; +import com.product.core.controller.support.AbstractBaseController; +import com.product.core.entity.DataTableEntity; +import com.product.core.entity.FieldSetEntity; +import com.product.core.entity.RequestParameterEntity; +import com.product.core.exception.BaseException; +import com.product.core.spring.context.SpringMVCContextHolder; +import com.product.mobile.core.config.MobileCoreCode; +import com.product.mobile.core.service.CommonMVCService; +import com.product.mobile.core.service.NavBarManagerService; +import com.product.mobile.core.service.SignInService; +import com.product.module.sys.version.ApiVersion; +import com.product.org.admin.config.CmnCode; + +/** + * 鎵嬫満绔�氱敤鏌ヨ + * + * @author shicf + */ +@RequestMapping("/api/mobile") +@RestController +public class CommonMVCController extends AbstractBaseController { + @Autowired + PublicService publicService; + @Autowired + CommonMVCService commonMVCService; + /** + * 鏍规嵁涓氬姟鏁版嵁锛屾煡璇㈡槸鍚︽湁瀹℃壒娴佺▼锛� + * 鏈夊垯杩斿洖涓氬姟瀹℃壒娴佺▼鍏朵腑涓�涓猽uid + * 鏃犲垯 杩斿洖涓氬姟鏁版嵁锛屽寘鎷墍鏈夊瓙琛紝鏁版嵁缁撴瀯 + * @param request + * @return + */ + @RequestMapping(value = "/find-table/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String listData(HttpServletRequest request) { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + try { + String flow_detail_uuid=commonMVCService.getApproveDetailUUID(fse.getTableName(),fse.getString("uuid")); + if(flow_detail_uuid==null) { + FieldSetEntity fs=publicService.getFieldSetEntity(fse, true); + + return this.result_OK_List(fs); + }else { + return this.OK_Add(flow_detail_uuid); + } + } catch (BaseException e) { + return this.error(e); + } catch (Exception e) { + + return this.error(MobileCoreCode.GET_DATA_FAIL); + } + } + /** + * 鍔犺浇MVC锛屽寘鎷紝褰撳墠鎸夐挳锛屾寜閽搷浣滅晫闈紝鐣岄潰鍚庨潰鐨勬洿鎸夐挳 + * ///鏌ュ嚭MVC涓寜閽搷浣滅殑鐣岄潰锛岀晫闈㈠悗闈㈢殑鎵�鏈夋寜閽� + * + * @param request + * @return + */ + @RequestMapping(value = "/find-button-page/{version}", method = RequestMethod.POST) + @ApiVersion(1) + public String findMVC(HttpServletRequest request) { + FieldSetEntity fse = null; + Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA); + if (bean != null) { + RequestParameterEntity reqp = (RequestParameterEntity) bean; + fse = reqp.getFormData(); + } + try { + return result_OK_List(commonMVCService.getPageButtons(fse)); + } catch (BaseException e) { + e.printStackTrace(); + return this.error(e); + } catch (Exception e) { + e.printStackTrace(); + return this.error(MobileCoreCode.GET_ROUTER_FAIL); + } + } +} -- Gitblit v1.9.2