| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.fs.his.mapper.MerchantAppConfigMapper">
- <resultMap type="MerchantAppConfig" id="MerchantAppConfigResult">
- <result property="id" column="id" />
- <result property="merchantType" column="merchant_type" />
- <result property="appId" column="app_id" />
- <result property="callbackUrl" column="callback_url" />
- <result property="dataJson" column="data_json" />
- <result property="createdTime" column="created_time" />
- <result property="updatedTime" column="updated_time" />
- <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, 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">
- <include refid="selectMerchantAppConfigVo"/>
- <where>
- <if test="merchantId != null and merchantId != ''"> and merchant_id = #{merchantId}</if>
- <if test="merchantType != null and merchantType != ''"> and merchant_type = #{merchantType}</if>
- <if test="appId != null and appId != ''"> and app_id = #{appId}</if>
- <if test="params.beginCreatedTime != null and params.beginCreatedTime != '' and params.endCreatedTime != null and params.endCreatedTime != ''"> and created_time between #{params.beginCreatedTime} and #{params.endCreatedTime}</if>
- <if test="isDeleted != null "> and is_deleted = #{isDeleted}</if>
- </where>
- </select>
- <select id="selectMerchantAppConfigById" parameterType="Long" resultMap="MerchantAppConfigResult">
- <include refid="selectMerchantAppConfigVo"/>
- where id = #{id}
- </select>
- <insert id="insertMerchantAppConfig" parameterType="MerchantAppConfig" useGeneratedKeys="true" keyProperty="id">
- insert into merchant_app_config
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="merchantType != null and merchantType != ''">merchant_type,</if>
- <if test="appId != null and appId != ''">app_id,</if>
- <if test="callbackUrl != null">callback_url,</if>
- <if test="dataJson != null">data_json,</if>
- <if test="createdTime != null">created_time,</if>
- <if test="updatedTime != null">updated_time,</if>
- <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>
- <if test="appId != null and appId != ''">#{appId},</if>
- <if test="callbackUrl != null">#{callbackUrl},</if>
- <if test="dataJson != null">#{dataJson},</if>
- <if test="createdTime != null">#{createdTime},</if>
- <if test="updatedTime != null">#{updatedTime},</if>
- <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>
- <update id="updateMerchantAppConfig" parameterType="MerchantAppConfig">
- update merchant_app_config
- <trim prefix="SET" suffixOverrides=",">
- <if test="merchantType != null and merchantType != ''">merchant_type = #{merchantType},</if>
- <if test="appId != null and appId != ''">app_id = #{appId},</if>
- <if test="callbackUrl != null">callback_url = #{callbackUrl},</if>
- <if test="dataJson != null">data_json = #{dataJson},</if>
- <if test="createdTime != null">created_time = #{createdTime},</if>
- <if test="updatedTime != null">updated_time = #{updatedTime},</if>
- <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>
- <delete id="deleteMerchantAppConfigById" parameterType="Long">
- delete from merchant_app_config where id = #{id}
- </delete>
- <delete id="deleteMerchantAppConfigByIds" parameterType="String">
- delete from merchant_app_config where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|