Explorar o código

添加label值

Wang-Xiao-Ran hai 1 ano
pai
achega
14a217cf1b

+ 25 - 12
src/main/java/com/sooka/sponest/mobile/comprehensive/organizationAndInstitutioncontroller/AppInstitutionsController.java

@@ -7,6 +7,7 @@ import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.core.web.page.PageDomain;
 import com.ruoyi.common.core.web.page.TableDataInfo;
 import com.ruoyi.common.core.web.page.TableSupport;
+import com.ruoyi.common.security.utils.DictUtils;
 import com.sooka.sponest.comprehensive.api.comprehensiveOrganizationAndInstitution.domain.ComprehensiveInstitutions;
 import com.sooka.sponest.comprehensive.api.comprehensiveOrganizationAndInstitution.service.RemoteInstitutionsService;
 import org.springframework.web.bind.annotation.*;
@@ -15,6 +16,7 @@ import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 综治机构
@@ -37,13 +39,21 @@ public class AppInstitutionsController extends BaseController {
         PageDomain pageDomain = TableSupport.buildPageRequest();
         Integer pageNum = pageDomain.getPageNum();
         Integer pageSize = pageDomain.getPageSize();
-        TableDataInfo tableDataInfo = remoteInstitutionsService.selectComprehensiveInstitutionsList(pageNum, pageSize,comprehensiveInstitutions.getInstitutionName(),comprehensiveInstitutions.getInstitutionType(),comprehensiveInstitutions.getLevel() );
-        if(HttpStatus.SUCCESS == tableDataInfo.getCode()){
+        TableDataInfo tableDataInfo = remoteInstitutionsService.selectComprehensiveInstitutionsList(pageNum, pageSize, comprehensiveInstitutions.getInstitutionName(), comprehensiveInstitutions.getInstitutionType(), comprehensiveInstitutions.getLevel());
+        Map<String, Object> comprehensiveInstitutionsType = DictUtils.getDictCacheToMap("comprehensive_Institutions_type");
+        Map<String, Object> comprehensiveLevels = DictUtils.getDictCacheToMap("comprehensive_levels");
+        List<HashMap<String, Object>> rows = (List<HashMap<String, Object>>) tableDataInfo.getRows();
+        for (HashMap<String, Object> row : rows) {
+            row.put("institutionTypeLabel", comprehensiveInstitutionsType.get(row.get("institutionType")));
+            row.put("levelLabel", comprehensiveLevels.get(row.get("level")));
+        }
+        if (HttpStatus.SUCCESS == tableDataInfo.getCode()) {
             return AjaxResult.success(tableDataInfo.getRows());
-        }else{
-            return AjaxResult.error(tableDataInfo.getCode(),tableDataInfo.getMsg());
+        } else {
+            return AjaxResult.error(tableDataInfo.getCode(), tableDataInfo.getMsg());
         }
     }
+
     @GetMapping("/comprehensiveInstitutionsf/comprehensiveInstitutionsfList")
     public AjaxResult selectComprehensiveInstitutionsf(ComprehensiveInstitutions comprehensiveInstitutions) {
         List<ComprehensiveInstitutions> comprehensiveInstitutionsList = remoteInstitutionsService.comprehensiveInstitutionsfList();
@@ -56,15 +66,17 @@ public class AppInstitutionsController extends BaseController {
      */
     @GetMapping("/comprehensiveInstitutionsf/edit")
     public AjaxResult getInfo(String id) {
-       R<ComprehensiveInstitutions> comprehensiveInstitutionsR = remoteInstitutionsService.selectComprehensiveInstitutionsById(id);
-       ComprehensiveInstitutions data = comprehensiveInstitutionsR.getData();
-       if (HttpStatus.SUCCESS == comprehensiveInstitutionsR.getCode()){
+        R<ComprehensiveInstitutions> comprehensiveInstitutionsR = remoteInstitutionsService.selectComprehensiveInstitutionsById(id);
+        ComprehensiveInstitutions data = comprehensiveInstitutionsR.getData();
+        data.setInstitutionTypeLabel(DictUtils.getDictDataByValue("comprehensive_Institutions_type", data.getInstitutionType()));
+        data.setLevelLabel(DictUtils.getDictDataByValue("comprehensive_levels", data.getLevel()));
+        if (HttpStatus.SUCCESS == comprehensiveInstitutionsR.getCode()) {
             data.setIsEdit(true);
-       }else if(HttpStatus.ERROR == comprehensiveInstitutionsR.getCode() && null!=data){
-           data.setIsEdit(false);
-       }else {
-           return AjaxResult.error(comprehensiveInstitutionsR.getCode(),comprehensiveInstitutionsR.getMsg());
-       }
+        } else if (HttpStatus.ERROR == comprehensiveInstitutionsR.getCode() && null != data) {
+            data.setIsEdit(false);
+        } else {
+            return AjaxResult.error(comprehensiveInstitutionsR.getCode(), comprehensiveInstitutionsR.getMsg());
+        }
         return AjaxResult.success(data);
     }
 
@@ -75,6 +87,7 @@ public class AppInstitutionsController extends BaseController {
     public AjaxResult add(@RequestBody String json) {
         return remoteInstitutionsService.insertComprehensiveInstitutions(json);
     }
+
     /**
      * 修改综治机构
      */