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

什么网站可以请人做软件郑州纯手工seo

什么网站可以请人做软件,郑州纯手工seo,网页网站怎么做的,网站良精企业网站系统PaginationInnerInterceptor 此插件是核心插件,目前代理了 Executor#query 和 Executor#update 和 StatementHandler#prepare 方法。 在SpringBoot环境中配置方式如下#xff1a; /*** author giserDev* description 配置分页插件、方言、mapper包扫描等* date 2023-12-13 …PaginationInnerInterceptor 此插件是核心插件,目前代理了 Executor#query 和 Executor#update 和 StatementHandler#prepare 方法。 在SpringBoot环境中配置方式如下 /*** author giserDev* description 配置分页插件、方言、mapper包扫描等* date 2023-12-13 23:23:35*/ Configuration MapperScan(com.giser.mybatisplus.mapper) public class MyBatisPlusConfig {Beanpublic MybatisPlusInterceptor mybatisPlusInterceptor(){MybatisPlusInterceptor mybatisPlusInterceptor new MybatisPlusInterceptor();mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));return mybatisPlusInterceptor;}}测试分页功能 import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.giser.mybatisplus.mapper.UserMapper; import com.giser.mybatisplus.pojo.User; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest;/*** author giserDev* description* date 2023-12-13 23:28:43*/ Slf4j SpringBootTest public class MyBatisPlusPluginsTest {Autowiredprivate UserMapper userMapper;Testpublic void testMyBatisPlusPage(){PageUser page new Page(1,3);userMapper.selectPage(page, null);log.info(分页查询结果为{}, page);}}如何自定义分页 # mybatis-plus配置 mybatis-plus:configuration:# 引入日志log-impl: org.apache.ibatis.logging.stdout.StdOutImplglobal-config:db-config:# 配置MybatisPlus操作的表的前缀table-prefix: t_# 配置MybatisPlus的主键生成策略id-type: assign_id# 指定类型别名type-aliases-package: com.giser.mybatisplus.pojo在Mapper接口中定义分页方法 Repository public interface UserMapper extends BaseMapperUser {/*** 利用MybatisPlus的分页功能* param page 分页对象必须在第一个参数位置传递参数 Page 即自动分页* param userName 查询条件* return 结果*/PageUser selectPageByName(Param(page) PageUser page, Param(userName) String userName);}在Mapper.xml文件中实现分页语句 ?xml version1.0 encodingUTF-8 ? !DOCTYPE mapperPUBLIC -//mybatis.org//DTD Mapper 3.0//ENhttp://mybatis.org/dtd/mybatis-3-mapper.dtd mapper namespacecom.giser.mybatisplus.mapper.UserMapperselect idselectPageByName resultTypeUserselect * from user where user_name #{userName}/select/mapper分页测试 import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.giser.mybatisplus.mapper.UserMapper; import com.giser.mybatisplus.pojo.User; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest;Slf4j SpringBootTest public class MyBatisPlusPluginsTest {Autowiredprivate UserMapper userMapper;/*** Preparing: SELECT COUNT(*) AS total FROM user WHERE is_deleted 0* Parameters:* Columns: total* Row: 25* Total: 1* Preparing: SELECT id,user_name AS name,age,email,is_deleted FROM user WHERE is_deleted0 LIMIT ?* Parameters: 3(Long)* Columns: id, name, age, email, is_deleted* Row: 1, Jone, 18, test1baomidou.com, 0* Row: 2, 窃听风云, 23, giserDev163.com, 0* Row: 3, Tom, 28, test3baomidou.com, 0* Total: 3* Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession3a109ff7]* 分页查询结果为com.baomidou.mybatisplus.extension.plugins.pagination.Page5ee77baf* 分页查询记录结果为[User(id1, nameJone, age18, emailtest1baomidou.com, isDeleted0), User(id2, name窃听风云, age23, emailgiserDev163.com, isDeleted0), User(id3, nameTom, age28, emailtest3baomidou.com, isDeleted0)]* 分页查询记录条数为25* 分页查询当前页码为1* 分页查询每页大小为3*/Testpublic void testMyBatisPlusPage(){PageUser page new Page(1,3);userMapper.selectPage(page, null);log.info(分页查询结果为{}, page);log.info(分页查询记录结果为{}, page.getRecords());log.info(分页查询记录条数为{}, page.getTotal());log.info(分页查询当前页码为{}, page.getCurrent());log.info(分页查询每页大小为{}, page.getSize());}/*** Preparing: SELECT COUNT(*) AS total FROM user WHERE user_name ?* Parameters: 李雷(String)* Columns: total* Row: 1* Total: 1* Preparing: select * from user where user_name ? LIMIT ?* Parameters: 李雷(String), 3(Long)* Columns: id, user_name, age, email, is_deleted* Row: 1734579107187970050, 李雷, 12, null, 1* Total: 1* Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSessiona316f6b]* 分页查询结果为com.baomidou.mybatisplus.extension.plugins.pagination.Page48368a08* 分页查询记录结果为[User(id1734579107187970050, namenull, age12, emailnull, isDeleted1)]* 分页查询记录条数为1* 分页查询当前页码为1* 分页查询每页大小为3*/Testvoid testAutoPage(){PageUser page new Page(1,3);userMapper.selectPageByName(page, 李雷);log.info(分页查询结果为{}, page);log.info(分页查询记录结果为{}, page.getRecords());log.info(分页查询记录条数为{}, page.getTotal());log.info(分页查询当前页码为{}, page.getCurrent());log.info(分页查询每页大小为{}, page.getSize());}}问题分页参数处理原理 拦截执行的语句 org.apache.ibatis.plugin.Plugin#invoke if (methods ! null methods.contains(method)) { return interceptor.intercept(new Invocation(target, method, args)); }com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor#intercept Overridepublic Object intercept(Invocation invocation) throws Throwable {// ...for (InnerInterceptor query : interceptors) {// com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor#willDoQuery// willDoQuery()先判断总条数决定是否执行sql语句if (!query.willDoQuery(executor, ms, parameter, rowBounds, resultHandler, boundSql)) {return Collections.emptyList();}// beforeQuery()处理排序、分页方言query.beforeQuery(executor, ms, parameter, rowBounds, resultHandler, boundSql); }// ...Overridepublic boolean willDoQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException {// 查找分页参数IPage? page ParameterUtils.findPage(parameter).orElse(null);if (page null || page.getSize() 0 || !page.searchCount()) {return true;}// ...// 组装统计语句判断总条数long total 0;if (CollectionUtils.isNotEmpty(result)) {// 个别数据库 count 没数据不会返回 0Object o result.get(0);if (o ! null) {total Long.parseLong(o.toString());}}page.setTotal(total);// protected boolean continuePage(IPage? page)// 返回是否继续执行后面的查询语句执行则返回true,否则返回falsereturn continuePage(page);}willDoQuery()方法中包含查询分页参数的逻辑如下 /*** 查找分页参数** param parameterObject 参数对象* return 分页参数*/ public static OptionalIPage findPage(Object parameterObject) {if (parameterObject ! null) {// 若参数类型为Map则从map中查找类型为IPage的参数作为分页参数if (parameterObject instanceof Map) {Map?, ? parameterMap (Map?, ?) parameterObject;for (Map.Entry entry : parameterMap.entrySet()) {if (entry.getValue() ! null entry.getValue() instanceof IPage) {return Optional.of((IPage) entry.getValue());}}} else if (parameterObject instanceof IPage) {// 若参数类型为IPage则直接返回作为分页参数return Optional.of((IPage) parameterObject);}}return Optional.empty(); }com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor#beforeQuery Overridepublic void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException {IPage? page ParameterUtils.findPage(parameter).orElse(null);if (null page) {return;}// 处理 orderBy 拼接boolean addOrdered false;String buildSql boundSql.getSql();ListOrderItem orders page.orders();if (CollectionUtils.isNotEmpty(orders)) {addOrdered true;buildSql this.concatOrderBy(buildSql, orders);}// size 小于 0 且不限制返回值则不构造分页sqlLong _limit page.maxLimit() ! null ? page.maxLimit() : maxLimit;if (page.getSize() 0 null _limit) {if (addOrdered) {PluginUtils.mpBoundSql(boundSql).sql(buildSql);}return;}handlerLimit(page, _limit);// 查找方言在配置分页插件时设置了DbType此时可确定方言如此时返回的是com.baomidou.mybatisplus.extension.plugins.pagination.dialects.MySqlDialectIDialect dialect findIDialect(executor);final Configuration configuration ms.getConfiguration();// 构造分页语句com.baomidou.mybatisplus.extension.plugins.pagination.dialects.IDialect#buildPaginationSql// 此时dialect为MySqlDialect会调用com.baomidou.mybatisplus.extension.plugins.pagination.dialects.MySqlDialect#buildPaginationSql来构造sqlDialectModel model dialect.buildPaginationSql(buildSql, page.offset(), page.getSize());// ...// 此处绑定执行的sql语句model.getDialectSql()mpBoundSql.sql(model.getDialectSql());mpBoundSql.parameterMappings(mappings);}com.baomidou.mybatisplus.extension.plugins.pagination.dialects.MySqlDialect#buildPaginationSql public class MySqlDialect implements IDialect {Overridepublic DialectModel buildPaginationSql(String originalSql, long offset, long limit) {StringBuilder sql new StringBuilder(originalSql).append( LIMIT ).append(FIRST_MARK);if (offset ! 0L) {sql.append(StringPool.COMMA).append(SECOND_MARK);return new DialectModel(sql.toString(), offset, limit).setConsumerChain();} else {return new DialectModel(sql.toString(), limit).setConsumer(true);}} }
http://www.w-s-a.com/news/473395/

