From 21e3f430db8e40c47720416a38c10a455c854c43 Mon Sep 17 00:00:00 2001 From: JiilingLee <462362@qq.com> Date: Sun, 8 Oct 2023 17:51:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=8B=E6=A1=A3=E5=8D=95=E4=BD=8D-=E5=BA=93?= =?UTF-8?q?=E6=88=BF-=E6=A1=A3=E6=A1=88=E6=9F=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../setting/dal/mysql/depot/DepotMapper.java | 2 +- .../organization/OrganizationMapper.java | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/dal/mysql/depot/DepotMapper.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/dal/mysql/depot/DepotMapper.java index 4995a773..bcf7517a 100644 --- a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/dal/mysql/depot/DepotMapper.java +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/dal/mysql/depot/DepotMapper.java @@ -60,7 +60,7 @@ public interface DepotMapper extends BaseMapperX { @Select("SELECT d.id AS depotId, d.name AS depotName, d.code AS depotCode, " + "c.id AS cabinetId, c.name AS cabinetName, c.code AS cabinetCode " + "FROM setting_depot d " + - "JOIN setting_depot_cabinet c ON d.id = c.depot_id " + + "LEFT JOIN setting_depot_cabinet c ON d.id = c.depot_id " + "WHERE d.organization_id = #{organizationId}") @Results({ @Result(property = "depotId", column = "depotId"), diff --git a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/dal/mysql/organization/OrganizationMapper.java b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/dal/mysql/organization/OrganizationMapper.java index 6b3ab6e3..e29d9c22 100644 --- a/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/dal/mysql/organization/OrganizationMapper.java +++ b/yudao-module-setting/yudao-module-setting-biz/src/main/java/cn/iocoder/yudao/module/setting/dal/mysql/organization/OrganizationMapper.java @@ -48,19 +48,16 @@ public interface OrganizationMapper extends BaseMapperX { .orderByDesc(OrganizationDO::getId)); } - @Select("SELECT o.id AS organizationId, o.organization_name AS organizationName, o.organization_code AS organizationCode, " + - "d.id AS depotId, d.name AS depotName, d.code AS depotCode, " + - "c.id AS cabinetId, c.name AS cabinetName, c.code AS cabinetCode " + - "FROM setting_organization o " + - "LEFT JOIN setting_depot d ON o.id = d.organization_id " + - "LEFT JOIN setting_depot_cabinet c ON d.id = c.depot_id ") - @Results({ - @Result(property = "organizationId", column = "organizationId"), + @Select("SELECT o.id AS organizationId, o.organization_name AS organizationName, o.organization_code AS organizationCode, " + + "d.id AS depotId, d.name AS depotName, d.code AS depotCode, " + + "IFNULL(c.id, '') AS cabinetId, IFNULL(c.name, '') AS cabinetName, IFNULL(c.code, '') AS cabinetCode " + + "FROM setting_organization o " + + "LEFT JOIN setting_depot d ON o.id = d.organization_id " + + "LEFT JOIN setting_depot_cabinet c ON d.id = c.depot_id ") + @Results({ @Result(property = "organizationId", column = "organizationId"), @Result(property = "organizationName", column = "organizationName"), @Result(property = "organizationCode", column = "organizationCode"), - @Result(property = "children", column = "organizationId",javaType = List.class, - many=@Many(select="cn.iocoder.yudao.module.setting.dal.mysql.depot.DepotMapper.getDepotCabinetByOrganization")) - }) + @Result(property = "children", column = "organizationId",javaType = List.class, many=@Many(select="cn.iocoder.yudao.module.setting.dal.mysql.depot.DepotMapper.getDepotCabinetByOrganization")) }) List getOrganizationDepotCabinets(); }