From c007f0ca1785db093d48f4846cda82fe8e955765 Mon Sep 17 00:00:00 2001
From: kimi <kimi42345@gmail.com>
Date: 星期三, 27 五月 2020 09:59:29 +0800
Subject: [PATCH] merage

---
 src/main/java/com/highdatas/mdm/controller/MasterDataController.java |  328 ++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 208 insertions(+), 120 deletions(-)

diff --git a/src/main/java/com/highdatas/mdm/controller/MasterDataController.java b/src/main/java/com/highdatas/mdm/controller/MasterDataController.java
index b2bbb0f..a821493 100644
--- a/src/main/java/com/highdatas/mdm/controller/MasterDataController.java
+++ b/src/main/java/com/highdatas/mdm/controller/MasterDataController.java
@@ -3,28 +3,28 @@
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.highdatas.mdm.entity.Character;
 import com.highdatas.mdm.entity.*;
 import com.highdatas.mdm.mapper.TableInfoMapper;
 import com.highdatas.mdm.pojo.CodeMsg;
 import com.highdatas.mdm.pojo.Operate;
 import com.highdatas.mdm.pojo.Result;
-import com.highdatas.mdm.service.IMaintainDetailService;
-import com.highdatas.mdm.service.IMaintainService;
-import com.highdatas.mdm.service.IMenuMappingService;
-import com.highdatas.mdm.service.MasterDataService;
+import com.highdatas.mdm.pojo.SysAssembleUpdateType;
+import com.highdatas.mdm.service.*;
 import com.highdatas.mdm.util.Constant;
 import com.highdatas.mdm.util.DbUtils;
+import com.highdatas.mdm.util.NoticeClient;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import java.text.MessageFormat;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -34,6 +34,7 @@
  */
 
 @RestController
+@Slf4j
 @RequestMapping("/master")
 public class MasterDataController {
     @Autowired
@@ -43,90 +44,83 @@
     IMaintainService maintainService;
     @Autowired
     IMaintainDetailService maintainDetailService;
-
+    @Autowired
+    IMaintainFieldService maintainFieldService;
     @Autowired
     IMenuMappingService menuMappingService;
 
     @Autowired
     TableInfoMapper tableInfoMapper;
 
+    @Autowired
+    IMasterModifiedService masterModifiedService;
+    @Autowired
+    IMasterAuthorService masterAuthorService;
+    @Autowired
+    ISysMenuService menuService;
+    @Autowired
+    NoticeClient noticeClient;
+
+    /**
+     *
+     * @description: 涓婁紶鍚庯紝鍏宠仈鐗堟湰淇℃伅
+     * @param tableName 琛ㄥ悕
+     * @return 鏄惁鍏宠仈鎴愬姛
+     *
+     */
     @RequestMapping(value = "{tableName}/uploaded",  method = RequestMethod.GET)
     public Result get(@PathVariable String tableName, HttpServletRequest request) {
-        String uploadType = request.getParameter("uploadType");
-        if (StringUtils.isEmpty(uploadType)) {
-            uploadType = Constant.All;
-        }
-        MenuMapping menuMapping = menuMappingService.selectOne(new EntityWrapper<MenuMapping>().eq("table_name",tableName));
-        SysOperateLog operateLog = new SysOperateLog();
-
-        Maintain maxVersion = maintainService.getMaxVersion(tableName);
-        Maintain maintain = new Maintain();
-        String biggerVersion = null;
-        if (maxVersion == null) {
-            biggerVersion = Constant.VERSION_Default;
-            maintain.setOrderNo(0);
-            operateLog.setOperate("鍒濆鍖栦富棰樻暟鎹�");
-        } else {
-            operateLog.setOperate("鏇存柊涓婚");
-            String flowId = maxVersion.getFlowId();
-            String mVersion = maxVersion.getVersion();
-            if (StringUtils.isEmpty(flowId)) {
-                biggerVersion = mVersion;
-                maintain.setOrderNo(maxVersion.getOrderNo());
-                String tempName = maxVersion.getTableName() + Constant.RECORD;
-
-                tableInfoMapper.deleteTempByMaintainId(tempName, DbUtils.quotedStr(maxVersion.getId()));
-                maintainDetailService.delete(new EntityWrapper<MaintainDetail>().eq("parent_id", maxVersion.getId()));
-
-                maxVersion.deleteById();
-            }else {
-                biggerVersion = DbUtils.versionAddBig(mVersion);
-                maintain.setOrderNo(DbUtils.getOrderNoAdd(maxVersion.getOrderNo()));
-            }
+        String uploadTypeStr = request.getParameter("uploadType");
+        SysAssembleUpdateType uploadType;
+        if (StringUtils.isEmpty(uploadTypeStr)) {
+            uploadType = SysAssembleUpdateType.Increment;
+        }else {
+            uploadType = SysAssembleUpdateType.valueOf(uploadTypeStr);
         }
 
-        String uuid = DbUtils.getUUID();
-        maintain.setId(uuid);
-        TUser user = (TUser) request.getSession().getAttribute(Constant.USER);
-        if (user == null) {
-            return Result.error(CodeMsg.ERROR_PARAMS_NOT_MATHED);
-        }
-        maintain.setVersion(biggerVersion);
-        maintain.setChargeId(user.getUserId());
-        maintain.setTableName(tableName);
-        maintain.setCreateTime(new Date());
+        TUser user = DbUtils.getUser(request);
+        //涓婁紶鏁版嵁鍚庣殑鎿嶄綔锛屽叧鑱旂増鏈�
+        Maintain maintain = masterDataService.uploadedData(tableName, uploadType, user.getUserId());
+        // 澶勭悊鍏宠仈浜�
+        //masterModifiedService.dealAssemble(maintain.getId(), user.getUserId(), true);
+        //娣诲姞 std_id 绱㈠紩
+        String recordTableName = tableName + Constant.RECORD;
+        masterDataService.createIdx(recordTableName);
 
-
-        tableInfoMapper.insertMatintainDetailFromTemp(DbUtils.quotedStr(maintain.getId()), maintain.getTableName() + Constant.RECORD);
-
-        tableInfoMapper.updateStdId( maintain.getTableName() + Constant.RECORD);
-
-        Long aLong = tableInfoMapper.tempDeal(maintain.getTableName() + Constant.RECORD, DbUtils.quotedStr(maintain.getId()));
-
-        maintain.setDesp(MessageFormat.format("涓婁紶鏁版嵁{0}鏉�", aLong));
-
-        operateLog.setCreateTime(new Date())
-                .setMaintainId(maintain.getId())
-                .setId(DbUtils.getUUID())
-                .setMaintainId(menuMapping.getId())
-                .setOperate("open")
-                .setDesp(MessageFormat.format("涓婁紶鏁版嵁{0}鏉�", aLong));
-
-        maintain.insert();
         JSONObject object = new JSONObject();
         object.fluentPut("maintainId",maintain.getId());
         object.fluentPut("version",maintain.getVersion());
         return Result.success(object);
     }
 
-
+    /**
+     *
+     * @description: 閫氳繃琛ㄥ悕鍜宨d鑾峰彇鍏蜂綋淇℃伅
+     * @param tableName 琛ㄥ悕
+     * @param id 鏁版嵁id
+     * @return 鍏蜂綋鏁版嵁
+     *
+     */
     @RequestMapping(value = "{tableName}/get/{id}",  method = RequestMethod.GET)
     public Result get(@PathVariable String tableName, @PathVariable String id) {
         return masterDataService.selectById(tableName,id);
     }
-
+    /**
+     *
+     * @description: 閫氳繃琛ㄥ悕鍒嗛〉鑾峰彇鏁版嵁
+     * @param tableName 琛ㄥ悕
+     * @param pageNo 椤垫暟
+     * @return 鍏蜂綋鏁版嵁
+     *
+     */
     @RequestMapping(value = "{tableName}/all/{pageNo}",  method = RequestMethod.GET)
     public Result getByPage(@PathVariable String tableName, @PathVariable Integer pageNo, HttpServletRequest request) throws UnsupportedEncodingException {
+        String uuid = DbUtils.getUUID();
+        Date start = new Date();
+        Character character = DbUtils.getCharacter(request);
+        Date end = new Date();
+        log.info(MessageFormat.format("master tag:{0} MASTER-- form userID selct user:{1} ms",uuid, (end.getTime() - start.getTime())));
+
         String pageSizeStr = request.getParameter("pageSize");
         String whereSegment = request.getParameter(Constant.WHERE_SEGMENT);
         String fields = request.getParameter(Constant.FIELDS);
@@ -150,52 +144,94 @@
             version = String.valueOf(nowVersion.getVersion());
         }else if(version.equalsIgnoreCase(Constant.MAX)){
             findMax = true;
-            version = String.valueOf(maintainService.getMaxVersion(tableName).getVersion());
+            Maintain maxVersion = maintainService.getMaxVersion(tableName);
+            if (maxVersion == null)  {
+                return Result.success(null);
+            }
+            version = String.valueOf(maxVersion.getVersion());
         }
+        Maintain maintainFromVersion = maintainService.getMaintainFromVersion(tableName, version);
+        if (maintainFromVersion == null) {
+            return null;
+        }
+        //ADD Filter
+        start = new Date();
+        log.info(MessageFormat.format("master tag:{0} MASTER-- select maintain:{1} ms",uuid, (start.getTime() - end.getTime())));
+
+        String filter = masterAuthorService.getFilter(character, maintainFromVersion.getId(), uuid);
+        if (!StringUtils.isEmpty(filter)) {
+            whereSegment = DbUtils.StrJoin(whereSegment, Constant.AND, filter);
+        }
+        end = new Date();
+        log.info(MessageFormat.format("master tag:{0}  MASTER-- select filter:{1} ms",uuid, (end.getTime() - start.getTime())));
 
         if (StringUtils.isEmpty(fields)) {
             if (StringUtils.isEmpty(pageSizeStr)) {
-                return masterDataService.selectListByPageByVersion(tableName, whereSegment,pageNo,version, findMax);
+                return masterDataService.selectListByPageByVersion(character, tableName, whereSegment,pageNo,version, findMax,uuid);
             }
-            return masterDataService.selectListByPageByVersion(tableName, null, whereSegment,pageNo, Integer.valueOf(pageSizeStr),version,findMax);
+            return masterDataService.selectListByPageByVersion(character, tableName, null, whereSegment,pageNo, Integer.valueOf(pageSizeStr),version,findMax, uuid);
         }else {
             String[] split = fields.split(Constant.COMMA_TRIM);
             List<String> fieldList = Arrays.stream(split).collect(Collectors.toList());
             if (StringUtils.isEmpty(pageSizeStr)) {
-                return masterDataService.selectListByPageByVersion(tableName, fieldList, whereSegment,pageNo, null,version, findMax);
+                return masterDataService.selectListByPageByVersion(character, tableName, fieldList, whereSegment,pageNo, null,version, findMax, uuid);
             }
-            return masterDataService.selectListByPageByVersion(tableName, fieldList, whereSegment,pageNo, Integer.valueOf(pageSizeStr), findMax);
+            return masterDataService.selectListByPageByVersion(character, tableName, fieldList, whereSegment,pageNo, Integer.valueOf(pageSizeStr), findMax, uuid);
 
         }
     }
+    /**
+     *
+     * @description: 閫氳繃琛ㄥ悕鑾峰彇鏁版嵁
+     * @param tableName 琛ㄥ悕
+     * @return 鍏蜂綋鏁版嵁
+     *
+     */
     @RequestMapping(value = "{tableName}/all",  method = RequestMethod.GET)
     public Result<MenuMapping> getAll(@PathVariable String tableName,HttpServletRequest request) {
+        TUser user = DbUtils.getUser(request);
         String whereSegment = request.getParameter(Constant.WHERE_SEGMENT);
         String version = request.getParameter(Constant.VERSION);
         if (StringUtils.isEmpty(version)) {
             version = String.valueOf(maintainService.getNowVersion(tableName).getVersion());
         }
         if (StringUtils.isEmpty(whereSegment)) {
-            return masterDataService.selectList(tableName);
+            return masterDataService.selectList(user, tableName,Constant.WHERE_DEFAULT, version);
         }
-        return masterDataService.selectList(tableName,whereSegment);
+        return masterDataService.selectList(user, tableName,whereSegment, version);
     }
 
+    /**
+     *
+     * @description: 閫氳繃琛ㄥ悕鍜屾搷浣滅被鍨嬫洿鏂板緟淇敼鏁版嵁
+     * @param maintainId  鏈敓鏁堢殑鐗堟湰id
+     * @param operateStr 鎿嶄綔绫诲瀷
+     * @return 鍏蜂綋鏁版嵁
+     *
+     */
     @RequestMapping(value = "{maintainId}/modify/{operateStr}", method = RequestMethod.POST)
-    public Result modify(@RequestParam String datas, @PathVariable String maintainId, @PathVariable String operateStr, HttpServletRequest request) throws UnsupportedEncodingException {
+    public Result modify(@RequestParam String datas, @PathVariable String maintainId, @PathVariable String operateStr,  @RequestParam String modify, HttpServletRequest request) throws UnsupportedEncodingException {
         Result result = null;
         Operate operate = Operate.parse(operateStr);
         Maintain maintain = maintainService.selectById(maintainId);
+        List<String> modifyFields = null;
+        if (!StringUtils.isEmpty(modify)) {
+            String[] split = modify.split(Constant.SEMICOLON);
+            modifyFields = Arrays.stream(split).collect(Collectors.toList());
+        }
+        TUser user = DbUtils.getUser(request);
+
         switch (operate) {
             case delete:
                 //datas is id;
                 Integer deleteCount = tableInfoMapper.deleteRecordByMaintainId(maintain.getTableName() + Constant.RECORD, DbUtils.quotedStr(datas), DbUtils.quotedStr(maintainId));
-
                 result = Result.success(deleteCount);
                 break;
             case update:
                 JSONObject jsonObject = JSONObject.parseObject(datas);
                 String id = (String) jsonObject.get("id");
+
+                masterModifiedService.updateModifiedUserById(maintainId, id, user.getUserId(), modifyFields);
                 jsonObject.remove(Constant.ID);
                 datas = jsonObject.toJSONString();
                 String updateSegment = masterDataService.getUpdateSegment(maintain.getTableName(), maintain.getTableName() + Constant.RECORD, datas);
@@ -206,6 +242,9 @@
             case create:
                 JSONObject createObject = JSONObject.parseObject(datas);
                 String recordId = DbUtils.getUUID();
+
+                masterModifiedService.updateModifiedUserById(maintainId, recordId, user.getUserId(), modifyFields);
+
                 createObject.fluentPut(Constant.ID, recordId);
                 createObject.fluentPut(Constant.STD_ID, DbUtils.getUUID());
                 datas = createObject.toJSONString();
@@ -230,51 +269,28 @@
         return result;
     }
 
-
+    /**
+     *
+     * @description:  淇敼涓�鏉℃暟鎹紝 渚涘湪绾跨紪杈戜娇鐢�
+     * @param tableName 琛ㄥ悕
+     * @param operateStr 鎿嶄綔绫诲瀷
+     * @return 鍏蜂綋鏁版嵁
+     *
+     */
     @RequestMapping(value = "{tableName}/{operateStr}", method = RequestMethod.POST)
-    public Result insert(@PathVariable String tableName,@PathVariable String operateStr, @RequestParam String datas, HttpServletRequest request) {
+    @Transactional(rollbackFor = {RuntimeException.class, Error.class})
+    public Result insert(@PathVariable String tableName,@PathVariable String operateStr, @RequestParam String datas, @RequestParam String modify, HttpServletRequest request) {
         String fields = request.getParameter("fields");
         Operate operate = Operate.parse(operateStr);
-
+        TUser user = DbUtils.getUser(request);
+        String userId = user.getUserId();
         Maintain maintain = maintainService.getMaxVersion(tableName);
-        Maintain unFlowMaxVersion = maintainService.getUnFlowMaxVersion(tableName);
-        if (unFlowMaxVersion == null) {
-            unFlowMaxVersion = new Maintain();
-            if (maintain != null) {
-                unFlowMaxVersion.setVersion(DbUtils.versionAddSub(maintain.getVersion()));
-                int orderNo = maintain.getOrderNo();
-                orderNo++;
-                unFlowMaxVersion.setOrderNo(orderNo);
-            } else {
-                unFlowMaxVersion.setVersion(Constant.VERSION_Default);
-                unFlowMaxVersion.setOrderNo(0);
-            }
+        Maintain nowMaintain = maintainService.getNextMaintain(tableName, userId);
 
-            unFlowMaxVersion.setId(DbUtils.getUUID());
-            TUser user = (TUser) request.getSession().getAttribute("user");
-            unFlowMaxVersion.setChargeId(user.getUserId());
-            unFlowMaxVersion.setCreateTime(new Date());
-            unFlowMaxVersion.setTableName(tableName);
-        }
-
-        Maintain nowMaintain = unFlowMaxVersion;
-        if (DbUtils.compareVersion(maintain, unFlowMaxVersion) != 0) {
-            nowMaintain = new Maintain();
-            String maintanId = DbUtils.getUUID();
-            nowMaintain.setId(maintanId);
-            nowMaintain.setCreateTime(new Date());
-            int orderNo = maintain.getOrderNo();
-            orderNo++;
-            nowMaintain.setVersion(DbUtils.versionAddSub(maintain.getVersion()));
-            nowMaintain.setOrderNo(orderNo);
-            nowMaintain.setTableName(tableName);
-        }
-
-        TUser user = (TUser) request.getSession().getAttribute("user");
-        nowMaintain.setChargeId(user.getUserId());
-        String maintainId = nowMaintain.getId();
-        if(StringUtils.isEmpty(maintainId)) {
-            nowMaintain.setId(DbUtils.getUUID());
+        List<String> modifyFields = null;
+        if (!StringUtils.isEmpty(modify)) {
+            String[] split = modify.split(Constant.SEMICOLON);
+            modifyFields = Arrays.stream(split).collect(Collectors.toList());
         }
 
         Result result;
@@ -282,8 +298,9 @@
             String nowMaintainId = nowMaintain.getId();
             String tempId = tableInfoMapper.getTempIdByStdId(tableName + Constant.RECORD,DbUtils.quotedStr(datas), DbUtils.quotedStr(nowMaintainId));
             if (!StringUtils.isEmpty(tempId)){
-                maintainDetailService.delete(new EntityWrapper<MaintainDetail>().eq("parent_id", maintain.getId()).eq("operate",Operate.delete.name()).eq("pre_merge_id",tempId));
-               return masterDataService.deleteById(tableName + Constant.RECORD, tempId);
+                maintainDetailService.delete(new EntityWrapper<MaintainDetail>().eq("parent_id", maintain.getId()).eq("pre_merge_id",tempId));
+                result = masterDataService.deleteById(tableName + Constant.RECORD, tempId);
+                return result;
             }else {
                 result = masterDataService.selectById(tableName, datas);
                 Object data = result.getData();
@@ -295,16 +312,19 @@
         } else if (operate.equals(Operate.update)) {
             JSONObject jsonObject = JSONObject.parseObject(datas);
             Object id = jsonObject.get("id");
+
             String nowMaintainId = nowMaintain.getId();
             String tempId = tableInfoMapper.getTempIdByStdId(tableName + Constant.RECORD,DbUtils.quotedStr(id.toString()), DbUtils.quotedStr(nowMaintainId));
             if (StringUtils.isEmpty(tempId)) {
                 result = masterDataService.selectById(tableName, id.toString());
             } else {
+                masterModifiedService.updateModifiedUserById(nowMaintain.getId(), id.toString(), user.getUserId(), modifyFields);
                 jsonObject.put(Constant.STD_ID, id);
                 jsonObject.put(Constant.ID, tempId);
                 return masterDataService.updateById(tableName + Constant.RECORD, JSON.toJSONString(jsonObject), tempId,false);
             }
         }
+
 
         //merge 2 temp
         String tableTempName = tableName + Constant.RECORD;
@@ -314,6 +334,7 @@
         if (dataId == null) {
             dataId = DbUtils.getUUID();
         }
+        masterModifiedService.updateModifiedUserById(nowMaintain.getId(), dataId.toString(), user.getUserId(), modifyFields);
         object.put(Constant.STD_ID, dataId);
         object.put(Constant.ID, DbUtils.getUUID());
         datas = JSON.toJSONString(object);
@@ -326,6 +347,7 @@
         List<String> ids = (List<String>) result.getData();
 
         nowMaintain.insertOrUpdate();
+
         for (String id : ids) {
             MaintainDetail maintainDetail = new MaintainDetail();
             maintainDetail.setId(DbUtils.getUUID());
@@ -341,7 +363,23 @@
         Maintain firstVersionMaintain = maintainService.getMaintainFromVersion(tableName, Constant.VERSION_Default);
 
         MenuMapping menuMapping = menuMappingService.selectOne(new EntityWrapper<MenuMapping>().eq("table_name", firstVersionMaintain.getTableName()));
+        String menuId = menuMapping.getMenuId();
+        SysMenu menu = menuService.selectById(menuId);
+        if (menu != null) {
+            LinkedHashSet<String> parentIdSet = new LinkedHashSet<>();
+            parentIdSet.add(menuId);
+            LinkedHashSet<String> byParentId = menuService.getByParentId(parentIdSet);
+            if (byParentId == null) {
+                noticeClient.EditMasterData(menu, null, user.getUserId(), operate);
+            } else {
+                if (!byParentId.isEmpty()) {
+                    List<SysMenu> sysMenus = menuService.selectBatchIds(byParentId);
+                    SysMenu parentMenu = sysMenus.get(0);
+                    noticeClient.EditMasterData(menu, parentMenu, user.getUserId(),operate);
+                }
 
+            }
+        }
         SysOperateLog operateLog = new SysOperateLog();
         operateLog.setChargeId(user.getUserId()).setId(DbUtils.getUUID())
                 .setMaintainId(nowMaintain.getId())
@@ -354,6 +392,15 @@
         return result;
 
     }
+
+    /**
+     *
+     * @description: 鐩存帴鏇存柊涓�鏉℃暟鎹�
+     * @param tableName 琛ㄥ悕
+     * @param id 鏁版嵁id
+     * @return 鍏蜂綋鏁版嵁
+     *
+     */
     @RequestMapping(value = "update/{id}", method = RequestMethod.POST)
     public Result updateById(@PathVariable String tableName,@RequestParam String datas, @PathVariable String id, HttpServletRequest request)  {
         String totalStr = request.getParameter(Constant.TOTAL);
@@ -379,14 +426,29 @@
         }
 
     }
-
+    /**
+     *
+     * @description: 鐩存帴鍒犻櫎涓�鏉℃暟鎹�
+     * @param tableName 琛ㄥ悕
+     * @param id 鏁版嵁id
+     * @return 鍒犻櫎缁撴灉
+     *
+     */
     @RequestMapping(value = "delete/{id}", method = RequestMethod.GET)
     public Result deleteById(@PathVariable String tableName, @PathVariable String id) {
        return masterDataService.deleteById(tableName,id);
     }
 
+    /**
+     *
+     * @description: 閫氳繃绛涢�夋潯浠跺垹闄ゆ暟鎹�
+     * @param tableName 琛ㄥ悕
+     * @return 鍏蜂綋鏁版嵁
+     *
+     */
     @RequestMapping(value = "delete", method = RequestMethod.GET)
     public Result delete(@PathVariable String tableName, HttpServletRequest request) {
+        //whereSegment 绛涢�夋潯浠�
         String whereSegment = request.getParameter(Constant.WHERE_SEGMENT);
         if (StringUtils.isEmpty(whereSegment)) {
             return masterDataService.delete(tableName);
@@ -394,4 +456,30 @@
             return masterDataService.delete(tableName, whereSegment);
         }
     }
+    /**
+     *
+     * @description: 閫氳繃瀛楁鐗堟湰鑾峰彇鏌愪釜瀛楁鐨勬墍鏈夌殑鏁版嵁
+     * @param maintainFieldId 瀛楁鐗堟湰
+     * @param menuId 涓婚id
+     * @param field 瀛楁
+     * @return 鍏蜂綋鏁版嵁
+     *
+     */
+    @RequestMapping(value = "/getValByMaintainFieldId/{maintainFieldId}", method = RequestMethod.GET)
+    public Result getValByMaintainFieldId(@PathVariable String maintainFieldId,@RequestParam String menuId, @RequestParam String field, HttpServletRequest request) {
+        String tableName = menuMappingService.getTableNameByMenu(menuId);
+        if (StringUtils.isEmpty(tableName)) {
+            return Result.error(CodeMsg.ERROR_PARAMS_NOT_MATHED);
+        }
+        if (maintainFieldId.equalsIgnoreCase(Constant.All)) {
+            Set<String> fieldValList =  masterDataService.getFieldValByTable(tableName, field);
+            return Result.success(fieldValList);
+        }
+
+        Set<String> fieldValByMaintainField = masterDataService.getFieldValByMaintainField(maintainFieldId, field, tableName);
+
+        return Result.success(fieldValByMaintainField);
+    }
+
+
 }

--
Gitblit v1.8.0