个人工作总结后端-三分白

本文涉及的产品
云服务器 ECS,每月免费额度200元 3个月
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
云服务器ECS,u1 2核4GB 1个月
简介: 个人工作总结后端-三分白

1.Application
package com.ssm;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@MapperScan("com.ssm.mapper")
public class Application {

public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
}

}

2.common.response
package com.ssm.common;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class Response {

private boolean success;
private Integer code;
private String msg;
private Object data;

public static Response fail(){
    return   new Response(false,4001,"请求失败","");
}

public static Response success(Object data){
    return   new Response(true,0,"请求æˆåŠŸ",data);

R }

}

3.patient
3.1pojo
package com.ssm.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Patient {

private Integer id;
private String name;
private String id_card;
private String phone;
private Integer state;
private String password;

}
3.2mapper
package com.ssm.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import com.ssm.pojo.Patient;

import java.util.List;

@Repository
@Mapper
public interface PatientMapper {

Integer addPatient(String name, String id_card, String phone);

Patient queryByIdCard(String id_card);

List<Patient> queryAll(Integer state);

int updateByPrimaryKeySelective(Patient record);

}
3.3xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<select id="queryAll" parameterType="int" resultType="com.ssm.pojo.Patient">
    select * from `patient` where state = #{0};
</select>

<update id="updateByPrimaryKeySelective" parameterType="com.ssm.pojo.Patient">
    update `patient` set `name` = #{name},`phone` = #{phone},`state` = #{state} where `id_card` = #{id_card};
</update>

<select id="queryByIdCard" parameterType="string" resultType="com.ssm.pojo.Patient">
    select * from `patient` where id_card = #{0};
</select>

