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

003 SSM框架整合

文章目录

  • 整合
    • web.xml
    • applicationContext-dao.xml
    • applicationContext-service.xml
    • springmvc.xml
    • db.properties
    • log4j.properties
    • pom.xml
  • 测试
    • sql
    • ItemController.java
    • ItemMapper.java
    • Item.java
    • ItemExample.java
    • ItemService.java
    • ItemServiceImpl.java
    • ItemMapper.xml

整合

将工程的三层结构中的 JavaBean 分别使用 Spring容器 (通过XML方式)进行管理。

  1. 整合持久层 mapper ,包括 数据源 、 SqlSessionFactory 及 mapper 代理对象的整合;
  2. 整合业务层 Service ,包括 事务Bean 及 service 的 bean 的配置;
  3. 整合表现层 Controller ,直接使用 springmvc 的配置。
  4. Web.xml 加载 spring 容器(包含多个XML文件,还分为 父子容器 )

核心配置文件:
applicationContext-dao.xml
applicationContext-service.xml
springmvc.xml
web.xml

web.xml


<!DOCTYPE web-app PUBLIC"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN""http://java.sun.com/dtd/web-app_2_3.dtd" ><!--        <?xml version="1.0" encoding="UTF-8"?>-->
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://java.sun.com/xml/ns/javaee"xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"id="WebApp_ID" version="2.5"><display-name>Archetype Created Web Application</display-name><!-- 配置springmvc的前端控制器 --><servlet><servlet-name>ssm</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><init-param><param-name>contextConfigLocation</param-name><param-value>classpath:spring/springmvc.xml</param-value></init-param><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>ssm</servlet-name><url-pattern>/</url-pattern></servlet-mapping><!--  在web.xml中,使用监听器来对spring的配置文件进行加载:--><!-- 指定持久层和业务层的spring配置文件路径--><!-- 加载spring容器 --><context-param><param-name>contextConfigLocation</param-name><param-value>classpath:spring/applicationContext-*.xml</param-value></context-param><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener></web-app>

applicationContext-dao.xml


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xmlns:mvc="http://www.springframework.org/schema/mvc"xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd"><!-- 加载db.properties --><context:property-placeholder location="classpath:db.properties" /><!-- 配置数据源 -->
<!--    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"-->
<!--          destroy-method="close">-->
<!--        <property name="driverClassName" value="${jdbc.driver}" />-->
<!--        <property name="url" value="${jdbc.url}" />-->
<!--        <property name="username" value="${jdbc.username}" />-->
<!--        <property name="password" value="${jdbc.password}" />-->
<!--        <property name="maxActive" value="30" />-->
<!--        <property name="maxIdle" value="5" />-->
<!--    </bean>--><!-- 配置数据源为HikariCP -->
<!--    <bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource"-->
<!--          destroy-method="close">-->
<!--        <property name="driverClassName" value="${jdbc.driver}" />-->
<!--        &lt;!&ndash; 注意:HikariCP 使用 jdbcUrl 而不是 url &ndash;&gt;-->
<!--        <property name="jdbcUrl" value="${jdbc.url}" />-->
<!--        <property name="username" value="${jdbc.username}" />-->
<!--        <property name="password" value="${jdbc.password}" />-->
<!--        &lt;!&ndash; HikariCP 的连接池大小配置 &ndash;&gt;-->
<!--        <property name="maximumPoolSize" value="30" />-->
<!--        &lt;!&ndash; HikariCP 没有直接的 maxIdle 属性,但可以通过 minimumIdle 控制空闲连接数 &ndash;&gt;-->
<!--        <property name="minimumIdle" value="5" />-->
<!--        &lt;!&ndash; 其他可选配置,如连接超时、空闲连接超时等 &ndash;&gt;-->
<!--        <property name="connectionTimeout" value="30000" />-->
<!--        <property name="idleTimeout" value="600000" />-->
<!--        <property name="maxLifetime" value="1800000" />-->
<!--    </bean>--><bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource"destroy-method="close"><property name="driverClassName" value="${jdbc.driver}" /><property name="url" value="${jdbc.url}" /><property name="username" value="${jdbc.username}" /><property name="password" value="${jdbc.password}" /><property name="maxTotal" value="30" /> <!-- DBCP2 中使用 maxTotal 替代 maxActive --><property name="maxIdle" value="5" /><property name="minIdle" value="0" /> <!-- 可选,设置最小空闲连接数 --><!-- 可选的其他配置,如连接验证、超时设置等 --><property name="validationQuery" value="SELECT 1" /> <!-- 用于验证从池中取出的连接是否仍然有效 --><property name="testOnBorrow" value="true" /> <!-- 从池中取出连接时是否进行验证 --><property name="testOnReturn" value="false" /> <!-- 连接归还到池中时是否进行验证 --><property name="testWhileIdle" value="true" /> <!-- 连接空闲时是否进行验证,如果为true,还需要设置timeBetweenEvictionRunsMillis属性 --><property name="timeBetweenEvictionRunsMillis" value="30000" /> <!-- 连接空闲时检测空闲连接的时间间隔 --><property name="numTestsPerEvictionRun" value="3" /> <!-- 每次检测空闲连接时检测的连接数 --><property name="minEvictableIdleTimeMillis" value="1800000" /> <!-- 连接在池中保持空闲而不被空闲连接回收器线程(如果有)回收的最小时间值 --></bean><!-- 配置SqlSessionFacotory --><bean id="sqlSessionFactory"class="org.mybatis.spring.SqlSessionFactoryBean"><!-- 加载mybatis的配置文件(如果配置文件中没有配置项,可以忽略该文件)-->
<!--        <property name="configLocation"-->
<!--                  value="classpath:mybatis/SqlMapConfig.xml" />--><!-- 配置数据源 --><property name="dataSource" ref="dataSource" /><property name="typeAliasesPackage" value="com.ssm.po"></property></bean><!-- 配置mapper扫描器,SqlSessionConfig.xml中的mapper配置去掉 --><bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"><!-- 指定扫描的包 --><property name="basePackage" value="com.ssm.mapper" /></bean>
</beans>

applicationContext-service.xml


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:context="http://www.springframework.org/schema/context"xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd"><!-- 扫描Service --><context:component-scan base-package="com.ssm.service" /><!-- 配置事务 --><!-- 事务管理器,对mybatis操作数据库进行事务控制,此处使用jdbc的事务控制 --><bean id="transactionManager"class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><!-- 指定要进行事务管理的数据源 --><property name="dataSource" ref="dataSource"></property></bean><!-- 通知 --><tx:advice id="txAdvice" transaction-manager="transactionManager"><tx:attributes><!-- 传播行为 --><tx:method name="save*" propagation="REQUIRED" /><tx:method name="add*" propagation="REQUIRED" /><tx:method name="insert*" propagation="REQUIRED" /><tx:method name="delete*" propagation="REQUIRED" /><tx:method name="del*" propagation="REQUIRED" /><tx:method name="remove*" propagation="REQUIRED" /><tx:method name="update*" propagation="REQUIRED" /><tx:method name="modify*" propagation="REQUIRED" /><tx:method name="find*" read-only="true" /><tx:method name="query*" read-only="true" /><tx:method name="select*" read-only="true" /><tx:method name="get*" read-only="true" /></tx:attributes></tx:advice><!-- aop -->
<!--    <aop:config>-->
<!--        <aop:advisor advice-ref="txAdvice"-->
<!--                     pointcut="execution(* com.ssm.service.impl.*.*(..))" />-->
<!--    </aop:config>--><aop:config><aop:advisor advice-ref="txAdvice"pointcut="execution(* *..*.*ServiceImpl.*(..))" /></aop:config>
</beans>

