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

淘宝刷单网站制作必应搜索引擎首页

淘宝刷单网站制作,必应搜索引擎首页,做网站襄樊,工业产品设计公司排名文章目录 说明流程增加依赖修改配置文件注释掉MybatisConfig里面的Bean 代码生成使用IDEA生成代码注意 Controller文件 说明 若依管理系统是一个非常完善的管理系统模板,里面含有代码生成的方法,可以帮助用户快速进行开发,但是项目使用的是m…

文章目录

  • 说明
  • 流程
    • 增加依赖
    • 修改配置文件
    • 注释掉MybatisConfig里面的Bean
  • 代码生成
    • 使用IDEA生成代码
      • 注意
    • Controller文件

说明

若依管理系统是一个非常完善的管理系统模板,里面含有代码生成的方法,可以帮助用户快速进行开发,但是项目使用的是mybatis,对于熟悉使用mybatis-plus进行开发的小伙伴们不是很便捷,本文主要讲解如何在不影响系统现有功能的基础上,将mybatis升级为mybatis-plus,以帮助小伙伴们更快速地开发。

流程

增加依赖

【首先修改父模块的pom.xml文件】
在这里插入图片描述

分别在properties标签内和dependencies标签内增加内容,所需增加的内容如下面的xml

    <properties><mybatis-plus.version>3.2.0</mybatis-plus.version></properties><!-- 依赖声明 --><dependencyManagement><dependencies><!-- mybatis-plus --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>${mybatis-plus.version}</version></dependency></dependencies></dependencyManagement>

【其次修改common包下的pom.xml文件】
在这里插入图片描述

直接在dependencies标签内增加如下内容即可,因为父模块已经管理了版本,这里不需要再声明版本

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

修改配置文件

需要修改admin包下的application.yml文件

在这里插入图片描述
在这里插入图片描述
注释掉mybatis的配置之后(mybatis-plus是兼容mybatis的,小伙伴们放心注释就行),增加mybatis-plus的配置,配置如下

mybatis-plus:mapper-locations: classpath*:mapper/**/*Mapper.xmltype-aliases-package: com.ruoyi.**.domainglobal-config:db-config:id-type: autoconfiguration:map-underscore-to-camel-case: truecache-enabled: falselog-impl: org.apache.ibatis.logging.stdout.StdOutImpl

注释掉MybatisConfig里面的Bean

系统会自动根据配置文件构建mybatisplus相关的Bean,所以这里也不需要修改成mybatis-plus的

在这里插入图片描述
修改之后记得重新 install framework包,这样修改才会生效

在这里插入图片描述

代码生成

上面的操作虽然是将mybatis-plus引入了,但是有小伙伴疑问了,使用若依管理系统自带的代码生成器,生成的还是mybatis的代码呀,那怎么办呢?

为了解决小伙伴们心中的疑惑,我这里提供一种解决思路,那就是结合IDEA生成的代码和若依代码生成器的代码

使用IDEA生成代码

首先安装下面的插件,记得安装1.5.5版本的插件,高版本的插件可能会有问题(我之前是安装的高版本,出问题之后才回退的),具体安装可以去阅读其他博主的教程

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

生成成功,由下图可知,除了controller外,其他代码都已经生成成功

在这里插入图片描述

注意

使用MybatisX生成的实体类是没有逻辑删除等注解的,如果需要使用逻辑删除,或者自动填充ID和时间,需要在实体类上面添加注解

Controller文件

Controller文件直接使用若依的代码生成器生成即可,使用这种方式生成的好处是,若依会生成对应的前端文件,这样可以直接搭配使用,不需要再去修改生成的api

在这里插入图片描述

虽然若依生成器生成了Controller代码,但是没办法直接将其进行应用,因为我们前面生成的Service文件使用的是mybatis-plus,所以还需要对Controller文件进行修改,修改的方式可以参考我下面的代码,当然这个代码还是非常不完善的,比如数据校验那些都没有

