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

多多进宝怎么做自己网站wordpress相对路径设置

多多进宝怎么做自己网站,wordpress相对路径设置,搜索关键词的软件,怎样策划一个营销型网站一、mybtis-plus配置下载 MyBatis-Plus 是一个 Mybatis 增强版工具#xff0c;在 MyBatis 上扩充了其他功能没有改变其基本功能#xff0c;为了简化开发提交效率而存在。 具体的介绍请参见官方文档。 官网文档地址#xff1a;mybatis-plus 添加mybatis-plus依赖 depe…一、mybtis-plus配置下载 MyBatis-Plus 是一个 Mybatis 增强版工具在 MyBatis 上扩充了其他功能没有改变其基本功能为了简化开发提交效率而存在。 具体的介绍请参见官方文档。 官网文档地址mybatis-plus 添加mybatis-plus依赖 dependencygroupIdcom.baomidou/groupIdartifactIdmybatis-plus-boot-starter/artifactIdversion3.5.1/version /dependency添加MyBatisPlusConfig配置文件 config包中添加MyBatisPlusConfig配置文件将原来在mapper中的mapper注解取消继承上BaseMapper泛型接口即可。 Mybatis-Plus里的BaseMapper接口自带crud功能继承了BaseMapper接口的接口.。 代码如下 package com.example.demo.config;import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import org.mybatis.spring.annotation.MapperScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration;Configuration MapperScan(com.example.demo.demos.web.demo.mapper) public class MyBatisPlusConfig {//配置分页插件Beanpublic MybatisPlusInterceptor mybatisPlusInterceptor(){MybatisPlusInterceptor interceptor new MybatisPlusInterceptor();//数据库类型是MySql因此参数填写DbType.MYSQLinterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));return interceptor;}}mapper 中如下配置 3. yml 中写如下配置 mybatis-plus:configuration:log-impl: org.apache.ibatis.logging.stdout.StdOutImpl二、mybtis-plus实现增删改查 数据增加或修改 在这里插入图片描述 结果 修改 注意映射表不要瞎加字段否则容易出现异常 Error querying database. Cause: java.sql.SQLSyntaxErrorException: Unknown column ‘page_num’ in ‘field list’ 所有代码 config package com.example.demo.config;import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import org.mybatis.spring.annotation.MapperScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration;Configuration MapperScan(com.example.demo.demos.web.demo.mapper) public class MyBatisPlusConfig {//配置分页插件Beanpublic MybatisPlusInterceptor mybatisPlusInterceptor(){MybatisPlusInterceptor interceptor new MybatisPlusInterceptor();//数据库类型是MySql因此参数填写DbType.MYSQLinterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));return interceptor;}}controller package com.example.demo.demos.web.demo.controller;import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.example.demo.demos.web.demo.entity.UserEntity; import com.example.demo.demos.web.demo.mapper.UserMapper; import com.example.demo.demos.web.demo.service.UserService; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*;import java.util.HashMap; import java.util.List; import java.util.Map;RestController RequestMapping(user) public class UserController {// Autowired// private UserMapper userMapper;Autowiredpublic UserService userService; /* GetMapping(/)public ListUserEntity index(){return userMapper.findAll();}*///使用mybtis-plus实现查询所有数据GetMapping(/)public ListUserEntity findAll(){return userService.list();}/* PostMapping(/add)//这里做了一个单纯的添加的示例使用的是mapper中的insert方法public Integer save(RequestBody UserEntity userEntity){return userService.save(userEntity);}*//* DeleteMapping(/{id})public Integer deleteById(PathVariable Integer id){return userService.deleteById(id);}*///使用mybtis-plus实现删除DeleteMapping(/{id})public boolean deleteById(PathVariable Integer id){return userService.removeById(id);}PostMapping(/add)//使用mybtis-plus,注意这里返回的是boolean型public Boolean save(RequestBody UserEntity user) {return userService.saveUser(user);}//分页查询//接口路径user/page?pageNum1pageSize10//RequestParam接受前台传过来的第几页每页显示数 /* GetMapping(/page)public MapString,Object findPage(RequestParam Integer pageNum,RequestParam Integer pageSize){pageNum(pageNum-1)*pageSize;ListUserEntity datauserService.selectPage(pageNum,pageSize);Integer totaluserMapper.selectTotal();MapString,Object resnew HashMap();res.put(data,data);res.put(total,total);return res;}*///使用mybtis-plus实现根据ID查找记录GetMapping(/{id})public UserEntity findOne(PathVariable Integer id){return userService.getById(id);}//使用mybtis-plus实现模糊查询并分页GetMapping(/page)public IPageUserEntity findPage(RequestParam Integer pageNum,RequestParam Integer pageSize,RequestParam(defaultValue ) String username,RequestParam(defaultValue ) String nickname,RequestParam(defaultValue ) String address){IPageUserEntity pagenew Page(pageNum,pageSize);QueryWrapperUserEntity queryWrappernew QueryWrapper();queryWrapper.like(username,username);queryWrapper.like(nickname,nickname);queryWrapper.like(address,address);return userService.page(page,queryWrapper);}}entity package com.example.demo.demos.web.demo.entity;import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor;Data NoArgsConstructor AllArgsConstructor TableName(valuesys_user) public class UserEntity {TableId(value id,type IdType.AUTO)private Integer id; /* private Integer pageNum;private Integer pageSize;*/private String username;private String password;private String email;private String phone;private String nickname;private String address;private String create_time;private String avatar;private String role;} mapper package com.example.demo.demos.web.demo.mapper;import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.example.demo.demos.web.demo.entity.UserEntity; import org.apache.ibatis.annotations.*;import java.util.List;//Mapper 前面配置文件中已经配置 这个注解可以注销但是要继承接口 public interface UserMapper extends BaseMapperUserEntity {/* Select(select * from sys_user limit #{pageNum},#{pageSize})ListUserEntity selectPage(Param(pageNum) Integer pageNum,Param(pageSize) Integer pageSize);//Select(select * from sys_user limit #{pageNum},#{pageSize})Select(select * from sys_user)ListUserEntity findAll();Insert(insert into sys_user(username,password,email,phone,nickname,address,avatar,role) VALUES(#{username},#{password},#{email},#{phone},#{nickname},#{address},#{avatar},#{role});)//这里只是做测试使用int insert(UserEntity userEntity);int update(UserEntity userEntity);Delete(delete from sys_user where id#{id})int deleteById(Param(id) Integer id);*/// 记录总数/* Select(select count(*) from sys_user)Integer selectTotal(); */}service package com.example.demo.demos.web.demo.service;import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.example.demo.demos.web.demo.entity.UserEntity; import com.example.demo.demos.web.demo.mapper.UserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service;import java.util.List;Service public class UserService extends ServiceImplUserMapper, UserEntity {// Autowired// private UserMapper userMapper;/* public int save(UserEntity userEntity){//如果user没有id则表明是新增if(userEntity.getId()null){return userMapper.insert(userEntity);}//否则就是更新else {return userMapper.update(userEntity);}}*/public Boolean saveUser(UserEntity userEntity){return saveOrUpdate(userEntity);}/* public Integer deleteById(Integer id) {return userMapper.deleteById(id);}*/// 分页查找/* public List selectPage(Integer pageNum, Integer pageSize) {return userMapper.selectPage(pageNum,pageSize);}*/} 项目架构
http://www.w-s-a.com/news/128562/

