Merge remote-tracking branch 'refs/remotes/origin/dev' into nanguangmall

This commit is contained in:
赵辉
2025-12-10 09:28:06 +08:00
158 changed files with 4032 additions and 324 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
# 基础镜像
FROM kdvolder/jdk8
FROM arm64v8/openjdk:8
# author
MAINTAINER manhuoda
#指定东八区时区
@@ -10,7 +10,7 @@ ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8"
# 其效果是在主机 /var/lib/docker 目录下创建了一个临时文件,并链接到容器的/tmp
VOLUME /tmp
#将当前mhd_product.jar 复制到容器根目录下
ADD mhd_product.jar mhd_product.jar
ADD target/mhd_product.jar mhd_product.jar
#暴露容器端口 Docker镜像告知Docker宿主机应用监听了端口
EXPOSE 8005
# 运行jar包
+20 -1
View File
@@ -74,9 +74,14 @@
<artifactId>mhd-common-redis</artifactId>
</dependency>
<!-- Mysql Connector -->
<dependency>
<!--<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>-->
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
<version>8.1.1.193</version>
</dependency>
<!--添加druid连接池 依赖 -->
<dependency>
@@ -144,4 +149,18 @@
</plugins>
</build>
<profiles>
<profile>
<id>mhd_product</id>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
@@ -0,0 +1,57 @@
package com.linke.product.domain.config;
import com.linke.product.domain.util.CamelCaseUtils;
import org.apache.ibatis.executor.resultset.ResultSetHandler;
import org.apache.ibatis.plugin.*;
import org.springframework.stereotype.Component;
import java.sql.Statement;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/**
* MyBatis插件:拦截Map类型结果,转换Key为驼峰
*/
@Intercepts({@Signature(
type = ResultSetHandler.class,
method = "handleResultSets",
args = {Statement.class}
)})
@Component
public class CamelCaseMapPlugin implements Interceptor {
@Override
public Object intercept(Invocation invocation) throws Throwable {
// 执行原方法获取结果
Object result = invocation.proceed();
// 处理结果:如果是List且元素是Map,转换Key
if (result instanceof List<?>) {
List<Map<String, Object>> list = (List<Map<String, Object>>) result;
for (int i = 0; i < list.size(); i++) {
Object item = list.get(i);
if (item instanceof Map<?, ?>) {
@SuppressWarnings("unchecked")
Map<String, Object> map = (Map<String, Object>) item;
// 转换Key为驼峰
list.set(i, CamelCaseUtils.convertMapKeyToCamel(map));
}
}
}
return result;
}
@Override
public Object plugin(Object target) {
// 只拦截ResultSetHandler类型
if (target instanceof ResultSetHandler) {
return Plugin.wrap(target, this);
}
return target;
}
@Override
public void setProperties(Properties properties) {
// 可配置参数,此处无需处理
}
}
@@ -152,6 +152,6 @@ public interface MenuMapper extends BaseMapper<Menu> {
List<Menu> selectListByProductIdList(@Param("list") List<Long> list);
@Select("SELECT * FROM `custom_auth` WHERE menu_id in (SELECT menu_id FROM sys_menu WHERE top_organization_id = #{organizationId})")
@Select("SELECT * FROM custom_auth WHERE menu_id in (SELECT menu_id FROM sys_menu WHERE top_organization_id = #{organizationId})")
List<CustomAuth> getCustomAuthByOrganizationId(@Param("organizationId") Long organizationId);
}
@@ -0,0 +1,54 @@
package com.linke.product.domain.util;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* 字符串工具类扩展:下划线/大写转驼峰
*/
public class CamelCaseUtils {
/**
* 大写下划线转驼峰(如:USER_NAME → userName
*/
public static String toCamelCase(String str) {
if (StringUtils.isBlank(str)) {
return str;
}
// 先转小写,再处理下划线
str = str.toLowerCase();
StringBuilder sb = new StringBuilder();
boolean nextUpperCase = false;
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (c == '_') {
nextUpperCase = true;
} else {
if (nextUpperCase) {
sb.append(Character.toUpperCase(c));
nextUpperCase = false;
} else {
sb.append(c);
}
}
}
return sb.toString();
}
/**
* 批量转换Map的Key为驼峰
*/
public static <V> Map<String, V> convertMapKeyToCamel(Map<String, V> map) {
if (map == null || map.isEmpty()) {
return map;
}
Map<String, V> newMap = new HashMap<>(map.size());
for (Map.Entry<String, V> entry : map.entrySet()) {
String camelKey = toCamelCase(entry.getKey());
newMap.put(camelKey, entry.getValue());
}
return newMap;
}
}
+4 -4
View File
@@ -18,13 +18,13 @@ spring:
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
# server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号
#server-addr: mhd-nacos:8848
server-addr: 10.33.0.129:6010
config:
server-addr: 127.0.0.1:8848
# server-addr: 127.0.0.1:8848
# 线上测试环境配置 容器名+端口号
#server-addr: mhd-nacos:8848
server-addr: 10.33.0.129:6010
group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使用默认分组可以不配置
file-extension: yml #默认properties
# 共享配置
@@ -52,7 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select
a.app_menu_id, a.app_id, me.modules_id
from app_menu a
left join `sys_menu` me ON me.menu_id = a.menu_id
left join sys_menu me ON me.menu_id = a.menu_id
where
a.del_Flag = 1
and me.del_Flag = 1
@@ -91,8 +91,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
me.menu_show,
me.menu_perms
from app_menu a
left join `app_config` co ON co.app_id = a.app_id
left join `sys_menu` me ON me.menu_id = a.menu_id
left join app_config co ON co.app_id = a.app_id
left join sys_menu me ON me.menu_id = a.menu_id
where
a.del_flag = 1
and me.del_flag = 1
@@ -81,7 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
me.menu_show,
me.menu_perms
from app_user_menu_settings a
left join `sys_menu` me ON me.menu_id = a.menu_id
left join sys_menu me ON me.menu_id = a.menu_id
where
a.del_flag = 1
and me.del_flag = 1
@@ -31,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update_by,
del_flag
FROM
`custom_auth_organization`
custom_auth_organization
</sql>
<select id="selectCustomAuthByOrganization" parameterType="com.linke.product.domain.customAuth.entity.CustomAuthOrganization" resultMap="CustomAuthOrganizationResult">
@@ -76,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
me.top_organization_id,
me.home_show_flag
FROM
`sys_menu` me
sys_menu me
LEFT JOIN
sys_modules mo
ON me.modules_id = mo.modules_id
@@ -168,7 +168,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
me.menu_remark,
me.menu_perms
FROM
`sys_menu` me
sys_menu me
LEFT JOIN
sys_modules mo
ON me.modules_id = mo.modules_id
@@ -231,7 +231,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
sys_tenants t
LEFT JOIN
`tenants_menu` tm
tenants_menu tm
ON t.tenants_id = tm.tenants_id
INNER JOIN
sys_menu m
@@ -258,7 +258,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
om.organization_id,
m.modules_id
FROM
`organization_menu` om
organization_menu om
LEFT JOIN
sys_menu m
ON om.menu_id = m.menu_id
@@ -273,15 +273,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMenuComponent" resultType="java.util.HashMap">
SELECT
menu_component AS menuComponent,
menu_redirect_path AS menuRedirectPath
menu_component,
menu_redirect_path
FROM
`sys_menu`
sys_menu
where
del_flag = 1
and menu_show = 1
AND menu_component IS NOT NULL
AND menu_component != ""
AND menu_component != ''
</select>
<select id="selectMenuById" parameterType="java.lang.Long" resultMap="MenuResult">
@@ -303,7 +303,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
DISTINCT modules_id
FROM
`sys_menu`
sys_menu
WHERE
del_flag = 1
AND menu_id in
@@ -317,9 +317,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
m.menu_id
FROM
`sys_menu` m
sys_menu m
LEFT JOIN
`sys_menu` mp
sys_menu mp
ON m.parent_menu_id = mp.menu_id
LEFT JOIN
sys_modules mo
@@ -341,7 +341,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
menu_id
FROM
`sys_menu`
sys_menu
WHERE
del_flag = 1
and menu_show = 1
@@ -352,7 +352,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
DISTINCT parent_menu_id
FROM
`sys_menu`
sys_menu
WHERE
parent_menu_id != 0
AND menu_id in
@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update_by,
del_flag
FROM
`modules_menu`
modules_menu
</sql>
<select id="selectMenuListByModulesId" parameterType="java.lang.Long" resultMap="ModulesMenuResult">
@@ -96,9 +96,9 @@
o1.interbank_number,
o1.template_seal
FROM
`sys_organization` o1
sys_organization o1
LEFT JOIN
`sys_organization` o2
sys_organization o2
ON o1.parent_organization_id = o2.organization_id
</sql>
@@ -120,7 +120,7 @@
</foreach>
</if>
<if test=" isCorrelation != null and isCorrelation == 1 and organizationId != null ">
AND o1.organization_id NOT IN ( SELECT organization_id FROM `sys_organization_correlation` WHERE organization_id = #{organizationId} )
AND o1.organization_id NOT IN ( SELECT organization_id FROM sys_organization_correlation WHERE organization_id = #{organizationId} )
</if>
order by o1.create_time desc
</select>
@@ -134,7 +134,7 @@
SELECT
organization_id
FROM
`sys_organization`
sys_organization
where tenants_id = #{value} and del_flag = 1
and organization_state = 1
</select>
@@ -148,9 +148,9 @@
b.tenants_simple_name,
b.user_id
FROM
`sys_organization` a
LEFT JOIN `sys_tenants` b ON a.tenants_id = b.tenants_id AND b.del_flag = 1
LEFT JOIN `tenants_domain_name` c ON b.tenants_id = c.tenants_id AND c.del_flag = 1
sys_organization a
LEFT JOIN sys_tenants b ON a.tenants_id = b.tenants_id AND b.del_flag = 1
LEFT JOIN tenants_domain_name c ON b.tenants_id = c.tenants_id AND c.del_flag = 1
WHERE
a.del_flag = 1
AND (b.tenants_domain_name = #{value}
@@ -216,7 +216,7 @@
SELECT
organization_id
FROM
`sys_organization`
sys_organization
where
del_flag = 1
</select>
@@ -225,7 +225,7 @@
SELECT
organization_id
FROM
`sys_organization`
sys_organization
where
del_flag = 1
AND parent_organization_id in
@@ -234,43 +234,66 @@
</foreach>
</select>
<select id="selectChildByOrganization" resultType="java.lang.Long">
select organization_id from (
select
t1.organization_id,
if(find_in_set(parent_organization_id, @pids) > 0, @pids := concat(@pids, ',', organization_id), 0) as ischild
from (
select
organization_id,
parent_organization_id
from sys_organization t order by parent_organization_id, organization_id
) t1,
(select @pids := #{id}) t2
) t3 where ischild != 0 OR organization_id = #{id}
order by organization_id
<!--达梦适配修改-->
<!--select organization_id from (-->
<!-- select-->
<!-- t1.organization_id,-->
<!-- if(find_in_set(parent_organization_id, @pids) > 0, @pids := concat(@pids, ',', organization_id), 0) as ischild-->
<!-- from (-->
<!-- select-->
<!-- organization_id,-->
<!-- parent_organization_id-->
<!-- from sys_organization t order by parent_organization_id, organization_id-->
<!-- ) t1,-->
<!-- (select @pids := #{id}) t2-->
<!--) t3 where ischild != 0 OR organization_id = #{id}-->
<!--order by organization_id-->
SELECT organization_id
FROM sys_organization
WHERE organization_id = #{id}
UNION
SELECT organization_id
FROM sys_organization
START WITH organization_id = #{id}
CONNECT BY PRIOR organization_id = parent_organization_id
ORDER BY organization_id;
</select>
<select id="selectAllOrganizationById" resultType="java.lang.Long" parameterType="java.lang.Long">
SELECT
organization_id
FROM
(
SELECT
t1.organization_id,
t1.organization_name,
t1.parent_organization_id,
IF
(
find_in_set( parent_organization_id, @pids ) > 0,
@pids := concat( @pids, ',', organization_id ),
IF
( t1.organization_id = #{organizationId}, #{organizationId}, - 1 )
) AS ischild
FROM
( SELECT organization_id, parent_organization_id, organization_name FROM sys_organization t ) t1,
( SELECT @pids := #{organizationId} ) t2
) t3
WHERE
ischild != - 1
<!-- SELECT-->
<!-- organization_id-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- t1.organization_id,-->
<!-- t1.organization_name,-->
<!-- t1.parent_organization_id,-->
<!-- IF-->
<!-- (-->
<!-- find_in_set( parent_organization_id, @pids ) > 0,-->
<!-- @pids := concat( @pids, ',', organization_id ),-->
<!-- IF-->
<!-- ( t1.organization_id = #{organizationId}, #{organizationId}, - 1 )-->
<!-- ) AS ischild-->
<!-- FROM-->
<!-- ( SELECT organization_id, parent_organization_id, organization_name FROM sys_organization t ) t1,-->
<!-- ( SELECT @pids := #{organizationId} ) t2-->
<!-- ) t3-->
<!--WHERE-->
<!--ischild != - 1-->
WITH RECURSIVE org_tree(org_id) AS (
-- 初始查询:找到指定组织
SELECT organization_id
FROM sys_organization
WHERE organization_id = #{organizationId}
UNION ALL
-- 递归查询:找到所有子组织
SELECT child.organization_id
FROM sys_organization child
INNER JOIN org_tree parent
ON child.parent_organization_id = parent.org_id
)
SELECT org_id AS organization_id FROM org_tree;
</select>
<select id="getAllOrganization"
resultType="com.linke.product.domain.organization.repository.po.OrganizationPo">
@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update_by,
del_flag
FROM
`organization_menu`
organization_menu
</sql>
<select id="selectMenuListByOrganizationId" parameterType="java.lang.Long" resultMap="OrganizationMenuResult">
@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
spd.update_by,
spd.del_flag
FROM
`sys_product_details` spd
sys_product_details spd
LEFT JOIN sys_modules sm ON spd.modules_id = sm.modules_id
AND sm.del_flag = 1
</sql>
@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update_by,
del_flag
FROM
`product_menu`
product_menu
</sql>
<select id="selectMenuListByProductId" parameterType="java.lang.Long" resultMap="ProductMenuResult">
@@ -52,8 +52,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN
(SELECT
p.product_id,
GROUP_CONCAT(m.modules_name) as modules_names,
GROUP_CONCAT(m.modules_id) as modules_ids
WM_CONCAT(m.modules_name) as modules_names,
WM_CONCAT(m.modules_id) as modules_ids
FROM
sys_product p
LEFT JOIN
@@ -68,8 +68,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN (
SELECT
p.product_id AS app_product_id,
GROUP_CONCAT( m.modules_name ) AS app_modules_names,
GROUP_CONCAT( m.modules_id ) AS app_modules_ids
WM_CONCAT( m.modules_name ) AS app_modules_names,
WM_CONCAT( m.modules_id ) AS app_modules_ids
FROM
sys_product p
LEFT JOIN sys_product_details d ON p.product_id = d.product_id
@@ -127,7 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
DISTINCT m.menu_id
FROM
`sys_product` p
sys_product p
LEFT JOIN
sys_product_details d
ON p.product_id = d.product_id
@@ -223,7 +223,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
p.product_home_name,
p.route_status
FROM
`sys_product` p
sys_product p
LEFT JOIN tenants_product tp ON tp.product_id = p.product_id
LEFT JOIN sys_organization o ON o.tenants_id = tp.tenants_id
WHERE
@@ -234,7 +234,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
a.product_id
FROM
`sys_product` a
sys_product a
LEFT JOIN sys_product_details b ON a.product_id = b.product_id
AND b.del_flag = 1
LEFT JOIN sys_menu c ON b.modules_id = c.modules_id
@@ -60,12 +60,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
sys_tenants t
LEFT JOIN
`sys_organization` o
sys_organization o
ON t.tenants_id = o.tenants_id AND o.parent_organization_id = 0
LEFT JOIN
(SELECT
t.tenants_id,
GROUP_CONCAT(p.product_name) as product_name
WM_CONCAT(p.product_name) as product_name
FROM
sys_tenants t
LEFT JOIN
@@ -99,7 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
p.product_id
FROM
`sys_tenants` t
sys_tenants t
LEFT JOIN
sys_organization o
ON t.tenants_id = o.tenants_id
@@ -113,7 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
o.organization_id = #{values} and t.del_flag = 1 and po.product_status = 1
</select>
<select id="selectByDomainName" resultType="com.linke.product.domain.tenants.entity.SysTenants">
SELECT * FROM `sys_tenants`
SELECT * FROM sys_tenants
where del_flag = 1
and tenants_domain_name = #{tenantsDomainName}
<if test="tenantsId != null and tenantsId != ''">
@@ -126,7 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.*,
c.organization_id
FROM
`tenants_domain_name` a
tenants_domain_name a
LEFT JOIN sys_tenants b ON a.tenants_id = b.tenants_id
LEFT JOIN sys_organization c ON b.tenants_id = c.tenants_id and c.organization_state =1
WHERE
@@ -187,7 +187,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteSysTenantsByTenantsId" parameterType="java.lang.Long">
UPDATE `sys_tenants` SET `del_flag` = 2 WHERE `tenants_id` = #{tenantsId}
UPDATE sys_tenants SET del_flag = 2 WHERE tenants_id = #{tenantsId}
</delete>
<delete id="deleteSysTenantsByTenantsIds" parameterType="java.lang.String">
@@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update_by,
del_flag
FROM
`tenants_menu`
tenants_menu
</sql>
<select id="selectMenuListByTenantsId" parameterType="java.lang.Long" resultMap="TenantsMenuResult">
@@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
p.product_icon,
p.product_photo
FROM
`tenants_product` p
tenants_product p
LEFT JOIN
sys_product po
ON po.product_id = p.product_id