springmvc.xml


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xmlns:mvc="http://www.springframework.org/schema/mvc"xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd"><!-- 配置三大组件之处理器映射器和处理器适配器 --><mvc:annotation-driven /><!-- 配置三大组件之视图解析器 --><beanclass="org.springframework.web.servlet.view.InternalResourceViewResolver"><property name="prefix" value="/WEB-INF/jsp/" /><property name="suffix" value=".jsp" /></bean><!-- 配置处理器Bean的读取 --><!-- 扫描controller注解,多个包中间使用半角逗号分隔--><!-- 使用注解的handler可以使用组件扫描器,加载handler --><context:component-scan base-package="com.ssm.controller" />
</beans>

db.properties

jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/ssm?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
jdbc.username=root
jdbc.password=root

log4j.properties


#dev env [debug] product env [info]
log4j.rootLogger=DEBUG, stdout
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

pom.xml


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"><modelVersion>4.0.0</modelVersion><groupId>org.example</groupId><artifactId>ssm</artifactId><packaging>war</packaging><version>1.0-SNAPSHOT</version><name>ssm Maven Webapp</name><url>http://maven.apache.org</url><dependencies>
<!--    <dependency>-->
<!--      <groupId>junit</groupId>-->
<!--      <artifactId>junit</artifactId>-->
<!--      <version>3.8.1</version>-->
<!--      <scope>test</scope>-->
<!--    </dependency>--><!-- 持久层依赖 开始 --><!-- spring ioc组件需要的依赖包 --><dependency><groupId>org.springframework</groupId><artifactId>spring-beans</artifactId><version>5.0.7.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>5.0.7.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>5.0.7.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-expression</artifactId><version>5.0.7.RELEASE</version></dependency><!-- spring 事务管理和JDBC依赖包 --><dependency><groupId>org.springframework</groupId><artifactId>spring-tx</artifactId><version>5.0.7.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId><version>5.0.7.RELEASE</version></dependency><!-- mysql数据库驱动包 --><!-- https://mvnrepository.com/artifact/com.mysql/mysql-connector-j --><dependency><groupId>com.mysql</groupId><artifactId>mysql-connector-j</artifactId><version>8.3.0</version></dependency><!-- dbcp连接池的依赖包 -->
<!--    <dependency>-->
<!--      <groupId>commons-dbcp</groupId>-->
<!--      <artifactId>commons-dbcp</artifactId>-->
<!--      <version>1.4</version>-->
<!--    </dependency>--><dependency><groupId>org.apache.commons</groupId><artifactId>commons-dbcp2</artifactId><version>2.12.0</version></dependency><!--      <dependency>-->
<!--          <groupId>com.zaxxer</groupId>-->
<!--          <artifactId>HikariCP</artifactId>-->
<!--          <version>4.0.3</version>-->
<!--      </dependency>--><!-- mybatis依赖 --><dependency><groupId>org.mybatis</groupId><artifactId>mybatis</artifactId><version>3.5.16</version></dependency><!-- mybatis和spring的整合依赖 --><dependency><groupId>org.mybatis</groupId><artifactId>mybatis-spring</artifactId><version>1.3.1</version></dependency><!-- 持久层依赖 结束 --><!-- 业务层依赖 开始 --><!-- 基于AspectJ的aop依赖 --><dependency><groupId>org.springframework</groupId><artifactId>spring-aspects</artifactId><version>5.0.7.RELEASE</version></dependency><dependency><groupId>aopalliance</groupId><artifactId>aopalliance</artifactId><version>1.0</version></dependency><!-- 业务层依赖 结束 --><!-- 表现层依赖 开始 --><!-- spring MVC依赖包 --><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>5.0.7.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-web</artifactId><version>5.0.7.RELEASE</version></dependency><!-- jstl 取决于视图对象是否是JSP --><dependency><groupId>javax.servlet</groupId><artifactId>jstl</artifactId><version>1.2</version></dependency><dependency><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>3.1.0</version><scope>provided</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId><version>5.0.7.RELEASE</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-oxm</artifactId><version>5.0.7.RELEASE</version></dependency><dependency><groupId>com.thoughtworks.xstream</groupId><artifactId>xstream</artifactId><version>1.4.10</version></dependency><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databind</artifactId><version>2.9.6</version></dependency><!-- 表现层依赖 结束 --><!-- spring 单元测试组件包 --><dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId><version>5.0.7.RELEASE</version></dependency><!-- 单元测试Junit --><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.12</version></dependency><!-- Mock测试使用的json-path依赖 --><dependency><groupId>com.jayway.jsonpath</groupId><artifactId>json-path</artifactId><version>2.2.0</version></dependency><!-- 文件上传 --><dependency><groupId>commons-fileupload</groupId><artifactId>commons-fileupload</artifactId><version>1.3.1</version></dependency></dependencies><build><finalName>ssm</finalName><plugins><!-- 配置Maven的JDK编译级别 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.2</version><configuration><source>1.8</source><target>1.8</target><encoding>UTF-8</encoding></configuration></plugin><plugin><groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId><version>2.2</version><configuration><path>/</path><port>80</port></configuration></plugin></plugins></build>
</project>

测试

表现层

  • 请求URL:/queryItem
  • 请求参数:无
  • 请求返回值:json格式数据

业务层

  • 业务处理逻辑(需求分析):实现商品列表的查询

持久层

  • 只针对表进行增删改查操作

sql


