1.添加MBG插件 \n2.使用mvn mybatis-generator:generate 生成 实体类和数据库操作类

This commit is contained in:
haotianmingyue 2025-06-27 09:39:30 +08:00
parent d0b844d976
commit c9fda9f5b1
18 changed files with 1511 additions and 1 deletions

18
pom.xml
View File

@ -70,6 +70,24 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
<!--生成mybatis一系列模版插件 -->
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
<overwrite>true</overwrite> <!-- 覆盖旧文件 -->
</configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.23</version>
</dependency>
</dependencies>
</plugin>
</plugins> </plugins>
</build> </build>

View File

@ -0,0 +1,110 @@
package com.example.testspring.demos.modules.common.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class BaseEntity implements Serializable
{
private static final long serialVersionUID = 1L;
/** 搜索值 */
private String searchValue;
/** 创建者 */
private String createBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 更新者 */
private String updateBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/** 备注 */
private String remark;
/** 请求参数 */
private Map<String, Object> params;
public String getSearchValue()
{
return searchValue;
}
public void setSearchValue(String searchValue)
{
this.searchValue = searchValue;
}
public String getCreateBy()
{
return createBy;
}
public void setCreateBy(String createBy)
{
this.createBy = createBy;
}
public Date getCreateTime()
{
return createTime;
}
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
public String getUpdateBy()
{
return updateBy;
}
public void setUpdateBy(String updateBy)
{
this.updateBy = updateBy;
}
public Date getUpdateTime()
{
return updateTime;
}
public void setUpdateTime(Date updateTime)
{
this.updateTime = updateTime;
}
public String getRemark()
{
return remark;
}
public void setRemark(String remark)
{
this.remark = remark;
}
public Map<String, Object> getParams()
{
if (params == null)
{
params = new HashMap<>();
}
return params;
}
public void setParams(Map<String, Object> params)
{
this.params = params;
}
}

View File

@ -0,0 +1,35 @@
package com.example.testspring.demos.modules.user.controller;
import com.example.testspring.demos.modules.user.entity.Robot;
import com.example.testspring.demos.modules.user.entity.SysMenu;
import com.example.testspring.demos.modules.user.entity.SysUser;
import com.example.testspring.demos.modules.user.service.IRobotService;
import com.example.testspring.demos.modules.user.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
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;
@RestController
@RequestMapping("/test")
public class testController {
@Autowired
private ISysUserService sysUserService;
@Autowired
private IRobotService robotService;
// @GetMapping("/testMenu")
// public List<SysMenu> test(){
// return sysUserService.selectMenuList();
// }
@GetMapping("/testRobot")
public List<Robot> test(){
return robotService.selectRobotList(new Robot());
}
}

View File

