1.权限开发:jwt,shiro
2.企业报表的解决方法:poi(xls) ,jasper(pdf)
3.代码生成工具的制作与解析
4.企业工作流定制:activiti7
5.人工智能:人脸登录
只提供基础设备,例如服务器(cpu、内存、网络)
包含服务器、操作系统、数据库、运行环境库
包含服务器、操作系统、数据库、运行环境库、应用
- <dependency>
- <groupId>org.projectlombokgroupId>
- <artifactId>lombokartifactId>
- <version>1.16.16version>
- dependency>
1.选择maven,因为父工程不需要什么骨架,直接next创建
2.应为父工程没有代码,所有把src目录删掉
- <packaging>pompackaging>
- <name>ihrm_parentname>
- <description>IHRM-黑马程序员description>
-
- <parent>
- <groupId>org.springframework.bootgroupId>
- <artifactId>spring-boot-starter-parentartifactId>
- <version>2.0.5.RELEASEversion>
- <relativePath/>
- parent>
-
- <properties>
- <project.build.sourceEncoding>UTF-8project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8project.reporting.outputEncoding>
- <java.version>1.8java.version>
- <fastjson.version>1.2.47fastjson.version>
- properties>
-
- <dependencies>
- <dependency>
- <groupId>org.springframework.bootgroupId>
- <artifactId>spring-boot-starter-webartifactId>
- dependency>
- <dependency>
- <groupId>org.springframework.bootgroupId>
- <artifactId>spring-boot-starter-loggingartifactId>
- dependency>
- <dependency>
- <groupId>org.springframework.bootgroupId>
- <artifactId>spring-boot-starter-testartifactId>
- <scope>testscope>
- dependency>
- <dependency>
- <groupId>com.alibabagroupId>
- <artifactId>fastjsonartifactId>
- <version>${fastjson.version}version>
- dependency>
- <dependency>
- <groupId>org.projectlombokgroupId>
- <artifactId>lombokartifactId>
- <version>1.16.16version>
- dependency>
- dependencies>
-
- <repositories>
- <repository>
- <id>spring-snapshotsid>
- <name>Spring Snapshotsname>
- <url>https://repo.spring.io/snapshoturl>
- <snapshots>
- <enabled>trueenabled>
- snapshots>
- repository>
- <repository>
- <id>spring-milestonesid>
- <name>Spring Milestonesname>
- <url>https://repo.spring.io/milestoneurl>
- <snapshots>
- <enabled>falseenabled>
- snapshots>
- repository>
- repositories>
-
- <pluginRepositories>
- <pluginRepository>
- <id>spring-snapshotsid>
- <name>Spring Snapshotsname>
- <url>https://repo.spring.io/snapshoturl>
- <snapshots>
- <enabled>trueenabled>
- snapshots>
- pluginRepository>
- <pluginRepository>
- <id>spring-milestonesid>
- <name>Spring Milestonesname>
- <url>https://repo.spring.io/milestoneurl>
- <snapshots>
- <enabled>falseenabled>
- snapshots>
- pluginRepository>
- pluginRepositories>
- <build>
- <plugins>
-
- <plugin>
- <groupId>org.apache.maven.pluginsgroupId>
- <artifactId>maven-compiler-pluginartifactId>
- <version>3.1version>
- <configuration>
- <source>${java.version}source>
- <target>${java.version}target>
- configuration>
- plugin>
-
-
- <plugin>
- <groupId>org.apache.maven.pluginsgroupId>
- <artifactId>maven-surefire-pluginartifactId>
- <version>2.12.4version>
- <configuration>
- <skipTests>trueskipTests>
- configuration>
- plugin>
- plugins>
- build>
1.放回结果的实体类
2.分布式id生成器
疑问:问什么有了Result还要ResultCode枚举类呢?
其实只要Result也行,不过我们对于多条信息要不断的去get和set值,比较麻烦,所有定义ResultCode枚举类封装信息会比较方便
(1)新建com.ihrm.common.entity包,包下创建类Result,用于控制器类返回结果
- package com.ihrm.common.entity;
-
- import com.fasterxml.jackson.annotation.JsonInclude;
- import com.fasterxml.jackson.databind.annotation.JsonSerialize;
- import lombok.AllArgsConstructor;
- import lombok.Data;
- import lombok.NoArgsConstructor;
-
-
- @Data
- @NoArgsConstructor
- public class Result {
-
- private boolean success;//是否成功
- private Integer code;// 返回码
- private String message;//返回信息
- private Object data;// 返回数据
-
- public Result(ResultCode code) {
- this.success = code.success;
- this.code = code.code;
- this.message = code.message;
- }
-
- public Result(ResultCode code,Object data) {
- this.success = code.success;
- this.code = code.code;
- this.message = code.message;
- this.data = data;
- }
-
- public Result(Integer code,String message,boolean success) {
- this.code = code;
- this.message = message;
- this.success = success;
- }
-
- public static Result SUCCESS(){
- return new Result(ResultCode.SUCCESS);
- }
-
- public static Result ERROR(){
- return new Result(ResultCode.SERVER_ERROR);
- }
-
- public static Result FAIL(){
- return new Result(ResultCode.FAIL);
- }
- }
(2)创建类PageResult ,用于返回分页结果
- package com.ihrm.common.entity;
-
- import lombok.AllArgsConstructor;
- import lombok.Data;
- import lombok.NoArgsConstructor;
-
- import java.util.List;
-
- @Data
- @AllArgsConstructor
- @NoArgsConstructor
- public class PageResult
{ - private Long total;
- private List
rows; - }
- package com.ihrm.common.entity;
-
- public enum ResultCode {
-
- SUCCESS(true,10000,"操作成功!"),
- //---系统错误返回码-----
- FAIL(false,10001,"操作失败"),
- UNAUTHENTICATED(false,10002,"您还未登录"),
- UNAUTHORISE(false,10003,"权限不足"),
- SERVER_ERROR(false,99999,"抱歉,系统繁忙,请稍后重试!");
-
- //---用户操作返回码----
- //---企业操作返回码----
- //---权限操作返回码----
- //---其他操作返回码----
-
- //操作是否成功
- boolean success;
- //操作代码
- int code;
- //提示信息
- String message;
-
- ResultCode(boolean success,int code, String message){
- this.success = success;
- this.code = code;
- this.message = message;
- }
-
- public boolean success() {
- return success;
- }
-
- public int code() {
- return code;
- }
-
- public String message() {
- return message;
- }
-
- }
主键id生成
方案一:数据库自增(如果对user表合并就会产生冲突,不推荐)
方案二:uuid全球唯一(缺点:太长,数据量太大)
方案三:借助全局redis(缺点:网络开销太大)
方案四:雪花算法
(2)引入坐标
- <dependencies>
- <dependency>
- <groupId>org.springframework.bootgroupId>
- <artifactId>spring-boot-starter-data-jpaartifactId>
- dependency>
- <dependency>
- <groupId>org.examplegroupId>
- <artifactId>ihrm_commonartifactId>
- <version>1.0-SNAPSHOTversion>
- dependency>
- dependencies>
- <dependencies>
- <dependency>
- <groupId>org.springframework.bootgroupId>
- <artifactId>spring-boot-starter-data-jpaartifactId>
- dependency>
- <dependency>
- <groupId>mysqlgroupId>
- <artifactId>mysql-connector-javaartifactId>
- dependency>
- <dependency>
- <groupId>org.examplegroupId>
- <artifactId>ihrm_commonartifactId>
- <version>1.0-SNAPSHOTversion>
- dependency>
- dependencies>
- server:
- port: 9001
- spring:
- application:
- name: ihrm-company #指定服务名
- datasource:
- driver-class-name: com.mysql.jdbc.Driver
- url: jdbc:mysql://localhost:3306/ihrm?useUnicode=true&characterEncoding=utf8
- username: root
- password: 111111
- jpa:
- database: MySQL
- show-sql: true
- open-in-view: true