dongke 2 年 前
コミット
8957c3b2e4

+ 4 - 2
src/main/java/com/dk/mdm/controller/mst/MoneyAccountController.java

@@ -13,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import io.swagger.annotations.Api;
 import com.dk.mdm.service.mst.MoneyAccountService;
 
+import java.util.Map;
+
 @Api(tags = "资金账户API接口")
 @RestController
 @RequestMapping("/mst/moneyAccount")
@@ -41,8 +43,8 @@ public class MoneyAccountController{
      * @date : 2023/2/29 10:36
      */
     @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
-    @PostMapping({"list_by"})
-    public ResponseResultVO<PageList<MoneyAccountResponse>> wxSelectByCond(@RequestBody MoneyAccountQuery moneyAccountQuery) {
+    @PostMapping({"wx_list_by"})
+    public ResponseResultVO<Map<String, Object>> wxSelectByCond(@RequestBody MoneyAccountQuery moneyAccountQuery) {
         return moneyAccountService.wxSelectByCond(moneyAccountQuery);
     }
 

+ 2 - 1
src/main/java/com/dk/mdm/mapper/mst/MoneyAccountMapper.java

@@ -8,6 +8,7 @@ import com.dk.mdm.model.response.sale.OrderResponse;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
+import java.util.Map;
 
 /**
 *  资金账户 Mapper
@@ -25,7 +26,7 @@ public interface MoneyAccountMapper extends BaseMapper<MoneyAccount>{
      * @author : 王英杰
      * @date   : 2024/3/1 10:42
      */
-    List<MoneyAccountResponse> wxSelectByCond(MoneyAccountQuery moneyAccountQuery);
+    List<Map<String, Object>>  wxSelectByCond(MoneyAccountQuery moneyAccountQuery);
 
     /**
      * @desc   : 根据条件进行查询(数量)

+ 67 - 10
src/main/java/com/dk/mdm/mapper/mst/MoneyAccountMapper.xml

@@ -79,24 +79,81 @@
     </select>
 
     <!-- 王英杰 2024年3月6日 微信小程序用 -->
-    <select id="wxSelectByCond" resultMap="BaseResultMap">
+    <select id="wxSelectByCond" resultType="java.util.Map">
+        SELECT T
+        .*
+        FROM
+        (
         SELECT
-        tmma.mac_type, tmdd.data_value AS "macTypeName",
-        SUM(balance) AS totalBalance,
-        json_agg(json_build_object('macId', tmma.mac_id, 'macName', tmma.mac_name, 'balance', tmma.balance)) AS subList
-        FROM dkic_b.t_mst_money_account tmma
-        left join dkic_b.t_mst_dictionary_data tmdd on tmdd.data_id = tmma.mac_type
-        GROUP BY tmma.mac_type,tmdd.data_value
+        null AS "macType",
+        null AS  "macCode",
+        tmdd.data_value AS  "macName",
+        null	AS "Remarks",
+        null AS "flgValid",
+        null AS "macTypeName",
+        null AS  "macId",
+        null	AS "balance",
+        null AS "displayNo"
+        FROM
+        dkic_b.t_mst_dictionary_data tmdd
+        WHERE
+        tmdd.dict_code = '账户类别' UNION ALL
+        SELECT
+        ma.mac_Type as "macType",
+        ma.mac_code AS "macCode",
+        ma.mac_name AS "macName",
+        ma.remarks  AS "Remarks",
+        ma.flg_valid AS "flgValid",
+        dd.data_value AS "macTypeName",
+        ma.mac_id AS  "macId",
+        ma.balance AS  "balance",
+        ma.display_no AS  "displayNo"
+        FROM
+        dkic_b.t_mst_money_account ma
+        LEFT JOIN dkic_b.t_mst_dictionary_data dd ON ma.mac_type = dd.data_id
         <include refid="Condition"/>
+
+        ) T
+
+
     </select>
+
     <!-- 王英杰 2024年3月6日 微信小程序用 -->
     <select id="wxCountByCond" resultType="Long">
         SELECT
         count(1)
-        FROM dkic_b.t_mst_money_account tmma
-        left join dkic_b.t_mst_dictionary_data tmdd on tmdd.data_id = tmma.mac_type
-        GROUP BY tmma.mac_type,tmdd.data_value
+        FROM
+        (
+        SELECT
+        null AS "macType",
+        tmdd.data_value AS  "macCode",
+        null AS  "macName",
+        null	AS "Remarks",
+        null AS "flgValid",
+        null AS "macTypeName",
+        null AS  "macId",
+        null	AS "balance",
+        null AS "displayNo"
+        FROM
+        dkic_b.t_mst_dictionary_data tmdd
+        WHERE
+        tmdd.dict_code = '账户类别' UNION ALL
+        SELECT
+        ma.mac_Type as "macType",
+        ma.mac_code AS "macCode",
+        ma.mac_name AS "macName",
+        ma.remarks  AS "Remarks",
+        ma.flg_valid AS "flgValid",
+        dd.data_value AS "macTypeName",
+        ma.mac_id AS  "macId",
+        ma.balance AS  "balance",
+        ma.display_no AS  "displayNo"
+        FROM
+        dkic_b.t_mst_money_account ma
+        LEFT JOIN dkic_b.t_mst_dictionary_data dd ON ma.mac_type = dd.data_id
         <include refid="Condition"/>
+        ) T
+
     </select>
     <!-- 根据主键查询表t_mst_money_account的一行数据 -->
     <select id="selectById" resultMap="BaseResultMap">

+ 11 - 3
src/main/java/com/dk/mdm/service/mst/MoneyAccountService.java

@@ -19,6 +19,8 @@ import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
@@ -68,9 +70,15 @@ public class MoneyAccountService extends BaseService<MoneyAccount> {
 	 * @date   : 2023/2/29 10:40
 	 */
 	@Pagination
-	public ResponseResultVO<PageList<MoneyAccountResponse>> wxSelectByCond(MoneyAccountQuery moneyAccountQuery) {
-		return super.mergeListWithCount(moneyAccountQuery, moneyAccountMapper.wxSelectByCond(moneyAccountQuery),
-				moneyAccountMapper.wxCountByCond(moneyAccountQuery));
+	public ResponseResultVO<Map<String, Object>> wxSelectByCond(MoneyAccountQuery moneyAccountQuery) {
+
+		// 获取系统基础数据
+		List<Map<String, Object>> list = moneyAccountMapper.wxSelectByCond(moneyAccountQuery);
+		Map<String, Object> objectObjectHashMap = new HashMap<>();
+		objectObjectHashMap.put("list", list);
+		return ResponseResultUtil.success(objectObjectHashMap);
+
+
 	}