成都网站建设 四川冠辰科技公司/整合营销传播工具有哪些
班级管理
1 班级列表:后端
- 编写JavaBean【已有】
- 编写Mapper【已有】
- 编写Service
- 编写controller
-
编写Service
-
接口
package com.czxy.service;import com.czxy.domain.Classes;import java.util.List;/*** @author 桐叔* @email liangtong@itcast.cn* @description*/ public interface ClassesService {/*** 查询所有* @return*/public List<Classes> selectAll(); }
-
实现类
package com.czxy.service.impl;import com.czxy.domain.Classes; import com.czxy.mapper.ClassesMapper; import com.czxy.service.ClassesService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional;import javax.annotation.Resource; import java.util.List;/*** @author 桐叔* @email liangtong@itcast.cn* @description*/ @Service @Transactional public class ClassesServiceImpl implements ClassesService {@Resourceprivate ClassesMapper classesMapper;@Overridepublic List<Classes> selectAll() {List<Classes> classesList = classesMapper.selectAll();return classesList;} }
-
-
编写controller
package com.czxy.controller;import com.czxy.domain.Classes; import com.czxy.service.ClassesService; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;import javax.annotation.Resource; import java.util.List;/*** @author 桐叔* @email liangtong@itcast.cn* @description*/ @RestController @RequestMapping("/classes") public class ClassesController {@Resourceprivate ClassesService classesService;@GetMappingpublic ResponseEntity<List<Classes>> selectAll() {// 查询List<Classes> classesList = classesService.selectAll();// 返回return ResponseEntity.ok(classesList);} }
城市管理
1 查询所有城市:后端
1 JavaBean
package com.czxy.domain;import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.ArrayList;
import java.util.List;/*** @author 桐叔* @email liangtong@itcast.cn* @description*/
@Table(name = "tb_city")
public class City {@Id@Column(name = "c_id")private String cid; //城市IDprivate String cityName; //城市名称private String parentId; //父ID//一对多:一个城市(省/市)拥有多个子城市(多个市/多个县) ,new对象为了操作【方便】private List<City> children = new ArrayList<>();//....
}/*
CREATE TABLE tb_city(c_id VARCHAR(32) PRIMARY KEY COMMENT '城市ID',city_name VARCHAR(20) COMMENT '城市名称' ,parent_id VARCHAR(32) COMMENT '父ID'
);*/
2 Mapper
package com.czxy.mapper;import com.czxy.domain.City;
import tk.mybatis.mapper.common.Mapper;/*** @author 桐叔* @email liangtong@itcast.cn* @description*/
public interface CityMapper extends Mapper<City> {
}
3 Service
-
接口
package com.czxy.service;import com.czxy.domain.City;import java.util.List;/*** @author 桐叔* @email liangtong@itcast.cn* @description*/ public interface CityService {/*** 查询所有(省、市、县)* @return*/public List<City> selectAll(); }
-
实现类
package com.czxy.service.impl;import com.czxy.domain.City; import com.czxy.mapper.CityMapper; import com.czxy.service.CityService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import tk.mybatis.mapper.entity.Example;import javax.annotation.Resource; import java.util.List;/*** @author 桐叔* @email liangtong@itcast.cn* @description*/ @Service @Transactional public class CityServiceImpl implements CityService {@Resourceprivate CityMapper cityMapper;@Overridepublic List<City> selectAll() {//1 条件查询:排序Example example = new Example(City.class);example.orderBy("parentId").asc(); //升序//2 查询List<City> cityList = cityMapper.selectByExample(example);return cityList;} }
4 Controller
package com.czxy.controller;import com.czxy.domain.City;
import com.czxy.service.CityService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;/*** @author 桐叔* @email liangtong@itcast.cn* @description*/
@RestController
@RequestMapping("/city")
public class CityController {@Resourceprivate CityService cityService;@GetMappingpublic ResponseEntity<List<City>> selectAll() {// 1 查询所有 省/市/县List<City> cityList = cityService.selectAll();// 2 处理数据 省(市(县))// 2.1.1 提供Map,用于缓存所有城市,目的:方便子城市找到父城市// map.id 城市id,方便子获得, map.value 城市Map<String, City> cacheMap = new HashMap<>();// 2.1.2 提供List,存放所有的省List<City> provinceList = new ArrayList<>();// 2.2 遍历所有城市for(City city: cityList) {// 2.3.1 从map获得父城市City parentCity = cacheMap.get(city.getParentId());if(parentCity == null) {// 2.3.2 1)如果没有获得父城市,表示就是省,直接添加ListprovinceList.add(city);} else {// 2.3.2 2)如果获得父城市,表示市、县,将器追加到父城市的子列表中parentCity.getChildren().add(city);}// 2.3.3 当前城市添加到map中,方便下一次自己的子城市可以获得自己cacheMap.put(city.getCid(), city);}//3 返回所有的省return ResponseEntity.ok(provinceList);}
}
查询指定父id的所有城市:后端
1 Service
-
接口
/*** 通过父id查询所有* @param parentId* @return*/public List<City> selectByParentId(String parentId);
-
实现类
@Overridepublic List<City> selectByParentId(String parentId) {//1 条件Example example = new Example(City.class);Example.Criteria criteria = example.createCriteria();criteria.andEqualTo("parentId", parentId);//2 查询List<City> cityList = cityMapper.selectByExample(example);//3 返回return cityList;}
2 Controller
/*** 通过父id查询* @param pid* @return*/@GetMapping("/parent/{pid}")public ResponseEntity<List<City>> selectAllByParentId(@PathVariable("pid") String pid) {//查询List<City> cityList = cityService.selectByParentId(pid);//返回return ResponseEntity.ok(cityList);}
课程管理
1查询所有:后端
1 Service
-
接口
package com.czxy.service;import com.czxy.domain.Course;import java.util.List;/*** @author 桐叔* @email liangtong@itcast.cn* @description*/ public interface CourseService {/*** 查询所有课程* @return*/public List<Course> selectAll(); }
-
实现类
package com.czxy.service.impl;import com.czxy.domain.Course; import com.czxy.mapper.CourseMapper; import com.czxy.service.CourseService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional;import javax.annotation.Resource; import java.util.List;/*** @author 桐叔* @email liangtong@itcast.cn* @description*/ @Service @Transactional public class CourseServiceImpl implements CourseService {@Resourceprivate CourseMapper courseMapper;@Overridepublic List<Course> selectAll() {List<Course> courseList = courseMapper.selectAll();return courseList;} }
2 Controller
package com.czxy.controller;import com.czxy.domain.Course;
import com.czxy.service.CourseService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;import javax.annotation.Resource;
import java.util.List;/*** @author 桐叔* @email liangtong@itcast.cn* @description*/
@RestController
@RequestMapping("/course")
public class CourseController {@Resourceprivate CourseService courseService;/*** 查询所有课程* @return*/@GetMappingpublic ResponseEntity<List<Course>> selectAll() {//查询List<Course> courseList = courseService.selectAll();//返回return ResponseEntity.ok(courseList);}
}
2 查询指定学生的所有课程:后端
1 Mapper【已有】
2 Service
-
接口
/*** 查询指定学生的所有课程* @param sid* @return*/public List<Course> selectAllBySid(Integer sid);
-
实现类
@Overridepublic List<Course> selectAllBySid(Integer sid) {List<Course> courseList = courseMapper.selectAllBySid(sid);return courseList;}
相关文章:

Java项目学生管理系统六后端补充
班级管理 1 班级列表:后端 编写JavaBean【已有】编写Mapper【已有】编写Service编写controller 编写Service 接口 package com.czxy.service;import com.czxy.domain.Classes;import java.util.List;/*** author 桐叔* email liangtongitcast.cn* description*/ p…...

PDF控件Spire.PDF for .NET【转换】演示:将 PDF 转换为线性化
PDF 线性化,也称为“快速 Web 查看”,是一种优化 PDF 文件的方法。通常,只有当用户的网络浏览器从服务器下载了所有页面后,用户才能在线查看多页 PDF 文件。然而,如果 PDF 文件是线性化的,即使完整下载尚未…...

猫头虎博主深度探索:Amazon Q——2023 re:Invent大会的AI革新之星
猫头虎博主深度探索:Amazon Q——2023 re:Invent大会的AI革新之星 授权说明:本篇文章授权活动官方亚马逊云科技文章转发、改写权,包括不限于在 亚马逊云科技开发者社区, 知乎,自媒体平台,第三方开发者媒体等亚马逊云科…...

Spring框架-GOF代理模式之JDK动态代理
我们可以分成三步来完成jdk动态代理的实现 第一步:创建目标对象 第二步:创建代理对象 第三步:调用代理对象的代理方法 public class Client {public static void main(String[] args) {//创建目标对象final OrderService target new OrderS…...

基于JAVAEE技术校园车辆管理系统论文
摘 要 现代经济快节奏发展以及不断完善升级的信息化技术,让传统数据信息的管理升级为软件存储,归纳,集中处理数据信息的管理方式。本校园车辆管理系统就是在这样的大环境下诞生,其可以帮助管理者在短时间内处理完毕庞大的数据信息…...

基于FFmpeg,实现播放器功能
一、客户端选择音视频文件 MainActivity package com.anniljing.ffmpegnative;import android.Manifest; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.net.Ur…...

利用tf-idf对特征进行提取
TF-IDF是一种文本特征提取的方法,用于评估一个词在一组文档中的重要性。 一、代码 from sklearn.feature_extraction.text import TfidfVectorizer import numpy as npdef print_tfidf_words(documents):"""打印TF-IDF矩阵中每个文档中非零值对应…...

遇到运维故障,有没有排查和解决故障的正确流程?
稳定是偶然,异常才是常态,用来标注IT运维工作再适合不过。 因为对于IT运维来说,工作最常遇到的就是不稳定性带来的各种故障,经常围绕发现故障、响应故障、定位故障、恢复故障这四大步。 故障处理是最心跳的事情,没有…...

javaWebssh汽车销售管理系统myeclipse开发mysql数据库MVC模式java编程计算机网页设计
一、源码特点 java ssh汽车销售管理系统是一套完善的web设计系统(系统采用ssh框架进行设计开发),对理解JSP java编程开发语言有帮助,系统具有完整的源代码和数据库,系统主要采用 B/S模式开发。开发环境为TOMCAT7.…...

基于pandoraNext使用chatgpt4
1.登陆GitHub 获取pandoraNext项目GitHub - pandora-next/deploy: Pandora Cloud Pandora Server Shared Chat BackendAPI Proxy Chat2API Signup Free PandoraNext. New GPTs(Gizmo) UI, All in one! 在release中选择相应版本操作系统的安装包进行下载 2.获取license_…...

12.视图
目录 1.视图的含义与作用 2.视图的创建与查看 1.创建视图的语法形式 2、查看视图: 1.使用DESCRIBE语句查看视图基本信息 2.使用SHOW TABLE STATUS语查看视图基本信息查看视图的信息 3.使用SHOW CREATE VIEW语查看视图详细信息 4.在views表中查看视图详细信息…...

Leetcode69 x的平方根
x的平方根 题解1 袖珍计算器算法题解2 二分查找题解3 牛顿迭代 给你一个非负整数 x ,计算并返回 x 的 算术平方根 。 由于返回类型是整数,结果只保留 整数部分 ,小数部分将被 舍去 。 注意:不允许使用任何内置指数函数和算符&…...

在Linux上安装配置Nginx高性能Web服务器
1 前言 Nginx是一个高性能的开源Web服务器,同时也可以作为反向代理服务器、负载均衡器、HTTP缓存以及作为一个邮件代理服务器。它以其出色的性能和灵活性而闻名,被广泛用于处理高流量的网站和应用程序。本文将介绍在Linux环境中安装Nginx的步骤…...

LeetCode 每日一题 Day 11||贪心
2697. 字典序最小回文串 给你一个由 小写英文字母 组成的字符串 s ,你可以对其执行一些操作。在一步操作中,你可以用其他小写英文字母 替换 s 中的一个字符。 请你执行 尽可能少的操作 ,使 s 变成一个 回文串 。如果执行 最少 操作次数的方…...

ocr表格文字识别软件怎么使用?
现在的OCR软件几乎是傻瓜式的设计,操作很简单,像金鸣识别的软件无论是网页版还是电脑客户端又或是小程序,界面都简单明了,用户只需提交待识别的图片,然后点击提交识别,等识别完成就直接打开或下载打开就行了…...

【QT 5 调试软件+Linux下调用脚本shell-经验总结+初步调试+基础样例】
【QT 5 调试软件Linux下调用脚本shell-经验总结初步调试基础样例】 1、前言2、实验环境3、自我总结4、实验过程(1)准备工作-脚本1)、准备工作-编写运行脚本文件2)、给权限3)、运行脚本 (2)进入q…...

使用 Goroutine 和 Channel 构建高并发程序
使用 Goroutine 和 Channel 构建高并发程序 文章目的与概要Golang 并发模型的重要性 Goroutine 和 Channel 的基础Goroutine:轻量级线程Channel:通信机制Goroutine 与 Channel 的协同工作 构建高并发模型的策略有效使用 Goroutine使用 Channel 进行数据传…...

大数据机器学习与深度学习——过拟合、欠拟合及机器学习算法分类
大数据机器学习与深度学习——过拟合、欠拟合及机器学习算法分类 过拟合,欠拟合 针对模型的拟合,这里引入两个概念:过拟合,欠拟合。 过拟合:在机器学习任务中,我们通常将数据集分为两部分:训…...

Lenovo联想拯救者Legion Y9000X 2021款(82BD)原装出厂Windows10系统
链接:https://pan.baidu.com/s/1GRTR7CAAQJdnh4tHbhQaDQ?pwdl42u 提取码:l42u 联想原厂WIN10系统自带所有驱动、出厂主题壁纸、系统属性专属LOGO标志、Office办公软件、联想电脑管家等预装程序 所需要工具:16G或以上的U盘 文件格式&am…...

pytorch中的transpose用法
注意:维数从0开始,0维 1维2维…,负数代表从右往左数,-1代表第一维,以此类推 import torch import numpy as np# 创建一个二维数组 arr torch.tensor([[[1, 2],[3, 4]],[[5, 6],[7, 8]]]) print("原始数组:"…...

SpringBoot面试题及答案(最新50道大厂版,持续更新)
在准备Spring Boot相关的面试题时,我发现网络上的资源往往缺乏深度和全面性。为了帮助广大Java程序员更好地准备面试,我花费了大量时间进行研究和整理,形成了这套Spring Boot面试题大全。 这套题库不仅包含了一系列经典的Spring Boot面试题及…...

KUKA机器人如何隐藏程序或程序段?
KUKA机器人如何隐藏程序或程序段? 如下图所示,新建一个示例程序进行说明, 如下图所示,如果红框中的动作指令不想让别人看到,想隐藏起来,如何做到? 如下图所示,在想要隐藏的程序或程序段的前后,分别添加 ;fold 和 endfold指令(这里要注意是英文状态下的输入法), 如…...

C++ STL(1)--概述
1. 简述 STL即标准模板库 Standard Template Library,包含了许多在计算机科学领域里所常用的基本数据结构和算法。STL具有高可重用性、高性能、高可移植性(跨平台)的优点。 两个特点: 1.1 数据结构和算法分离。 1.2 它不是面向对象的,是基于模…...

unity 2d 入门 飞翔小鸟 死亡闪烁特效(十三)
一、c#脚本 using System.Collections; using System.Collections.Generic; using UnityEngine;public class Bling : MonoBehaviour {public Texture img;public float speed;public static bool changeWhite false;private float alpha0f;// Start is called before the fi…...

Cannot find cache named ‘‘ for Builder Redis
当引入 Redissson 时,springCache 缓存机制失效 原因:springCache 默认使用本地缓存 Redisson 使用redis 缓存 最后都转成redis了。。。 总感觉哪不对 两者居然不共存...

IntelliJ IDEA的下载安装配置步骤详解
引言 IntelliJ IDEA 是一款功能强大的集成开发环境,它具有许多优势,适用于各种开发过程。本文将介绍 IDEA 的主要优势,并提供详细的安装配置步骤。 介绍 IntelliJ IDEA(以下简称 IDEA)之所以被广泛使用,…...

光线追踪算法实现
我们已经涵盖了所有要说的内容! 我们现在准备编写第一个光线追踪器。 你现在应该能够猜测光线追踪算法是如何工作的。 首先,请花点时间注意一下,光在自然界中的传播只是从光源发出的无数光线,它们四处反弹,直到到达我…...

学习深度强化学习---第3部分----RL蒙特卡罗相关算法
文章目录 3.1节 蒙特卡罗法简介3.2节 蒙特卡罗策略评估3.3节 蒙特卡罗强化学习3.4节 异策略蒙特卡罗法 本部分视频所在地址:深度强化学习的理论与实践 3.1节 蒙特卡罗法简介 在其他学科中的蒙特卡罗法是一种抽样的方法。 如果状态转移概率是已知的,则是…...

linux虚拟机使用81-persistent-net.rule后接口名依然改变的问题处理
测试环境:vmware workstation17 、oracle linux 7.8 1. 复位原有ifname 1)nmcli c s 查看管理的网卡 [rootrac2 ~]# nmcli c s NAME UUID TYPE DEVICE enp0s3 5b01a9de-9552-45da-a84a-1ae6c9506354…...

ARMV8 - A64 - 跳转和返回指令
说明 C语言等高级语言,根据是否需要返回到触发跳转代码的下一条代码,跳转有两种语句: 不需要返回,例如:if,goto,switch,while等语句。需要返回,例如:函数调…...