相关文章:

  • 深圳整站seo个人网站建设一般流程
  • 济南网站中企动力wordpress主题ripro
  • 淮北网站建设求职简历怎么做点击图片进网站
  • 自适应网站推广注册公司流程和费用公司注册
  • 电子商务网站建设预算表网站建设卩金手指科杰
  • 广西响应式网站哪家好产品网络推广怎样做
  • 移动网可以上的网站是什么样子的淘宝优惠券网站开发
  • wordpress php设置伊宁seo网站建设
  • 兰陵住房建设局网站wordpress中文标题
  • 福州搜索优化网站个人网页网站制作模板
  • 网站开发分哪几个步骤使用wordpress开发一个页面跳转
  • 网站制作后还能更改么wordpress 近期文章 代码
  • 做一个小网站需要多少钱wordpress集成paypal
  • 加强网站建设管理 及时更新自己设计装修的app
  • 集团网站设计案例网页制作网站开发
  • 怎么优化网站的单个关键词排名惠州品牌网站建设
  • 上海跨境电商网站制作wordpress弃用react
  • phpcms网站模版下载电商网站建设属于研发费用吗
  • 动画毕业设计代做网站高校门户网站建设需要多少钱
  • 网站内链设置wordpress前台特别慢
  • 杭州模板网站建设系统江苏省建设考试网站准考证打印
  • 国家建设执业资格注册中心网站企业手机网站建设机构
  • 内容管理系统做网站怎么做英文版的网站
  • 浙江省专业网站制作网站建设网站设计及内容策划
  • 浙江门户网站建设公司做网站上哪买空间
  • 郑州网站怎么推广贵阳市网站建设
  • 规范网站建设福州外贸网站建设推广
  • 平台电商网站开发传媒公司排行
  • 在哪给人做网站怎么样制作一个网页
  • 网站更改文章标题广西新闻