分表后mybatis-plus删除操作失效等问题处理

因为重构dao层,问题太多了,于是想着另起一个章节。
4 count的问题
使用count复用,不需要查询所有字段,否则会出现下面的错误

### SQL: SELECT COUNT(  t.id,t.company_id,t.user_id,t.bind_time,t.role_type,t.job_type,t.student_class,t.is_current,t.used_time,t.is_operational,t1.name AS name,t1.type AS name,t1.tax_no AS name,t1.tel AS name,t1.province AS name,t1.city AS name,t1.area AS name,t1.address AS name,t1.status AS name,t1.creator_id AS name  ) FROM eayc_company_user  t    INNER JOIN eayc_company t1 ON (t1.id = t.company_id)      WHERE   (t1.status = ? AND t.user_id = ?)
### Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't.company_id,t.user_id,t.bind_time,t.role_type,t.job_type,t.student_class,t.is_c' at line 2
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't.company_id,t.user_id,t.bind_time,t.role_type,t.job_type,t.student_class,t.is_c' at line 2at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:239)at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)at com.sun.proxy.$Proxy161.selectOne(Unknown Source)at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:160)at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:89)at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:148)at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89)at com.sun.proxy.$Proxy174.selectJoinCount(Unknown Source)at com.github.yulichang.base.MPJBaseService.selectJoinCount(MPJBaseService.java:54)at com.whty.eayc.user.service.base.impl.EaycCompanyUserServiceImpl.count(EaycCompanyUserServiceImpl.java:156)

处理方案,如下即可

 MPJLambdaWrapper<EaycCompanyUser> mpjLambdaWrapper = new MPJLambdaWrapper<>();mpjLambdaWrapper.select("1").innerJoin(EaycCompany.class,EaycCompany::getId,EaycCompanyUser::getCompanyId);

3 mybatis封装对象的问题
直接使用mybatis自身的对象,会有问题,他的列表对象会设置一个id,导致后续的工程会出问题

 <select id="getStatementDefaultEquations" resultMap="defaultEquationsMap">select<include refid="com.whty.acc.setting.dao.AccStatementMapper.Base_Column_List_Udf"></include>,<include refid="com.whty.acc.setting.dao.AccStatementDefaultMapper.Base_Column_List_Udf"></include>from acc_statement accStatementleft join acc_statement_default accStatementDefaulton accStatement.id = accStatementDefault.sheet_idwhere accStatement.accounting_standard = #{standard}and accStatement.type = #{type}order by accStatement.id, accStatementDefault.id</select><resultMap id="defaultEquationsMap" type="com.whty.acc.setting.dto.dto.StatementDefaultEquationDto" extends="com.whty.acc.setting.dao.AccStatementMapper.BaseResultMapUdf"><collection property="accStatementDefaults" ofType="com.whty.acc.setting.pojo.AccStatementDefault" resultMap="com.whty.acc.setting.dao.AccStatementDefaultMapper.BaseResultMapUdf"></collection></resultMap>

调整如下,按照mybatis的写法,对象才能封装正确

@Overridepublic List<StatementDefaultEquationDto> getStatementDefaultEquations(String type, String standard) {MPJLambdaWrapper<AccStatement> mpjLambdaWrapper = new MPJLambdaWrapper<>();mpjLambdaWrapper.selectAll(AccStatement.class).selectCollection(AccStatementDefault.class,StatementDefaultEquationDto::getAccStatementDefaults).leftJoin(AccStatementDefault.class,AccStatementDefault::getSheetId,AccStatement::getId);mpjLambdaWrapper.eq(AccStatement::getAccountingStandard,standard);mpjLambdaWrapper.eq(AccStatement::getType,type);mpjLambdaWrapper.orderByAsc(AccStatement::getId);mpjLambdaWrapper.orderByAsc(AccStatementDefault::getId);return selectJoinList(StatementDefaultEquationDto.class,mpjLambdaWrapper);}

2 看似是空指针异常,实则与mybatis-plus写法有关系。