相关文章:

  • 南城网站仿做无锡网站制作哪家价格便宜
  • c做的网站营销策划课程
  • 免费网站404免费进入重庆的公需科目在哪个网站做
  • 网站空间租用费用网站建设公司怎么宣传
  • 镇江网站建设优化案例分析dw2018网页制作步骤图文
  • 网站开发一个多少钱为什么前端都不用dw
  • 网站降权的原因北京中小企业网站建设公司
  • 个人域名能做网站吗wordpress
  • 手机网站设计只找亿企邦工业设计公司简介
  • 腾讯云主机做网站免费网站怎么做啊
  • 网站建设推广销售话术广州网页定制多少钱
  • 备案号是哪个网站项目管理pmp
  • 做网站需要哪些硬件软件网站视频链接怎么做的
  • 电子商务网站建设试题二wordpress主页显示浏览数
  • 网站快照没了广州企业电话大全
  • 网站项目开发收费标准网站开发app开发主营业务
  • 怎么到国外网站去接模具订单做互联网建设企业网站
  • 深圳品牌网站建设公司排名洪雅网站建设
  • nodejs 做网站wordpress主题绕过激活码
  • 平湖模板网站建设公司网页美工培训
  • 顺德网站建设市场建设工程交易中心网站
  • 深圳企业网站怎么做浪琴手表网站建设图
  • 2018网站外链怎么做济南 网站设计公司
  • 承德百度网站建设郑州网站seo优化公司
  • 四川建站模板网站公司分类信息网站制作
  • 网站开发前后端有wordpress模板安装教程视频教程
  • 有网站想修改里面的内容怎么做怎么做黑彩黑彩网站
  • 什么专业会做网站网站建设续费合同
  • 网站开发的项目开发网站做直播功能需要注册吗
  • 网站开发新手什么软件好网站设计师和ui设计师