当前位置: 首页 > news >正文

Student后台管理系统查询接口

实体类student代码

package org.example.studentback01.entity;import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;@Data
@TableName("student")
public class Student {@TableId(type = IdType.AUTO)private Integer id;private String no;private String name;private String password;private int sex;private int roleId;private String phone;@TableField(exist = false)private String isValid;@Overridepublic String toString() {return "Student{" +"id=" + id +", no='" + no + '\'' +", name='" + name + '\'' +", password='" + password + '\'' +", sex=" + sex +", roleId=" + roleId +", phone='" + phone + '\'' +", isValid='" + isValid + '\'' +'}';}public Integer getId() {return id;}public void setId(Integer id) {this.id = id;}public String getNo() {return no;}public void setNo(String no) {this.no = no;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getPassword() {return password;}public void setPassword(String password) {this.password = password;}public int getSex() {return sex;}public void setSex(int sex) {this.sex = sex;}public int getRoleId() {return roleId;}public void setRoleId(int roleId) {this.roleId = roleId;}public String getPhone() {return phone;}public void setPhone(String phone) {this.phone = phone;}public String getIsValid() {return isValid;}public void setIsValid(String isValid) {this.isValid = isValid;}
}

controller代码

package org.example.studentback01.controller;import org.example.studentback01.entity.Student;
import org.example.studentback01.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;import java.util.List;@RestController
public class helloController {@GetMappingpublic String hello(){return "hello world";}@Autowiredprivate StudentService studentService;@GetMapping("/list")public List<Student> list(){return studentService.listAllStudent();}
}

StudentMapper

package org.example.studentback01.mapper;import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.example.studentback01.entity.Student;import java.util.List;
@Mapper
public interface StudentMapper extends BaseMapper<Student> {List<Student> listAllStudent();
}

StudentService

package org.example.studentback01.service;import com.baomidou.mybatisplus.extension.service.IService;
import org.example.studentback01.entity.Student;import java.util.List;public interface StudentService extends IService<Student> {List<Student> listAllStudent();}

StudentServiceImpl

package org.example.studentback01.service.impl;import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.studentback01.entity.Student;
import org.example.studentback01.mapper.StudentMapper;
import org.example.studentback01.service.StudentService;
import org.springframework.stereotype.Service;import javax.annotation.Resource;
import java.util.List;@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> implements StudentService {@Resourceprivate StudentMapper studentMapper;@Overridepublic List<Student> listAllStudent() {return list();}
}

StudentMapper.xml

<?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">
<mapper namespace="org..example.studentback01.mapper.StudentMapper"><select id="listAllStudent" resultType="org.example.studentback01.entity.Student">select * from student</select></mapper>

数据库学生表结构

DROP TABLE IF EXISTS `student`;
CREATE TABLE `student`  (`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',`no` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '账号',`name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '名字',`PASSWORD` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '密码',`age` int NULL DEFAULT NULL,`sex` int NULL DEFAULT NULL COMMENT '性别',`phone` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT '电话',`role_id` int NULL DEFAULT NULL COMMENT '角色 0超级管理员,1管理员,2普通账号',`isValid` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT 'Y' COMMENT '是否有效,Y有效,其他无效',PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic;SET FOREIGN_KEY_CHECKS = 1;


文章转载自:
http://achy.pzdurr.cn
http://canterbury.pzdurr.cn
http://accompanying.pzdurr.cn
http://apocarp.pzdurr.cn
http://albatross.pzdurr.cn
http://athwarthawse.pzdurr.cn
http://actinin.pzdurr.cn
http://choirmaster.pzdurr.cn
http://anaesthetics.pzdurr.cn
http://affectlessness.pzdurr.cn
http://abscissa.pzdurr.cn
http://bcom.pzdurr.cn
http://aril.pzdurr.cn
http://antagonist.pzdurr.cn
http://bp.pzdurr.cn
http://barbule.pzdurr.cn
http://autography.pzdurr.cn
http://anagoge.pzdurr.cn
http://algometry.pzdurr.cn
http://cannibalistic.pzdurr.cn
http://chromatogram.pzdurr.cn
http://autoshape.pzdurr.cn
http://archaistic.pzdurr.cn
http://blaze.pzdurr.cn
http://botch.pzdurr.cn
http://chaldea.pzdurr.cn
http://accidentalism.pzdurr.cn
http://chevrolet.pzdurr.cn
http://anastigmat.pzdurr.cn
http://apache.pzdurr.cn
http://www.dtcms.com/a/280592.html

相关文章:

  • 无人机GPS定位系统核心技术解析
  • Java :List,LinkedList,ArrayList
  • ov5640,ov2640,ov7670摄像头比较
  • OSPF过滤
  • 在百亿流量面前,让“不存在”无处遁形——Redis 缓存穿透的极限攻防实录
  • uniapp 微信小程序Vue3项目使用内置组件movable-area封装悬浮可拖拽按钮(拖拽结束时自动吸附到最近的屏幕边缘)
  • 解锁Python爬虫:数据获取与清洗的进阶指南
  • 运维技术教程之Jenkins的秘钥设置
  • TP商城登录系统测试报告
  • Python Fabric库详解:从入门到自动化运维实战
  • C++ Boost Aiso TCP 网络聊天(服务端客户端一体化)
  • 【论文阅读 | PR 2024 |ITFuse:一种用于红外与可见光图像融合的交互式 Transformer】
  • 第三章 OB SQL 引擎高级技术
  • 【网络安全】大型语言模型(LLMs)及其应用的红队演练指南
  • 【Git】详解git commit --amend用法以及使用遇到的问题
  • Vue 2 和 Vue 3 中,组件的封装、二次开发和优化
  • Sersync和Rsync部署
  • Keil 5下载的时候提示“No J-Link found”
  • 《恋与深空》中龙和蛇分别是谁的代表
  • 25、企业能源管理(Energy):锚定双碳目标,从分类管控到智能优化的数字化转型之路
  • flutter弹窗:fluttertoast
  • HTTP 性能优化实战:突破高并发瓶颈的工业级方案
  • elasticsearch 下载/安装
  • 飞睿UWB超宽带定位测距技术,数字钥匙重塑智能生活,高精度厘米级定位无感解锁
  • ffmpeg音视频处理大纲
  • HR数字化转型:3大痛点解决方案与效率突破指南
  • QT 中各种坑
  • 基于Scikit-learn的机器学习建模与SHAP解释分析
  • 如何解决 Spring Boot 使用 Maven 打包后运行失败的问题(附详细排查步骤)
  • [雨云教程]端口冲突该如何解决