09:54:55.293 ERROR c.w.a.s.controller.AccBalanceSheetController - null
java.lang.NullPointerException: nullat com.whty.acc.statement.service.ext.impl.AccBalanceSheetExtServiceImpl.genBalanceAndNoteBySimpleDto(AccBalanceSheetExtServiceImpl.java:1333)at com.whty.acc.statement.service.ext.impl.AccBalanceSheetExtServiceImpl.genSheetLineBalanceBySimpleDto(AccBalanceSheetExtServiceImpl.java:1257)at com.whty.acc.statement.service.ext.impl.AccBalanceSheetExtServiceImpl.assetsBySimpleDto(AccBalanceSheetExtServiceImpl.java:574)at com.whty.acc.statement.service.ext.impl.AccBalanceSheetExtServiceImpl.getDataBySimpleDto(AccBalanceSheetExtServiceImpl.java:392)at com.whty.acc.statement.service.ext.impl.AccBalanceSheetExtServiceImpl.getBalanceSheet(AccBalanceSheetExtServiceImpl.java:158)at com.whty.acc.statement.service.ext.impl.AccBalanceSheetExtServiceImpl$$FastClassBySpringCGLIB$$4edc7667.invoke(<generated>)
java.lang.NullPointerException: nullat com.whty.acc.statement.service.ext.impl.AccCashFlowEquationServiceImpl.lambda$getEquationDtos$3(AccCashFlowEquationServiceImpl.java:170)at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)at com.whty.acc.statement.service.ext.impl.AccCashFlowEquationServiceImpl.getEquationDtos(AccCashFlowEquationServiceImpl.java:170)at com.whty.acc.statement.service.ext.impl.AccCashFlowEquationServiceImpl.getCashFlowByEquation(AccCashFlowEquationServiceImpl.java:87)at com.whty.acc.statement.service.ext.impl.AccCashFlowSheetExtServiceImpl.getCashFlowSheetDtos(AccCashFlowSheetExtServiceImpl.java:91)at com.whty.acc.statement.service.ext.impl.AccCashFlowSheetExtServiceImpl$$FastClassBySpringCGLIB$$3b4f4002.invoke(<generated>)

1 分表后没有生产导致sql异常
下面这个语句咋一看是没有任何问题的,但实际根本没有acc_voucher这张表,因为数据库做了分表。
所以问题在为什么mybatis-plus后,delete操作分表没有生效。
下面是正常情况,ShardingSphere-SQL会做一次翻译
1
但下面删除操作却没有,为什么呢?

### SQL: DELETE FROM    acc_voucher t           WHERE   (t.as_id = ? AND t.id = ?)
### Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't WHERE (t.as_id = 92293 AND t.id = 2)' at line 2
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't WHERE (t.as_id = 92293 AND t.id = 2)' at line 2at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:239)at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)at com.sun.proxy.$Proxy169.delete(Unknown Source)at org.mybatis.spring.SqlSessionTemplate.delete(SqlSessionTemplate.java:304)at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:69)at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:148)at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89)at com.sun.proxy.$Proxy174.delete(Unknown Source)at com.baomidou.mybatisplus.extension.service.IService.remove(IService.java:149)at com.whty.acc.voucher.service.base.impl.AccVoucherServiceImpl.deleteByPrimaryKey(AccVoucherServiceImpl.java:89)at com.whty.acc.voucher.service.base.impl.AccVoucherServiceImpl$$FastClassBySpringCGLIB$$f3310a26.invoke(<generated>)at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708)at com.whty.acc.voucher.service.base.impl.AccVoucherServiceImpl$$EnhancerBySpringCGLIB$$9a0ca76a.deleteByPrimaryKey(<generated>)at com.whty.acc.voucher.service.dubbo.consume.impl.AccVoucherDubboConsumeImpl.remove(AccVoucherDubboConsumeImpl.java:101)at com.whty.acc.voucher.service.dubbo.consume.impl.AccVoucherDubboConsumeImpl.removeByLock(AccVoucherDubboConsumeImpl.java:79)at com.whty.acc.voucher.service.dubbo.consume.impl.AccVoucherDubboConsumeImpl$$FastClassBySpringCGLIB$$e041f606.invoke(<generated>)at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)at org.springframework.aop.aspectj.AspectJAfterAdvice.invoke(AspectJAfterAdvice.java:49)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:58)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708)at com.whty.acc.voucher.service.dubbo.consume.impl.AccVoucherDubboConsumeImpl$$EnhancerBySpringCGLIB$$c79c2987.removeByLock(<generated>)at com.whty.acc.voucher.controller.AccVoucherController.remove(AccVoucherController.java:583)at com.whty.acc.voucher.controller.AccVoucherController$$FastClassBySpringCGLIB$$271f1de3.invoke(<generated>)at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:123)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:102)at com.whty.acc.setting.annotation.WebLogAspect.around(WebLogAspect.java:60)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:498)at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:634)at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:624)at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:72)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:58)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708)at com.whty.acc.voucher.controller.AccVoucherController$$EnhancerBySpringCGLIB$$ca9bb02d.remove(<generated>)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:498)at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1071)at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:964)at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)at org.springframework.web.servlet.FrameworkServlet.doDelete(FrameworkServlet.java:931)at javax.servlet.http.HttpServlet.service(HttpServlet.java:671)at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)at com.whty.framework.web.filter.CorsFilter.doFilter(CorsFilter.java:41)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177)at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891)at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1784)at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)at java.lang.Thread.run(Thread.java:748)

