Browse Source

组织树

da-xian 4 months ago
parent
commit
c02e1b4f0c

+ 2 - 1
src/main/java/com/bowintek/smartsearch/controller/WellInfoController.java

@@ -70,7 +70,8 @@ public class WellInfoController {
 
     @GetMapping("/getOrganizationTree")
     public BaseResponse getOrganizationTree() {
-        return RespGenerstor.success(organizationService.getListTree("HBlQAIBGob"));
+        //HBlQAIBGob
+        return RespGenerstor.success(organizationService.getListTree());
     }
 
     @GetMapping("/getWellBaseInfo")

+ 2 - 0
src/main/java/com/bowintek/smartsearch/mapper/cquery/CdOrganizationCQuery.java

@@ -6,6 +6,8 @@ import org.apache.ibatis.annotations.Param;
 import java.util.List;
 
 public interface CdOrganizationCQuery {
+    List<CdOrganizationTreeVo> getListToTree2();
+
     List<CdOrganizationTreeVo> getListToTree();
     List<CdOrganizationTreeVo> getListByIdList(@Param("idList") List<String> idList);
 }

+ 12 - 2
src/main/java/com/bowintek/smartsearch/services/impl/OrganizationServiceImpl.java

@@ -8,6 +8,7 @@ import com.bowintek.smartsearch.vo.cd.CdOrganizationTreeVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -18,8 +19,9 @@ public class OrganizationServiceImpl implements OrganizationService {
     private CdOrganizationCQuery cdOrganizationCQuery;
 
     @Override
+    @SwitchDataSource(DBTypeEnum.POSTGRE)
     public List<CdOrganizationTreeVo> getListTree(){
-        List<CdOrganizationTreeVo> sources = cdOrganizationCQuery.getListToTree();
+        List<CdOrganizationTreeVo> sources = cdOrganizationCQuery.getListToTree2();
         return recursionListTree(sources, null);
     }
 
@@ -27,13 +29,21 @@ public class OrganizationServiceImpl implements OrganizationService {
     @Override
     @SwitchDataSource(DBTypeEnum.POSTGRE)
     public List<CdOrganizationTreeVo> getListTree(String parentValue){
-        List<CdOrganizationTreeVo> sources = cdOrganizationCQuery.getListToTree();
+        List<CdOrganizationTreeVo> sources = cdOrganizationCQuery.getListToTree2();
         return recursionListTree(sources, parentValue);
     }
     public List<CdOrganizationTreeVo> recursionListTree(List<CdOrganizationTreeVo> sources, String parentValue){
         List<CdOrganizationTreeVo> rtnList = findTreeByParent(sources, parentValue);
         for(int i=0;i<rtnList.size();i++){
             CdOrganizationTreeVo vo = rtnList.get(i);
+            if(vo.getValue()==null){
+                vo.setChildren(new ArrayList<>());
+                continue;
+            }
+            if(vo.getParentValue() != null && vo.getValue().equals(vo.getParentValue())){
+                vo.setChildren(new ArrayList<>());
+                continue;
+            }
             List<CdOrganizationTreeVo> childs = recursionListTree(sources, vo.getValue());
             vo.setChildren(childs);
         }

+ 1 - 0
src/main/java/com/bowintek/smartsearch/vo/query/WellInfoParams.java

@@ -21,6 +21,7 @@ public class WellInfoParams {
     private String oil_prod_recent_date_begin;
     private String oil_prod_recent_date_end;
     private String org_id_a1;
+    private String org_name_a2;
     private String project_id;
     private List<String> orgList;
     private List<String> unitList;

+ 5 - 0
src/main/resources/mapping/cquery/CdOrganizationCQuery.xml

@@ -15,4 +15,9 @@
             #{orgId}
         </foreach>
     </select>
+
+    <select id="getListToTree2" resultType="com.bowintek.smartsearch.vo.cd.CdOrganizationTreeVo">
+        select id as value, name as label, parent_id as parentValue
+        from by_dwr.org_202411new order by name
+    </select>
 </mapper>

+ 6 - 0
src/main/resources/mapping/cquery/WellInfoCQuery.xml

@@ -126,6 +126,9 @@
         <if test="org_id_a1!='' and org_id_a1!=null">
             and well.org_id_a2 =#{org_id_a1}
         </if>
+        <if test="org_name_a2!='' and org_name_a2!=null">
+            and well.org_name_a2 = #{org_name_a2}
+        </if>
         <if test="project_id!='' and project_id!=null">
             and well.project_id =#{project_id}
         </if>
@@ -177,6 +180,9 @@
         <if test="org_id_a1!='' and org_id_a1!=null">
             and well.org_id_a2 =#{org_id_a1}
         </if>
+        <if test="org_name_a2!='' and org_name_a2!=null">
+            and well.org_name_a2 =#{org_name_a2}
+        </if>
         <if test="project_id!='' and project_id!=null">
             and well.project_id =#{project_id}
         </if>

+ 5 - 3
vue/src/views/wellinfo/index.vue

@@ -47,7 +47,6 @@
       <DoubleRightOutlined @click="showTree=true;colspan=8;"/>
     </div>
     <v-tour name="wellInfoTour" style="z-index: 1000;" :steps="steps" :options="myOptions" :callbacks="myCallbacks"></v-tour>
-
     <div class="query-index-content" >
       <div class="query-index-form" >
         <a-form ref="formRef" name="fromQuery"
@@ -714,6 +713,7 @@ export default defineComponent({
     const tabChange = (key) => {
       console.log("tabChange", key);
       formState.org_id_a1 = '';
+      formState.org_name_a2 = '';
       formState.project_id = '';
       formState.orgList = [];
       formState.unitList = [];
@@ -829,8 +829,10 @@ export default defineComponent({
       console.log(selected, selectedNodes, node);
       if (selectedNodes.node.parent != undefined || activeTab.value == "1") {
         if (activeTab.value == "1") {
-          formState.org_id_a1 = selected.length > 0 ? selectedNodes.node.key : '';
-          formState.orgList = selected.length > 0 ? [formState.org_id_a1] : [];
+          formState.org_name_a2 = selected.length > 0 ? selectedNodes.node.label : '';
+          // formState.org_id_a1 = selected.length > 0 ? selectedNodes.node.key : '';
+          // formState.orgList = selected.length > 0 ? [formState.org_id_a1] : [];
+
           onOrgTreeChange();
         } else {
           formState.project_id = selected.length > 0 ? selectedNodes.node.key : '';

+ 3 - 2
vue/src/views/wellinfo/table.ts

@@ -135,6 +135,7 @@ export const formState = reactive({
   project_id: '',
   orgList: [] as any[],
   unitList: [] as any[],
+  org_name_a2: '',
 });
 export const columns: TableColumnsType = [
   {
@@ -156,8 +157,8 @@ export const columns: TableColumnsType = [
   {title: '井别', dataIndex: 'well_purpose', key: 'well_purpose', width: 100,resizable: true, customHeaderCell: onHeaderCell},
   {
     title: '组织机构',
-    dataIndex: 'org_name_a1',
-    key: 'org_name_a1',
+    dataIndex: 'org_name_a2',
+    key: 'org_name_a2',
     width: 150,
     ellipsis: true,
     resizable: true,