|
|
@@ -15,10 +15,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="isDeleted" column="is_deleted" />
|
|
|
<result property="createdBy" column="created_by" />
|
|
|
<result property="updatedBy" column="updated_by" />
|
|
|
+ <result property="merchantId" column="merchant_id" />
|
|
|
</resultMap>
|
|
|
|
|
|
+ <!-- 检查表是否存在 -->
|
|
|
+ <select id="checkTableExists" resultType="java.lang.Integer">
|
|
|
+ SELECT COUNT(*) FROM information_schema.tables
|
|
|
+ WHERE table_schema = DATABASE() AND table_name = 'merchant_app_config'
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 创建商户配置表 -->
|
|
|
+ <update id="createMerchantAppConfigTable">
|
|
|
+ CREATE TABLE `merchant_app_config` (
|
|
|
+ `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
|
|
+ `merchant_type` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商户类型:如WECHAT_PAY、ALIPAY等',
|
|
|
+ `app_id` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '应用ID',
|
|
|
+ `callback_url` varchar(512) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '回调地址,用于接收支付结果等通知',
|
|
|
+ `data_json` json DEFAULT NULL COMMENT '扩展配置数据,JSON格式存储其他配置信息',
|
|
|
+ `created_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
|
+ `updated_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
|
+ `is_deleted` tinyint NOT NULL DEFAULT '0' COMMENT '删除状态:0-正常,1-已删除',
|
|
|
+ `created_by` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '创建人ID或用户名',
|
|
|
+ `updated_by` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '修改人ID或用户名',
|
|
|
+ `merchant_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '商户号',
|
|
|
+ PRIMARY KEY (`id`),
|
|
|
+ KEY `idx_merchant_type` (`merchant_type`),
|
|
|
+ KEY `idx_app_id` (`app_id`),
|
|
|
+ KEY `idx_created_time` (`created_time`),
|
|
|
+ KEY `merchant_app_config_merchant_type_IDX` (`merchant_type`,`is_deleted`,`merchant_id`) USING BTREE
|
|
|
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商户应用配置表'
|
|
|
+ </update>
|
|
|
+
|
|
|
+
|
|
|
<sql id="selectMerchantAppConfigVo">
|
|
|
- select id, merchant_type, app_id, callback_url, data_json, created_time, updated_time, is_deleted, created_by, updated_by from merchant_app_config
|
|
|
+ select id, merchant_type, app_id, merchant_id,callback_url, data_json, created_time, updated_time, is_deleted, created_by, updated_by from merchant_app_config
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectMerchantAppConfigList" parameterType="MerchantAppConfig" resultMap="MerchantAppConfigResult">
|
|
|
@@ -48,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="isDeleted != null">is_deleted,</if>
|
|
|
<if test="createdBy != null and createdBy != ''">created_by,</if>
|
|
|
<if test="updatedBy != null and updatedBy != ''">updated_by,</if>
|
|
|
+ <if test="merchantId != null and merchantId != ''">merchant_id,</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="merchantType != null and merchantType != ''">#{merchantType},</if>
|
|
|
@@ -59,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="isDeleted != null">#{isDeleted},</if>
|
|
|
<if test="createdBy != null and createdBy != ''">#{createdBy},</if>
|
|
|
<if test="updatedBy != null and updatedBy != ''">#{updatedBy},</if>
|
|
|
+ <if test="merchantId != null and merchantId != ''">#{merchantId},</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
|
@@ -74,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="isDeleted != null">is_deleted = #{isDeleted},</if>
|
|
|
<if test="createdBy != null and createdBy != ''">created_by = #{createdBy},</if>
|
|
|
<if test="updatedBy != null and updatedBy != ''">updated_by = #{updatedBy},</if>
|
|
|
+ <if test="merchantId != null and merchantId != ''">merchant_id = #{merchantId},</if>
|
|
|
</trim>
|
|
|
where id = #{id}
|
|
|
</update>
|