查看删除操作的代码

 @Transactional@Overridepublic boolean deleteByPrimaryKey(Integer asId, Integer id) {MPJLambdaWrapper<AccVoucher> mpjLambdaWrapper = new MPJLambdaWrapper<>();mpjLambdaWrapper.eq(AccVoucher::getAsId,asId);mpjLambdaWrapper.eq(AccVoucher::getId,id);return remove(mpjLambdaWrapper);}

调整如下,问题就解决了,看来问题在MPJLambdaWrapper,对分表的删除操作有影响。

 @Transactional@Overridepublic boolean deleteByPrimaryKey(Integer asId, Integer id) {LambdaQueryWrapper<AccVoucher> mpjLambdaWrapper = new LambdaQueryWrapper<>();mpjLambdaWrapper.eq(AccVoucher::getAsId,asId);mpjLambdaWrapper.eq(AccVoucher::getId,id);return remove(mpjLambdaWrapper);}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/6049.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

openSUSE leap 15.3安装mysql-community-server

openSUSE Software 下载"https://software.opensuse.org/ymp/home:bjoernv/15.3/mysql-community-server.ymp" wget "https://software.opensuse.org/ymp/home:bjoernv/15.3/mysql-community-server.ymp" 双击"mysql-community-server.ymp" 添…

【算法基础:搜索与图论】3.2 树与图的dfs和bfs

文章目录 例题846. 树的重心&#xff08;深度优先遍历 / 树形DP&#xff09;⭐⭐⭐⭐⭐&#x1f6b9;&#x1f6b9;&#x1f6b9;&#x1f6b9;&#x1f6b9;&#xff08;重要&#xff01;好题&#xff01;&#xff09;847. 图中点的层次 相关链接 要学会建树、建图的通用方法。…

s390x 架构docker安装mysql

由于 MySQL 官方未提供 s390x 架构镜像&#xff0c;所以在应用商店启用 MySQL 前&#xff0c;需要手动修改 MySQL 镜像版本 MySQL 5.7 下载 s390x 架构最新版本镜像 docker pull ibmcom/mysql-s390x:5.7.34将镜像重命名为 1Panel 应用商店中使用的 MySQL 版本 docker tag i…

逻辑回归概述

逻辑回归介绍 1. 逻辑回归的应用场景 逻辑回归(Logistic Regression)是机器学习中的 一种分类模型 ,逻辑回归是一种分类算法,虽然名字中带有回归。由于算法的简单和高效,在实际中应用非常广泛 广告点击率是否为垃圾邮件是否患病信用卡账单是否会违约 逻辑回归就是解决二…

【Matlab】基于遗传算法优化 BP 神经网络的数据回归预测(Excel可直接替换数据)

【Matlab】基于遗传算法优化 BP 神经网络的数据回归预测&#xff08;Excel可直接替换数据&#xff09; 1.模型原理2.文件结构3.Excel数据4.分块代码4.1 arithXover.m4.2 delta.m4.3 ga.m4.4 gabpEval.m4.5 initializega.m4.6 maxGenTerm.m4.7 nonUnifMutation.m4.8 normGeomSel…

org.springframework.web.client.RestTemplate 的使用

目录 前言使用配置具体使用 前言 后端难免会发送请求&#xff0c;大致分为两种请求&#xff1a;微服务之间的内部请求和系统之间的外部请求&#xff0c;org.springframework.web.client.RestTemplate对这两种请求都支持。 使用 配置 import org.springframework.cloud.clie…

为harbor仓库添加https,新增DigiCert 免费版SSL证书

完成效果&#xff1a; 前言&#xff1a;在本地搭建好docker的镜像仓库harbor后&#xff0c;当我们登录docker login时&#xff0c;会提示证书问题x509: cannot validate certificate 登录本地报错X509 无法登录仓库也无法上传和拉取镜像&#xff0c;虽然有本机的解决方法&…

300M的联通宽带,电脑直接连接光猫只有100M;电脑连接路由器,然后路由器连接光猫却有300M???

1. 现象 300M的联通宽带&#xff0c;用了小半年之后发现网络比以前满&#xff0c;通过https://www.speedtest.cn网站测试发现只有100M 2. 猜测 难道是联通这帮人&#xff0c;偷偷把我网速降到了100M&#xff1f;&#xff1f;&#xff1f; 3. 排查过程 打电话让联通师傅上门排查…

Windows下YUICompress实现js、css混淆压缩

首先&#xff0c;我们针对Linux下的部分命令进行Windows系统的对应实现 ls————cmd /c dir/b rm————cmd /c del mv————cmd /c move pwd————cmd /c chdir 注&#xff1a;cmd /c是执行完命令后关闭命令行窗口、cmd /k是执行完命令后不关闭命令行窗口、cmd /c sta…

