一个开源的企业级自动化办公(OA)系统项目 -SpringBoot依赖升级篇

项目: https://gitee.com/aaluoxiang/oa_system

介绍:

办公自动化(OA)是面向组织的日常运作和管理,员工及管理者使用频率最高的应用系统,极大提高公司的办公效率。oasys是一个OA办公自动化系统,使用Maven进行项目管理,基于springboot框架开发的项目,mysql底层数据库,前端采用freemarker模板引擎,Bootstrap作为前端UI框架,集成了jpa、mybatis等框架

  1. 我直接用IDEA克隆打开的,发现报错javax.validation.Validationorg.hibernate.validator.constraints.NotEmpty@RunWith @Test 需要junit4
<dependency>
	<groupId>org.hibernate</groupId>
	<artifactId>hibernate-validator</artifactId>
	<version>5.3.4.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
<dependency>
	<groupId>javax.validation</groupId>
	<artifactId>validation-api</artifactId>
	<version>2.0.1.Final</version>
</dependency>
<dependency>
	<groupId>junit</groupId>
	<artifactId>junit</artifactId>
	<scope>test</scope>
	<version>4.13.2</version>
</dependency>

<!-- springload maven下载不了,舍弃 -->

SpringData JPA的函数变动:

SpringBoot 2.0以下SpringBoot 2.0 以上
findOne()findById().get()
new PageRequest()PageRequest().of()
new Sort()Sort.by()
delete()deleteById()
  1. No property in found for type Notepaper!
public interface NotepaperDao extends JpaRepository<Notepaper, Long> {
	
	//查找
	@Query(nativeQuery=true,value="SELECT * from aoa_notepaper n where n.notepaper_user_id=?1 ORDER BY n.create_time DESC LIMIT 0,5")
	List<Notepaper> findByUserIdOrderByCreateTimeDesc(long userid);
	
	// 根据用户找便签
	Page<Notepaper> findByUserIdOrderByCreateTimeDesc(User user,Pageable pa);

	// 根据用户找便签
//	Page<Notepaper> findByUserIdOrderByCreateTimeDesc(Pageable page);

	/**
	 * 模糊查询
	 * 
	 * @param baseKey
	 * @param page
	 * @return
	 */
	Page<Notepaper> findByTitleLikeOrderByCreateTimeDesc(String baseKey, Pageable page);
}

3.Operator SIMPLE_PROPERTY on users requires a scalar argument

public interface DaymanageDao extends JpaRepository<ScheduleList,Long>{
	
	List<ScheduleList> findByUser(User user);
	//这两行名字改下
	List<ScheduleList> findByUsersIn(List<User> users);
	//这两行名字改下
	Page<ScheduleList> findByUsersIn(List<User> users,Pageable pa);
	
	Page<ScheduleList> findByUser(User user,Pageable pa);
	
	Page<ScheduleList> findByUserAndUsersIn(User user,List<User> users,Pageable pa);
}
  1. 替换 拦截器
//配置拦截器
@Configuration
public class Interceptorconfig implements WebMvcConfigurer {
    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        configurer.setUseSuffixPatternMatch(false);
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**")
                .addResourceLocations("classpath:/static/");
    }

}
  1. application.yml
attachment:
    roopath: D:/oasys/resources/static/attachment
file:
    root:
        path: D:/oasys/resources/static/file
img:
    rootpath: D:/oasys/resources/static/images
mybatis:
    mapper-locations: classpath*:/mappers/*.xml
    type-aliases-package: cn.gson.oasys.model.entity
server:
    port: 8088
spring:
    datasource:
        driver-class-name: com.mysql.cj.jdbc.Driver
        password: root
        url: jdbc:mysql://localhost:3306/oasys?autoReconnect=true&useSSL=false&characterEncoding=utf-8&serverTimezone=GMT%2B8
        username: root
    freemarker:
        suffix: .ftl                                 # 设置模板后缀名
        content-type: text/html                      # 设置文档类型
        charset: UTF-8                               # 设置页面编码格式
        cache: false                                 # 设置页面缓存
        template-loader-path: classpath:/templates   # 设置ftl文件路径
    http:
        multipart:
            enabled: true
            file-size-threshold: 5MB
            max-file-size: 500MB
            max-request-size: 200MB
            resolve-lazily: false

  1. 创建文件夹
D:/oasys/resources/static/attachment
D:/oasys/resources/static/file
D:/oasys/resources/static/images 

将 oasys.jpg 图片 放到 D:/oasys/resources/static/images 下

  1. 暂时能记得的就这么多,启动无报错!

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

文章原创,项目非原创

chsengni@126.com


版权声明:本文为qq_37655607原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。