初始化版本-- 代码生成器重构 --mybatis升级为mybatis-plus
This commit is contained in:
parent
a4c8026265
commit
5254251013
15
pom.xml
15
pom.xml
|
|
@ -24,6 +24,8 @@
|
|||
<kaptcha.version>2.3.3</kaptcha.version>
|
||||
<swagger.version>3.0.0</swagger.version>
|
||||
<pagehelper.boot.version>1.4.7</pagehelper.boot.version>
|
||||
<mybatis-plus.boot.version>3.5.2</mybatis-plus.boot.version>
|
||||
<lombok.version>1.18.24</lombok.version>
|
||||
<fastjson.version>1.2.83</fastjson.version>
|
||||
<oshi.version>6.4.8</oshi.version>
|
||||
<commons.io.version>2.13.0</commons.io.version>
|
||||
|
|
@ -100,6 +102,19 @@
|
|||
<version>${pagehelper.boot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatis-plus.boot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- 获取系统信息 -->
|
||||
<dependency>
|
||||
<groupId>com.github.oshi</groupId>
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ spring:
|
|||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://121.62.23.77:3306/youban?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: password
|
||||
password: Clunt@12345
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ ruoyi:
|
|||
# 实例演示开关
|
||||
demoEnabled: true
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: D:/ruoyi/uploadPath
|
||||
profile: /home/ruoyi/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
|
||||
|
|
@ -82,6 +82,10 @@ mybatis:
|
|||
# 加载全局的配置文件
|
||||
configLocation: classpath:mybatis/mybatis-config.xml
|
||||
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:mapper/**/*Mapper.xml
|
||||
type-aliases-package: com.ruoyi.**.domain
|
||||
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
helperDialect: mysql
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="/home/ruoyi/logs" />
|
||||
<property name="log.path" value="./logs" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,16 @@
|
|||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 自定义验证注解 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import java.io.Serializable;
|
|||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
|
@ -19,9 +21,11 @@ public class BaseEntity implements Serializable
|
|||
|
||||
/** 搜索值 */
|
||||
@JsonIgnore
|
||||
@TableField(exist = false)
|
||||
private String searchValue;
|
||||
|
||||
/** 创建者 */
|
||||
@TableField(exist = false)
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
|
|
@ -29,6 +33,7 @@ public class BaseEntity implements Serializable
|
|||
private Date createTime;
|
||||
|
||||
/** 更新者 */
|
||||
@TableField(exist = false)
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间 */
|
||||
|
|
@ -40,6 +45,7 @@ public class BaseEntity implements Serializable
|
|||
|
||||
/** 请求参数 */
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> params;
|
||||
|
||||
public String getSearchValue()
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ import com.ruoyi.common.utils.StringUtils;
|
|||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
//@Configuration
|
||||
public class MyBatisConfig
|
||||
{
|
||||
@Autowired
|
||||
// @Autowired
|
||||
private Environment env;
|
||||
|
||||
static final String DEFAULT_RESOURCE_PATTERN = "**/*.class";
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@ package ${packageName}.domain;
|
|||
#foreach ($import in $importList)
|
||||
import ${import};
|
||||
#end
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
#if($table.crud || $table.sub)
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
|
@ -23,6 +25,9 @@ import com.ruoyi.common.core.domain.TreeEntity;
|
|||
#elseif($table.tree)
|
||||
#set($Entity="TreeEntity")
|
||||
#end
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "${tableName}")
|
||||
public class ${ClassName} extends ${Entity}
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
@ -55,51 +60,5 @@ public class ${ClassName} extends ${Entity}
|
|||
private List<${subClassName}> ${subclassName}List;
|
||||
|
||||
#end
|
||||
#foreach ($column in $columns)
|
||||
#if(!$table.isSuperColumn($column.javaField))
|
||||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
||||
#set($AttrName=$column.javaField)
|
||||
#else
|
||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||
#end
|
||||
public void set${AttrName}($column.javaType $column.javaField)
|
||||
{
|
||||
this.$column.javaField = $column.javaField;
|
||||
}
|
||||
|
||||
public $column.javaType get${AttrName}()
|
||||
{
|
||||
return $column.javaField;
|
||||
}
|
||||
#end
|
||||
#end
|
||||
|
||||
#if($table.sub)
|
||||
public List<${subClassName}> get${subClassName}List()
|
||||
{
|
||||
return ${subclassName}List;
|
||||
}
|
||||
|
||||
public void set${subClassName}List(List<${subClassName}> ${subclassName}List)
|
||||
{
|
||||
this.${subclassName}List = ${subclassName}List;
|
||||
}
|
||||
|
||||
#end
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
#foreach ($column in $columns)
|
||||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
||||
#set($AttrName=$column.javaField)
|
||||
#else
|
||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||
#end
|
||||
.append("${column.javaField}", get${AttrName}())
|
||||
#end
|
||||
#if($table.sub)
|
||||
.append("${subclassName}List", get${subClassName}List())
|
||||
#end
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package ${packageName}.mapper;
|
|||
|
||||
import java.util.List;
|
||||
import ${packageName}.domain.${ClassName};
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
#if($table.sub)
|
||||
import ${packageName}.domain.${subClassName};
|
||||
#end
|
||||
|
|
@ -12,7 +13,7 @@ import ${packageName}.domain.${subClassName};
|
|||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
public interface ${ClassName}Mapper
|
||||
public interface ${ClassName}Mapper extends BaseMapper<${ClassName}>
|
||||
{
|
||||
/**
|
||||
* 查询${functionName}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package ${packageName}.service;
|
|||
|
||||
import java.util.List;
|
||||
import ${packageName}.domain.${ClassName};
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
#if($table.tree)
|
||||
import com.ruoyi.common.core.domain.Ztree;
|
||||
#end
|
||||
|
|
@ -12,7 +13,7 @@ import com.ruoyi.common.core.domain.Ztree;
|
|||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
public interface I${ClassName}Service
|
||||
public interface I${ClassName}Service extends IService<${ClassName}>
|
||||
{
|
||||
/**
|
||||
* 查询${functionName}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import ${packageName}.mapper.${ClassName}Mapper;
|
|||
import ${packageName}.domain.${ClassName};
|
||||
import ${packageName}.service.I${ClassName}Service;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* ${functionName}Service业务层处理
|
||||
|
|
@ -31,7 +32,7 @@ import com.ruoyi.common.core.text.Convert;
|
|||
* @date ${datetime}
|
||||
*/
|
||||
@Service
|
||||
public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||
public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}> implements I${ClassName}Service
|
||||
{
|
||||
@Autowired
|
||||
private ${ClassName}Mapper ${className}Mapper;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ package ${packageName}.domain;
|
|||
#foreach ($import in $subImportList)
|
||||
import ${import};
|
||||
#end
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
|
|
@ -14,6 +17,8 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
|||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "${subTableName}")
|
||||
public class ${subClassName} extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
@ -36,41 +41,11 @@ public class ${subClassName} extends BaseEntity
|
|||
#else
|
||||
@Excel(name = "${comment}")
|
||||
#end
|
||||
@TableField(value = "$column.columnName")
|
||||
#end
|
||||
private $column.javaType $column.javaField;
|
||||
|
||||
#end
|
||||
#end
|
||||
#foreach ($column in $subTable.columns)
|
||||
#if(!$table.isSuperColumn($column.javaField))
|
||||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
||||
#set($AttrName=$column.javaField)
|
||||
#else
|
||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||
#end
|
||||
public void set${AttrName}($column.javaType $column.javaField)
|
||||
{
|
||||
this.$column.javaField = $column.javaField;
|
||||
}
|
||||
|
||||
public $column.javaType get${AttrName}()
|
||||
{
|
||||
return $column.javaField;
|
||||
}
|
||||
#end
|
||||
#end
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
#foreach ($column in $subTable.columns)
|
||||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
||||
#set($AttrName=$column.javaField)
|
||||
#else
|
||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||
#end
|
||||
.append("${column.javaField}", get${AttrName}())
|
||||
#end
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* App用户对象 tb_user
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-12-07
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "tb_user")
|
||||
public class TbUser extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 应用用户id */
|
||||
private Long id;
|
||||
|
||||
/** 用户手机号 */
|
||||
@Excel(name = "用户手机号")
|
||||
private String mobile;
|
||||
|
||||
/** 密码(需加密存储) */
|
||||
@Excel(name = "密码(需加密存储)")
|
||||
private String password;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.system.domain.TbUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* App用户Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-12-07
|
||||
*/
|
||||
@Mapper
|
||||
public interface TbUserMapper extends BaseMapper<TbUser>
|
||||
{
|
||||
/**
|
||||
* 查询App用户
|
||||
*
|
||||
* @param id App用户主键
|
||||
* @return App用户
|
||||
*/
|
||||
public TbUser selectTbUserById(Long id);
|
||||
|
||||
/**
|
||||
* 查询App用户列表
|
||||
*
|
||||
* @param tbUser App用户
|
||||
* @return App用户集合
|
||||
*/
|
||||
public List<TbUser> selectTbUserList(TbUser tbUser);
|
||||
|
||||
/**
|
||||
* 新增App用户
|
||||
*
|
||||
* @param tbUser App用户
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTbUser(TbUser tbUser);
|
||||
|
||||
/**
|
||||
* 修改App用户
|
||||
*
|
||||
* @param tbUser App用户
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTbUser(TbUser tbUser);
|
||||
|
||||
/**
|
||||
* 删除App用户
|
||||
*
|
||||
* @param id App用户主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTbUserById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除App用户
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTbUserByIds(String[] ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.system.domain.TbUser;
|
||||
|
||||
/**
|
||||
* App用户Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-12-07
|
||||
*/
|
||||
public interface ITbUserService extends IService<TbUser>
|
||||
{
|
||||
/**
|
||||
* 查询App用户
|
||||
*
|
||||
* @param id App用户主键
|
||||
* @return App用户
|
||||
*/
|
||||
public TbUser selectTbUserById(Long id);
|
||||
|
||||
/**
|
||||
* 查询App用户列表
|
||||
*
|
||||
* @param tbUser App用户
|
||||
* @return App用户集合
|
||||
*/
|
||||
public List<TbUser> selectTbUserList(TbUser tbUser);
|
||||
|
||||
/**
|
||||
* 新增App用户
|
||||
*
|
||||
* @param tbUser App用户
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTbUser(TbUser tbUser);
|
||||
|
||||
/**
|
||||
* 修改App用户
|
||||
*
|
||||
* @param tbUser App用户
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTbUser(TbUser tbUser);
|
||||
|
||||
/**
|
||||
* 批量删除App用户
|
||||
*
|
||||
* @param ids 需要删除的App用户主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTbUserByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除App用户信息
|
||||
*
|
||||
* @param id App用户主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTbUserById(Long id);
|
||||
}
|
||||
|
|
@ -4,6 +4,9 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.validation.Validator;
|
||||
|
||||
import com.ruoyi.system.domain.TbUser;
|
||||
import com.ruoyi.system.service.ITbUserService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -63,6 +66,9 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
@Autowired
|
||||
protected Validator validator;
|
||||
|
||||
@Autowired
|
||||
private ITbUserService tbUserService;
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
|
|
@ -73,6 +79,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
@DataScope(deptAlias = "d", userAlias = "u")
|
||||
public List<SysUser> selectUserList(SysUser user)
|
||||
{
|
||||
List<TbUser> users = tbUserService.lambdaQuery().isNotNull(TbUser::getId).list();
|
||||
return userMapper.selectUserList(user);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,98 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.TbUserMapper;
|
||||
import com.ruoyi.system.domain.TbUser;
|
||||
import com.ruoyi.system.service.ITbUserService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* App用户Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-12-07
|
||||
*/
|
||||
@Service
|
||||
public class TbUserServiceImpl extends ServiceImpl<TbUserMapper, TbUser> implements ITbUserService
|
||||
{
|
||||
@Autowired
|
||||
private TbUserMapper tbUserMapper;
|
||||
|
||||
/**
|
||||
* 查询App用户
|
||||
*
|
||||
* @param id App用户主键
|
||||
* @return App用户
|
||||
*/
|
||||
@Override
|
||||
public TbUser selectTbUserById(Long id)
|
||||
{
|
||||
return tbUserMapper.selectTbUserById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询App用户列表
|
||||
*
|
||||
* @param tbUser App用户
|
||||
* @return App用户
|
||||
*/
|
||||
@Override
|
||||
public List<TbUser> selectTbUserList(TbUser tbUser)
|
||||
{
|
||||
return tbUserMapper.selectTbUserList(tbUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增App用户
|
||||
*
|
||||
* @param tbUser App用户
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTbUser(TbUser tbUser)
|
||||
{
|
||||
tbUser.setCreateTime(DateUtils.getNowDate());
|
||||
return tbUserMapper.insertTbUser(tbUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改App用户
|
||||
*
|
||||
* @param tbUser App用户
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTbUser(TbUser tbUser)
|
||||
{
|
||||
tbUser.setUpdateTime(DateUtils.getNowDate());
|
||||
return tbUserMapper.updateTbUser(tbUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除App用户
|
||||
*
|
||||
* @param ids 需要删除的App用户主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTbUserByIds(String ids)
|
||||
{
|
||||
return tbUserMapper.deleteTbUserByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除App用户信息
|
||||
*
|
||||
* @param id App用户主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTbUserById(Long id)
|
||||
{
|
||||
return tbUserMapper.deleteTbUserById(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
<?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.ruoyi.system.mapper.TbUserMapper">
|
||||
|
||||
<resultMap type="TbUser" id="TbUserResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="mobile" column="mobile" />
|
||||
<result property="password" column="password" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTbUserVo">
|
||||
select id, mobile, password, create_time, update_time from tb_user
|
||||
</sql>
|
||||
|
||||
<select id="selectTbUserList" parameterType="TbUser" resultMap="TbUserResult">
|
||||
<include refid="selectTbUserVo"/>
|
||||
<where>
|
||||
<if test="mobile != null and mobile != ''"> and mobile = #{mobile}</if>
|
||||
<if test="password != null and password != ''"> and password = #{password}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectTbUserById" parameterType="Long" resultMap="TbUserResult">
|
||||
<include refid="selectTbUserVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertTbUser" parameterType="TbUser" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into tb_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="mobile != null and mobile != ''">mobile,</if>
|
||||
<if test="password != null">password,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="mobile != null and mobile != ''">#{mobile},</if>
|
||||
<if test="password != null">#{password},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTbUser" parameterType="TbUser">
|
||||
update tb_user
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
|
||||
<if test="password != null">password = #{password},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteTbUserById" parameterType="Long">
|
||||
delete from tb_user where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTbUserByIds" parameterType="String">
|
||||
delete from tb_user where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue