Explorar el Código

1、新增红包商户配置

yys hace 1 semana
padre
commit
62beb8f6c9

+ 111 - 0
fs-admin/src/main/java/com/fs/company/controller/SysRedpacketConfigMoreController.java

@@ -0,0 +1,111 @@
+package com.fs.company.controller;
+
+
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.his.domain.SysRedpacketConfigMore;
+import com.fs.his.param.updateChangeMchIdParam;
+import com.fs.his.service.ISysRedpacketConfigMoreService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 多商户配置Controller
+ *
+ * @author fs
+ * @date 2025-11-27
+ */
+@RestController
+@RequestMapping("/redPacket/more")
+public class SysRedpacketConfigMoreController extends BaseController
+{
+    @Autowired
+    private ISysRedpacketConfigMoreService sysRedpacketConfigMoreService;
+
+    /**
+     * 查询多商户配置列表
+     */
+    @PreAuthorize("@ss.hasPermi('redPacket:more:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(SysRedpacketConfigMore sysRedpacketConfigMore)
+    {
+        startPage();
+        List<SysRedpacketConfigMore> list = sysRedpacketConfigMoreService.selectSysRedpacketConfigMoreList(sysRedpacketConfigMore);
+        return getDataTable(list);
+    }
+
+
+    /**
+     * 获取多商户配置详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('redPacket:more:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(sysRedpacketConfigMoreService.selectSysRedpacketConfigMoreById(id));
+    }
+
+    /**
+     * 获取当前发红包的商户号
+     */
+    @PreAuthorize("@ss.hasPermi('redPacket:more:editConfig')")
+    @GetMapping(value = "/getRedPacketConfig")
+    public AjaxResult getRedPacketConFig()
+    {
+        return AjaxResult.success(sysRedpacketConfigMoreService.getRedPacketConFig());
+    }
+
+
+
+
+    /**
+     * 新增多商户配置
+     */
+    @PreAuthorize("@ss.hasPermi('redPacket:more:add')")
+    @Log(title = "多商户配置", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody SysRedpacketConfigMore sysRedpacketConfigMore)
+    {
+        return toAjax(sysRedpacketConfigMoreService.insertSysRedpacketConfigMore(sysRedpacketConfigMore));
+    }
+
+    /**
+     * 修改发商户号的商户
+     */
+    @Log(title = "修改发商户号的商户", businessType = BusinessType.UPDATE)
+    @PostMapping("/updateChangeMchId")
+    public R updateChangeMchId(@RequestBody updateChangeMchIdParam param)
+    {
+        return sysRedpacketConfigMoreService.updateChangeMchId(param);
+    }
+
+    /**
+     * 修改多商户配置
+     */
+    @PreAuthorize("@ss.hasPermi('redPacket:more:edit')")
+    @Log(title = "多商户配置", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody SysRedpacketConfigMore sysRedpacketConfigMore)
+    {
+        return toAjax(sysRedpacketConfigMoreService.updateSysRedpacketConfigMore(sysRedpacketConfigMore));
+    }
+
+    /**
+     * 删除多商户配置
+     */
+    @PreAuthorize("@ss.hasPermi('redPacket:more:remove')")
+    @Log(title = "多商户配置", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(sysRedpacketConfigMoreService.deleteSysRedpacketConfigMoreByIds(ids));
+    }
+}

+ 75 - 0
fs-service/src/main/java/com/fs/his/domain/SysRedpacketConfigMore.java

@@ -0,0 +1,75 @@
+package com.fs.his.domain;
+
+
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 多商户配置对象 sys_redpacket_config_more
+ *
+ * @author fs
+ * @date 2025-11-27
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class SysRedpacketConfigMore  {
+
+    /** $column.columnComment */
+    private Long id;
+
+    /** 0:老商户 商家转账到零钱 1:新商户 商家转账 */
+    @Excel(name = "0:老商户 商家转账到零钱 1:新商户 商家转账")
+    private Integer isNew;
+
+    /** 公众号appId */
+    @Excel(name = "公众号appId")
+    private String appId;
+
+    /** 小程序appId */
+    @Excel(name = "小程序appId")
+    private String miniappId;
+
+    /** 商户号 */
+    @Excel(name = "商户号")
+    private String mchId;
+
+    /** 商户密钥 */
+    @Excel(name = "商户密钥")
+    private String mchKey;
+
+    /** p12证书文件的绝对路径或者以classpath:开头的类路径. */
+    @Excel(name = "p12证书文件的绝对路径或者以classpath:开头的类路径.")
+    private String keyPath;
+
+    /** apiclient_key.pem证书文件的绝对路径或者以classpath:开头的类路径. */
+    @Excel(name = "apiclient_key.pem证书文件的绝对路径或者以classpath:开头的类路径.")
+    private String privateKeyPath;
+
+    /** apiclient_cert.pem证书文件的绝对路径或者以classpath:开头的类路径. */
+    @Excel(name = "apiclient_cert.pem证书文件的绝对路径或者以classpath:开头的类路径.")
+    private String privateCertPath;
+
+    /** apiV3 秘钥值. */
+    @Excel(name = "apiV3 秘钥值.")
+    private String apiV3Key;
+
+    /** 公钥ID */
+    @Excel(name = "公钥ID")
+    private String publicKeyId;
+
+    /** pub_key.pem证书文件的绝对路径或者以classpath:开头的类路径. */
+    @Excel(name = "pub_key.pem证书文件的绝对路径或者以classpath:开头的类路径.")
+    private String publicKeyPath;
+
+    /** 回调地址 */
+    @Excel(name = "回调地址")
+    private String notifyUrl;
+
+    /** $column.columnComment */
+    @Excel(name = "回调地址")
+    private String notifyUrlScrm;
+
+
+}

+ 63 - 0
fs-service/src/main/java/com/fs/his/mapper/SysRedpacketConfigMoreMapper.java

@@ -0,0 +1,63 @@
+package com.fs.his.mapper;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.his.domain.SysRedpacketConfigMore;
+
+import java.util.List;
+
+/**
+ * 多商户配置Mapper接口
+ *
+ * @author fs
+ * @date 2025-11-27
+ */
+public interface SysRedpacketConfigMoreMapper extends BaseMapper<SysRedpacketConfigMore> {
+    /**
+     * 查询多商户配置
+     *
+     * @param id 多商户配置主键
+     * @return 多商户配置
+     */
+    SysRedpacketConfigMore selectSysRedpacketConfigMoreById(Long id);
+
+    /**
+     * 查询多商户配置列表
+     *
+     * @param sysRedpacketConfigMore 多商户配置
+     * @return 多商户配置集合
+     */
+    List<SysRedpacketConfigMore> selectSysRedpacketConfigMoreList(SysRedpacketConfigMore sysRedpacketConfigMore);
+
+    /**
+     * 新增多商户配置
+     *
+     * @param sysRedpacketConfigMore 多商户配置
+     * @return 结果
+     */
+    int insertSysRedpacketConfigMore(SysRedpacketConfigMore sysRedpacketConfigMore);
+
+    /**
+     * 修改多商户配置
+     *
+     * @param sysRedpacketConfigMore 多商户配置
+     * @return 结果
+     */
+    int updateSysRedpacketConfigMore(SysRedpacketConfigMore sysRedpacketConfigMore);
+
+    /**
+     * 删除多商户配置
+     *
+     * @param id 多商户配置主键
+     * @return 结果
+     */
+    int deleteSysRedpacketConfigMoreById(Long id);
+
+    /**
+     * 批量删除多商户配置
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteSysRedpacketConfigMoreByIds(Long[] ids);
+}

+ 9 - 0
fs-service/src/main/java/com/fs/his/param/updateChangeMchIdParam.java

@@ -0,0 +1,9 @@
+package com.fs.his.param;
+
+import lombok.Data;
+
+@Data
+public class updateChangeMchIdParam {
+    private Long oldChangeMchId;
+    private Long newChangeMchId;
+}

+ 69 - 0
fs-service/src/main/java/com/fs/his/service/ISysRedpacketConfigMoreService.java

@@ -0,0 +1,69 @@
+package com.fs.his.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.common.core.domain.R;
+import com.fs.his.domain.SysRedpacketConfigMore;
+import com.fs.his.param.updateChangeMchIdParam;
+
+import java.util.List;
+
+/**
+ * 多商户配置Service接口
+ *
+ * @author fs
+ * @date 2025-11-27
+ */
+public interface ISysRedpacketConfigMoreService extends IService<SysRedpacketConfigMore> {
+    /**
+     * 查询多商户配置
+     *
+     * @param id 多商户配置主键
+     * @return 多商户配置
+     */
+    SysRedpacketConfigMore selectSysRedpacketConfigMoreById(Long id);
+    Long getRedPacketConFig();
+    R updateChangeMchId(updateChangeMchIdParam param);
+    void changeRedPacketConfig();
+
+
+    /**
+     * 查询多商户配置列表
+     *
+     * @param sysRedpacketConfigMore 多商户配置
+     * @return 多商户配置集合
+     */
+    List<SysRedpacketConfigMore> selectSysRedpacketConfigMoreList(SysRedpacketConfigMore sysRedpacketConfigMore);
+
+    /**
+     * 新增多商户配置
+     *
+     * @param sysRedpacketConfigMore 多商户配置
+     * @return 结果
+     */
+    int insertSysRedpacketConfigMore(SysRedpacketConfigMore sysRedpacketConfigMore);
+
+    /**
+     * 修改多商户配置
+     *
+     * @param sysRedpacketConfigMore 多商户配置
+     * @return 结果
+     */
+    int updateSysRedpacketConfigMore(SysRedpacketConfigMore sysRedpacketConfigMore);
+
+    /**
+     * 批量删除多商户配置
+     *
+     * @param ids 需要删除的多商户配置主键集合
+     * @return 结果
+     */
+    int deleteSysRedpacketConfigMoreByIds(Long[] ids);
+
+    /**
+     * 删除多商户配置信息
+     *
+     * @param id 多商户配置主键
+     * @return 结果
+     */
+    int deleteSysRedpacketConfigMoreById(Long id);
+}

+ 209 - 0
fs-service/src/main/java/com/fs/his/service/impl/SysRedpacketConfigMoreServiceImpl.java

@@ -0,0 +1,209 @@
+package com.fs.his.service.impl;
+
+
+import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fs.common.BeanCopyUtils;
+import com.fs.common.core.domain.R;
+import com.fs.common.core.redis.RedisCache;
+import com.fs.common.utils.StringUtils;
+import com.fs.course.config.RedPacketConfig;
+import com.fs.his.domain.SysRedpacketConfigMore;
+import com.fs.his.mapper.SysRedpacketConfigMoreMapper;
+import com.fs.his.param.updateChangeMchIdParam;
+import com.fs.his.service.ISysRedpacketConfigMoreService;
+import com.fs.system.service.ISysConfigService;
+import io.netty.util.internal.StringUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Comparator;
+import java.util.List;
+import java.util.OptionalInt;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+/**
+ * 多商户配置Service业务层处理
+ *
+ * @author fs
+ * @date 2025-11-27
+ */
+@Slf4j
+@Service
+public class SysRedpacketConfigMoreServiceImpl extends ServiceImpl<SysRedpacketConfigMoreMapper, SysRedpacketConfigMore> implements ISysRedpacketConfigMoreService {
+
+
+    @Autowired
+    private ISysConfigService configService;
+
+    @Autowired
+    private RedisCache redisCache;
+
+    /**
+     * 查询多商户配置
+     *
+     * @param id 多商户配置主键
+     * @return 多商户配置
+     */
+    @Override
+    public SysRedpacketConfigMore selectSysRedpacketConfigMoreById(Long id)
+    {
+        return baseMapper.selectSysRedpacketConfigMoreById(id);
+    }
+
+    @Override
+    public Long getRedPacketConFig() {
+
+        String json = redisCache.getCacheObject("sys_config:redPacket.config.new");
+        if (StringUtil.isNullOrEmpty(json) || json.isEmpty()) {
+            json = configService.selectConfigByKey("redPacket.config");
+        }
+
+        RedPacketConfig config   = JSONUtil.toBean(json, RedPacketConfig.class);
+
+        return Long.valueOf(config.getMchId());
+
+    }
+
+    @Override
+    public R updateChangeMchId(updateChangeMchIdParam param) {
+
+        SysRedpacketConfigMore configMore = baseMapper.selectOne(new QueryWrapper<SysRedpacketConfigMore>().eq("mch_id", param.getNewChangeMchId()));
+
+        if (configMore == null || configMore.getMchId() == null) {
+            return R.error("商户号不存在");
+        }
+
+        RedPacketConfig config = new RedPacketConfig();
+        BeanCopyUtils.copy(configMore,config);
+
+        if (config.getMchId()!=null){
+            redisCache.setCacheObject("sys_config:redPacket.config.new", JSONUtil.toJsonStr(config));
+            redisCache.deleteObject("sys_config:redPacket.config.newCount");
+        }
+
+        return R.ok();
+    }
+
+    @Override
+    public void changeRedPacketConfig() {
+        Integer count = redisCache.getCacheObject("sys_config:redPacket.config.newCount");
+        if (count >= 1000) {
+            String json = redisCache.getCacheObject("sys_config:redPacket.config.new");
+            if (StringUtil.isNullOrEmpty(json) || json.isEmpty()) {
+                json = configService.selectConfigByKey("redPacket.config");
+            }
+
+            RedPacketConfig config   = JSONUtil.toBean(json, RedPacketConfig.class);
+
+            SysRedpacketConfigMore configMore = baseMapper.selectOne(new QueryWrapper<SysRedpacketConfigMore>().eq("mch_id", config.getMchId()));
+
+            if (configMore == null) {
+                log.error("获取不到商户号");
+                return;
+            }
+
+            List<SysRedpacketConfigMore> configMoreList = baseMapper.selectList(
+                    new QueryWrapper<SysRedpacketConfigMore>().orderByAsc("id")
+            );
+
+            // 空列表处理
+            if (configMoreList.isEmpty()) {
+                log.error("商户号列表为空");
+            }
+
+
+            // 查找当前元素的索引
+            int currentIndex = -1;
+            Long currentId = configMore != null ? configMore.getId() : null;
+
+            for (int i = 0; i < configMoreList.size(); i++) {
+                if (configMoreList.get(i).getId().equals(currentId)) {
+                    currentIndex = i;
+                    break;
+                }
+            }
+
+            // 计算下一个索引(使用取模实现循环)
+            int nextIndex = (currentIndex + 1) % configMoreList.size();
+
+            SysRedpacketConfigMore configMoreNew = configMoreList.get(nextIndex);
+
+
+            RedPacketConfig configNew = new RedPacketConfig();
+            BeanCopyUtils.copy(configMoreNew,configNew);
+
+            if (configNew.getMchId()!=null){
+                log.info("自动切换商户号-原:"+configMore.getMchId()+"-新:"+configNew.getMchId());
+                redisCache.setCacheObject("sys_config:redPacket.config.new", JSONUtil.toJsonStr(configNew));
+                redisCache.deleteObject("sys_config:redPacket.config.newCount");
+            }
+        }
+    }
+
+
+
+
+    /**
+     * 查询多商户配置列表
+     *
+     * @param sysRedpacketConfigMore 多商户配置
+     * @return 多商户配置
+     */
+    @Override
+    public List<SysRedpacketConfigMore> selectSysRedpacketConfigMoreList(SysRedpacketConfigMore sysRedpacketConfigMore)
+    {
+        return baseMapper.selectSysRedpacketConfigMoreList(sysRedpacketConfigMore);
+    }
+
+    /**
+     * 新增多商户配置
+     *
+     * @param sysRedpacketConfigMore 多商户配置
+     * @return 结果
+     */
+    @Override
+    public int insertSysRedpacketConfigMore(SysRedpacketConfigMore sysRedpacketConfigMore)
+    {
+        return baseMapper.insertSysRedpacketConfigMore(sysRedpacketConfigMore);
+    }
+
+    /**
+     * 修改多商户配置
+     *
+     * @param sysRedpacketConfigMore 多商户配置
+     * @return 结果
+     */
+    @Override
+    public int updateSysRedpacketConfigMore(SysRedpacketConfigMore sysRedpacketConfigMore)
+    {
+        return baseMapper.updateSysRedpacketConfigMore(sysRedpacketConfigMore);
+    }
+
+    /**
+     * 批量删除多商户配置
+     *
+     * @param ids 需要删除的多商户配置主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysRedpacketConfigMoreByIds(Long[] ids)
+    {
+        return baseMapper.deleteSysRedpacketConfigMoreByIds(ids);
+    }
+
+    /**
+     * 删除多商户配置信息
+     *
+     * @param id 多商户配置主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysRedpacketConfigMoreById(Long id)
+    {
+        return baseMapper.deleteSysRedpacketConfigMoreById(id);
+    }
+}

+ 118 - 0
fs-service/src/main/resources/mapper/his/SysRedpacketConfigMoreMapper.xml

@@ -0,0 +1,118 @@
+<?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.SysRedpacketConfigMoreMapper">
+
+    <resultMap type="SysRedpacketConfigMore" id="SysRedpacketConfigMoreResult">
+        <result property="id"    column="id"    />
+        <result property="isNew"    column="is_new"    />
+        <result property="appId"    column="app_id"    />
+        <result property="miniappId"    column="miniapp_id"    />
+        <result property="mchId"    column="mch_id"    />
+        <result property="mchKey"    column="mch_key"    />
+        <result property="keyPath"    column="key_path"    />
+        <result property="privateKeyPath"    column="private_key_path"    />
+        <result property="privateCertPath"    column="private_cert_path"    />
+        <result property="apiV3Key"    column="api_v3_key"    />
+        <result property="publicKeyId"    column="public_key_id"    />
+        <result property="publicKeyPath"    column="public_key_path"    />
+        <result property="notifyUrl"    column="notify_url"    />
+        <result property="notifyUrlScrm"    column="notify_url_scrm"    />
+    </resultMap>
+
+    <sql id="selectSysRedpacketConfigMoreVo">
+        select id, is_new, app_id, miniapp_id, mch_id, mch_key, key_path, private_key_path, private_cert_path, api_v3_key, public_key_id, public_key_path, notify_url, notify_url_scrm from sys_redpacket_config_more
+    </sql>
+
+    <select id="selectSysRedpacketConfigMoreList" parameterType="SysRedpacketConfigMore" resultMap="SysRedpacketConfigMoreResult">
+        <include refid="selectSysRedpacketConfigMoreVo"/>
+        <where>
+            <if test="isNew != null "> and is_new = #{isNew}</if>
+            <if test="appId != null  and appId != ''"> and app_id = #{appId}</if>
+            <if test="miniappId != null  and miniappId != ''"> and miniapp_id = #{miniappId}</if>
+            <if test="mchId != null  and mchId != ''"> and mch_id = #{mchId}</if>
+            <if test="mchKey != null  and mchKey != ''"> and mch_key = #{mchKey}</if>
+            <if test="keyPath != null  and keyPath != ''"> and key_path = #{keyPath}</if>
+            <if test="privateKeyPath != null  and privateKeyPath != ''"> and private_key_path = #{privateKeyPath}</if>
+            <if test="privateCertPath != null  and privateCertPath != ''"> and private_cert_path = #{privateCertPath}</if>
+            <if test="apiV3Key != null  and apiV3Key != ''"> and api_v3_key = #{apiV3Key}</if>
+            <if test="publicKeyId != null  and publicKeyId != ''"> and public_key_id = #{publicKeyId}</if>
+            <if test="publicKeyPath != null  and publicKeyPath != ''"> and public_key_path = #{publicKeyPath}</if>
+            <if test="notifyUrl != null  and notifyUrl != ''"> and notify_url = #{notifyUrl}</if>
+            <if test="notifyUrlScrm != null  and notifyUrlScrm != ''"> and notify_url_scrm = #{notifyUrlScrm}</if>
+        </where>
+    </select>
+
+    <select id="selectSysRedpacketConfigMoreById" parameterType="Long" resultMap="SysRedpacketConfigMoreResult">
+        <include refid="selectSysRedpacketConfigMoreVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertSysRedpacketConfigMore" parameterType="SysRedpacketConfigMore">
+        insert into sys_redpacket_config_more
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="isNew != null">is_new,</if>
+            <if test="appId != null">app_id,</if>
+            <if test="miniappId != null">miniapp_id,</if>
+            <if test="mchId != null">mch_id,</if>
+            <if test="mchKey != null">mch_key,</if>
+            <if test="keyPath != null">key_path,</if>
+            <if test="privateKeyPath != null">private_key_path,</if>
+            <if test="privateCertPath != null">private_cert_path,</if>
+            <if test="apiV3Key != null">api_v3_key,</if>
+            <if test="publicKeyId != null">public_key_id,</if>
+            <if test="publicKeyPath != null">public_key_path,</if>
+            <if test="notifyUrl != null">notify_url,</if>
+            <if test="notifyUrlScrm != null">notify_url_scrm,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="isNew != null">#{isNew},</if>
+            <if test="appId != null">#{appId},</if>
+            <if test="miniappId != null">#{miniappId},</if>
+            <if test="mchId != null">#{mchId},</if>
+            <if test="mchKey != null">#{mchKey},</if>
+            <if test="keyPath != null">#{keyPath},</if>
+            <if test="privateKeyPath != null">#{privateKeyPath},</if>
+            <if test="privateCertPath != null">#{privateCertPath},</if>
+            <if test="apiV3Key != null">#{apiV3Key},</if>
+            <if test="publicKeyId != null">#{publicKeyId},</if>
+            <if test="publicKeyPath != null">#{publicKeyPath},</if>
+            <if test="notifyUrl != null">#{notifyUrl},</if>
+            <if test="notifyUrlScrm != null">#{notifyUrlScrm},</if>
+         </trim>
+    </insert>
+
+    <update id="updateSysRedpacketConfigMore" parameterType="SysRedpacketConfigMore">
+        update sys_redpacket_config_more
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="isNew != null">is_new = #{isNew},</if>
+            <if test="appId != null">app_id = #{appId},</if>
+            <if test="miniappId != null">miniapp_id = #{miniappId},</if>
+            <if test="mchId != null">mch_id = #{mchId},</if>
+            <if test="mchKey != null">mch_key = #{mchKey},</if>
+            <if test="keyPath != null">key_path = #{keyPath},</if>
+            <if test="privateKeyPath != null">private_key_path = #{privateKeyPath},</if>
+            <if test="privateCertPath != null">private_cert_path = #{privateCertPath},</if>
+            <if test="apiV3Key != null">api_v3_key = #{apiV3Key},</if>
+            <if test="publicKeyId != null">public_key_id = #{publicKeyId},</if>
+            <if test="publicKeyPath != null">public_key_path = #{publicKeyPath},</if>
+            <if test="notifyUrl != null">notify_url = #{notifyUrl},</if>
+            <if test="notifyUrlScrm != null">notify_url_scrm = #{notifyUrlScrm},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteSysRedpacketConfigMoreById" parameterType="Long">
+        delete from sys_redpacket_config_more where id = #{id}
+    </delete>
+
+    <delete id="deleteSysRedpacketConfigMoreByIds" parameterType="String">
+        delete from sys_redpacket_config_more where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>