- 博客(51)
- 收藏
- 关注
原创 sql排序赋值 https://www.cnblogs.com/ilxx1988/p/5579753.html
【代码】sql排序赋值 https://www.cnblogs.com/ilxx1988/p/5579753.html。
2022-09-01 11:04:04
491
原创 Java校验身份证、手机号、银行卡号
public String saveGreenPerson(HttpServletRequest request) { String msg = "验证未通过"; String id = request.getParameter("id"); String username = request.getParameter("username"); String tel = request.getParameter("tel"); .
2022-05-30 10:43:39
1686
1
原创 replace()函数不起作用
字符串是不可变的。因此header_raw_text.replace()不会更改字符串本身。替换后,您必须重新分配结果。header_raw_text = header_raw_text.replace("arrow_upward ", “”)
2022-04-20 13:42:24
811
原创 事务异常回滚
捕获异常,进行事务回滚TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//就是这一句了,加上之后,如果doDbStuff2()抛了异常, //doDbStuff1()是会回滚的 @Transactional(rollbackFor = {
2022-03-23 16:12:24
724
原创 sqlserver中时间、日期是两个字段匹配查询条件
示例:AND CONVERT ( DATETIME, record_date + ' ' + record_time ) >= '2022-03-08 14:44:13' AND CONVERT ( DATETIME, record_date + ' ' + record_time ) <= '2022-03-22 14:44:21' 下面是完整代码:SELECT c.work_shift, c.pid , c.num, d.lose , gp.username, c
2022-03-23 08:35:24
2137
原创 get请求,url地址出现无效字符
springboot项目加入下面配置类,或者降低tomcat版本@Configurationpublic class TomcatConfig { /* * tomcat版本过高,GET请求时url地址出现{,},<,>等符号,视为无效字符 * 会报错The valid characters are defined in RFC 7230 and RFC 3986 * 加入该配置,或者降低tomcat版本号*/ @Bean public Tom
2022-03-09 10:04:05
696
1
原创 SQL查询,百分比+%
SELECT p.id, p.planName , p.nodeUpdateTime, isnull( COUNT ( d.id ), 0 ) AS total, CONVERT(VARCHAR(20),COALESCE ( SUM ( CASE WHEN d.NODE_NAME = '预录入' THEN 1 ELSE 0 END ), 0 )*100/isnull( COUNT ( d.id ), 0 ))+'%' count1, COALESCE ( SUM ( CASE WHEN d.NO
2022-03-08 14:52:16
1279
原创 前端跳转另一个系统会带上本系统的默认前缀
在链接前添加http://所有的请求,只要不指定路径,就是相对路径,也就是说请求时会在请求路径前拼上 页面路径。要协商通信协议
2022-03-07 10:50:38
746
1
原创 java根据日期计算相差的天数
/* * 每隔1秒触发一次*/ @Scheduled(cron = "0/1 * * * * *") public void fixedDelay() throws ParseException { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String endTime="2022-03-04 17:30:00"; Date p
2022-03-04 15:56:48
383
原创 Java根据日期和增加的天数推算预计日期
public void test01() throws ParseException { SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd"); Date parse = dateFormat.parse("2022-02-28"); int n=1; int i = parse.getDate() + n; parse.setDate(i); .
2022-03-04 11:04:11
662
原创 两个数据表统计,合成一条数据的SQL 刷新视图 sp_refreshview viewname
SELECT SUM( oneCount ) oneCount,SUM ( twoCount ) twoCount,SUM ( threeCount ) threeCount,SUM ( fourCount ) fourCount,SUM ( fiveCount ) fiveCount,SUM ( sixCount ) sixCount,SUM ( severnCount ) severnCount,SUM ( eightCount ) eightCount,SUM ( nineCount
2021-10-12 11:01:17
318
原创 左表为基础,查询右表的统计值
SELECTs.project_property,s.project_name,s.project_num,s.input_contract_num,s.input_contract_name,s.total_price,s.net_interest_rate,s.estimated_income,s.estimated_cost,SUM ( isnull( br.cur_back_money, 0 ) ) AS ‘monthly_actual_collection’FROMiwp_
2021-09-29 11:08:32
216
原创 端口被占用
cmd命令行执行查看被占用的8080 端口 ,netstat -ano|findstr 8080然后去任务管理器找到对应的pid 37384我的已关闭,然后就可以了
2021-09-24 10:34:03
52
原创 springboot打包问题
org.springframework.boot spring-boot-maven-plugin true true
2021-06-22 13:45:15
67
原创 时间格式返回
/** * 检查时间 */@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")@DateTimeFormat(pattern = "yyyy-MM-dd")private Date checkTime;,在get方法上面加也行
2021-06-22 09:11:12
110
原创 多条件查询jpa
@Query(value = “select * from mw_user where is_identification = 1 and is_inter_identification = 1 and if(?1 !=’’,mobile=?1,1=1) and if(?2 !=’’,nick=?2,1=1)”,nativeQuery = true)List findBySearch(String mobile,String nick);@Select({"
2021-06-18 17:47:44
440
原创 时间错误!时间格式问题
Failed to convert property value of type ‘java.lang.String’ to required type ‘java.util.Date’ for property ‘checkTime’实体类中加入 @DateTimeFormat(pattern = “yyyy-MM-dd HH:mm:ss”)格式//转换时间格式SimpleDateFormat sdf = new SimpleDateFormat( " yyyy-MM-dd HH:mm:ss" )
2021-06-18 15:41:44
719
原创 SQL优化
1.limit返回前多少条SELECT *FROM PersonsLIMIT 5查询Persons表的所有内容,返回前五条。(PageHelper.startPage分页在SQL语句执行之前使用,相当于,在SQL语句后边家伙加上LIMIT)2.UNION 操作符用于合并两个或多个 SELECT 语句的结果集。应尽量避免在 where 子句中使用 or 来连接条件,否则将导致引擎放弃使用索引而进行全表扫描SELECT id FROM work where id=2UNION ALLSELE
2021-04-12 10:58:46
71
原创 Java之零碎知识点
一》》》》扩展SQL语句列表查询 SELECT * FROM B_Station WHERE CustID=#{custid} andStationNo in <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach>//将授权站点集合里的双引号去除。.replace(""","")String sj = st
2021-04-08 15:03:31
93
原创 Spring boot整合mybatis后端分页
int l_Page = l_course.getInteger("Page");int l_PageSize = l_course.getInteger("Rows");//第一个参数的意思为:当前页数,第二个参数的意思为:每页显示多少条记录PageHelper.startPage(l_Page, l_PageSize);List<BWsCustAuth> bStationAuths = _bStationAuthService.selectBstationAuth(v_custId)
2021-04-01 09:15:47
181
1
原创 字符串转数组,json转字符串,字符串转json
if (stationStr.length() != 0) {//将授权站点集合里的双引号去除。.replace(""","")String sj = stationStr.replace(""", “”);//去除前后[],并以逗号分割成数组String[] split = sj.substring(1, sj.length() - 1).split(",");arr = new String[split.length];//遍历字符串,for (int i = 0; i < spli
2021-03-30 14:21:37
181
原创 跨域问题的产生,如何解决?
**1.**客户端和服务端只要“协议”、“域名”、“端口”任何一个不一样,都表示跨域,如果都一样,则表示它们同源。**2.**从一个域上加载的脚本不允许访问另外一个域的文档属性。**3.**不允许跨域访问并非是浏览器限制了发起跨站请求,而是跨站请求可以正常发起,但是返回结果被浏览器拦截了。同源策略:就是不同的域名, 不同端口, 不同的协议不允许共享资源的。**4.**克服跨域限制的方法有以下五种:(1)通过jsonp跨域(2)通过修改document.domain来跨子域(3)使用window
2021-03-30 10:00:56
220
原创 Spring Boot打成jar包和war包有什么不同
**1.**创建项目时,jar包只有一个启动类,war包是有两个启动类。打war包的放在tomact运行,就会执行第二个启动类。是为了给tomact用。**2.**war包放进tomcat运行,发现端口号变成tomcat默认的8080(我在server.port中设置端口8090)项目名称也必须加上了。**3.**通过jar运行实际上是启动了内置的tomcat,所以用的是应用的配置文件中的端口。直接部署到tomcat之后,内置的tomcat就不会启用,所以相关配置就以安装的tomcat为准,与应用的配
2021-03-30 09:37:24
248
原创 Spring Boot打包部署项目
1.引入pom.xml文件spring boot使用这个插件可以将项目打包成一个可运行的jar,无需在目标服务器安装tomcat等<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifa
2021-03-30 09:00:57
89
原创 Spring boot导出Excel
添加依赖org.apache.poipoi3.17org.apache.poipoi-ooxml3.17导出表名是中文,要加这句编码格式。esponse.setHeader(“Content-Disposition”,“attachment;filename=”+ URLEncoder.encode(fileName,“utf-8”));下面是controller@RequestMapping(value = “UserExcelDownloads”, method = Requ
2021-03-24 09:41:02
304
原创 mybatis后端分页查询
第一个参数的意思为:当前页数,第二个参数的意思为:每页显示多少条记录获取参数后执行PageHelper.startPage(pageNum,pageSize);只对紧跟其后的 第一条SQL语句有效xxxxxxxxxxxxxxxxxxxxxxxxxxxx(它返回的数据,只能返回Page或者是List,Page实际上也是List,所以要用pageinfo来接收)PageInfo page = new PageInfo(selectview,5);//传入连续显示的页数5...
2021-03-11 13:27:53
284
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人