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

扬州高邮网站建设焊工培训心得体会

扬州高邮网站建设,焊工培训心得体会,工商所什么网站可做年报,做美食介绍的网站一、新建一个spring boot项目 如何在idea中创建一个SpringBoot项目&#xff08;超详细教学&#xff09;_我是老伯的博客-CSDN博客 二、建立分层包 添加依赖 <dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter<…

一、新建一个spring boot项目

如何在idea中创建一个SpringBoot项目(超详细教学)_我是老伯的博客-CSDN博客

二、建立分层包

添加依赖

<dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>3.4.2</version>
</dependency>

1. config层 MybatisPlusConfig.java   

集成完毕分页插件之后,可去掉PageHelper 分页插件

@Configuration
public class MybatisPlusConfig {// 最新版@Bean  // <bean id=""/>public MybatisPlusInterceptor mybatisPlusInterceptor() {MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));return interceptor;}
}

2. entity层 Student.java

@Data
public class Student {private Long id;private String name;private String number;}

3.mapper层 StudentMapper.java

public interface StudentMapper extends BaseMapper<Student> {
}

4.service层 Impl包下StudentServiceImpl.java

@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> implements StudentService {
}

StudentService.java

public interface StudentService extends IService<Student> {}

mybatis plus配置

application.yaml

spring:datasource:url: jdbc:mysql://localhost:3306/qcby_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=CTTusername: rootpassword: 密码driver-class-name: com.mysql.cj.jdbc.Driver
# mybatis-plus配置
mybatis-plus:configuration:log-impl: org.apache.ibatis.logging.stdout.StdOutImpltypeAliasesPackage: com.qcby.zsgc.entitymapperLocations: classpath:mapper/*.xml#  全局配置id自增global-config:db-config:id-type: autopagehelper:helperDialect: mysqlreasonable: true # 修改默认值

5. controller层 Studentcontroller.java

@RestController
@RequestMapping("/student")
public class StudentController {@Autowiredprivate StudentService studentService;@RequestMapping("save")public void save(Student student){studentService.save(student);}@RequestMapping("update")public void update(Student student) {studentService.updateById(student);}@RequestMapping("saveOrUpdate")public void saveOrUpdate(Student student){studentService.saveOrUpdate(student);}@RequestMapping("removeById")public void removeById(Long id) {studentService.removeById(id);}@RequestMapping("list")public List<Student> list(Long id) {return studentService.list();}/*** 查询条件 =》name得模糊查询 和 number精确匹配  可选的* @param pageNo* @param pageSize* @return*/@RequestMapping("listPage")public Page<Student> listPage(Integer pageNo,Integer pageSize){Page<Student> page =new Page(pageNo,pageSize);return studentService.page(page);}
}

 添加模糊查询和精确查询

@RequestMapping("listPage")public Page<Student> listPage(Integer pageNo,Integer pageSize,Student student){//处理分页Page<Student> page =new Page(pageNo,pageSize);//帮助我们拼接whereQueryWrapper<Student> queryWrapper = new QueryWrapper();if(!StringUtils.isEmpty(student.getName())){queryWrapper.like("name",student.getName());}if (!StringUtils.isEmpty(student.getNumber())) {queryWrapper.eq("numner",student.getNumber());}//添加分页 和查询条件return studentService.page(page,queryWrapper);}

http://www.lbrq.cn/news/2764711.html

相关文章:

  • 抖音网站怎么做热门推广软件
  • 直播app开发教程seo排名优化app
  • 网站建设制作及推广seo基础知识培训
  • wordpress略缩图altseo服务包括哪些
  • 如何用xshell安装wordpress百度关键词优化推广
  • 单独做手机网站怎么做百度广告投放价格表
  • 如何提高网站点击率怎么做搜索引擎优化排名技巧
  • 前端入门先学什么seo交流群
  • 做好政府门户网站的建设百度排名点击
  • 网红营销模式分析英文网站seo
  • 计算机网站建设开题报告如何自己建设网站
  • 求个没封的a站yw1129cm苏州推广排名
  • 网站 开发流程国内最新消息
  • 外贸soho怎么建网站廊坊seo快速排名
  • 广州大型网站建设公司排名全网整合营销推广系统
  • 建设网站公司哪家好软件网站排行榜
  • 深圳企业网站建设费用温州seo招聘
  • 沈阳市网站建设哪里的公司比较好线上营销策划案例
  • dedecms能做什么网站微信引流推广精准粉
  • 静态网站作品怎么做网络营销推广啊
  • 网站建设公司网站定制开发网站怎么推广
  • 无锡优化网站公司百度合伙人答题兼职赚钱
  • wordpress的xmlrpc长沙优化科技有限公司
  • 苏州模板做网站官网整站优化
  • 九江建网站公司有哪些免费的关键词优化软件
  • 域名网站平台网站设计公司怎么样
  • 网站服务公司代买空间有无义务软文代写接单平台
  • 金融公司网站制作免费建站哪个网站最好
  • 自己网站建设多少钱站长资源平台
  • 网站布局f网络营销策略
  • Linux设备树简介
  • Leetcode 16 java
  • 英特尔公司Darren Pulsipher 博士:以架构之力推动政府数字化转型
  • 48.Seata认识、部署TC服务、微服务集成
  • vue封装请求拦截器 响应拦截器
  • 原子操作及基于原子操作的shared_ptr实现