CREATE TABLE `item` (  `id` INT NOT NULL AUTO_INCREMENT,  `name` VARCHAR(255) DEFAULT NULL,  `price` FLOAT DEFAULT NULL,  `pic` VARCHAR(255) DEFAULT NULL,  `createtime` DATETIME DEFAULT NULL,  PRIMARY KEY (`id`)  
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ItemController.java


package com.ssm.controller;import com.ssm.po.Item;
import com.ssm.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;import java.util.List;@Controller
public class ItemController {@Autowiredprivate ItemService service;@RequestMapping("/queryItem")@ResponseBodypublic List<Item> queryItem() {
// 根据查询条件去数据库中查询商品列表List<Item> itemList = service.queryItemList();return itemList;}
}

ItemMapper.java


package com.ssm.mapper;import com.ssm.po.Item;
import com.ssm.po.ItemExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;public interface ItemMapper {int countByExample(ItemExample example);int deleteByExample(ItemExample example);int deleteByPrimaryKey(Integer id);int insert(Item record);int insertSelective(Item record);List<Item> selectByExample(ItemExample example);Item selectByPrimaryKey(Integer id);int updateByExampleSelective(@Param("record") Item record, @Param("example") ItemExample example);int updateByExample(@Param("record") Item record, @Param("example") ItemExample example);int updateByPrimaryKeySelective(Item record);int updateByPrimaryKey(Item record);
}

Item.java


package com.ssm.po;import java.util.Date;public class Item {private Integer id;private String name;private Float price;private String pic;private Date createtime;public Integer getId() {return id;}public void setId(Integer id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name == null ? null : name.trim();}public Float getPrice() {return price;}public void setPrice(Float price) {this.price = price;}public String getPic() {return pic;}public void setPic(String pic) {this.pic = pic == null ? null : pic.trim();}public Date getCreatetime() {return createtime;}public void setCreatetime(Date createtime) {this.createtime = createtime;}
}

ItemExample.java


package com.ssm.po;import java.util.ArrayList;
import java.util.Date;
import java.util.List;public class ItemExample {protected String orderByClause;protected boolean distinct;protected List<Criteria> oredCriteria;public ItemExample() {oredCriteria = new ArrayList<Criteria>();}public void setOrderByClause(String orderByClause) {this.orderByClause = orderByClause;}public String getOrderByClause() {return orderByClause;}public void setDistinct(boolean distinct) {this.distinct = distinct;}public boolean isDistinct() {return distinct;}public List<Criteria> getOredCriteria() {return oredCriteria;}public void or(Criteria criteria) {oredCriteria.add(criteria);}public Criteria or() {Criteria criteria = createCriteriaInternal();oredCriteria.add(criteria);return criteria;}public Criteria createCriteria() {Criteria criteria = createCriteriaInternal();if (oredCriteria.size() == 0) {oredCriteria.add(criteria);}return criteria;}protected Criteria createCriteriaInternal() {Criteria criteria = new Criteria();return criteria;}public void clear() {oredCriteria.clear();orderByClause = null;distinct = false;}protected abstract static class GeneratedCriteria {protected List<Criterion> criteria;protected GeneratedCriteria() {super();criteria = new ArrayList<Criterion>();}public boolean isValid() {return criteria.size() > 0;}public List<Criterion> getAllCriteria() {return criteria;}public List<Criterion> getCriteria() {return criteria;}protected void addCriterion(String condition) {if (condition == null) {throw new RuntimeException("Value for condition cannot be null");}criteria.add(new Criterion(condition));}protected void addCriterion(String condition, Object value, String property) {if (value == null) {throw new RuntimeException("Value for " + property + " cannot be null");}criteria.add(new Criterion(condition, value));}protected void addCriterion(String condition, Object value1, Object value2, String property) {if (value1 == null || value2 == null) {throw new RuntimeException("Between values for " + property + " cannot be null");}criteria.add(new Criterion(condition, value1, value2));}public Criteria andIdIsNull() {addCriterion("id is null");return (Criteria) this;}public Criteria andIdIsNotNull() {addCriterion("id is not null");return (Criteria) this;}public Criteria andIdEqualTo(Integer value) {addCriterion("id =", value, "id");return (Criteria) this;}public Criteria andIdNotEqualTo(Integer value) {addCriterion("id <>", value, "id");return (Criteria) this;}public Criteria andIdGreaterThan(Integer value) {addCriterion("id >", value, "id");return (Criteria) this;}public Criteria andIdGreaterThanOrEqualTo(Integer value) {addCriterion("id >=", value, "id");return (Criteria) this;}public Criteria andIdLessThan(Integer value) {addCriterion("id <", value, "id");return (Criteria) this;}public Criteria andIdLessThanOrEqualTo(Integer value) {addCriterion("id <=", value, "id");return (Criteria) this;}public Criteria andIdIn(List<Integer> values) {addCriterion("id in", values, "id");return (Criteria) this;}public Criteria andIdNotIn(List<Integer> values) {addCriterion("id not in", values, "id");return (Criteria) this;}public Criteria andIdBetween(Integer value1, Integer value2) {addCriterion("id between", value1, value2, "id");return (Criteria) this;}public Criteria andIdNotBetween(Integer value1, Integer value2) {addCriterion("id not between", value1, value2, "id");return (Criteria) this;}public Criteria andNameIsNull() {addCriterion("name is null");return (Criteria) this;}public Criteria andNameIsNotNull() {addCriterion("name is not null");return (Criteria) this;}public Criteria andNameEqualTo(String value) {addCriterion("name =", value, "name");return (Criteria) this;}public Criteria andNameNotEqualTo(String value) {addCriterion("name <>", value, "name");return (Criteria) this;}public Criteria andNameGreaterThan(String value) {addCriterion("name >", value, "name");return (Criteria) this;}public Criteria andNameGreaterThanOrEqualTo(String value) {addCriterion("name >=", value, "name");return (Criteria) this;}public Criteria andNameLessThan(String value) {addCriterion("name <", value, "name");return (Criteria) this;}public Criteria andNameLessThanOrEqualTo(String value) {addCriterion("name <=", value, "name");return (Criteria) this;}public Criteria andNameLike(String value) {addCriterion("name like", value, "name");return (Criteria) this;}public Criteria andNameNotLike(String value) {addCriterion("name not like", value, "name");return (Criteria) this;}public Criteria andNameIn(List<String> values) {addCriterion("name in", values, "name");return (Criteria) this;}public Criteria andNameNotIn(List<String> values) {addCriterion("name not in", values, "name");return (Criteria) this;}public Criteria andNameBetween(String value1, String value2) {addCriterion("name between", value1, value2, "name");return (Criteria) this;}public Criteria andNameNotBetween(String value1, String value2) {addCriterion("name not between", value1, value2, "name");return (Criteria) this;}public Criteria andPriceIsNull() {addCriterion("price is null");return (Criteria) this;}public Criteria andPriceIsNotNull() {addCriterion("price is not null");return (Criteria) this;}public Criteria andPriceEqualTo(Float value) {addCriterion("price =", value, "price");return (Criteria) this;}public Criteria andPriceNotEqualTo(Float value) {addCriterion("price <>", value, "price");return (Criteria) this;}public Criteria andPriceGreaterThan(Float value) {addCriterion("price >", value, "price");return (Criteria) this;}public Criteria andPriceGreaterThanOrEqualTo(Float value) {addCriterion("price >=", value, "price");return (Criteria) this;}public Criteria andPriceLessThan(Float value) {addCriterion("price <", value, "price");return (Criteria) this;}public Criteria andPriceLessThanOrEqualTo(Float value) {addCriterion("price <=", value, "price");return (Criteria) this;}public Criteria andPriceIn(List<Float> values) {addCriterion("price in", values, "price");return (Criteria) this;}public Criteria andPriceNotIn(List<Float> values) {addCriterion("price not in", values, "price");return (Criteria) this;}public Criteria andPriceBetween(Float value1, Float value2) {addCriterion("price between", value1, value2, "price");return (Criteria) this;}public Criteria andPriceNotBetween(Float value1, Float value2) {addCriterion("price not between", value1, value2, "price");return (Criteria) this;}public Criteria andPicIsNull() {addCriterion("pic is null");return (Criteria) this;}public Criteria andPicIsNotNull() {addCriterion("pic is not null");return (Criteria) this;}public Criteria andPicEqualTo(String value) {addCriterion("pic =", value, "pic");return (Criteria) this;}public Criteria andPicNotEqualTo(String value) {addCriterion("pic <>", value, "pic");return (Criteria) this;}public Criteria andPicGreaterThan(String value) {addCriterion("pic >", value, "pic");return (Criteria) this;}public Criteria andPicGreaterThanOrEqualTo(String value) {addCriterion("pic >=", value, "pic");return (Criteria) this;}public Criteria andPicLessThan(String value) {addCriterion("pic <", value, "pic");return (Criteria) this;}public Criteria andPicLessThanOrEqualTo(String value) {addCriterion("pic <=", value, "pic");return (Criteria) this;}public Criteria andPicLike(String value) {addCriterion("pic like", value, "pic");return (Criteria) this;}public Criteria andPicNotLike(String value) {addCriterion("pic not like", value, "pic");return (Criteria) this;}public Criteria andPicIn(List<String> values) {addCriterion("pic in", values, "pic");return (Criteria) this;}public Criteria andPicNotIn(List<String> values) {addCriterion("pic not in", values, "pic");return (Criteria) this;}public Criteria andPicBetween(String value1, String value2) {addCriterion("pic between", value1, value2, "pic");return (Criteria) this;}public Criteria andPicNotBetween(String value1, String value2) {addCriterion("pic not between", value1, value2, "pic");return (Criteria) this;}public Criteria andCreatetimeIsNull() {addCriterion("createtime is null");return (Criteria) this;}public Criteria andCreatetimeIsNotNull() {addCriterion("createtime is not null");return (Criteria) this;}public Criteria andCreatetimeEqualTo(Date value) {addCriterion("createtime =", value, "createtime");return (Criteria) this;}public Criteria andCreatetimeNotEqualTo(Date value) {addCriterion("createtime <>", value, "createtime");return (Criteria) this;}public Criteria andCreatetimeGreaterThan(Date value) {addCriterion("createtime >", value, "createtime");return (Criteria) this;}public Criteria andCreatetimeGreaterThanOrEqualTo(Date value) {addCriterion("createtime >=", value, "createtime");return (Criteria) this;}public Criteria andCreatetimeLessThan(Date value) {addCriterion("createtime <", value, "createtime");return (Criteria) this;}public Criteria andCreatetimeLessThanOrEqualTo(Date value) {addCriterion("createtime <=", value, "createtime");return (Criteria) this;}public Criteria andCreatetimeIn(List<Date> values) {addCriterion("createtime in", values, "createtime");return (Criteria) this;}public Criteria andCreatetimeNotIn(List<Date> values) {addCriterion("createtime not in", values, "createtime");return (Criteria) this;}public Criteria andCreatetimeBetween(Date value1, Date value2) {addCriterion("createtime between", value1, value2, "createtime");return (Criteria) this;}public Criteria andCreatetimeNotBetween(Date value1, Date value2) {addCriterion("createtime not between", value1, value2, "createtime");return (Criteria) this;}}public static class Criteria extends GeneratedCriteria {protected Criteria() {super();}}public static class Criterion {private String condition;private Object value;private Object secondValue;private boolean noValue;private boolean singleValue;private boolean betweenValue;private boolean listValue;private String typeHandler;public String getCondition() {return condition;}public Object getValue() {return value;}public Object getSecondValue() {return secondValue;}public boolean isNoValue() {return noValue;}public boolean isSingleValue() {return singleValue;}public boolean isBetweenValue() {return betweenValue;}public boolean isListValue() {return listValue;}public String getTypeHandler() {return typeHandler;}protected Criterion(String condition) {super();this.condition = condition;this.typeHandler = null;this.noValue = true;}protected Criterion(String condition, Object value, String typeHandler) {super();this.condition = condition;this.value = value;this.typeHandler = typeHandler;if (value instanceof List<?>) {this.listValue = true;} else {this.singleValue = true;}}protected Criterion(String condition, Object value) {this(condition, value, null);}protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {super();this.condition = condition;this.value = value;this.secondValue = secondValue;this.typeHandler = typeHandler;this.betweenValue = true;}protected Criterion(String condition, Object value, Object secondValue) {this(condition, value, secondValue, null);}}
}

ItemService.java


package com.ssm.service;import com.ssm.po.Item;import java.util.List;public interface ItemService {List<Item> queryItemList();
}

ItemServiceImpl.java


package com.ssm.service;import com.ssm.mapper.ItemMapper;
import com.ssm.po.Item;
import com.ssm.po.ItemExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.List;@Service
public class ItemServiceImpl implements ItemService {@Autowiredprivate ItemMapper mapper;public List<Item> queryItemList() {ItemExample example = new ItemExample();return mapper.selectByExample(example);}
}

ItemMapper.xml


<?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.ssm.mapper.ItemMapper" ><resultMap id="BaseResultMap" type="com.ssm.po.Item" ><id column="id" property="id" jdbcType="INTEGER" /><result column="name" property="name" jdbcType="VARCHAR" /><result column="price" property="price" jdbcType="REAL" /><result column="pic" property="pic" jdbcType="VARCHAR" /><result column="createtime" property="createtime" jdbcType="TIMESTAMP" /></resultMap><sql id="Example_Where_Clause" ><where ><foreach collection="oredCriteria" item="criteria" separator="or" ><if test="criteria.valid" ><trim prefix="(" suffix=")" prefixOverrides="and" ><foreach collection="criteria.criteria" item="criterion" ><choose ><when test="criterion.noValue" >and ${criterion.condition}</when><when test="criterion.singleValue" >and ${criterion.condition} #{criterion.value}</when><when test="criterion.betweenValue" >and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}</when><when test="criterion.listValue" >and ${criterion.condition}<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >#{listItem}</foreach></when></choose></foreach></trim></if></foreach></where></sql><sql id="Update_By_Example_Where_Clause" ><where ><foreach collection="example.oredCriteria" item="criteria" separator="or" ><if test="criteria.valid" ><trim prefix="(" suffix=")" prefixOverrides="and" ><foreach collection="criteria.criteria" item="criterion" ><choose ><when test="criterion.noValue" >and ${criterion.condition}</when><when test="criterion.singleValue" >and ${criterion.condition} #{criterion.value}</when><when test="criterion.betweenValue" >and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}</when><when test="criterion.listValue" >and ${criterion.condition}<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >#{listItem}</foreach></when></choose></foreach></trim></if></foreach></where></sql><sql id="Base_Column_List" >id, name, price, pic, createtime</sql><select id="selectByExample" resultMap="BaseResultMap" parameterType="com.ssm.po.ItemExample" >select<if test="distinct" >distinct</if><include refid="Base_Column_List" />from item<if test="_parameter != null" ><include refid="Example_Where_Clause" /></if><if test="orderByClause != null" >order by ${orderByClause}</if></select><select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >select<include refid="Base_Column_List" />from itemwhere id = #{id,jdbcType=INTEGER}</select><delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >delete from itemwhere id = #{id,jdbcType=INTEGER}</delete><delete id="deleteByExample" parameterType="com.ssm.po.ItemExample" >delete from item<if test="_parameter != null" ><include refid="Example_Where_Clause" /></if></delete><insert id="insert" parameterType="com.ssm.po.Item" >insert into item (id, name, price,pic, createtime)values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{price,jdbcType=REAL},#{pic,jdbcType=VARCHAR}, #{createtime,jdbcType=TIMESTAMP})</insert><insert id="insertSelective" parameterType="com.ssm.po.Item" >insert into item<trim prefix="(" suffix=")" suffixOverrides="," ><if test="id != null" >id,</if><if test="name != null" >name,</if><if test="price != null" >price,</if><if test="pic != null" >pic,</if><if test="createtime != null" >createtime,</if></trim><trim prefix="values (" suffix=")" suffixOverrides="," ><if test="id != null" >#{id,jdbcType=INTEGER},</if><if test="name != null" >#{name,jdbcType=VARCHAR},</if><if test="price != null" >#{price,jdbcType=REAL},</if><if test="pic != null" >#{pic,jdbcType=VARCHAR},</if><if test="createtime != null" >#{createtime,jdbcType=TIMESTAMP},</if></trim></insert><select id="countByExample" parameterType="com.ssm.po.ItemExample" resultType="java.lang.Integer" >select count(*) from item<if test="_parameter != null" ><include refid="Example_Where_Clause" /></if></select><update id="updateByExampleSelective" parameterType="map" >update item<set ><if test="record.id != null" >id = #{record.id,jdbcType=INTEGER},</if><if test="record.name != null" >name = #{record.name,jdbcType=VARCHAR},</if><if test="record.price != null" >price = #{record.price,jdbcType=REAL},</if><if test="record.pic != null" >pic = #{record.pic,jdbcType=VARCHAR},</if><if test="record.createtime != null" >createtime = #{record.createtime,jdbcType=TIMESTAMP},</if></set><if test="_parameter != null" ><include refid="Update_By_Example_Where_Clause" /></if></update><update id="updateByExample" parameterType="map" >update itemset id = #{record.id,jdbcType=INTEGER},name = #{record.name,jdbcType=VARCHAR},price = #{record.price,jdbcType=REAL},pic = #{record.pic,jdbcType=VARCHAR},createtime = #{record.createtime,jdbcType=TIMESTAMP}<if test="_parameter != null" ><include refid="Update_By_Example_Where_Clause" /></if></update><update id="updateByPrimaryKeySelective" parameterType="com.ssm.po.Item" >update item<set ><if test="name != null" >name = #{name,jdbcType=VARCHAR},</if><if test="price != null" >price = #{price,jdbcType=REAL},</if><if test="pic != null" >pic = #{pic,jdbcType=VARCHAR},</if><if test="createtime != null" >createtime = #{createtime,jdbcType=TIMESTAMP},</if></set>where id = #{id,jdbcType=INTEGER}</update><update id="updateByPrimaryKey" parameterType="com.ssm.po.Item" >update itemset name = #{name,jdbcType=VARCHAR},price = #{price,jdbcType=REAL},pic = #{pic,jdbcType=VARCHAR},createtime = #{createtime,jdbcType=TIMESTAMP}where id = #{id,jdbcType=INTEGER}</update>
</mapper>

相关文章:

003 SSM框架整合

文章目录 整合web.xmlapplicationContext-dao.xmlapplicationContext-service.xmlspringmvc.xmldb.propertieslog4j.propertiespom.xml 测试sqlItemController.javaItemMapper.javaItem.javaItemExample.javaItemService.javaItemServiceImpl.javaItemMapper.xml 整合 将工程的…...

web刷题记录(7)

[HDCTF 2023]SearchMaster 打开环境&#xff0c;首先的提示信息就是告诉我们&#xff0c;可以用post传参的方式来传入参数data 首先考虑的还是rce&#xff0c;但是这里发现&#xff0c;不管输入那种命令&#xff0c;它都会直接显示在中间的那一小行里面&#xff0c;而实际的命令…...

【单片机毕业设计选题24037】-基于STM32的电力系统电力参数无线监控系统

系统功能: 系统上电后&#xff0c;OLED显示“欢迎使用电力监控系统请稍后”&#xff0c;两秒后显示“Waiting..”等待ESP8266初始化完成&#xff0c; ESP8266初始化成功后进入正常页面显示&#xff0c; 第一行显示电压值&#xff08;单位V&#xff09; 第二行显示电流值&am…...

Python使用彩虹表来尝试对MD5哈希进行破解

MD5是一种散列算法&#xff0c;它是不可逆的&#xff0c;无法直接解密。它的主要作用是将输入数据进行散列&#xff0c;生成一个固定长度的唯一哈希值。 然而&#xff0c;可以使用预先计算好的MD5哈希值的彩虹表&#xff08;Rainbow Table&#xff09;来尝试对MD5进行破解。彩…...

数据恢复篇: 如何在数据丢失后恢复照片

数据丢失的情况并不少见。如果您曾经遇到过图像丢失的情况&#xff0c;您可能想过照片恢复工具是如何工作的&#xff1f;可能会丢失多少数据图像&#xff1f;即使是断电也可能导致照片和媒体文件丢失。 话虽如此&#xff0c;如果你认为删除的照片无法恢复&#xff0c;那你就错…...

c++ 引用第三方库

文章目录 背景编写cmake代码里引用测试 背景 遇到一个c项目&#xff0c;想跑一些示例。了解下如何直接引用第三方库。 编写cmake 项目结构 myprojectincludexx.hmain.cppCMakeLists.txt CMakeLists.txt cmake_minimum_required(VERSION 3.28) project(velox_demo)set(CM…...

[数据集][目标检测]猪只状态吃喝睡站检测数据集VOC+YOLO格式530张4类别

数据集格式&#xff1a;Pascal VOC格式YOLO格式(不包含分割路径的txt文件&#xff0c;仅仅包含jpg图片以及对应的VOC格式xml文件和yolo格式txt文件) 图片数量(jpg文件个数)&#xff1a;530 标注数量(xml文件个数)&#xff1a;530 标注数量(txt文件个数)&#xff1a;530 标注类别…...

Redis中设置验证码

限制一分钟内最多发送5次&#xff0c;且每次有效时间是5分钟&#xff01; String 发送验证码(phoneNumber) {key "shortMsg:limit:" phoneNumber;// 设置过期时间为 1 分钟&#xff08;60 秒&#xff09;// 使⽤ NX&#xff0c;只在不存在 key 时才能设置成功bool…...

使用hadoop进行数据分析

Hadoop是一个开源框架&#xff0c;它允许分布式处理大数据集群上的大量数据。Hadoop由两个主要部分组成&#xff1a;HDFS&#xff08;Hadoop分布式文件系统&#xff09;和MapReduce。以下是使用Hadoop进行数据分析的基本步骤&#xff1a; 数据准备&#xff1a; 将数据存储在HDF…...

架构师篇-7、企业安全架构设计及实践

摘要&#xff1a; 认识企业安全架构企业安全案例分析及实践 内容&#xff1a; 为什么做企业安全架构怎么做好安全架构设计案例实践分析&随堂练 为什么要做企业安全架构 安全是麻烦制造者&#xff1f; 整天提安全需求增加开发工作增加运维要求增加不确定性延后业务上线…...

递归算法~快速排序、归并排序

递归排序是一种基于分治法的排序算法&#xff0c;最典型的例子就是快速排序和归并排序。这两种算法都利用递归将问题分解成更小的子问题&#xff0c;然后将子问题的解合并以得到原始问题的解。 1、快速排序&#xff08;Quick Sort&#xff09; 快速排序的基本思想是选择一个基…...

DarkGPT:基于GPT-4-200k设计的人工智能OSINT助手

关于DarkGPT DarkGPT是一款功能强大的人工智能安全助手&#xff0c;该工具基于GPT-4-200k设计并实现其功能&#xff0c;可以帮助广大研究人员针对泄露数据库进行安全分析和数据查询相关的OSINT操作。 工具要求 openai1.13.3 requests python-dotenv pydantic1.10.12 工具安装 …...

RAG 检索增强生成有效评估

我们将介绍RAG(检索增强生成)的评估工作流程 RAG工作流程的部分 数据集 这里是我们将要使用的LCEL (LangChain Expression Language)相关问题的数据集。 这个数据集是在LangSmith UI中使用csv上传创建的: https://smith.langchain.com/public/730d833b-74da-43e2-a614-4e2ca…...

Day38:LeedCode 1049. 最后一块石头的重量 II 494. 目标和 474.一和零

1049. 最后一块石头的重量 II 有一堆石头&#xff0c;用整数数组 stones 表示。其中 stones[i] 表示第 i 块石头的重量。 每一回合&#xff0c;从中选出任意两块石头&#xff0c;然后将它们一起粉碎。假设石头的重量分别为 x 和 y&#xff0c;且 x < y。那么粉碎的可能结果…...

sqlalchemy分页查询

sqlalchemy分页查询 在SQLAlchemy中,可以使用limit和offset方法实现分页查询 from sqlalchemy.orm import sessionmaker from sqlalchemy import create_engine from models import MyModel # 假设MyModel是你定义的模型# 连接数据库 engine = create_engine(sqlite:///myd…...

Java--常用类APl(复习总结)

前言: Java是一种强大而灵活的编程语言&#xff0c;具有广泛的应用范围&#xff0c;从桌面应用程序到企业级应用程序都能够使用Java进行开发。在Java的编程过程中&#xff0c;使用标准类库是非常重要的&#xff0c;因为标准类库提供了丰富的类和API&#xff0c;可以简化开发过…...

【股指期权投教】一手股指期权大概多少钱?

一手股指期权的权利金大概在几千人民币左右&#xff0c;如果是作为期权卖方还需要另外缴纳保证金的。国内的股指期权有三种&#xff0c;沪深300、上证50、中证1000股指期权&#xff0c;每点合约人民币100 元。 期权合约的价值计算可以通过此公式得出&#xff1a;权利金的支付或…...

mmap()函数和munmap()函数的例子

代码&#xff1a; #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/mman.h> #include <string.h> #include <stdio.h> #include <unistd.h>#define FILELENGTH 80 int main(void) {int fd-1;char …...

计算神经网络中梯度的核心机制 - 反向传播(backpropagation)算法(1)

计算神经网络中梯度的核心机制 - 反向传播&#xff08;backpropagation&#xff09;算法&#xff08;1&#xff09; flyfish 链式法则在深度学习中的主要应用是在反向传播&#xff08;backpropagation&#xff09;算法中。 从简单的开始 &#xff0c;文本说的就是链式法则 R …...

VUE实现简易购物车

主要是对基础的指令的使用&#xff0c;直接上代码&#xff1a; <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0">&l…...

混沌工程——从捣乱的视角看系统稳定性

概念 混沌工程是通过捣乱实验探究系统稳定性的实践过程&#xff0c;其作战武器是风险因子&#xff0c;即在健康的运行环境中引入风险变量来验证系统对风险的抵抗能力&#xff0c;它的作用是推动系统容错能力建设、验证监控告警及时性、提升研发问题排查能力。 混沌工程的工作…...

Windows宝塔面板部署ThinkPHP8.0创建Vue项目案例

安装ThinkPHP8.0 登录宝塔面板&#xff0c;创建一个站点。 输入composer代码&#xff0c;执行完成后自动创建TP目录 composer create-project topthink/think tp 网站目录设置为tp&#xff0c;运行目录设置为public 设置PHP版本为8.0以上&#xff0c;不然会出现下面的报错代…...

5G频段简介

5G频段 5G网络一共有29个频段&#xff0c;主要被分为两个频谱范围&#xff0c;其中6GHz以下的频段共有26个&#xff08;统称为Sub6GHz&#xff09;&#xff0c;毫米波频段有3个。目前国内主要使用的是Sub6GHz&#xff0c;包括n1/n3/n28/n41/n77/n78/n79共7个频段。具体介绍如下…...

【python学习】bytearray 数组

在Python中&#xff0c;bytearray 是一个可变序列&#xff0c;用于表示一个字节数组。与不可变的 bytes 类型相比&#xff0c;bytearray 允许你修改其内容。你可以通过索引来访问和修改 bytearray 中的元素&#xff0c;也可以添加或删除元素。 使用 bytearray 的一些示例&…...

Labview_Occurrencel(事件发生)

PS&#xff1a;这里遇到 一个很Low的事情&#xff1a; 在停止第二个while循环的时候出现了停止不了的情况。因为等待事件发生设置的超时时间为:-1。所以等事件发生后出现了条件接线端已经执行的情况&#xff0c;所以当下次事件发生时未能及时停止。初版的停止设置如下图&#x…...

天气网站爬虫及可视化

摘要&#xff1a;随着互联网的快速发展&#xff0c;人们对天气信息的需求也越来越高。本论文基于Python语言&#xff0c;设计并实现了一个天气网站爬虫及可视化系统。该系统通过网络爬虫技术从多个天气网站上获取实时的天气数据&#xff0c;并将数据进行清洗和存储。同时&#…...

【python - 数据】

一、序列 序列&#xff08;sequence&#xff09;是一组有顺序的值的集合&#xff0c;是计算机科学中的一个强大且基本的抽象概念。序列并不是特定内置类型或抽象数据表示的实例&#xff0c;而是一个包含不同类型数据间共享行为的集合。也就是说&#xff0c;序列有很多种类&…...

几种热管的构造

1、超薄热管构造形式 在实际应用中&#xff0c;超薄热管通常定义为厚度小于2.0mm的平板热管。超薄热管很薄&#xff0c;可紧贴电子元件表面散热&#xff0c;故被广泛应用于移动和可携带电子设备&#xff0c;如智能手机、笔记本电脑和智能手表。用于笔记本电脑和平板电脑的超薄…...

【GitOps】使用Google工具JIB实现本地无需安装容器推送镜像,加速SpringCloud项目开发

文章目录 一、效果展示二、简介三、安装Jib插件1、区分环境2、安装插件一、效果展示 本地是window系统,无docker环境,没有任何runtime,使用jib工具打包镜像并推送完成,用时20秒 二、简介 Jib 是 Google 开发的一款开源工具,旨在帮助 Java 开发者更高效地将 Java 应用程…...

【proteus经典实战】16X192点阵程序

一、简介 6X192点阵程序通常用于表示高分辨率图像或文字&#xff0c;其中16X表示像素阵列的宽度&#xff0c;192表示每个像素阵列中的点阵数&#xff0c;16X192点阵程序需要一定的编程知识和技能才能编写和调试&#xff0c;同时还需要考虑硬件设备的兼容性和性能等因素。 初始…...

小白上手AIGC-基于FC部署stable-diffusion

AIGC AIGC&#xff08;人工智能创造内容&#xff09;作为一种基于人工智能技术生成内容的新型创作模式。打破了过去大家对于AI的理解都是说只能涉足部分领域而无法涉足艺术或者是其他的创作领域的定律&#xff0c;现在的AIGC也能够创作内容了&#xff0c;而不再只是单纯的返回…...

一些指标的学习

1.平均倒数排名&#xff08;MRR&#xff09; 1.定义 MRR 是衡量检索系统返回的结果列表中第一个相关结果位置的指标。具体来说&#xff0c;它是所有查询倒数排名的平均值。 2.计算步骤 对每个查询&#xff0c;找到第一个正确答案在结果列表中的排名 &#x1d445;&#x1d44…...

dledger原理源码分析系列(三)-选主

简介 dledger是openmessaging的一个组件&#xff0c; raft算法实现&#xff0c;用于分布式日志&#xff0c;本系列分析dledger如何实现raft概念&#xff0c;以及dledger在rocketmq的应用 本系列使用dledger v0.40 本文分析dledger的选主 关键词 Raft Openmessaging 心跳/选…...

如何修改PDF文档的作者名称?

要修改一个 PDF 文档的作者名称&#xff0c;你可以按照以下步骤进行操作&#xff1a; 1. **使用 Adobe Acrobat**&#xff08;如果有&#xff09;&#xff1a; - Adobe Acrobat 是一个功能强大的 PDF 编辑工具&#xff0c;支持修改文档属性信息&#xff0c;包括作者名称。打开…...

从笔灵到AI去痕:全方位提升内容创作与学术诚信

内容为王&#xff0c;在内容创作的世界中尤为重要。然而&#xff0c;面对写作时常常感到无从下手&#xff1a;有时缺乏灵感&#xff0c;有时难以表达清楚自己的想法。AI写作助手的出现&#xff0c;为这些问题提供了创新的解决方案&#xff0c;极大地改变了内容创作的过程。 今…...

考试如果出现汉诺塔问题怎么办?

对于这道题来说 就按照测试案例里的数字进行输入 测试案例用100 那这三只鸡的具体最多能有多少只鸡呢&#xff1f; 用总数除以这只鸡的单价>>>>>>>即为这只鸡最多有 >>>>>>>> n / 单价 修改后 >>>>> 不只适…...

导出word模板开发记录

exportWordDocx.js import JSZipUtils from “jszip-utils” import Docxtemplater from “docxtemplater” import {saveAs} from “file-saver” import PizZip from “pizzip” const exportWordDocx (demoUrl, docxData, fileName) > {// 读取并获得模板文件的二进制…...

PHP爬虫类的并发与多线程处理技巧

PHP爬虫类的并发与多线程处理技巧 引言&#xff1a; 随着互联网的快速发展&#xff0c;大量的数据信息存储在各种网站上&#xff0c;获取这些数据已经成为很多业务场景下的需求。而爬虫作为一种自动化获取网络信息的工具&#xff0c;被广泛应用于数据采集、搜索引擎、舆情分析…...

用Python将PowerPoint演示文稿转换到图片和SVG

PowerPoint演示文稿作为展示创意、分享知识和表达观点的重要工具&#xff0c;被广泛应用于教育、商务汇报及个人项目展示等领域。然而&#xff0c;面对不同的分享场景与接收者需求&#xff0c;有时需要我们将PPT内容以图片形式保存与传播。这样能够避免软件兼容性的限制&#x…...

机电公司管理小程序的设计

管理员账户功能包括&#xff1a;系统首页&#xff0c;个人中心&#xff0c;用户管理&#xff0c;管理员管理&#xff0c;客户管理&#xff0c;公告管理&#xff0c;考勤管理&#xff0c;请假管理 微信端账号功能包括&#xff1a;系统首页&#xff0c;公告&#xff0c;机电零件&…...

SQL中的子查询和CTE(with ....as..)

第一次看到with as 这种类似于python中读文件的写法还是挺疑惑的&#xff0c;其实它是CTE&#xff0c;功能和子查询很类似但又有不同点&#xff0c;在实际应用场景中具有着独特作用。 子查询 子查询是在主查询中的嵌套查询&#xff0c;可以出现在SELECT、FROM、WHERE等子句中…...

Cesium 基本概念:创建实体和相机控制

基本概念 Entity // 创建一个实体 const entity_1 viewer.entities.add({position: new Cesium.Cartesian3(0, 0, 10000000),point: {pixelSize: 10,color: Cesium.Color.BLUE} });// 通过经纬度创建实体 const position Cesium.Cartesian3.fromDegrees(180.0, 0.0); // 创…...

vue使用scrollreveal和animejs实现页面滑动到指定位置后再开始执行动画效果

效果图 效果链接&#xff1a;http://website.livequeen.top 介绍 一、Scrollreveal ScrollReveal 是一个 JavaScript 库&#xff0c;用于在元素进入/离开视口时轻松实现动画效果。 ScrollReveal 官网链接&#xff1a;ScrollReveal 二、animejs animejs是一个好用的动画库…...

在Ubuntu 16.04上安装和配置GitLab的方法

前些天发现了一个巨牛的人工智能学习网站&#xff0c;通俗易懂&#xff0c;风趣幽默&#xff0c;忍不住分享一下给大家。点击跳转到网站。 简介 GitLab CE&#xff08;Community Edition&#xff09;是一个开源应用程序&#xff0c;主要用于托管 Git 仓库&#xff0c;并提供额…...

STM32的SPI通信

1 SPI协议简介 SPI&#xff08;Serial Peripheral Interface&#xff09;协议是由摩托罗拉公司提出的通信协议&#xff0c;即串行外围设备接口&#xff0c;是一种高速全双工的通信总线。它被广泛地使用在ADC、LCD等设备与MCU间&#xff0c;使用于对通信速率要求较高的场合。 …...

机器学习引领教育革命:智能教育的新时代

&#x1f4dd;个人主页&#x1f339;&#xff1a;Eternity._ &#x1f339;&#x1f339;期待您的关注 &#x1f339;&#x1f339; ❀目录 &#x1f4d2;1. 引言&#x1f4d9;2. 机器学习在教育中的应用&#x1f31e;个性化学习&#x1f319;评估与反馈的智能化⭐教学资源的优…...

6月29日,每日信息差

第一、位于四川省绵阳市的中广核质子治疗装备制造基地正式通过竣工验收&#xff0c;为全球装机数量和治疗患者数量最多的国际领先质子治疗系统全面国产化奠定了坚实基础。质子治疗作为目前全球最尖端的肿瘤放射治疗技术之一&#xff0c;与传统放疗技术相比&#xff0c;质子治疗…...

SpringCloud中复制模块然后粘贴,文件图标缺少蓝色方块

再maven中点击&#xff0b;号&#xff0c;把当前pom文件交给maven管理即可...

JS乌龟吃鸡游戏

代码&#xff1a; <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><title>乌龟游戏</title><script type"text/javascript">function move(obj){//乌龟图片高度var wuGui_height 67;…...

第十节:学习ConfigurationProperties类来配置pojo实体类参数(自学Spring boot 3.x的第二天)

大家好&#xff0c;我是网创有方 。这节记录下如何使用ConfigurationProperties来实现自动注入配置值。。实现将配置文件里的application.properties的参数赋值给实体类并且打印出来。 第一步&#xff1a;新建一个实体类WechatConfig package cn.wcyf.wcai.config;import org…...

Linux进程信号

信号&#xff1a;Linux系统提供的一种向指定进程发送特定事件的方式&#xff0c;用作识别和处理&#xff0c;并且信号的产生是异步的。 信号的处理&#xff08;信号递达delivery&#xff09;&#xff1a;默认动作、忽略动作、自定义处理 一、信号产生 前置知识&#xff1a;sig…...

【信息学奥赛】CSP-J/S初赛07 排序算法及其他算法在初赛中的考察

本专栏&#x1f449;CSP-J/S初赛内容主要讲解信息学奥赛的初赛内容&#xff0c;包含计算机基础、初赛常考的C程序和算法以及数据结构&#xff0c;并收集了近年真题以作参考。 如果你想参加信息学奥赛&#xff0c;但之前没有太多C基础&#xff0c;请点击&#x1f449;专栏&#…...

第四十五章 在 SOAP 消息中使用数据集 - 以 XML 形式查看数据集和架构

文章目录 第四十五章 在 SOAP 消息中使用数据集 - 以 XML 形式查看数据集和架构以 XML 形式查看数据集和架构对 WSDL 的影响 第四十五章 在 SOAP 消息中使用数据集 - 以 XML 形式查看数据集和架构 以 XML 形式查看数据集和架构 扩展 %XML.DataSet 的数据集在具有可用于生成 X…...

与枚举结合的策略模式

枚举类&#xff1a; package com.dtranx.tools.corpora.businessapi.enums;import com.dtranx.tools.commons.vo.EnumResponseVo; import com.google.common.collect.Lists;import java.util.List;/*** ClassName SimpleSearchMode* Description TODO* Date 2024/5/28 15:55* A…...

SpringSecurity中文文档(Servlet RememberMe)

Remember-Me Authentication Remember-me 或持久登录身份验证指的是网站能够在会话之间记住主体的标识。这通常是通过向浏览器发送 Cookie 来完成的&#xff0c;Cookie 将在以后的会话中被检测到&#xff0c;并导致自动登录的发生。Spring Security 为这些操作提供了必要的钩子…...

联合概率密度函数

目录 1. 什么是概率密度由联合概率密度求概率参考链接 1. 什么是概率密度 概率密度到底在表达什么&#xff1f; 外卖在20-40分钟内送达的概率 随机变量落在[20,40]之间的概率。下图中&#xff0c;对总面积做规范化处理&#xff0c;令总面积1&#xff0c; f ( x ) f(x) f(x)则成…...

JeepAvenger4xe,1.2T+双电机

近日,懂车之道获悉,Jeep品牌发布Avenger 4xe车型官图,据悉,新车预计今年晚些时候在欧洲上市。下面,和大家一起来看看新车的产品力如何?外观上,Avenger 4xe新车造型更为精致,封闭式七孔格栅装饰,前大灯组合,引擎上更是有多条筋线,下格栅造型硬朗,下包围采用大量黑色…...

最长递增子序列,交错字符串

第一题&#xff1a; 代码如下&#xff1a; int lengthOfLIS(vector<int>& nums) {//dp[i]表示以第i个元素为结尾的最长子序列的长度int n nums.size();int res 1;vector<int> dp(n, 1);for (int i 1; i < n; i){for (int j 0; j < i; j){if (nums[i]…...

MySQL8找不到my.ini配置文件以及报sql_mode=only_full_group_by解决方案

一、找不到my.ini配置文件 MySQL 8 安装或启动过程中&#xff0c;如果系统找不到my.ini文件&#xff0c;通常意味着 MySQL服务器没有找到其配置文件。在Windows系统上&#xff0c;MySQL 8 预期使用my.ini作为配置文件&#xff0c;而不是在某些情况下用到的my.cnf文件。 通过 …...

使用NuScenes数据集生成ROS Bag文件:深度学习与机器人操作的桥梁

在自动驾驶、机器人导航及环境感知的研究中&#xff0c;高质量的数据集是推动算法发展的关键。NuScenes数据集作为一项开源的多模态自动驾驶数据集&#xff0c;提供了丰富的雷达、激光雷达&#xff08;LiDAR&#xff09;、摄像头等多种传感器数据&#xff0c;是进行多传感器融合…...

端口扫描利器--nmap

目录 普通扫描 几种指定目标的方法 TCP/UDP扫描 端口服务扫描 综合扫描 普通扫描 基于端口连接并响应(真实) ​ nmap -sn 网段(0/24)-sn 几种指定目标的方法 单个IP扫描 IP范围扫描 扫描文件里的IP 扫描网段,(排除某IP) 扫描网段(排除某清单IP) TCP/UDP扫描 -sS …...

教你网站如何免费实现https

想要实现https访问最简单有效的的方法就是安装SSL证书。只要证书正常安装上以后&#xff0c;浏览器就不会出现网站不安全提示或者访问被拦截的情况。下面我来教大家怎么去获取免费的SSL证书&#xff0c;又如何安装证书实现https访问。 一、选择免费SSL证书提供商 有多家机构提…...