学习阶段,记录一下!
数据库:空
/*
Navicat Premium Data Transfer
Source Server : my
Source Server Type : MySQL
Source Server Version : 50722
Source Host : localhost:3306
Source Schema : use
Target Server Type : MySQL
Target Server Version : 50722
File Encoding : 65001
Date: 10/08/2020 11:43:37
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for about
-- ----------------------------
DROP TABLE IF EXISTS `about`;
CREATE TABLE `about` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
`uid` int(11) NOT NULL COMMENT 'uid',
`situation` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '大用概况',
`aSpeech` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '总经理致辞',
`target` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '使命目标',
`institutions` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '组织机构',
`culture` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '企业文化',
`advantages` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '企业优势',
`market` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '大用市场',
`honor` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '资质荣誉',
`relations` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '公共关系',
`course` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '大用历程',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for classify_news
-- ----------------------------
DROP TABLE IF EXISTS `classify_news`;
CREATE TABLE `classify_news` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
`uid` int(11) NULL DEFAULT NULL COMMENT 'uid',
`pid` int(11) NULL DEFAULT NULL COMMENT 'pid',
`zhuti` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '主题',
PRIMARY KEY (`id`) USING BTREE,
INDEX `pid`(`pid`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for classify_solutions
-- ----------------------------
DROP TABLE IF EXISTS `classify_solutions`;
CREATE TABLE `classify_solutions` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
`uid` int(55) NULL DEFAULT NULL COMMENT 'uid',
`pid` int(11) NULL DEFAULT NULL COMMENT 'pid',
`zhuti` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '智慧城市',
PRIMARY KEY (`id`) USING BTREE,
INDEX `pid`(`pid`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for custom
-- ----------------------------
DROP TABLE IF EXISTS `custom`;
CREATE TABLE `custom` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
`uid` int(11) NULL DEFAULT NULL COMMENT 'uid',
`customerCenter` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '客户中心',
`title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标题',
`content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for joinus
-- ----------------------------
DROP TABLE IF EXISTS `joinus`;
CREATE TABLE `joinus` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
`uid` int(11) NULL DEFAULT NULL COMMENT 'uid',
`joinTitle` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '招聘标题',
`joinContent` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '招聘内容',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for news
-- ----------------------------
DROP TABLE IF EXISTS `news`;
CREATE TABLE `news` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
`uid` int(11) NULL DEFAULT NULL COMMENT 'uid',
`pid` int(11) NULL DEFAULT NULL COMMENT 'pid',
`newsTitle` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '新闻_标题',
`newsTime` datetime(0) NULL DEFAULT NULL COMMENT '新闻_发表时间',
`newsAuthor` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '新闻_文章编辑/作者',
`newsViewed` int(255) NULL DEFAULT NULL COMMENT '新闻_浏览次数',
`newsTab` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '新闻_标签',
`newsContent` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '新闻_内容',
PRIMARY KEY (`id`) USING BTREE,
INDEX `ky_erji`(`pid`) USING BTREE,
CONSTRAINT `ky_erji` FOREIGN KEY (`pid`) REFERENCES `classify_news` (`pid`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 39 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for solution
-- ----------------------------
DROP TABLE IF EXISTS `solution`;
CREATE TABLE `solution` (
`id` int(255) NOT NULL AUTO_INCREMENT COMMENT 'id',
`uid` int(50) NULL DEFAULT NULL COMMENT 'uid',
`pid` int(50) NULL DEFAULT NULL COMMENT 'pid',
`solutionTitle` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标题',
`solutionTime` datetime(0) NULL DEFAULT NULL COMMENT '发表日期',
`solutionAuthor` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文章编辑:作者',
`solutionViewed` int(255) NULL DEFAULT NULL COMMENT '浏览次数',
`solutionTab` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标签',
`solutionCoutent` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '内容',
PRIMARY KEY (`id`) USING BTREE,
INDEX `ky_erji`(`uid`) USING BTREE,
INDEX `ky_erjicaidan`(`pid`) USING BTREE,
CONSTRAINT `ky_erjicaidan` FOREIGN KEY (`pid`) REFERENCES `classify_solutions` (`pid`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
2.pom.xml导入需要的包
<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.0modelVersion>
<parent>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-parentartifactId>
<version>2.3.2.RELEASEversion>
<relativePath/>
parent>
<groupId>com.wanggroupId>
<artifactId>useartifactId>
<version>0.0.1-SNAPSHOTversion>
<name>usename>
<description>Demo project for Spring Bootdescription>
<properties>
<java.version>1.8java.version>
properties>
<dependencies>
<dependency>
<groupId>io.springfoxgroupId>
<artifactId>springfox-swagger2artifactId>
<version>2.7.0version>
dependency>
<dependency>
<groupId>io.springfoxgroupId>
<artifactId>springfox-swagger-uiartifactId>
<version>2.7.0version>
dependency>
<dependency>
<groupId>com.baomidougroupId>
<artifactId>mybatis-plus-boot-starterartifactId>
<version>3.0.5version>
dependency>
<dependency>
<groupId>com.baomidougroupId>
<artifactId>mybatis-plusartifactId>
<version>3.0.5version>
dependency>
<dependency>
<groupId>org.apache.velocitygroupId>
<artifactId>velocity-engine-coreartifactId>
<version>2.0version>
dependency>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-configuration-processorartifactId>
<optional>trueoptional>
dependency>
<dependency>
<groupId>mysqlgroupId>
<artifactId>mysql-connector-javaartifactId>
dependency>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-webartifactId>
dependency>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-devtoolsartifactId>
<scope>runtimescope>
<optional>trueoptional>
dependency>
<dependency>
<groupId>mysqlgroupId>
<artifactId>mysql-connector-javaartifactId>
<scope>runtimescope>
dependency>
<dependency>
<groupId>javax.servletgroupId>
<artifactId>servlet-apiartifactId>
<version>2.5version>
<scope>providedscope>
dependency>
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-testartifactId>
<scope>testscope>
<exclusions>
<exclusion>
<groupId>org.junit.vintagegroupId>
<artifactId>junit-vintage-engineartifactId>
exclusion>
exclusions>
dependency>
dependencies>
<build>
<resources>
<resource>
<directory>src/main/javadirectory>
<includes>
<include>**/*.xmlinclude>
includes>
resource>
<resource>
<directory>src/main/resourcesdirectory>
<includes>
<include>**/*.ymlinclude>
<include>**/*.yamlinclude>
<include>**/*.propertiesinclude>
<include>**/*.xmlinclude>
includes>
<filtering>falsefiltering>
resource>
resources>
<plugins>
<plugin>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-maven-pluginartifactId>
plugin>
plugins>
build>
project>
3.链接数据库
server:
port: 8080
#数据库链接配置
spring:
datasource:
username: root
password: 123456
url: jdbc:mysql://localhost:3306/use?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC
driver-class-name: com.mysql.cj.jdbc.Driver
# sql执行效率,执行的慢报错
profiles:
active: dev #开发
mybatis-plus:
mapper-locations: classpath:mapper/*.xml
config:
swagger-ui-open: true
4.使用代码自动生成工具类 (参考)
package com.wang;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.GlobalConfig;
import com.baomidou.mybatisplus.generator.config.PackageConfig;
import com.baomidou.mybatisplus.generator.config.StrategyConfig;
import com.baomidou.mybatisplus.generator.config.po.TableFill;
import com.baomidou.mybatisplus.generator.config.rules.DateType;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import java.util.ArrayList;
//自动代码生成器
public class Code {
public static void main(String[] args) {
//需要构建一个代码自动生成器对象
AutoGenerator mpg = new AutoGenerator();
//配置策略
//1.全局配置
GlobalConfig gc = new GlobalConfig();
//获取系统当前目录
String property = System.getProperty("user.dir");
//代码生成到这个目录下
gc.setOutputDir(property + "/src/main/java");
gc.setAuthor("王");//代码上注释的作者
gc.setOpen(false);//是否打开资源管理器(代码生成后打开代码所在文件夹)
gc.setFileOverride(true);//是否覆盖原来生成的
gc.setServiceName("%sService");//去Service的I前缀
gc.setIdType(IdType.ID_WORKER);//生成策略
gc.setDateType(DateType.ONLY_DATE);//时间类型
gc.setSwagger2(true);//自动配置swagger文档
mpg.setGlobalConfig(gc);
//2.设置数据源(配用户名链接密码连接数据库)
DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://localhost:3306/use?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC");
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
dsc.setUsername("root");
dsc.setPassword("123456");
dsc.setDbType(DbType.MYSQL);//数据库的类型
mpg.setDataSource(dsc);
//3.包的配置
PackageConfig pc = new PackageConfig();
//pc.setModuleName("site");//模块名字
pc.setParent("com.wang");//生成模块在这个路径下
pc.setEntity("entity");
pc.setMapper("mapper");
pc.setService("service");
pc.setController("controller");
mpg.setPackageInfo(pc);
//策略配置
StrategyConfig strategy = new StrategyConfig();
strategy.setInclude("about,classify_news,classify_solutions,custom,joinus,news,solution");//要生成的表名,想要生成哪个表的代码就填表名,可传多个参数,","隔开
strategy.setNaming(NamingStrategy.underline_to_camel);//下划线转驼峰命名
strategy.setColumnNaming(NamingStrategy.underline_to_camel);//列的名字下划线转驼峰
strategy.setEntityLombokModel(true); //是否使用lombok开启注解链式变成是否支持
strategy.setLogicDeleteFieldName("deleted");//逻辑删除(deleted表明)
//自动填充配置
TableFill tableFill = new TableFill("user", FieldFill.INSERT);//创建时自动填充策略user数据库表
TableFill tableFill1 = new TableFill("user", FieldFill.INSERT_UPDATE);//修改时
ArrayList<TableFill> list = new ArrayList<>();
list.add(tableFill);
list.add(tableFill1);
strategy.setTableFillList(list);
//乐观锁
strategy.setVersionFieldName("version");//乐观锁
strategy.setRestControllerStyle(true);//开启驼峰命名格式
strategy.setControllerMappingHyphenStyle(true);//localhost:8080/hello_id_2
mpg.execute();//执行
}
}
(1).Entity(pojo)实体类:
package com.wang.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
*
*
*
* @author 王
* @since 2020-08-05
*/
@ApiModel(value="About对象", description="")
public class About implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "uid")
private Integer uid;
@ApiModelProperty(value = "大用概况")
private String situation;
@ApiModelProperty(value = "总经理致辞")
private String aSpeech;
@ApiModelProperty(value = "使命目标")
private String target;
@ApiModelProperty(value = "组织机构")
private String institutions;
@ApiModelProperty(value = "企业文化")
private String culture;
@ApiModelProperty(value = "企业优势")
private String advantages;
@ApiModelProperty(value = "大用市场")
private String market;
@ApiModelProperty(value = "资质荣誉")
private String honor;
@ApiModelProperty(value = "公共关系")
private String relations;
@ApiModelProperty(value = "大用历程")
private String course;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public String getSituation() {
return situation;
}
public void setSituation(String situation) {
this.situation = situation;
}
public String getaSpeech() {
return aSpeech;
}
public void setaSpeech(String aSpeech) {
this.aSpeech = aSpeech;
}
public String getTarget() {
return target;
}
public void setTarget(String target) {
this.target = target;
}
public String getInstitutions() {
return institutions;
}
public void setInstitutions(String institutions) {
this.institutions = institutions;
}
public String getCulture() {
return culture;
}
public void setCulture(String culture) {
this.culture = culture;
}
public String getAdvantages() {
return advantages;
}
public void setAdvantages(String advantages) {
this.advantages = advantages;
}
public String getMarket() {
return market;
}
public void setMarket(String market) {
this.market = market;
}
public String getHonor() {
return honor;
}
public void setHonor(String honor) {
this.honor = honor;
}
public String getRelations() {
return relations;
}
public void setRelations(String relations) {
this.relations = relations;
}
public String getCourse() {
return course;
}
public void setCourse(String course) {
this.course = course;
}
@Override
public String toString() {
return "About{" +
"id=" + id +
", uid=" + uid +
", situation=" + situation +
", aSpeech=" + aSpeech +
", target=" + target +
", institutions=" + institutions +
", culture=" + culture +
", advantages=" + advantages +
", market=" + market +
", honor=" + honor +
", relations=" + relations +
", course=" + course +
"}";
}
}
(2).Mapper(Dao) 使用注解:
package com.wang.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wang.entity.About;
import org.apache.ibatis.annotations.*;
import java.util.List;
/**
*
* Mapper 接口
*
*
* @author 王
* @since 2020-08-05
*/
public interface AboutMapper extends BaseMapper<About> {
//查询所有
@Select("select * from about ")
List<About> queryAllAbout();
//通过id查询数据
@Select("select * from about where id=#{id}")
List<About> queryById(Integer id);
//通过uid查询数据
@Select("select * from about where uid=#{uid}")
List<About> queryByUid(Integer uid);
//模糊查询
@Select("select * from about where " +
"uid like '%${value}%'" +
"or situation like '%${value}%' " +
"or aSpeech like '%${value}%' " +
"or target like '%${value}%' " +
"or institutions like '%${value}%' " +
"or culture like '%${value}%' " +
"or advantages like '%${value}%' " +
"or market like '%${value}%' " +
"or honor like '%${value}%' " +
"or relations like '%${value}%' " +
"or course like '%${value}%' ")
List<About> queryLike(String value);
//添加
@Insert("insert into about (uid,situation,aSpeech,target,institutions,culture," +
"advantages,market,honor,relations,course)" +
" values(#{uid}," +
"#{situation}," +
"#{aSpeech}," +
"#{target}," +
"#{institutions}," +
"#{culture}," +
"#{advantages}," +
"#{market}," +
"#{honor}," +
"#{relations}," +
"#{course})")
int addAbout(About about);
//删除
@Delete("delete from about where id=#{id}")
int delAbout(Integer id);
//修改:sql语句属性前要加表名
@Update("update use.about set " +
"uid=#{about.uid}," +
"situation=#{about.situation}," +
"aSpeech=#{about.aSpeech}," +
"target=#{about.target}" +
"institutions=#{about.institutions}" +
"culture=#{about.culture}" +
"advantages=#{about.advantages}" +
"market=#{about.market}" +
"honor=#{about.honor}" +
"relations=#{about.relations}" +
"course=#{about.course}" +
" where id=#{id}")
int updateAbout(@Param("about") About about, @Param("id") Integer id);
}
(3).Service:
package com.wang.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wang.entity.About;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
* 服务类
*
*
* @author 王
* @since 2020-08-05
*/
public interface AboutService extends IService<About> {
//查询所有
List<About> queryAllAbout();
//通过id查询数据
List<About> queryById(Integer id);
//通过uid查询数据
List<About> queryByUid(Integer uid);
//模糊查询
List<About> queryLike(String value);
//添加
int addAbout(About about);
//删除
int delAbout(Integer id);
//修改
int updateAbout(@Param("about") About about, @Param("id") Integer id);
}
(4).:ServiceImpl实现类:
package com.wang.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wang.entity.About;
import com.wang.mapper.AboutMapper;
import com.wang.service.AboutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
* 服务实现类
*
*
* @author 王
* @since 2020-08-05
*/
@Service
public class AboutServiceImpl extends ServiceImpl<AboutMapper, About> implements AboutService {
@Autowired
AboutMapper aboutMapper;
@Override
public List<About> queryAllAbout() {
return aboutMapper.queryAllAbout();
}
@Override
public List<About> queryById(Integer id) {
return aboutMapper.queryById(id);
}
@Override
public List<About> queryByUid(Integer uid) {
return aboutMapper.queryByUid(uid);
}
@Override
public List<About> queryLike(String value) {
return aboutMapper.queryLike(value);
}
@Override
public int addAbout(About about) {
return aboutMapper.addAbout(about);
}
@Override
public int delAbout(Integer id) {
return aboutMapper.delAbout(id);
}
@Override
public int updateAbout(About about, Integer id) {
return aboutMapper.updateAbout(about, id);
}
}
(5).Controller 控制器:
注解:@CrossOrigin(解决跨域问题)详见
@Api,@ApiOperation(Swagger:接口测试工具)详见
package com.wang.controller;
import com.wang.entity.About;
import com.wang.service.impl.AboutServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
*
* 前端控制器
*
*
* @author 王
* @since 2020-08-05
*/
@RestController
@CrossOrigin
@Api(description = "关于我们:AboutController")
@RequestMapping("/about")
public class AboutController {
@Autowired
AboutServiceImpl aboutService;
@GetMapping("/api_all_about")
@ApiOperation("查询全部")
public List<About> queryAllAbout() {
return aboutService.queryAllAbout();
}
@GetMapping("/api_id_about")
@ApiOperation("id查询")
public List<About> queryById(Integer id) {
return aboutService.queryById(id);
}
@GetMapping("/api_uid_about")
@ApiOperation("uid查询")
public List<About> queryByUid(Integer uid) {
return aboutService.queryByUid(uid);
}
@GetMapping("/api_like_about")
@ApiOperation("模糊查询")
public List<About> queryLike(String value) {
return aboutService.queryLike(value);
}
@GetMapping("/api_add_about")
@ApiOperation("添加")
public int addAbout(About about) {
return aboutService.addAbout(about);
}
@GetMapping("/api_del_about")
@ApiOperation("删除")
public int delete(Integer id) {
return aboutService.delAbout(id);
}
@GetMapping("/api_upd_about")
@ApiOperation("修改")
public int updateAbout(About about, Integer id) {
return aboutService.updateAbout(about, id);
}
}
运行项目:
输入:http://ip地址:端口号/swagger-ui.html 进入swagger接口测试界面