package com.shm.controller;import java.util.List;
import javax.servlet.http.HttpServletResponse;import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.core.domain.entity.Follow;
import com.ruoyi.common.core.domain.model.LoginUser;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.shm.service.IFollowService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;/*** 关注Controller** @author dam* @date 2023-08-08*/
@RestController
@RequestMapping("/market/follow")
public class FollowController extends BaseController {@Autowiredprivate IFollowService followService;/*** 查询关注列表*/@PreAuthorize("@ss.hasPermi('shm:follow:list')")@GetMapping("/list")public TableDataInfo list(Follow follow) {startPage();List<Follow> list = followService.list(new QueryWrapper<Follow>(follow));return getDataTable(list);}/*** 导出关注列表*/@PreAuthorize("@ss.hasPermi('shm:follow:export')")@Log(title = "关注", businessType = BusinessType.EXPORT)@PostMapping("/export")public void export(HttpServletResponse response, Follow follow) {List<Follow> list = followService.list(new QueryWrapper<Follow>(follow));ExcelUtil<Follow> util = new ExcelUtil<Follow>(Follow.class);util.exportExcel(response, list, "关注数据");}/*** 获取关注详细信息*/@PreAuthorize("@ss.hasPermi('shm:follow:query')")@GetMapping(value = "/{id}")public AjaxResult getInfo(@PathVariable("id") Long id) {return success(followService.getById(id));}/*** 新增关注*/@PreAuthorize("@ss.hasPermi('shm:follow:add')")@Log(title = "关注", businessType = BusinessType.INSERT)@PostMappingpublic AjaxResult add(@RequestBody Follow follow) {// 设置商品主人LoginUser loginUser = getLoginUser();follow.setFollowerId(loginUser.getUserId());return toAjax(followService.save(follow));}/*** 修改关注*/@PreAuthorize("@ss.hasPermi('shm:follow:edit')")@Log(title = "关注", businessType = BusinessType.UPDATE)@PutMappingpublic AjaxResult edit(@RequestBody Follow follow) {return toAjax(followService.updateById(follow));}/*** 删除关注*/@PreAuthorize("@ss.hasPermi('shm:follow:remove')")@Log(title = "关注", businessType = BusinessType.DELETE)@DeleteMapping("/{ids}")public AjaxResult remove(@PathVariable List<Long> ids) {return toAjax(followService.removeByIds(ids));}
}
http://www.zhongyajixie.com/news/54861.html

相关文章:

  • 安庆网站建设推广保定百度seo排名
  • 北京网站优化效果怎样淘宝关键词排名查询工具免费
  • WordPress网站打不开nginxseo搜索引擎优化策略
  • 网站空间商推荐网站开发公司排行榜
  • wordpress 网站名称宁波seo外包费用
  • 自己做网站打开很卡怎么把网站排名排上去
  • 手机网站建设的第一个问题b站推广网站2024年不用下载
  • 西宁做网站网络优化主要做什么
  • 博彩网站开发seo关键词排名优
  • 界面设计好看的网站谷歌推广一年多少钱
  • 门户网站建设实施方案商丘搜索引擎优化
  • 网站建设 人员 年终总结哪里有软件培训班
  • 网站推广策划书 精品如何做网站推广及优化
  • 怎么做网站推广平台网站流量统计平台
  • 网站建设与网页制作基础入门教程营销广告网站
  • 如何做免费域名网站昆山网站建设公司
  • 莞城网站仿做seo网站优化培训要多少钱
  • 网站代码编辑器志鸿优化网
  • 门户网站开发投标文件.doc微信搜一搜怎么做推广
  • 优化推广排名网站教程重庆整站seo
  • 张家界旅游网站官网b2b网站推广排名
  • 巢湖做网站seo网站优化平台
  • 邵阳整站优化网易游戏推广代理加盟
  • 大淘客联盟做网站石家庄网站建设方案优化
  • 手机版做我女朋友网站常州网站建设书生商友
  • 网站建设维护学什么九幺seo优化神器
  • 北京网站建设公司房山华网怎么注册网站平台
  • 网站建设人员配置竞价推广是什么工作
  • 网页设计和网站设计武汉 网络 推广
  • 制作网页网站项目介绍舆情网站直接打开怎么弄