@ -0,0 +1,236 @@
package com.example.testspring.demos.modules.user.entity;
import java.util.Date;
public class Robot {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column robot.robotId
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
private String robotid;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column robot.number
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
private String number;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column robot.groupingId
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
private String groupingid;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column robot.onlineStatus
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
private String onlinestatus;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column robot.status
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
private String status;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column robot.createTime
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
private Date createtime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column robot.updateTime
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
private Date updatetime;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column robot.robotId
*
* @return the value of robot.robotId
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
public String getRobotid() {
return robotid;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column robot.robotId
*
* @param robotid the value for robot.robotId
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
public void setRobotid(String robotid) {
this.robotid = robotid;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column robot.number
*
* @return the value of robot.number
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
public String getNumber() {
return number;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column robot.number
*
* @param number the value for robot.number
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
public void setNumber(String number) {
this.number = number;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column robot.groupingId
*
* @return the value of robot.groupingId
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
public String getGroupingid() {
return groupingid;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column robot.groupingId
*
* @param groupingid the value for robot.groupingId
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
public void setGroupingid(String groupingid) {
this.groupingid = groupingid;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column robot.onlineStatus
*
* @return the value of robot.onlineStatus
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
public String getOnlinestatus() {
return onlinestatus;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column robot.onlineStatus
*
* @param onlinestatus the value for robot.onlineStatus
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
public void setOnlinestatus(String onlinestatus) {
this.onlinestatus = onlinestatus;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column robot.status
*
* @return the value of robot.status
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
public String getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column robot.status
*
* @param status the value for robot.status
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
public void setStatus(String status) {
this.status = status;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column robot.createTime
*
* @return the value of robot.createTime
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
public Date getCreatetime() {
return createtime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column robot.createTime
*
* @param createtime the value for robot.createTime
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column robot.updateTime
*
* @return the value of robot.updateTime
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
public Date getUpdatetime() {
return updatetime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column robot.updateTime
*
* @param updatetime the value for robot.updateTime
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
public void setUpdatetime(Date updatetime) {
this.updatetime = updatetime;
}
}

View File

@ -0,0 +1,267 @@
package com.example.testspring.demos.modules.user.entity;
public class SysMenu {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_menu.menu_id
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private Long menuId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_menu.parent_id
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private Long parentId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_menu.name
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private String name;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_menu.url
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private String url;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_menu.perms
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private String perms;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_menu.type
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private Integer type;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_menu.icon
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private String icon;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_menu.order_num
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private Integer orderNum;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_menu.menu_id
*
* @return the value of sys_menu.menu_id
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public Long getMenuId() {
return menuId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_menu.menu_id
*
* @param menuId the value for sys_menu.menu_id
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setMenuId(Long menuId) {
this.menuId = menuId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_menu.parent_id
*
* @return the value of sys_menu.parent_id
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public Long getParentId() {
return parentId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_menu.parent_id
*
* @param parentId the value for sys_menu.parent_id
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setParentId(Long parentId) {
this.parentId = parentId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_menu.name
*
* @return the value of sys_menu.name
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public String getName() {
return name;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_menu.name
*
* @param name the value for sys_menu.name
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setName(String name) {
this.name = name;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_menu.url
*
* @return the value of sys_menu.url
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public String getUrl() {
return url;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_menu.url
*
* @param url the value for sys_menu.url
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setUrl(String url) {
this.url = url;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_menu.perms
*
* @return the value of sys_menu.perms
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public String getPerms() {
return perms;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_menu.perms
*
* @param perms the value for sys_menu.perms
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setPerms(String perms) {
this.perms = perms;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_menu.type
*
* @return the value of sys_menu.type
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public Integer getType() {
return type;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_menu.type
*
* @param type the value for sys_menu.type
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setType(Integer type) {
this.type = type;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_menu.icon
*
* @return the value of sys_menu.icon
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public String getIcon() {
return icon;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_menu.icon
*
* @param icon the value for sys_menu.icon
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setIcon(String icon) {
this.icon = icon;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_menu.order_num
*
* @return the value of sys_menu.order_num
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public Integer getOrderNum() {
return orderNum;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_menu.order_num
*
* @param orderNum the value for sys_menu.order_num
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
}

View File

@ -0,0 +1,335 @@
package com.example.testspring.demos.modules.user.entity;
import java.util.Date;
public class SysUser {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_user.user_id
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private Long userId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_user.username
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private String username;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_user.password
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private String password;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_user.name
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private String name;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_user.salt
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private String salt;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_user.email
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private String email;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_user.mobile
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private String mobile;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_user.status
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private Byte status;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_user.create_user_id
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private Long createUserId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column sys_user.create_time
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
private Date createTime;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_user.user_id
*
* @return the value of sys_user.user_id
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public Long getUserId() {
return userId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_user.user_id
*
* @param userId the value for sys_user.user_id
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setUserId(Long userId) {
this.userId = userId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_user.username
*
* @return the value of sys_user.username
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public String getUsername() {
return username;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_user.username
*
* @param username the value for sys_user.username
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setUsername(String username) {
this.username = username;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_user.password
*
* @return the value of sys_user.password
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public String getPassword() {
return password;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_user.password
*
* @param password the value for sys_user.password
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setPassword(String password) {
this.password = password;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_user.name
*
* @return the value of sys_user.name
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public String getName() {
return name;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_user.name
*
* @param name the value for sys_user.name
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setName(String name) {
this.name = name;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_user.salt
*
* @return the value of sys_user.salt
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public String getSalt() {
return salt;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_user.salt
*
* @param salt the value for sys_user.salt
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setSalt(String salt) {
this.salt = salt;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_user.email
*
* @return the value of sys_user.email
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public String getEmail() {
return email;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_user.email
*
* @param email the value for sys_user.email
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setEmail(String email) {
this.email = email;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_user.mobile
*
* @return the value of sys_user.mobile
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public String getMobile() {
return mobile;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_user.mobile
*
* @param mobile the value for sys_user.mobile
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setMobile(String mobile) {
this.mobile = mobile;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_user.status
*
* @return the value of sys_user.status
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public Byte getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_user.status
*
* @param status the value for sys_user.status
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setStatus(Byte status) {
this.status = status;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_user.create_user_id
*
* @return the value of sys_user.create_user_id
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public Long getCreateUserId() {
return createUserId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_user.create_user_id
*
* @param createUserId the value for sys_user.create_user_id
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column sys_user.create_time
*
* @return the value of sys_user.create_time
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column sys_user.create_time
*
* @param createTime the value for sys_user.create_time
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -0,0 +1,50 @@
package com.example.testspring.demos.modules.user.mapper;
import com.example.testspring.demos.modules.user.entity.Robot;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface RobotMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table robot
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
int deleteByPrimaryKey(String robotid);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table robot
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
int insert(Robot record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table robot
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
Robot selectByPrimaryKey(String robotid);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table robot
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
List<Robot> selectAll();
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table robot
*
* @mbg.generated Fri Jun 27 09:12:11 CST 2025
*/
int updateByPrimaryKey(Robot record);
}

View File

@ -0,0 +1,50 @@
package com.example.testspring.demos.modules.user.mapper;
import com.example.testspring.demos.modules.user.entity.SysMenu;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface SysMenuMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_menu
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
int deleteByPrimaryKey(Long menuId);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_menu
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
int insert(SysMenu record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_menu
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
SysMenu selectByPrimaryKey(Long menuId);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_menu
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
List<SysMenu> selectAll();
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_menu
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
int updateByPrimaryKey(SysMenu record);
}

View File

@ -0,0 +1,52 @@
package com.example.testspring.demos.modules.user.mapper;
import com.example.testspring.demos.modules.user.entity.SysUser;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface SysUserMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_user
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
int deleteByPrimaryKey(Long userId);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_user
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
int insert(SysUser record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_user
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
SysUser selectByPrimaryKey(Long userId);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_user
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
List<SysUser> selectAll();
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table sys_user
*
* @mbg.generated Thu Jun 26 17:58:24 CST 2025
*/
int updateByPrimaryKey(SysUser record);
List<SysUser> selectUserList(SysUser user);
}

View File

@ -0,0 +1,10 @@
package com.example.testspring.demos.modules.user.service;
import com.example.testspring.demos.modules.user.entity.Robot;
import java.util.List;
public interface IRobotService {
public List<Robot> selectRobotList(Robot robot);
}

View File

@ -0,0 +1,14 @@
package com.example.testspring.demos.modules.user.service;
import com.example.testspring.demos.modules.user.entity.SysMenu;
import com.example.testspring.demos.modules.user.entity.SysUser;
import java.util.List;
public interface ISysUserService {
public List<SysUser> selectUserList(SysUser user);
// public List<SysMenu> selectMenuList();
}

View File

@ -0,0 +1,21 @@
package com.example.testspring.demos.modules.user.service.impl;
import com.example.testspring.demos.modules.user.entity.Robot;
import com.example.testspring.demos.modules.user.mapper.RobotMapper;
import com.example.testspring.demos.modules.user.service.IRobotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class RobotImpl implements IRobotService {
@Autowired
private RobotMapper robotMapper;
@Override
public List<Robot> selectRobotList(Robot robot) {
return robotMapper.selectAll();
}
}

View File

@ -0,0 +1,29 @@
package com.example.testspring.demos.modules.user.service.impl;
import com.example.testspring.demos.modules.user.entity.SysMenu;
import com.example.testspring.demos.modules.user.entity.SysUser;
import com.example.testspring.demos.modules.user.mapper.SysMenuMapper;
import com.example.testspring.demos.modules.user.mapper.SysUserMapper;
import com.example.testspring.demos.modules.user.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class SysUserServiceImpl implements ISysUserService {
@Autowired
private SysUserMapper sysUserMapper;
@Autowired
private SysMenuMapper sysMenuMapper;
@Override
public List<SysUser> selectUserList(SysUser user) {
return sysUserMapper.selectUserList(user);
}
}

View File

@ -2,7 +2,8 @@ spring:
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource # 如使用Druid则取消注释 type: com.alibaba.druid.pool.DruidDataSource # 如使用Druid则取消注释
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: 'jdbc:mysql://localhost:3306/ruoyi-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8' # url: 'jdbc:mysql://localhost:3306/ruoyi-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8'
url: 'jdbc:mysql://localhost:3306/kangda?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8'
username: root username: root
password: root password: root
# Druid 连接池专属配置区 (注意缩进对齐) # Druid 连接池专属配置区 (注意缩进对齐)

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<context id="MysqlTables" targetRuntime="MyBatis3Simple">
<!-- 数据库连接配置 -->
<jdbcConnection
driverClass="com.mysql.cj.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/kangda?serverTimezone=UTC"
userId="root"
password="root"/>
<!-- 实体类生成位置 -->
<javaModelGenerator
targetPackage="com.example.testspring.demos.modules.user.entity"
targetProject="src/main/java"/>
<!-- XML 文件生成位置 -->
<sqlMapGenerator
targetPackage="mapper"
targetProject="src/main/resources"/>
<!-- Mapper 接口生成位置 -->
<javaClientGenerator
type="XMLMAPPER"
targetPackage="com.example.testspring.demos.modules.user.mapper"
targetProject="src/main/java"/>
<!-- 指定需生成的表 -->
<table tableName="robot"/> <!-- 生成 user 表对应文件 -->
<!-- <table tableName="sys_menu"/> &lt;!&ndash; 支持多表 &ndash;&gt;-->
</context>
</generatorConfiguration>

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.testspring.demos.modules.user.mapper.RobotMapper">
<resultMap id="BaseResultMap" type="com.example.testspring.demos.modules.user.entity.Robot">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Fri Jun 27 09:12:11 CST 2025.
-->
<id column="robotId" jdbcType="VARCHAR" property="robotid" />
<result column="number" jdbcType="VARCHAR" property="number" />
<result column="groupingId" jdbcType="VARCHAR" property="groupingid" />
<result column="onlineStatus" jdbcType="VARCHAR" property="onlinestatus" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="createTime" jdbcType="TIMESTAMP" property="createtime" />
<result column="updateTime" jdbcType="TIMESTAMP" property="updatetime" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Fri Jun 27 09:12:11 CST 2025.
-->
delete from robot
where robotId = #{robotid,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.example.testspring.demos.modules.user.entity.Robot">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Fri Jun 27 09:12:11 CST 2025.
-->
insert into robot (robotId, number, groupingId,
onlineStatus, status, createTime,
updateTime)
values (#{robotid,jdbcType=VARCHAR}, #{number,jdbcType=VARCHAR}, #{groupingid,jdbcType=VARCHAR},
#{onlinestatus,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createtime,jdbcType=TIMESTAMP},
#{updatetime,jdbcType=TIMESTAMP})
</insert>
<update id="updateByPrimaryKey" parameterType="com.example.testspring.demos.modules.user.entity.Robot">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Fri Jun 27 09:12:11 CST 2025.
-->
update robot
set number = #{number,jdbcType=VARCHAR},
groupingId = #{groupingid,jdbcType=VARCHAR},
onlineStatus = #{onlinestatus,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
createTime = #{createtime,jdbcType=TIMESTAMP},
updateTime = #{updatetime,jdbcType=TIMESTAMP}
where robotId = #{robotid,jdbcType=VARCHAR}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Fri Jun 27 09:12:11 CST 2025.
-->
select robotId, number, groupingId, onlineStatus, status, createTime, updateTime
from robot
where robotId = #{robotid,jdbcType=VARCHAR}
</select>
<select id="selectAll" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Fri Jun 27 09:12:11 CST 2025.
-->
select robotId, number, groupingId, onlineStatus, status, createTime, updateTime
from robot
</select>
</mapper>

View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.testspring.demos.modules.user.mapper.SysMenuMapper">
<resultMap id="BaseResultMap" type="com.example.testspring.demos.modules.user.entity.SysMenu">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 26 17:58:24 CST 2025.
-->
<id column="menu_id" jdbcType="BIGINT" property="menuId" />
<result column="parent_id" jdbcType="BIGINT" property="parentId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="perms" jdbcType="VARCHAR" property="perms" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="icon" jdbcType="VARCHAR" property="icon" />
<result column="order_num" jdbcType="INTEGER" property="orderNum" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 26 17:58:24 CST 2025.
-->
delete from sys_menu
where menu_id = #{menuId,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.example.testspring.demos.modules.user.entity.SysMenu">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 26 17:58:24 CST 2025.
-->
insert into sys_menu (menu_id, parent_id, name,
url, perms, type, icon,
order_num)
values (#{menuId,jdbcType=BIGINT}, #{parentId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
#{url,jdbcType=VARCHAR}, #{perms,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{icon,jdbcType=VARCHAR},
#{orderNum,jdbcType=INTEGER})
</insert>
<update id="updateByPrimaryKey" parameterType="com.example.testspring.demos.modules.user.entity.SysMenu">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 26 17:58:24 CST 2025.
-->
update sys_menu
set parent_id = #{parentId,jdbcType=BIGINT},
name = #{name,jdbcType=VARCHAR},
url = #{url,jdbcType=VARCHAR},
perms = #{perms,jdbcType=VARCHAR},
type = #{type,jdbcType=INTEGER},
icon = #{icon,jdbcType=VARCHAR},
order_num = #{orderNum,jdbcType=INTEGER}
where menu_id = #{menuId,jdbcType=BIGINT}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 26 17:58:24 CST 2025.
-->
select menu_id, parent_id, name, url, perms, type, icon, order_num
from sys_menu
where menu_id = #{menuId,jdbcType=BIGINT}
</select>
<select id="selectAll" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 26 17:58:24 CST 2025.
-->
select menu_id, parent_id, name, url, perms, type, icon, order_num
from sys_menu
</select>
</mapper>

View File

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.testspring.demos.modules.user.mapper.SysUserMapper">
<resultMap id="BaseResultMap" type="com.example.testspring.demos.modules.user.entity.SysUser">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 26 17:58:24 CST 2025.
-->
<id column="user_id" jdbcType="BIGINT" property="userId" />
<result column="username" jdbcType="VARCHAR" property="username" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="salt" jdbcType="VARCHAR" property="salt" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="mobile" jdbcType="VARCHAR" property="mobile" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="create_user_id" jdbcType="BIGINT" property="createUserId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 26 17:58:24 CST 2025.
-->
delete from sys_user
where user_id = #{userId,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.example.testspring.demos.modules.user.entity.SysUser">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 26 17:58:24 CST 2025.
-->
insert into sys_user (user_id, username, password,
name, salt, email,
mobile, status, create_user_id,
create_time)
values (#{userId,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{salt,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
#{mobile,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}, #{createUserId,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP})
</insert>
<update id="updateByPrimaryKey" parameterType="com.example.testspring.demos.modules.user.entity.SysUser">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 26 17:58:24 CST 2025.
-->
update sys_user
set username = #{username,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
salt = #{salt,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR},
mobile = #{mobile,jdbcType=VARCHAR},
status = #{status,jdbcType=TINYINT},
create_user_id = #{createUserId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP}
where user_id = #{userId,jdbcType=BIGINT}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 26 17:58:24 CST 2025.
-->
select user_id, username, password, name, salt, email, mobile, status, create_user_id,
create_time
from sys_user
where user_id = #{userId,jdbcType=BIGINT}
</select>
<select id="selectAll" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Thu Jun 26 17:58:24 CST 2025.
-->
select user_id, username, password, name, salt, email, mobile, status, create_user_id,
create_time
from sys_user
</select>
<select id="selectUserList" resultType="com.example.testspring.demos.modules.user.entity.SysUser">
select user_id, username, password, name, salt, email, mobile, status, create_user_id,
create_time
from sys_user
where 1=1
<if test="username != null and username != ''">
and username like '%${username}%'
</if>
<if test="name != null and name != ''">
and name like '%${name}%'
</if>
<if test="status != null">
and status = #{status}
</if>
</select>
</mapper>