当前位置: 首页 > news >正文

网站建设明细表百度seo发包工具

网站建设明细表,百度seo发包工具,php.ini wordpress,wordpress自动空格配置表 通过配置表,灵活的配置。 开发中某些经常变更的参数值,加上配置。比如 订单30分钟后失效,需求变更,要改为15分钟,那么直接改配置表就行了,不用发版。 某些关键的容易出错的逻辑,加上一…

配置表

通过配置表,灵活的配置。

开发中某些经常变更的参数值,加上配置。比如 订单30分钟后失效,需求变更,要改为15分钟,那么直接改配置表就行了,不用发版。

某些关键的容易出错的逻辑,加上一个开关,也就是 config_value 为 0或1,为1表示打开,为0表示关掉。

不需要的逻辑,可以及时用开关关掉。

或者是逻辑复杂,开发环境造数据麻烦时,也可以用配置表配置开关,把前置条件关掉,方便验证数据。

建表语句:

config_key 唯一索引,保证配置的 key 唯一。

config_value,如果有多个,可以用逗号隔开。

is_delete 表示是否删除:0-否;1-是。

CREATE TABLE `tb_system_config` (`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',`config_key` varchar(128) NOT NULL COMMENT '配置的KEY',`config_value` varchar(2000) DEFAULT '' COMMENT '配置的值。如果有多个,用逗号隔开',`description` varchar(100) DEFAULT '' COMMENT '描述',`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',`is_delete` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除:0-否;1-是',PRIMARY KEY (`id`),UNIQUE KEY `uk_config_key` (`config_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4  COMMENT='系统配置表';

查询系统配置表:

插入配置数据后,查询:

找出 config_key 为 config_test 的配置值。

SELECT config_value FROM tb_system_config_test WHERE config_key='config_test' AND is_delete=0;

依赖包:

采用 mybatisPlus ,也可以自己用 mybatis 处理。

    <properties><mybatis.plus.version>3.4.0</mybatis.plus.version></properties><dependencies><!--mybatis-plus下面这两个依赖必须加--><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>${mybatis.plus.version}</version></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId></dependency><!--mybatis-plus以下依赖是拓展,比如分页插件--><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-extension</artifactId><version>${mybatis.plus.version}</version></dependency><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-annotation</artifactId><version>${mybatis.plus.version}</version></dependency><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-core</artifactId><version>${mybatis.plus.version}</version></dependency><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-generator</artifactId><version>${mybatis.plus.version}</version></dependency><!--单元测试依赖--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency></dependencies>

实体类:

@Data
@EqualsAndHashCode(callSuper = false)
@TableName("tb_system_config")
public class SystemConfigEntity implements Serializable {private static final long serialVersionUID = 1L;/*** 主键*/@TableId(value = "id", type = IdType.AUTO)private Integer id;/*** 配置的KEY*/private String configKey;/*** 配置的值*/private String configValue;/*** 描述*/private String description;/*** 创建时间*/@TableField(fill = FieldFill.INSERT)private Date createTime;/*** 更新时间*/@TableField(fill = FieldFill.UPDATE)private Date updateTime;/*** 是否删除:0-否;1-是*/@TableLogicprivate Boolean isDelete;}

Mapper :

public interface SystemConfigMapper extends BaseMapper<SystemConfigEntity> {}

Mapper.xml:

namespace 和 type 的路径,自行修改。。

<?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.example.demo.dao.SystemConfigMapper"><!-- 通用查询映射结果 --><resultMap id="BaseResultMap" type="com.example.demo.domain.SystemConfigEntity"><id column="id" property="id" /><result column="config_key" property="configKey" /><result column="config_value" property="configValue" /><result column="description" property="description" /><result column="create_time" property="createTime" /><result column="update_time" property="updateTime" /><result column="is_delete" property="isDelete" /></resultMap><!-- 通用查询结果列 --><sql id="Base_Column_List">id, config_key, config_value, description, create_time, update_time, is_delete</sql></mapper>

Service 服务类:

如果系统接入了 缓存,也可以先从缓存中获取数据。

插入/更新数据后,记得删掉缓存,保持一致性。

系统配置表的逻辑如下:

@Service
public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigMapper, SystemConfigEntity> implements SystemConfigService {/*** 根据 key 获取配置的 value* @param key* @return*/public String getValueByKey(String key) {LambdaQueryWrapper<SystemConfigEntity> queryWrapper = new LambdaQueryWrapper<>();queryWrapper.eq(SystemConfigEntity::getConfigKey, key);//未删除的数据queryWrapper.eq(SystemConfigEntity::getIsDelete, false);SystemConfigEntity systemConfigEntity = getOne(queryWrapper);if (systemConfigEntity == null) {return "";}return systemConfigEntity.getConfigValue();}/*** 获取所有的配置。* 需要多次查询时使用,不用反复查数据表。** @return*/public Map<String, String> getValueMap() {LambdaQueryWrapper<SystemConfigEntity> queryWrapper = new LambdaQueryWrapper<>();//未删除的数据queryWrapper.eq(SystemConfigEntity::getIsDelete, false);List<SystemConfigEntity> list = list(queryWrapper);Map<String, String> map = new HashMap<>();if (CollectionUtils.isEmpty( list)) {return map;}map = list.stream().collect(Collectors.toMap(SystemConfigEntity::getConfigKey, SystemConfigEntity::getConfigValue, (key1, key2) -> key2));return map;}}
http://www.hkea.cn/news/297128/

相关文章:

  • 国外学做咖啡的网站百度高级搜索网址
  • 建网站开源代码游戏推广怎么找玩家
  • 莱州哪里有做网站的浙江网站建设平台
  • ps网站设计与制作免费推广seo
  • 网站查询功能怎么做关键词搜索量怎么查
  • 付费网站推广网站优化包括哪些内容
  • 在日本做色情网站广州seo外包
  • 最棒的网站建设考研最靠谱的培训机构
  • 广州建设企业网站黑河seo
  • 招商网站建设性价比高seo排名优化的
  • 产品网站怎么做的长沙正规关键词优化价格从优
  • 怎样查询江西省城乡建设厅网站杭州seo网
  • 网站建设空间是指什么软件网站优化最为重要的内容是
  • 做美工要开通什么网站的会员呢新网站友链
  • 网站集约化建设推进情况推广app赚钱
  • 番禺大石做网站域名污染查询网站
  • 长沙市在建工程项目免费seo快速排名工具
  • 南宁定制网站制作电话图片外链生成工具
  • 哪些网站做的海报比较高大上百度客服电话是多少
  • 菏泽网站建设电话常州seo外包
  • 做木皮的网站裂变营销五种模式十六种方法
  • 精美 企业网站模板微信软文推广怎么做
  • 怎么建立一个网站里面可以查询资料百度权重域名
  • 网站建设顺序镇江交叉口优化
  • 低价企业网站搭建软文新闻发布网站
  • 创造与魔法官方网站做自己喜欢的事seo视频
  • 淘宝联盟推广网站怎么做吉安seo招聘
  • 工程招聘网站如何免费制作自己的网站
  • 网站建设调研问卷搜易网托管模式的特点
  • 在哪个网站可以做java面试题宁德市蕉城区疫情