<insert id="addPatient" parameterType="com.ssm.vo.param.PatientParam">
    insert into `patient`(`name`,`id_card`,`phone`, `state`,`password`)
        values(#{name}, #{id_card}, #{phone}, 1, '123');
</insert>


3.4service
package com.ssm.service.impl;

import com.ssm.common.Response;
import com.ssm.mapper.PatientMapper;
import com.ssm.pojo.Patient;
import com.ssm.service.PatientService;
import com.ssm.vo.param.PatientParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PatientServiceImpl implements PatientService {

@Autowired
private PatientMapper patientMapper;

public Response add(PatientParam patientParam){
    Integer number = patientMapper.addPatient(patientParam.getName(),patientParam.getId_card(),patientParam.getPhone());
    return Response.success(number);
}

public Response getAll(){
    List<Patient> patients = patientMapper.queryAll(1);
    return Response.success(patients);
}

public Response del(String idNumber){
    Patient patient = patientMapper.queryByIdCard(idNumber);
    patient.setState(0);
    int num = patientMapper.updateByPrimaryKeySelective(patient);
    return Response.success(num);
}

public Response update(Patient patient){
    int num = patientMapper.updateByPrimaryKeySelective(patient);
    return Response.success(num);
}

}
3.5.controller
package com.ssm.controller;

import com.ssm.common.Response;
import com.ssm.pojo.Patient;
import com.ssm.service.PatientService;
import com.ssm.vo.param.PatientParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/patient")
public class PatientController {

@Autowired
private PatientService patientService;

@RequestMapping("/add")
public Response add(@RequestBody PatientParam patientParam){
    return patientService.add(new PatientParam(patientParam.getName(),patientParam.getId_card(),patientParam.getPhone()));
}
@RequestMapping("/findAll")
public Response getAll(){

    return patientService.getAll();
}
@RequestMapping("/del/{idNumber}")
public Response del(@PathVariable String idNumber){
    return patientService.del(idNumber);
}

@RequestMapping("/update")
public Response update(@RequestBody  Patient patient){
    return patientService.update(patient);
}

@RequestMapping("/login/{name}")
public void login(@PathVariable Integer name, HttpSession httpSession){
    httpSession.setAttribute("patientId", name);
}

@RequestMapping("/logout/{name}")
public void logout(@PathVariable Integer name, HttpSession httpSession){
    httpSession.removeAttribute("patientId");
}

}
3.6.param
package com.ssm.vo.param;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class PatientParam {

private String name;
private String id_card;
private String phone;

}

4.clinic
4.1pojo
public int id;
public String title;
public int fees;
4.2mapper
List queryAll();
4.3xml

<select id="queryAll" resultType="com.ssm.pojo.Clinic">
    select * from `clinic`;
</select>


4.4service

public List<Clinic> queryAll() {
    return clinicMapper.queryAll();

}
4.5.controller
@RequestMapping("/findAll")

public Response queryAll(){
    return Response.success(clinicSevice.queryAll());

}

5.department
5.1pojo
public int id;

   public String title;
public int parent;

public String about;
5.2mapper
List getAllByParent(Integer parent);
5.3xml

<select id="getAllByParent" parameterType="int" resultType="com.ssm.pojo.Department">
    select * from `department` where parent = #{0};
</select>


5.4service

public Response getAllByParent(Integer parent) {
    return Response.success(departmentMapper.getAllByParent(parent));

}
5.5.controller
@RequestMapping("/findAll/{parent}")

public Response getAllByParent(@PathVariable String parent){
    return departmentService.getAllByParent(Integer.parseInt(parent));

}

6.doctor
6.1pojo
public int id;

public String name;
public int departmentId;
public String level;
public byte[] avatar;

public int password;
6.2mapper
List queryAll();

List getDocByTitleAndId(@Param("title") String title, @Param("time") String time);
6.3xml

<select id="queryAll" resultType="com.ssm.pojo.Doctor">
    select * from `doctor`;
</select>

<select id="getDocByTitleAndId" resultType="com.ssm.pojo.Doctor">
    select * from `doctor` d LEFT JOIN `scheduling` s on d.id = s.doctor
        where s.clinic = #{title} and s.time = #{time};
</select>


6.4service

@Override
public List<Doctor> queryAll() {
    return doctorMapper.queryAll();
}

@Override
public List<Doctor> getDocByTitleAndId(String title, String time) {
    return doctorMapper.getDocByTitleAndId(title, time);

}
6.5.controller
@RequestMapping("/findAll")

public Response queryAll(){
    return Response.success(doctorService.queryAll());
}

@RequestMapping("/find/{title}")
public Response queryByTitleAndId(@PathVariable String title, @DateTimeFormat(pattern = "yyyy-MM-dd") Date time){
    return Response.success(doctorService.getDocByTitleAndId(title, new SimpleDateFormat("yyyy-MM-dd").format(time)));

}

7.scheduling
7.1pojo
public int id;

public int doctor;
public Date time;
public int clinic;

public int count;
7.2mapper
List queryAll();

int add(Scheduling scheduling);
7.3xml

<select id="queryAll" resultType="com.ssm.pojo.Scheduling">
    select * from `scheduling`
</select>

<insert id="add" parameterType="com.ssm.pojo.Scheduling">
    insert into `scheduling`(`doctor`,`time`,`clinic`, `count`)
    values(#{doctor}, #{time}, #{clinic}, #{count});
</insert>


7.4service

public int add(Scheduling scheduling) {
    return schedulingMapper.add(scheduling);
}

@Override
public List<Scheduling> queryAll(Map<String, Object> map) {
    int pageIndex = (Integer)map.get("pageIndex");
    int pageSize= (Integer)map.get("pageSize");
    System.out.println(pageIndex);
    System.out.println(pageSize);
    PageHelper.startPage(pageIndex, pageSize);
    PageInfo<Scheduling> schedulingPage = new PageInfo<Scheduling>(schedulingMapper.queryAll());
    System.out.println(schedulingPage.getPageNum());
    System.out.println(schedulingPage.getPageSize());
    System.out.println(schedulingPage.getPages());
    return  schedulingPage.getList();

}
7.5.controller
@RequestMapping("/findAll")

public Response selectByPage(@RequestBody Map<String, Object> map){
    return Response.success(schedulingService.queryAll(map));
}

@RequestMapping("/add")
public Response add(@RequestBody Scheduling scheduling){
    return Response.success(schedulingService.add(scheduling));

}

8.appointment
8.1pojo
public int id;

public int patient;
public int doctor;
public Date time;
public int num;
public String department;
public int fees;

public String state;
8.2mapper
Integer addAppoint(Integer patient, Integer doctor, String time,

                     Integer num, String department);

List<AppointDetailVo> getOneDetail(Integer patient);

Integer delAppoint(Integer aId);

int schedulingNum(Integer doctor, String time);
8.3xml

<insert id="addAppoint" >
    insert into `appointment`(`patient`,`doctor`,`time`, `num`,`department`,`fees`, `state`)
    values(#{patient}, #{doctor}, #{time}, #{num}, #{department}, 5, "预约成功");
</insert>

<select id="getOneDetail" parameterType="int" resultType="com.ssm.vo.res.AppointDetailVo">
    select * from `appointment` where patient = #{0};
</select>

<update id="delAppoint">
    update `appointment` set `state` = "预约取消" where `id` = #{aId};
</update>

<select id="schedulingNum" resultType="int">
    select count from `scheduling` where doctor = #{doctor} and time = #{time};
</select>


8.4service

 @Override
public Response appointSubmit(AppointmentParam appointmentParam) {
    return Response.success(appointmentMapper.addAppoint(appointmentParam.getPatient(), appointmentParam.getDoctor(),
            appointmentParam.getTime(),appointmentParam.getNum(),appointmentParam.getDepartment()));
}

@Override
public Response getOneDetail(Integer patient) {
    return Response.success(appointmentMapper.getOneDetail(patient));
}

@Override
public Response delAppoint(String id) {
    return Response.success(appointmentMapper.delAppoint(Integer.parseInt(id)));
}

@Override
public Integer schedulingNum(Integer doctor, String time) {
    return appointmentMapper.schedulingNum(doctor, time) + 1;

}
8.5.controller
@RequestMapping("/submit")

public Response appointSubmit(@RequestBody AppointmentParam appointmentParam, HttpSession httpSession){
    int newNum = appointmentService.schedulingNum(appointmentParam.getDoctor(), appointmentParam.getTime());
    Integer patient = (Integer)httpSession.getAttribute("patientId");
    appointmentParam.setNum(newNum);
    appointmentParam.setPatient(patient);
    return appointmentService.appointSubmit(appointmentParam);
}
@RequestMapping("/detail")
public Response getOneDetail(HttpSession httpSession){
    Integer patient = (Integer)httpSession.getAttribute("patientId");
    return appointmentService.getOneDetail(patient);
}
@RequestMapping("/del/{id}")
public Response delAppoint(@PathVariable String id){
    return  appointmentService.delAppoint(id);

}
8.6 param
package com.ssm.vo.param;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AppointmentParam {

Integer patient;
Integer doctor;
String time;
Integer num;
String department;

}
8.7 vo.res.detailvo
package com.ssm.vo.res;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AppointDetailVo {

public int patient;
public int doctor;
public Date time;
public int num;
public String department;
public int fees;
public String state;

}

9.yml/application.properties
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.druid.driver-class-name=com.mysql.jdbc.Driver

spring.datasource.druid.url=jdbc:mysql://rm-2zeu2mx5rmvv9k0tb.mysql.rds.aliyuncs.com:3306/patient?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.druid.username=hha6027875
spring.datasource.druid.password=Hha6027875

mybatis.mapper-locations=classpath:mappers/*.xml
pagehelper.helperDialect=mysql
pagehelper.reasonable=true
logging.file.path=sp.log
logging.level.root=info
logging.level.web=debug
logging.level.sql=debug
logging.level.com.ssm.mapper=debug

thymeleaf

spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.encoding=utf-8
spring.thymeleaf.servlet.content-type=text/html
spring.thymeleaf.cache=false
10.pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.4.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.xiexin.bootjsj</groupId>
<artifactId>code-race</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>code-race</name>
<description>Demo project for Spring Boot</description>

<properties>
    <java.version>1.8</java.version>
</properties>

<dependencies>

    <!--lombok-->
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>
    <!--整合spring的web启动器-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
  <!-- 持久层 整合 mybaits-->
    <dependency>
        <groupId>org.mybatis.spring.boot</groupId>
        <artifactId>mybatis-spring-boot-starter</artifactId>
        <version>2.1.3</version>
    </dependency>
    <!--分页依赖-->
    <dependency>
        <groupId>com.github.jsqlparser</groupId>
        <artifactId>jsqlparser</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>com.github.pagehelper</groupId>
        <artifactId>pagehelper-spring-boot-starter</artifactId>
        <version>1.2.5</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.47</version>
    </dependency>
    <!--数据源-->
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>druid-spring-boot-starter</artifactId>
        <version>1.1.10</version>
    </dependency>
    <!--  显示 层  整合thymeleaf模板-->
    <!--thymeleaf默认使用html5规则标签必须闭合等 使用次此包正常解析-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
<packaging>jar</packaging>


11.settings
<!-- mirrors
| This is a list of mirrors to be used in downloading artifacts from remote repositories.
|
| It works like this: a POM may declare a repository to use in resolving certain artifacts.
| However, this repository may have problems with heavy traffic at times, so people have mirrored
| it to several places.
|
| That repository definition will have a unique id, so we can create a mirror reference for that
| repository, to be used as an alternate download site. The mirror site will be the preferred
| server for that repository.
|-->

<!-- mirror
 | Specifies a repository mirror site to use instead of a given repository. The repository that
 | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
 | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
 |
<mirror>
  <id>mirrorId</id>
  <mirrorOf>repositoryId</mirrorOf>
  <name>Human Readable Name for this Mirror.</name>
  <url>http://my.repository.com/repo/path</url>
</mirror>
<mirror>
  <id>maven-default-http-blocker</id>
  <mirrorOf>external:http:*</mirrorOf>
  <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
  <url>http://0.0.0.0/</url>
  <blocked>true</blocked>
</mirror>
 -->
<mirror>
  <id>nexus-aliyun</id>
  <mirrorOf>central</mirrorOf>
  <name>Nexus aliyun</name>
  <url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>


12.测试
doctor:

查询time科室医师列表localhost:8080/doctor/find/1?time=2022-07-28   get
查询所有医生localhost:8080/doctor/findAll            get

patient:

编辑就诊人localhost:8080/patient/update    post
{
"name":"wufang",
"id_card":"4444444",
"phone":"1444444444445",
"state":1
}
添加就诊人 localhost:8080/patient/add   post
{
"name":"qhj",
"id_card":"5555555",
"phone":"155555555"
}
查询就诊人列表  localhost:8080/patient/findAll  get
删除就诊信息:localhost:8080/patient/del/4444444   get

clinic:

查询全部门诊 localhost:8080/clinic/findAll    get

department:

查询门诊下级科室:localhost:8080/department/findAll/1   get

scheduling:

值班信息分页查询localhost:8080/scheduling/findAll   post
{
"pageIndex":2,
"pageSize":2
}

增加一个医生值班信息localhost:8080/scheduling/add   post
{
"doctor":2,
"clinic":1,
"count":21,
"time":"2022-07-29"
}

appointment:

取消预约:localhost:8080/appointment/del/1   get
查看个人预约详情    localhost:8080/patient/login/1     get
    localhost:8080/appointment/detail   get
    localhost:8080/patient/logout/1      get
执行预约挂号    localhost:8080/patient/login/1     get
    localhost:8080/appointment/submit    post
    {
"doctor":1,
"time": "2022-07-29",
"department": "心内科"
}
    localhost:8080/patient/logout/1      get

13.总结
1.配置ide的阿里云镜像文件

打开文件位置(安装目录下面),返回上一层目录。按照 plugins\maven\lib\maven3\conf 的顺序,依次打开,在conf文件目录下出现一个setting.xml的文件
或者file-settings-build-build tools-maven

或者在preferences-build,execution,deployment-maven
user settings file找到该文件即可

粘贴在mirrors下面即可,别的全部注释,把- ->放在阿里云镜像<mirror>的上面,别的全部注释

2.解压编程资源包,加载maven文件
3.有可能jdk没装,需要自己下载一下在idea里面

关闭代码检查:file-power save mode,打开自动不检查了

4.enable lombak annotation processing
6.配置数据库地址,更改controller为restcontroller
7.医生那最后一个字段应该是password吧
8.医生查询当前time下的所有医生?方法名字还叫titleandid?啥叫当前time,是不可以理解为指定排版的医生

doctorservice的返回值list<map>?service也加签名吗
这块查询要使用find/1?time=2022-07-28

9.排版分页传参,默认叫法pageIndex,pageSize

注意startpage要放到mapper调用前面,xml里面select全部语句不能加;号,因为pagehelper会帮你加

10.预约里面的department竟然是字符串,注意数据库设计

主要问题是页面显示的叫做门诊,字段也叫clinic,department不是科室吗?吐血了
    先按照department处理了,设计char类型
预约第二个方法需要创建一个新的类,预约详情
    第一个方法用的docter int,第四个变成string无语了,按照int处理了
第三个方法mapper int,service参数string,sssb,按照String处理了,controller也是string
第四个service返回response不合适,需要返回原值,后面需要调用

11.fee按照int类型处理
12.clinic那参数有个appointmentparam,用不到吧,还有scheduling那个schedulingparams

普通上传
Ecs和rds一个vpc,一个可用区
1.创建ecs时第三部系统配置可以设置密码(ecs不是操作系统),默认root - Hha6027875,要设置公网ip

1.1或者通过实例右侧更多,网络,绑定弹性ip,远程连接,立即登录,弹性公网是后开的,不用担心
    1.2下载jdk,放到home目录下(默认目录就是home)
        wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm
1.3 chmod +x jdk-8u131-linux-x64.rpm 
    rpm -ivh jdk-8u131-linux-x64.rpm
1.4 

(不用管换行)
vi /etc/profile

    export JAVA_HOME=/usr/java/jdk1.8.0_131
    export JRE_HOME=${JAVA_HOME}/jre
    export CLASSPATH=.:JAVAHOME/lib:{JRE_HOME}/lib:$CLASSPATH
    export JAVA_PATH=${JAVAHOME}/bin:${JRE_HOME}/bin
    export PATH=$PATH:${JAVA_PATH}
1.5 java -version  javac查看是否安装成功并配置环境变量

2..rds创建后(跟switch一个可用区),点击实例,选择账号管理,创建数据库账号hha6027875/Hha6027875高权限账号(可以在创建时实例配置阶段设置,也可以在账户管理中进行设置,不行的话重置一下账号密码,输密码的时候不要选择默认,手敲一下,有时候不识别)

点击登录数据库,首次需要进行云资源的授权,授权dms系统默认角色,登录创建的账号
点击左侧数据库实例,右键数据库选择数据库管理,创建数据库,刷新,在自己的数据库里面进行操作,这里默认别的数据库是不让你动的,当时就吃了这个亏
别忘了设置库表主键自增加。
先把数据惯进去,右键表打开表,开启编辑,新增,提交修改即可,必须有主见

rds点击实例连接,基本信息,网络类型专有网络,查看链接详情,设置白名单,添加白名单分组(基本一个可用区是没问题的),回到基本信息,专业网络,查看链接详情,复制ip,到ecs里面ping一下,如果通了更改yml的数据库地址,端口306,用户名和密码
导入sql文件,右键表导入,上传sql文件提交
安全组,跟白名单一个位置,白名单右面就是安全组,可以导入安全组
安全组在ecs这创建,ecs管理界面安全组创建安全组

出现报错null刷新几次,新建数据库有这个问题

3.项目pom文件倒数第二行加jar

更改数据库地址,切记切记密码要配置成rds的密码,这块特别容易忘
打包,如果右键项目有maven install 直接选就行,如果没有,需要view-toolwindow-maven-绿色三角execute maven goal-选择install即可
找到该文件放到桌面(文件目录里面可以找一下target)
进入ecs实例管理页面,上面文件,打开新文件管理,上传文件,上传到home文件夹,会话-新终端退出回到正常命令行

4.查看端口是否被占用 netstat -anp | grep 8080

         查看进程netstat -ntulp |grep 8080  
    如果占用杀死他sudo kill -9 pid
回到home
java -jar code-race-0.0.1-SNAPSHOT.jar 出现spring logo代表运行成功
这时候ecs阻塞了,需要点击会话,横向打开新终端

5.输入curl http://localhost:8080/clinic/findAll测试即可
简易版restcontroller,返回response即可,page/ceshi
6.结束任务
ps -ef|grep java
kill -9 进程号
7.install或者Prcompile ocess terminated
setings找不到重新覆盖一下,clean一下

edas版本
1.打开edas,地域选择北京,创建应用新建ecs或者把已有ecs放到集群中
设置登录密码,
设置健康检查地址http://localhost:8080/page/ceshi
创建好机器后,启动应用
日志管理-日志目录-edascontainer-logs-catalina.out在线查看即可截图

th:
参数Model model
model.addAttribute("site","www.bjpowernode.com"); // 对象类型 model.addAttribute("myUser",new SysUser(1001,"王世超",20));
页面
都加上
引用都是th:标签,${site},${myUser.name}
th:href="@{/layui-v2.5.6/layui/css/layui.css}"
th:href="@{/layui-v2.5.6/layui/css/myStyle.css}"
th:src="@{/layui-v2.5.6/layui/layui.js}"
th:src="@{/layui-v2.5.6/layui/layui.all.js}"

内部链接,href都使用/page1/card,doctor,scheduling,patient,不需要加th,注意cols的[[]]要换行
这样layui和thymeleaf就完美兼容了
$('#search').click(function(){ $.ajax({ url:"http://localhost:8080/page/ceshi", method:"get", data:{}, success:function(res){ alert(res.data); } }); table.render

springgsecurity百度搜吧
https://blog.csdn.net/weixin_46301906/article/details/125653879
org.springframework.bootspring-boot-starter-security

        <groupId>org.springframework.security.oauth</groupId>
        <artifactId>spring-security-oauth2</artifactId>
        <version>2.3.6.RELEASE</version>
    </dependency>

仿照代码写选择密码模式,配置授权服务器设置oauth配置,资源服务器设置功能角色设置,springsecurity配置用户角色设置等等,到时候抄代码,用户名密码改从数据库中进行获取withuser和password那里换一下,roles从角色表里面进行获取
登录先访问/oauth/token请求token,参数是六个
然后带着返回的access_token进行别的操作
通过路径来判断是否有权限,对应的功能前缀加上/角色路径
token还是模拟redis存储
测试用例就是先请求oauth,参数
username,password,grant_type,client_id,scope,client_secret
然后请求各角色前缀路径携带token

拦截器按照https://blog.csdn.net/qq_42764468/article/details/127718048写
一个UserInfoInterceptor一个CommonWebMvcAutoConfiguration

前者设置拦截前后的操作,按照题目要求分别在response里面配置成功和失败的返回response信息,替代默认就行
后者配置具体拦截的地址即可,把相关地址放行了就可以了,不需要理解细节
直接复制代码

相关实践学习
一小时快速掌握 SQL 语法
本实验带您学习SQL的基础语法,快速入门SQL。
7天玩转云服务器
云服务器ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,可降低 IT 成本,提升运维效率。本课程手把手带你了解ECS、掌握基本操作、动手实操快照管理、镜像管理等。了解产品详情:&nbsp;https://www.aliyun.com/product/ecs
相关文章
|
21天前
|
数据采集 NoSQL 搜索推荐
五一假期畅游指南:Python技术构建的热门景点分析系统解读
五一假期畅游指南:Python技术构建的热门景点分析系统解读
|
5月前
|
Web App开发 前端开发 JavaScript
前端的培训计划书
前端的培训计划书
39 1
|
10月前
|
移动开发 前端开发 数据可视化
前端叹了口气,并表示谣言止于智者
前端叹了口气,并表示谣言止于智者
|
前端开发
个人工作总结前端-三分白
个人工作总结前端-三分白
81 0
|
弹性计算 关系型数据库 Java
个人工作总结无代码-三分白
个人工作总结无代码-三分白
407 0
|
前端开发 JavaScript
|
前端开发 JavaScript
前端每日两三问(20190923)
前端每日两三问(20190923)
|
前端开发 JavaScript
前端两三问(20190917)
前端两三问(20190917)
|
JavaScript 前端开发
|
前端开发 JavaScript
前端两三问(20190915)
前端两三问(20190915)