摘要: List的stream public ResultData queryMenuList() { // 获取所有数据List List<MenuVo> list = MenuDao.queryMenuList(); // 通过list.stream()将List结构转成Tree结构并返回 List<M 阅读全文
posted @ 2022-11-30 15:43 静沐丶暖阳 阅读(292) 评论(0) 推荐(0) 编辑
摘要: 1 @Data 2 public class ResultData implements Serializable { 3 4 /** 5 * 状态码 6 */ 7 private String code; 8 9 /** 10 * 提示信息 11 */ 12 private String msg; 阅读全文
posted @ 2022-08-15 21:08 静沐丶暖阳 阅读(85) 评论(0) 推荐(0) 编辑
摘要: 1 public ResultData backupDatabase(Integer type) { 2 // 构建备份sql的文件名 3 String sqlFileName = "test" + new SimpleDateFormat("yyyyMMddHHmmss").format(new 阅读全文
posted @ 2022-08-15 16:22 静沐丶暖阳 阅读(619) 评论(0) 推荐(0) 编辑
摘要: 1 import common.util.StringUtil; 2 import org.springframework.web.bind.annotation.ModelAttribute; 3 4 import javax.servlet.http.HttpServletRequest; 5 阅读全文
posted @ 2022-08-15 15:59 静沐丶暖阳 阅读(950) 评论(0) 推荐(0) 编辑
摘要: 1. 书写顺序 select->distinct->from->join->on->where->group by->having->order by->limit 2. 执行顺序 from->on->join->where->group by->sum、count、max、avg->having- 阅读全文
posted @ 2022-02-07 21:03 静沐丶暖阳 阅读(966) 评论(0) 推荐(0) 编辑
摘要: 一. 基础调优(从Sql语句角度) 1. 单条记录查询最后添加 limit 1, 避免全表查询; 2. 针对sql执行过长的语句进行explain解析, 再做相应调优; 3. where子句尽量避免: - 表达式; - 对null值判断,建议对null值设置默认值0; - 函数操作; - 使用!=或 阅读全文
posted @ 2022-02-07 20:10 静沐丶暖阳 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 1. 通过关联字段把一张表的字段值更新另一张表的字段值 update table_a a, table_b b set a.username = b.username where a.id = b.id; -- 以下2种更新结果以table_b的查询结果为准,table_b中没有查到的记录会全部被更 阅读全文
posted @ 2022-02-07 16:37 静沐丶暖阳 阅读(69) 评论(0) 推荐(0) 编辑
摘要: 1.<if> <select id="" parameterType="" resultType=""> select * from user where 1 = 1 <if test="username != null"> and username = #{username} </if> <if 阅读全文
posted @ 2022-02-07 10:46 静沐丶暖阳 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 1.添加依赖 1 <dependency> 2 <groupId>com.github.pagehelper</groupId> 3 <artifactId>pagehelper</artifactId> 4 <version>5.1.4</version> 5 </dependency> 2.ya 阅读全文
posted @ 2022-01-20 21:33 静沐丶暖阳 阅读(401) 评论(0) 推荐(0) 编辑
摘要: 开发过程中常用的Mysql函数: 函数 作用 示例 返回值 数 学 函 数 RAND() 返回0->1的随机数 SELECT RAND() 0.93099315644334 RAND() 返回0->X的随机数 SELECT RAND(2) 1.5865798029924 SQRT(x) 返回x的平方 阅读全文
posted @ 2022-01-10 10:57 静沐丶暖阳 阅读(44) 评论(0) 推荐(0) 编辑