Commit 003e71d2 authored by eddie.woo's avatar eddie.woo

fix account mapping

parent 79fd3dd2
......@@ -691,7 +691,8 @@ public class EnterpriseAccountServiceImpl extends AbstractService {
}).collect(Collectors.toList());
List<EnterpriseAccountDto> total = Lists.newArrayList();
formatEpAccountDtoTree(rootList, result, total);
return total.stream().sorted(Comparator.comparing(EnterpriseAccountDto::getCode)).collect(Collectors.toList());
return total.stream().collect(Collectors.groupingBy(EnterpriseAccountDto::getCode)).values().stream().map(o -> o.get(0))
.sorted(Comparator.comparing(EnterpriseAccountDto::getCode)).collect(Collectors.toList());
}
@Transactional
......
......@@ -16,10 +16,10 @@ public interface CustomAccountMapper extends MyMapper {
@Select("SELECT ea.id,ea.Code,ea.Name,ea.PARENT_CODE,ea.FULL_NAME,"
+ "CASE WHEN am.STANDARD_ACCOUNT_CODE='0000' THEN am.STANDARD_ACCOUNT_CODE ELSE sa.Code END StdCode,"
+ "sa.Name StdName,sa.PARENT_CODE StdParentCode "
+ "sa.Name Name,sa.PARENT_CODE StdParentCode "
+ "FROM (SELECT * FROM ENTERPRISE_ACCOUNT where PARENT_CODE=#{parentCode} and ENTERPRISE_ACCOUNT_SET_ID=#{accountSetId}) ea "
+ "LEFT JOIN (SELECT * FROM ACCOUNT_MAPPING WHERE ORGANIZATION_ID=#{orgId} AND INDUSTRY_ID=#{industryId} AND ENTERPRISE_ACCOUNT_SET_ID=#{accountSetId}) am ON ea.Code=am.ENTERPRISE_ACCOUNT_CODE "
+ "LEFT JOIN (SELECT * FROM StandardAccount WHERE IndustryID=#{industryId}) sa ON am.STANDARD_ACCOUNT_CODE=sa.Code "
+ "LEFT JOIN (SELECT * FROM STANDARD_ACCOUNT WHERE INDUSTRY_ID=#{industryId}) sa ON am.STANDARD_ACCOUNT_CODE=sa.Code "
+ "ORDER BY ea.CODE")
@Results({
@Result(id = true, column = "id", property = "id"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment