Sfoglia il codice sorgente

优化股东列表查询

wangwl 2 mesi fa
parent
commit
8ae365aae8

+ 1 - 1
ruoyi-equity/src/main/java/com/ruoyi/equity/controller/ShareholderInfoController.java

@@ -75,7 +75,7 @@ public class ShareholderInfoController extends BaseController {
     }
 
     /**
-     * 获取所有的股东
+     * 获取所有的股东  控制主体的股东
      */
     @ApiOperation("获取所有的股东")
     @GetMapping("/getAllShareholder")

+ 7 - 7
ruoyi-equity/src/main/resources/mapper/equity/ShareholderInfoMapper.xml

@@ -27,13 +27,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
 
     <select id="selectShareholderInfoList" parameterType="ShareholderInfoVO" resultType="com.ruoyi.equity.domain.vo.ShareholderInfoVO">
-        select shareholder_id, parent_id, ancestors, shareholder_name, shareholder_type, shareholding_ratio, controlled_company as thecompany, company_valuation, is_subject, node_type, create_by, create_time, update_by, update_time, remark ,
-        (select shareholder_name from e_shareholder_info where thecompany = shareholder_id) as companyName
-         from e_shareholder_info
-        where (is_subject = 1 or node_type in (1, 0))
-            <if test="shareholderName != null  and shareholderName != ''"> and shareholder_name like concat('%', #{shareholderName}, '%')</if>
-            <if test="shareholderType != null  and shareholderType != ''"> and shareholder_type = #{shareholderType}</if>
-            <if test="controlledCompany != null "> and controlled_company = #{controlledCompany}</if>
+        select esi.*,
+        esi2.shareholder_name as companyName
+        from e_shareholder_info esi left join e_shareholder_info esi2 on esi.controlled_company = esi2.shareholder_id
+        where (esi.is_subject = 1 or esi.node_type in (1, 0))
+            <if test="shareholderName != null  and shareholderName != ''"> and esi.shareholder_name like concat('%', #{shareholderName}, '%')</if>
+            <if test="shareholderType != null  and shareholderType != ''"> and esi.shareholder_type = #{shareholderType}</if>
+            <if test="controlledCompany != null "> and esi.controlled_company = #{controlledCompany}</if>
     </select>
     
     <select id="selectShareholderInfoByShareholderId" parameterType="Long" resultMap="ShareholderInfoResult">