归并排序与计数排序

目录 一、归并排序 1.基本思想 2.归并排序的特性总结&#xff1a; 3.代码实现&#xff1a; 4.代码优化 &#xff1a; 二、计数排序&#xff08;非比较排序&#xff09; 1. 概念&#xff1a; 2.计数排序的特性总结&#xff1a; 3.代码实现&#xff1a; 一、归并排序 1.…

香农极限是如何影响光纤容量的

1 引言 上世纪末&#xff0c;DWDM技术开始在干线通信中使用并迅速普及。虽然当时DWDM系统的容量只有402.5G&#xff0c;但实验室中DWDM支持的波道数甚至超过了1000波&#xff0c;单波道速率也飙到了惊人的160G&#xff08;超1000波和单波160G是两个独立事件&#xff09;。人们普…

自定义类型:结构体进阶学习分享

自定义类型&#xff1a;结构体进阶学习分享 前言1 结构体的基础知识2 结构的声明3 特殊声明4 结构的自引用5 结构体变量的定义和初始化6 结构体内存对齐6.1 计算结构体大小相关笔试题&#xff08;基于VS&#xff09;笔试题一&#xff1a;笔试题二&#xff1a; 6.2 为什么存在内…

使用Kafka Streams开发流处理应用

使用Kafka Streams开发流处理应用 一、简介1.1 Kafka Streams定义1.2 Kafka Streams的优势1.3 Kafka Streams应用场景 二、环境搭建2.1 安装Kafka2.2 安装Kafka Streams2.3 构建Kafka集群 三、Kafka Streams编程API介绍3.1 Kafka Streams主要API3.2 应用程序的配置和参数3.3 To…

FFmpeg 命令行实现居中高清上下模糊播放效果

FFmpeg 命令行实现居中高清上下模糊播放效果。 1、16:9 的横屏原视频&#xff0c;以 16:9 竖屏上下模糊播放 以该效果播放视频的命令如下&#xff1a; ffplay -i horizontal_test_video_169.mp4 -vf \ "split[a][b]; \ [a]crop(ih/16*9):ih,scaleiw/10:-1,gblursigma5…

分布式 - 负载均衡Nginx:Nginx常见问题总结(一)

文章目录 01. 什么是Nginx&#xff1f;02. 为什么要用Nginx?03. 为什么Nginx性能这么高&#xff1f;04. Nginx 为什么不使用多线程&#xff1f;05. Nginx 请求处理流程是什么&#xff1f;06. Nginx怎么处理请求的&#xff1f;07. 什么是正向代理和反向代理&#xff1f;08. 反向…

Python爬虫学习笔记(七)————Selenium

目录 1.什么是selenium&#xff1f; 2.为什么使用selenium&#xff1f; 3.selenium安装 4.selenium的使用步骤 5.selenium的元素定位 6.访问元素信息 7.交互 1.什么是selenium&#xff1f; &#xff08;1&#xff09;Selenium是一个用于Web应用程序测试的工具。 &#…

深度理解 Spring AOP

一、什么是AOP(面向切面编程)&#xff1f;&#x1f349; AOP 为 Aspect Oriented Programming 的缩写&#xff0c;意思为面向切面编程&#xff0c;是通过预编译方式 和运行期 动态代理 实现程序功能的统一维护的一种技术。 AOP &#xff08;面向切面编程&#xff09;是 OOP&a…

代码随想录额外题目| 数组02 ●189旋转数组 ●724寻找数组中心索引

#189旋转数组 很快写出来但是用了个新数组&#xff0c;不好 void rotate(vector<int>& nums, int k) {vector<int> res(nums.size(),0);for(int i0;i<nums.size();i){int newiik;if(newi>nums.size()-1) newinewi%nums.size();res[newi]nums[i];}numsr…

【react】react18的学习(十二)– 底层原理(二)之 迭代器 iterator

迭代器iterator 是一种 ES6 规范&#xff0c;具有这种机制的数据结构才可以使用for of循环&#xff1a;返回每一项的值&#xff1b; 原型链具有Symbol.iterator属性的数据结构都具备&#xff1b;如数组、部分类数组、字符串等&#xff1b; 普通对象就不能用&#xff1b; for-…

vue组件(个人学习笔记三)

目录 友情提醒第一章、vue的组件1.1&#xff09;什么是SPA应用1.2&#xff09;vue的组件简介1.3&#xff09;vue工程中的main.js文件 第二章、Vue组件的使用2.1&#xff09;一般组件的自定义2.2&#xff09;注册组件&#xff1a;全局注册和局部注册2.2.1&#xff09;全局注册&a…