diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/controller/SysConfigController.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/controller/SysConfigController.java new file mode 100644 index 0000000..21b4a15 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/controller/SysConfigController.java @@ -0,0 +1,141 @@ +package com.bonus.sgzb.base.controller; + +import com.bonus.sgzb.base.domain.MaConfig; +import com.bonus.sgzb.base.service.ISysConfigService; +import com.bonus.sgzb.common.core.utils.StringUtils; +import com.bonus.sgzb.common.core.utils.poi.ExcelUtil; +import com.bonus.sgzb.common.core.web.controller.BaseController; +import com.bonus.sgzb.common.core.web.domain.AjaxResult; +import com.bonus.sgzb.common.core.web.page.TableDataInfo; +import com.bonus.sgzb.common.log.annotation.Log; +import com.bonus.sgzb.common.log.enums.BusinessType; +import com.bonus.sgzb.common.security.annotation.RequiresPermissions; +import com.bonus.sgzb.common.security.utils.SecurityUtils; +import com.bonus.sgzb.largeScreen.util.RsaUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 参数配置 信息操作处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/config") +public class SysConfigController extends BaseController +{ + private final String publicKey = "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ=="; + private final String CONFIG_KEY = "sys.user.initPassword"; + + @Autowired + private ISysConfigService configService; + + /** + * 获取参数配置列表 + */ + @RequiresPermissions("system:config:list") + @GetMapping("/list") + public TableDataInfo list(MaConfig config) throws Exception { + startPage(); + List list = configService.selectConfigList(config); + for (MaConfig sysConfig : list) { + if (CONFIG_KEY.equals(sysConfig.getConfigKey()) && StringUtils.isNotBlank(sysConfig.getConfigValue())) { + String configValue = RsaUtil.encryptByPublicKey(sysConfig.getConfigValue(), publicKey); + sysConfig.setConfigValue(configValue); + } + } + return getDataTable(list); + } + + @Log(title = "参数管理", businessType = BusinessType.EXPORT) + @RequiresPermissions("system:config:export") + @PostMapping("/export") + public void export(HttpServletResponse response, MaConfig config) + { + List list = configService.selectConfigList(config); + ExcelUtil util = new ExcelUtil(MaConfig.class); + util.exportExcel(response, list, "参数数据"); + } + + /** + * 根据参数编号获取详细信息 + */ + @GetMapping(value = "/{configId}") + public AjaxResult getInfo(@PathVariable Long configId) + { + return success(configService.selectConfigById(configId)); + } + + /** + * 根据参数键名查询参数值 + */ + @GetMapping(value = "/configKey/{configKey}") + public AjaxResult getConfigKey(@PathVariable String configKey) throws Exception { + String configByKey = configService.selectConfigByKey(configKey); + if (CONFIG_KEY.equals(configKey) && StringUtils.isNotBlank(configByKey)) { + String configValue = RsaUtil.encryptByPublicKey(configByKey, publicKey); + return AjaxResult.success(configValue); + } + return success(configByKey); + } + + /** + * 新增参数配置 + */ + @RequiresPermissions("system:config:add") + @Log(title = "参数管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody MaConfig config) + { + if (!configService.checkConfigKeyUnique(config)) + { + return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); + } + config.setCreateBy(SecurityUtils.getUsername()); + return toAjax(configService.insertConfig(config)); + } + + /** + * 修改参数配置 + */ + @RequiresPermissions("system:config:edit") + @Log(title = "参数管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody MaConfig config) + { + if (!configService.checkConfigKeyUnique(config)) + { + return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); + } + config.setUpdateBy(SecurityUtils.getUsername()); + return toAjax(configService.updateConfig(config)); + } + + /** + * 删除参数配置 + */ + @RequiresPermissions("system:config:remove") + @Log(title = "参数管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{configIds}") + public AjaxResult remove(@PathVariable Long[] configIds) + { + configService.deleteConfigByIds(configIds); + return success(); + } + + /** + * 刷新参数缓存 + */ + @RequiresPermissions("system:config:remove") + @Log(title = "参数管理", businessType = BusinessType.CLEAN) + @DeleteMapping("/refreshCache") + public AjaxResult refreshCache() + { + configService.resetConfigCache(); + return success(); + } +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/domain/MaConfig.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/domain/MaConfig.java new file mode 100644 index 0000000..3cb9540 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/domain/MaConfig.java @@ -0,0 +1,112 @@ +package com.bonus.sgzb.base.domain; + +import com.bonus.sgzb.common.core.annotation.Excel; +import com.bonus.sgzb.common.core.annotation.Excel.ColumnType; +import com.bonus.sgzb.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; + +/** + * 参数配置表 sys_config + * + * @author bns + */ +public class MaConfig extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 参数主键 */ + @Excel(name = "参数主键", cellType = ColumnType.NUMERIC) + private Long configId; + + /** 参数名称 */ + @Excel(name = "参数名称") + private String configName; + + /** 参数键名 */ + @Excel(name = "参数键名") + private String configKey; + + /** 参数键值 */ + @Excel(name = "参数键值") + private String configValue; + + /** 系统内置(Y是 N否) */ + @Excel(name = "系统内置", readConverterExp = "Y=是,N=否") + private String configType; + + public Long getConfigId() + { + return configId; + } + + public void setConfigId(Long configId) + { + this.configId = configId; + } + + @NotBlank(message = "参数名称不能为空") + @Size(min = 0, max = 100, message = "参数名称不能超过100个字符") + public String getConfigName() + { + return configName; + } + + public void setConfigName(String configName) + { + this.configName = configName; + } + + @NotBlank(message = "参数键名长度不能为空") + @Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符") + public String getConfigKey() + { + return configKey; + } + + public void setConfigKey(String configKey) + { + this.configKey = configKey; + } + + @NotBlank(message = "参数键值不能为空") + @Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符") + public String getConfigValue() + { + return configValue; + } + + public void setConfigValue(String configValue) + { + this.configValue = configValue; + } + + public String getConfigType() + { + return configType; + } + + public void setConfigType(String configType) + { + this.configType = configType; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("configId", getConfigId()) + .append("configName", getConfigName()) + .append("configKey", getConfigKey()) + .append("configValue", getConfigValue()) + .append("configType", getConfigType()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/mapper/MaConfigMapper.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/mapper/MaConfigMapper.java new file mode 100644 index 0000000..e617310 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/mapper/MaConfigMapper.java @@ -0,0 +1,77 @@ +package com.bonus.sgzb.base.mapper; + +import com.bonus.sgzb.base.domain.MaConfig; + +import java.util.List; + +/** + * 参数配置 数据层 + * + * @author ruoyi + */ +public interface MaConfigMapper +{ + /** + * 查询参数配置信息 + * + * @param config 参数配置信息 + * @return 参数配置信息 + */ + public MaConfig selectConfig(MaConfig config); + + /** + * 通过ID查询配置 + * + * @param configId 参数ID + * @return 参数配置信息 + */ + public MaConfig selectConfigById(Long configId); + + /** + * 查询参数配置列表 + * + * @param config 参数配置信息 + * @return 参数配置集合 + */ + public List selectConfigList(MaConfig config); + + /** + * 根据键名查询参数配置信息 + * + * @param configKey 参数键名 + * @return 参数配置信息 + */ + public MaConfig checkConfigKeyUnique(String configKey); + + /** + * 新增参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + public int insertConfig(MaConfig config); + + /** + * 修改参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + public int updateConfig(MaConfig config); + + /** + * 删除参数配置 + * + * @param configId 参数ID + * @return 结果 + */ + public int deleteConfigById(Long configId); + + /** + * 批量删除参数信息 + * + * @param configIds 需要删除的参数ID + * @return 结果 + */ + public int deleteConfigByIds(Long[] configIds); +} \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/ISysConfigService.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/ISysConfigService.java new file mode 100644 index 0000000..2b4f133 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/ISysConfigService.java @@ -0,0 +1,83 @@ +package com.bonus.sgzb.base.service; + +import com.bonus.sgzb.base.domain.MaConfig; + +import java.util.List; + +/** + * 参数配置 服务层 + * + * @author ruoyi + */ +public interface ISysConfigService +{ + /** + * 查询参数配置信息 + * + * @param configId 参数配置ID + * @return 参数配置信息 + */ + public MaConfig selectConfigById(Long configId); + + /** + * 根据键名查询参数配置信息 + * + * @param configKey 参数键名 + * @return 参数键值 + */ + public String selectConfigByKey(String configKey); + + /** + * 查询参数配置列表 + * + * @param config 参数配置信息 + * @return 参数配置集合 + */ + public List selectConfigList(MaConfig config); + + /** + * 新增参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + public int insertConfig(MaConfig config); + + /** + * 修改参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + public int updateConfig(MaConfig config); + + /** + * 批量删除参数信息 + * + * @param configIds 需要删除的参数ID + */ + public void deleteConfigByIds(Long[] configIds); + + /** + * 加载参数缓存数据 + */ + public void loadingConfigCache(); + + /** + * 清空参数缓存数据 + */ + public void clearConfigCache(); + + /** + * 重置参数缓存数据 + */ + public void resetConfigCache(); + + /** + * 校验参数键名是否唯一 + * + * @param config 参数信息 + * @return 结果 + */ + public boolean checkConfigKeyUnique(MaConfig config); +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/impl/SysConfigServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/impl/SysConfigServiceImpl.java new file mode 100644 index 0000000..56132a0 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/impl/SysConfigServiceImpl.java @@ -0,0 +1,214 @@ +package com.bonus.sgzb.base.service.impl; + +import com.bonus.sgzb.base.domain.MaConfig; +import com.bonus.sgzb.base.mapper.MaConfigMapper; +import com.bonus.sgzb.base.service.ISysConfigService; +import com.bonus.sgzb.common.core.constant.CacheConstants; +import com.bonus.sgzb.common.core.constant.UserConstants; +import com.bonus.sgzb.common.core.exception.ServiceException; +import com.bonus.sgzb.common.core.text.Convert; +import com.bonus.sgzb.common.core.utils.StringUtils; +import com.bonus.sgzb.common.redis.service.RedisService; +import org.springframework.stereotype.Service; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import java.util.Collection; +import java.util.List; + +/** + * 参数配置 服务层实现 + * + * @author ruoyi + */ +@Service +public class SysConfigServiceImpl implements ISysConfigService +{ + @Resource + private MaConfigMapper configMapper; + + @Resource + private RedisService redisService; + + /** + * 项目启动时,初始化参数到缓存 + */ + @PostConstruct + public void init() + { + loadingConfigCache(); + } + + /** + * 查询参数配置信息 + * + * @param configId 参数配置ID + * @return 参数配置信息 + */ + @Override + public MaConfig selectConfigById(Long configId) + { + MaConfig config = new MaConfig(); + config.setConfigId(configId); + return configMapper.selectConfig(config); + } + + /** + * 根据键名查询参数配置信息 + * + * @param configKey 参数key + * @return 参数键值 + */ + @Override + public String selectConfigByKey(String configKey) + { + String configValue = Convert.toStr(redisService.getCacheObject(getCacheKey(configKey))); + if (StringUtils.isNotEmpty(configValue)) + { + return configValue; + } + MaConfig config = new MaConfig(); + config.setConfigKey(configKey); + MaConfig retConfig = configMapper.selectConfig(config); + if (StringUtils.isNotNull(retConfig)) + { + redisService.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue()); + return retConfig.getConfigValue(); + } + return StringUtils.EMPTY; + } + + /** + * 查询参数配置列表 + * + * @param config 参数配置信息 + * @return 参数配置集合 + */ + @Override + public List selectConfigList(MaConfig config) + { + return configMapper.selectConfigList(config); + } + + /** + * 新增参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + @Override + public int insertConfig(MaConfig config) + { + int row = configMapper.insertConfig(config); + if (row > 0) + { + redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); + } + return row; + } + + /** + * 修改参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + @Override + public int updateConfig(MaConfig config) + { + MaConfig temp = configMapper.selectConfigById(config.getConfigId()); + if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey())) + { + redisService.deleteObject(getCacheKey(temp.getConfigKey())); + } + + int row = configMapper.updateConfig(config); + if (row > 0) + { + redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); + } + return row; + } + + /** + * 批量删除参数信息 + * + * @param configIds 需要删除的参数ID + */ + @Override + public void deleteConfigByIds(Long[] configIds) + { + for (Long configId : configIds) + { + MaConfig config = selectConfigById(configId); + if (StringUtils.equals(UserConstants.YES, config.getConfigType())) + { + throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); + } + configMapper.deleteConfigById(configId); + redisService.deleteObject(getCacheKey(config.getConfigKey())); + } + } + + /** + * 加载参数缓存数据 + */ + @Override + public void loadingConfigCache() + { + List configsList = configMapper.selectConfigList(new MaConfig()); + for (MaConfig config : configsList) + { + redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); + } + } + + /** + * 清空参数缓存数据 + */ + @Override + public void clearConfigCache() + { + Collection keys = redisService.keys(CacheConstants.SYS_CONFIG_KEY + "*"); + redisService.deleteObject(keys); + } + + /** + * 重置参数缓存数据 + */ + @Override + public void resetConfigCache() + { + clearConfigCache(); + loadingConfigCache(); + } + + /** + * 校验参数键名是否唯一 + * + * @param config 参数配置信息 + * @return 结果 + */ + @Override + public boolean checkConfigKeyUnique(MaConfig config) + { + Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId(); + MaConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey()); + if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 设置cache key + * + * @param configKey 参数键 + * @return 缓存键key + */ + private String getCacheKey(String configKey) + { + return CacheConstants.SYS_CONFIG_KEY + configKey; + } +} diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/largeScreen/util/RsaUtil.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/largeScreen/util/RsaUtil.java new file mode 100644 index 0000000..6e2da20 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/largeScreen/util/RsaUtil.java @@ -0,0 +1,133 @@ +package com.bonus.sgzb.largeScreen.util; + +import javax.crypto.Cipher; +import java.security.KeyFactory; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import java.util.Base64; + +/** + * @Author ma_sh + * @create 2024/5/25 16:07 + */ +public class RsaUtil { + //签名算法名称 + private static final String RSA_KEY_ALGORITHM = "RSA"; + + //RSA密钥长度,默认密钥长度是1024,密钥长度必须是64的倍数,在512到65536位之间,不管是RSA还是RSA2长度推荐使用2048 + private static final int KEY_SIZE = 2048; + + /** + * 公钥加密(用于数据加密) + * + * @param data 加密前的字符串 + * @param publicKeyStr base64编码后的公钥 + * @return base64编码后的字符串 + * @throws Exception + */ + public static String encryptByPublicKey(String data, String publicKeyStr) throws Exception { + //Java原生base64解码 + byte[] pubKey = Base64.getDecoder().decode(publicKeyStr); + //创建X509编码密钥规范 + X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(pubKey); + //返回转换指定算法的KeyFactory对象 + KeyFactory keyFactory = KeyFactory.getInstance(RSA_KEY_ALGORITHM); + //根据X509编码密钥规范产生公钥对象 + PublicKey publicKey = keyFactory.generatePublic(x509KeySpec); + //根据转换的名称获取密码对象Cipher(转换的名称:算法/工作模式/填充模式) + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + //用公钥初始化此Cipher对象(加密模式) + cipher.init(Cipher.ENCRYPT_MODE, publicKey); + //对数据加密 + byte[] encrypt = cipher.doFinal(data.getBytes()); + //返回base64编码后的字符串 + return Base64.getEncoder().encodeToString(encrypt); + } + + + /** + * 私钥解密(用于数据解密) + * + * @param data 解密前的字符串 + * @param privateKeyStr 私钥 + * @return 解密后的字符串 + * @throws Exception + */ + public static String decryptByPrivateKey(String data, String privateKeyStr) throws Exception { + //Java原生base64解码 + byte[] priKey = Base64.getDecoder().decode(privateKeyStr); + //创建PKCS8编码密钥规范 + PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(priKey); + //返回转换指定算法的KeyFactory对象 + KeyFactory keyFactory = KeyFactory.getInstance(RSA_KEY_ALGORITHM); + //根据PKCS8编码密钥规范产生私钥对象 + PrivateKey privateKey = keyFactory.generatePrivate(pkcs8KeySpec); + //根据转换的名称获取密码对象Cipher(转换的名称:算法/工作模式/填充模式) + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + //用私钥初始化此Cipher对象(解密模式) + cipher.init(Cipher.DECRYPT_MODE, privateKey); + //对数据解密 + byte[] decrypt = cipher.doFinal(Base64.getDecoder().decode(data)); + //返回字符串 + return new String(decrypt); + } + + + + /** + * 私钥加密(用于数据签名) + * + * @param data 加密前的字符串 + * @param privateKeyStr base64编码后的私钥 + * @return base64编码后后的字符串 + * @throws Exception + */ + public static String encryptByPrivateKey(String data, String privateKeyStr) throws Exception { + //Java原生base64解码 + byte[] priKey = Base64.getDecoder().decode(privateKeyStr); + //创建PKCS8编码密钥规范 + PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(priKey); + //返回转换指定算法的KeyFactory对象 + KeyFactory keyFactory = KeyFactory.getInstance(RSA_KEY_ALGORITHM); + //根据PKCS8编码密钥规范产生私钥对象 + PrivateKey privateKey = keyFactory.generatePrivate(pkcs8KeySpec); + //根据转换的名称获取密码对象Cipher(转换的名称:算法/工作模式/填充模式) + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + //用私钥初始化此Cipher对象(加密模式) + cipher.init(Cipher.ENCRYPT_MODE, privateKey); + //对数据加密 + byte[] encrypt = cipher.doFinal(data.getBytes()); + //返回base64编码后的字符串 + return Base64.getEncoder().encodeToString(encrypt); + } + + /** + * 公钥解密(用于数据验签) + * + * @param data 解密前的字符串 + * @param publicKeyStr base64编码后的公钥 + * @return 解密后的字符串 + * @throws Exception + */ + public static String decryptByPublicKey(String data, String publicKeyStr) throws Exception { + //Java原生base64解码 + byte[] pubKey = Base64.getDecoder().decode(publicKeyStr); + //创建X509编码密钥规范 + X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(pubKey); + //返回转换指定算法的KeyFactory对象 + KeyFactory keyFactory = KeyFactory.getInstance(RSA_KEY_ALGORITHM); + //根据X509编码密钥规范产生公钥对象 + PublicKey publicKey = keyFactory.generatePublic(x509KeySpec); + //根据转换的名称获取密码对象Cipher(转换的名称:算法/工作模式/填充模式) + Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); + //用公钥初始化此Cipher对象(解密模式) + cipher.init(Cipher.DECRYPT_MODE, publicKey); + //对数据解密 + byte[] decrypt = cipher.doFinal(Base64.getDecoder().decode(data)); + //返回字符串 + return new String(decrypt); + } + +} diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/base/MaConfigMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/base/MaConfigMapper.xml new file mode 100644 index 0000000..4fb7ab0 --- /dev/null +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/base/MaConfigMapper.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark + from ma_config + + + + + + + and config_id = #{configId} + + + and config_key = #{configKey} + + + + + + + + + + + + + + insert into ma_config ( + config_name, + config_key, + config_value, + config_type, + create_by, + remark, + create_time + )values( + #{configName}, + #{configKey}, + #{configValue}, + #{configType}, + #{createBy}, + #{remark}, + sysdate() + ) + + + + update ma_config + + config_name = #{configName}, + config_key = #{configKey}, + config_value = #{configValue}, + config_type = #{configType}, + update_by = #{updateBy}, + remark = #{remark}, + update_time = sysdate() + + where config_id = #{configId} + + + + delete from ma_config where config_id = #{configId} + + + + delete from ma_config where config_id in + + #{configId} + + + + \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckDetailsMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckDetailsMapper.xml index 058e2b1..62de417 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckDetailsMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/PurchaseCheckDetailsMapper.xml @@ -199,7 +199,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select IFNULL(input_num,0) from purchase_check_details where task_id = #{taskId} and type_id = #{typeId}