feat: oss

This commit is contained in:
2024-03-05 18:04:58 +08:00
parent 28ad112a0d
commit 4551fe660c
112 changed files with 6518 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
package com.landaiqing.infra.basic.config;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MybatisConfiguration {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor(){
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
mybatisPlusInterceptor.addInnerInterceptor(new MybatisPlusAllSqlLog());
return mybatisPlusInterceptor;
}
}

View File

@@ -0,0 +1,116 @@
package com.landaiqing.infra.basic.config;
import com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.ParameterMapping;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.type.TypeHandlerRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
import java.sql.SQLException;
import java.text.DateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
public class MybatisPlusAllSqlLog implements InnerInterceptor {
public static final Logger log = LoggerFactory.getLogger("sys-sql");
@Override
public void beforeQuery(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException {
logInfo(boundSql, ms, parameter);
}
@Override
public void beforeUpdate(Executor executor, MappedStatement ms, Object parameter) throws SQLException {
BoundSql boundSql = ms.getBoundSql(parameter);
logInfo(boundSql, ms, parameter);
}
private static void logInfo(BoundSql boundSql, MappedStatement ms, Object parameter) {
try {
log.info("parameter = " + parameter);
// 获取到节点的id,即sql语句的id
String sqlId = ms.getId();
log.info("sqlId = " + sqlId);
// 获取节点的配置
Configuration configuration = ms.getConfiguration();
// 获取到最终的sql语句
String sql = getSql(configuration, boundSql, sqlId);
log.info("完整的sql:{}", sql);
} catch (Exception e) {
log.error("异常:{}", e.getLocalizedMessage(), e);
}
}
// 封装了一下sql语句使得结果返回完整xml路径下的sql语句节点id + sql语句
public static String getSql(Configuration configuration, BoundSql boundSql, String sqlId) {
return sqlId + ":" + showSql(configuration, boundSql);
}
// 进行?的替换
public static String showSql(Configuration configuration, BoundSql boundSql) {
// 获取参数
Object parameterObject = boundSql.getParameterObject();
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
// sql语句中多个空格都用一个空格代替
String sql = boundSql.getSql().replaceAll("[\\s]+", " ");
if (!CollectionUtils.isEmpty(parameterMappings) && parameterObject != null) {
// 获取类型处理器注册器类型处理器的功能是进行java类型和数据库类型的转换
TypeHandlerRegistry typeHandlerRegistry = configuration.getTypeHandlerRegistry();
// 如果根据parameterObject.getClass()可以找到对应的类型,则替换
if (typeHandlerRegistry.hasTypeHandler(parameterObject.getClass())) {
sql = sql.replaceFirst("\\?",
Matcher.quoteReplacement(getParameterValue(parameterObject)));
} else {
// MetaObject主要是封装了originalObject对象提供了get和set的方法用于获取和设置originalObject的属性值,主要支持对JavaBean、Collection、Map三种类型对象的操作
MetaObject metaObject = configuration.newMetaObject(parameterObject);
for (ParameterMapping parameterMapping : parameterMappings) {
String propertyName = parameterMapping.getProperty();
if (metaObject.hasGetter(propertyName)) {
Object obj = metaObject.getValue(propertyName);
sql = sql.replaceFirst("\\?",
Matcher.quoteReplacement(getParameterValue(obj)));
} else if (boundSql.hasAdditionalParameter(propertyName)) {
// 该分支是动态sql
Object obj = boundSql.getAdditionalParameter(propertyName);
sql = sql.replaceFirst("\\?",
Matcher.quoteReplacement(getParameterValue(obj)));
} else {
// 打印出缺失,提醒该参数缺失并防止错位
sql = sql.replaceFirst("\\?", "缺失");
}
}
}
}
return sql;
}
// 如果参数是String则添加单引号 如果是日期,则转换为时间格式器并加单引号; 对参数是null和不是null的情况作了处理
private static String getParameterValue(Object obj) {
String value;
if (obj instanceof String) {
value = "'" + obj.toString() + "'";
} else if (obj instanceof Date) {
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.DEFAULT,
DateFormat.DEFAULT, Locale.CHINA);
value = "'" + formatter.format(new Date()) + "'";
} else {
if (obj != null) {
value = obj.toString();
} else {
value = "";
}
}
return value;
}
}

View File

@@ -0,0 +1,52 @@
package com.landaiqing.infra.basic.config;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.*;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Properties;
@Intercepts({
@Signature(type = Executor.class, method = "update", args = {MappedStatement.class,
Object.class}),
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class,
Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class})})
public class SqlStatementInterceptor implements Interceptor {
public static final Logger log = LoggerFactory.getLogger("sys-sql");
@Override
public Object intercept(Invocation invocation) throws Throwable {
long startTime = System.currentTimeMillis();
try {
return invocation.proceed();
} finally {
long timeConsuming = System.currentTimeMillis() - startTime;
log.info("执行SQL:{}ms", timeConsuming);
if (timeConsuming > 999 && timeConsuming < 5000) {
log.info("执行SQL大于1s:{}ms", timeConsuming);
} else if (timeConsuming >= 5000 && timeConsuming < 10000) {
log.info("执行SQL大于5s:{}ms", timeConsuming);
} else if (timeConsuming >= 10000) {
log.info("执行SQL大于10s:{}ms", timeConsuming);
}
}
}
@Override
public Object plugin(Object target) {
return Plugin.wrap(target, this);
}
@Override
public void setProperties(Properties properties) {
}
}

View File

@@ -0,0 +1,83 @@
package com.landaiqing.infra.basic.dao;
import com.landaiqing.infra.basic.entity.Clazz;
import org.apache.ibatis.annotations.Param;
import java.awt.print.Pageable;
import java.util.List;
/**
* (Clazz)表数据库访问层
*
* @author makejava
* @since 2024-03-04 22:43:59
*/
public interface ClazzDao {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
Clazz queryById(Integer id);
/**
* 查询指定行数据
*
* @param clazz 查询条件
* @return 对象列表
*/
List<Clazz> queryAllByLimit(Clazz clazz);
/**
* 统计总行数
*
* @param clazz 查询条件
* @return 总行数
*/
long count(Clazz clazz);
/**
* 新增数据
*
* @param clazz 实例对象
* @return 影响行数
*/
int insert(Clazz clazz);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<Clazz> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<Clazz> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<Clazz> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<Clazz> entities);
/**
* 修改数据
*
* @param clazz 实例对象
* @return 影响行数
*/
int update(Clazz clazz);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
}

View File

@@ -0,0 +1,83 @@
package com.landaiqing.infra.basic.dao;
import com.landaiqing.infra.basic.entity.Grade;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* (Grade)表数据库访问层
*
* @author makejava
* @since 2024-03-04 22:29:20
*/
public interface GradeDao {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
Grade queryById(Long id);
/**
* 查询指定行数据
*
* @param grade 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
List<Grade> queryAllByLimit(Grade grade);
/**
* 统计总行数
*
* @param grade 查询条件
* @return 总行数
*/
long count(Grade grade);
/**
* 新增数据
*
* @param grade 实例对象
* @return 影响行数
*/
int insert(Grade grade);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<Grade> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<Grade> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<Grade> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<Grade> entities);
/**
* 修改数据
*
* @param grade 实例对象
* @return 影响行数
*/
int update(Grade grade);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Long id);
}

View File

@@ -0,0 +1,84 @@
package com.landaiqing.infra.basic.dao;
import com.landaiqing.infra.basic.entity.Permission;
import org.apache.ibatis.annotations.Param;
import java.awt.print.Pageable;
import java.util.List;
/**
* (Permission)表数据库访问层
*
* @author makejava
* @since 2024-03-04 22:29:35
*/
public interface PermissionDao {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
Permission queryById(Long id);
/**
* 查询指定行数据
*
* @param permission 查询条件
* @return 对象列表
*/
List<Permission> queryAllByLimit(Permission permission);
/**
* 统计总行数
*
* @param permission 查询条件
* @return 总行数
*/
long count(Permission permission);
/**
* 新增数据
*
* @param permission 实例对象
* @return 影响行数
*/
int insert(Permission permission);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<Permission> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<Permission> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<Permission> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<Permission> entities);
/**
* 修改数据
*
* @param permission 实例对象
* @return 影响行数
*/
int update(Permission permission);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Long id);
List<Permission> queryPermission(@Param("list") List<Integer> permissionList);
}

View File

@@ -0,0 +1,83 @@
package com.landaiqing.infra.basic.dao;
import com.landaiqing.infra.basic.entity.Role;
import org.apache.ibatis.annotations.Param;
import java.awt.print.Pageable;
import java.util.List;
/**
* (Role)表数据库访问层
*
* @author makejava
* @since 2024-03-04 22:29:56
*/
public interface RoleDao {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
Role queryById(Long id);
/**
* 查询指定行数据
*
* @param role 查询条件
* @return 对象列表
*/
List<Role> queryAllByLimit(Role role);
/**
* 统计总行数
*
* @param role 查询条件
* @return 总行数
*/
long count(Role role);
/**
* 新增数据
*
* @param role 实例对象
* @return 影响行数
*/
int insert(Role role);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<Role> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<Role> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<Role> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<Role> entities);
/**
* 修改数据
*
* @param role 实例对象
* @return 影响行数
*/
int update(Role role);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Long id);
}

View File

@@ -0,0 +1,84 @@
package com.landaiqing.infra.basic.dao;
import com.landaiqing.infra.basic.entity.RolePermission;
import org.apache.ibatis.annotations.Param;
import java.awt.print.Pageable;
import java.util.List;
/**
* (RolePermission)表数据库访问层
*
* @author makejava
* @since 2024-03-04 22:30:14
*/
public interface RolePermissionDao {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
RolePermission queryById(Long id);
/**
* 查询指定行数据
*
* @param rolePermission 查询条件
* @return 对象列表
*/
List<RolePermission> queryAllByLimit(RolePermission rolePermission);
/**
* 统计总行数
*
* @param rolePermission 查询条件
* @return 总行数
*/
long count(RolePermission rolePermission);
/**
* 新增数据
*
* @param rolePermission 实例对象
* @return 影响行数
*/
int insert(RolePermission rolePermission);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<RolePermission> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<RolePermission> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<RolePermission> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<RolePermission> entities);
/**
* 修改数据
*
* @param rolePermission 实例对象
* @return 影响行数
*/
int update(RolePermission rolePermission);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Long id);
List<Integer> queryPermissionById(@Param("roleId") Integer roleId);
}

View File

@@ -0,0 +1,90 @@
package com.landaiqing.infra.basic.dao;
import com.landaiqing.auth.common.entity.PageResult;
import com.landaiqing.infra.basic.entity.Student;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* (Student)表数据库访问层
*
* @author makejava
* @since 2024-03-04 22:25:32
*/
public interface StudentDao {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
Student queryById(Long id);
/**
* 查询指定行数据
*
* @param student 查询条件
* @return 对象列表
*/
List<Student> queryAllByLimit(Student student);
/**
* 统计总行数
*
* @param student 查询条件
* @return 总行数
*/
long count(Student student);
/**
* 新增数据
*
* @param student 实例对象
* @return 影响行数
*/
int insert(Student student);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<Student> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<Student> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<Student> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<Student> entities);
/**
* 修改数据
*
* @param student 实例对象
* @return 影响行数
*/
int update(Student student);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Long id);
List<Student> queryPage(@Param("student") Student student,
@Param("start") int start,
@Param("pageSize") Integer pageSize);
Integer selectCount();
Integer login(Student student);
}

View File

@@ -0,0 +1,85 @@
package com.landaiqing.infra.basic.dao;
import com.landaiqing.infra.basic.entity.Student;
import com.landaiqing.infra.basic.entity.StudentRole;
import org.apache.ibatis.annotations.Param;
import java.awt.print.Pageable;
import java.util.List;
/**
* (StudentRole)表数据库访问层
*
* @author makejava
* @since 2024-03-05 12:17:53
*/
public interface StudentRoleDao {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
StudentRole queryById(Integer id);
/**
* 查询指定行数据
*
* @param studentRole 查询条件
* @return 对象列表
*/
List<StudentRole> queryAllByLimit(StudentRole studentRole);
/**
* 统计总行数
*
* @param studentRole 查询条件
* @return 总行数
*/
long count(StudentRole studentRole);
/**
* 新增数据
*
* @param studentRole 实例对象
* @return 影响行数
*/
int insert(StudentRole studentRole);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<StudentRole> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<StudentRole> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<StudentRole> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<StudentRole> entities);
/**
* 修改数据
*
* @param studentRole 实例对象
* @return 影响行数
*/
int update(StudentRole studentRole);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
Integer queryRoleById(Student student);
}

View File

@@ -0,0 +1,81 @@
package com.landaiqing.infra.basic.dao;
import com.landaiqing.infra.basic.entity.User;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* (User)表数据库访问层
*
* @author makejava
* @since 2024-03-05 12:17:20
*/
public interface UserDao {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
User queryById(Integer id);
/**
* 查询指定行数据
*
* @param user 查询条件
* @return 对象列表
*/
List<User> queryAllByLimit(User user);
/**
* 统计总行数
*
* @param user 查询条件
* @return 总行数
*/
long count(User user);
/**
* 新增数据
*
* @param user 实例对象
* @return 影响行数
*/
int insert(User user);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<User> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<User> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<User> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<User> entities);
/**
* 修改数据
*
* @param user 实例对象
* @return 影响行数
*/
int update(User user);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
}

View File

@@ -0,0 +1,83 @@
package com.landaiqing.infra.basic.dao;
import com.landaiqing.infra.basic.entity.UserRole;
import org.apache.ibatis.annotations.Param;
import java.awt.print.Pageable;
import java.util.List;
/**
* (UserRole)表数据库访问层
*
* @author makejava
* @since 2024-03-05 12:18:10
*/
public interface UserRoleDao {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
UserRole queryById(Long id);
/**
* 查询指定行数据
*
* @param userRole 查询条件
* @return 对象列表
*/
List<UserRole> queryAllByLimit(UserRole userRole);
/**
* 统计总行数
*
* @param userRole 查询条件
* @return 总行数
*/
long count(UserRole userRole);
/**
* 新增数据
*
* @param userRole 实例对象
* @return 影响行数
*/
int insert(UserRole userRole);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<UserRole> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<UserRole> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<UserRole> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<UserRole> entities);
/**
* 修改数据
*
* @param userRole 实例对象
* @return 影响行数
*/
int update(UserRole userRole);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Long id);
}

View File

@@ -0,0 +1,50 @@
package com.landaiqing.infra.basic.entity;
import java.io.Serializable;
/**
* (Clazz)实体类
*
* @author makejava
* @since 2024-03-04 22:44:00
*/
public class Clazz implements Serializable {
private static final long serialVersionUID = -14659318323663338L;
private Integer id;
/**
* 班级名称
*/
private String className;
/**
* 班级人数
*/
private Integer num;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public Integer getNum() {
return num;
}
public void setNum(Integer num) {
this.num = num;
}
}

View File

@@ -0,0 +1,28 @@
package com.landaiqing.infra.basic.entity;
import lombok.Data;
import java.io.Serializable;
/**
* (Grade)实体类
*
* @author makejava
* @since 2024-03-04 22:29:20
*/
@Data
public class Grade implements Serializable {
private Long id;
/**
* 年级
*/
private String gradeName;
/**
* 年级人数
*/
private Long num;
}

View File

@@ -0,0 +1,54 @@
package com.landaiqing.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* (Permission)实体类
*
* @author makejava
* @since 2024-03-04 22:29:35
*/
@Data
public class Permission implements Serializable {
private Long id;
private String name;
private Long parentId;
private Integer type;
private String menuUrl;
private Integer status;
private Integer show;
private String icon;
private String permissionKey;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
private Integer isDeleted;
}

View File

@@ -0,0 +1,43 @@
package com.landaiqing.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* (Role)实体类
*
* @author makejava
* @since 2024-03-04 22:29:56
*/
@Data
public class Role implements Serializable {
private Long id;
private String roleName;
private String roleKey;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
private Integer isDeleted;
}

View File

@@ -0,0 +1,43 @@
package com.landaiqing.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* (RolePermission)实体类
*
* @author makejava
* @since 2024-03-04 22:30:14
*/
@Data
public class RolePermission implements Serializable {
private Long id;
private Long roleId;
private Long permissionId;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
private Integer isDeleted;
}

View File

@@ -0,0 +1,82 @@
package com.landaiqing.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* (Student)实体类
*
* @author makejava
* @since 2024-03-04 22:25:32
*/
@Data
public class Student implements Serializable {
/**
* id
*/
private Long id;
/**
* 学号
*/
private String sno;
/**
* 密码
*/
private String password;
/**
* 姓名
*/
private String username;
/**
* 班级
*/
private Integer className;
/**
* 年级
*/
private Integer grade;
/**
* 年龄
*/
private Integer age;
/**
* 性别
*/
private Integer sex;
/**
* 头像链接
*/
private String avatar;
/**
* 出生日期
*/
private Date dateOfBirth;
/**
* email
*/
private String email;
/**
* 电话
*/
private String phoneNumber;
/**
* 班级id
*/
private Long classId;
/**
* 年级id
*/
private Long gradeId;
/**
* 角色id
*/
private Integer roleId;
private Integer isDeleted;
}

View File

@@ -0,0 +1,46 @@
package com.landaiqing.infra.basic.entity;
import java.io.Serializable;
/**
* (StudentRole)实体类
*
* @author makejava
* @since 2024-03-05 12:17:53
*/
public class StudentRole implements Serializable {
private static final long serialVersionUID = -31879713425539695L;
private Integer id;
private Long studentId;
private Long roleId;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Long getStudentId() {
return studentId;
}
public void setStudentId(Long studentId) {
this.studentId = studentId;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
}

View File

@@ -0,0 +1,46 @@
package com.landaiqing.infra.basic.entity;
import java.io.Serializable;
/**
* (User)实体类
*
* @author makejava
* @since 2024-03-05 12:17:20
*/
public class User implements Serializable {
private static final long serialVersionUID = 722350032981333679L;
private Integer id;
private String username;
private String password;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}

View File

@@ -0,0 +1,46 @@
package com.landaiqing.infra.basic.entity;
import java.io.Serializable;
/**
* (UserRole)实体类
*
* @author makejava
* @since 2024-03-05 12:18:10
*/
public class UserRole implements Serializable {
private static final long serialVersionUID = -74671402061801196L;
private Long id;
private Long userId;
private Long roleId;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
}

View File

@@ -0,0 +1,48 @@
package com.landaiqing.infra.basic.service;
import com.landaiqing.infra.basic.entity.Clazz;
/**
* (Clazz)表服务接口
*
* @author makejava
* @since 2024-03-04 22:44:00
*/
public interface ClazzService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
Clazz queryById(Integer id);
/**
* 新增数据
*
* @param clazz 实例对象
* @return 实例对象
*/
Clazz insert(Clazz clazz);
/**
* 修改数据
*
* @param clazz 实例对象
* @return 实例对象
*/
Clazz update(Clazz clazz);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Integer id);
}

View File

@@ -0,0 +1,49 @@
package com.landaiqing.infra.basic.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.landaiqing.infra.basic.entity.Grade;
/**
* (Grade)表服务接口
*
* @author makejava
* @since 2024-03-04 22:29:20
*/
public interface GradeService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
Grade queryById(Long id);
/**
* 新增数据
*
* @param grade 实例对象
* @return 实例对象
*/
Grade insert(Grade grade);
/**
* 修改数据
*
* @param grade 实例对象
* @return 实例对象
*/
Grade update(Grade grade);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
}

View File

@@ -0,0 +1,52 @@
package com.landaiqing.infra.basic.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.landaiqing.infra.basic.entity.Permission;
import java.util.List;
/**
* (Permission)表服务接口
*
* @author makejava
* @since 2024-03-04 22:29:35
*/
public interface PermissionService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
Permission queryById(Long id);
/**
* 新增数据
*
* @param permission 实例对象
* @return 实例对象
*/
Permission insert(Permission permission);
/**
* 修改数据
*
* @param permission 实例对象
* @return 实例对象
*/
Permission update(Permission permission);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
List<Permission> queryPermission(List<Integer> permissionList);
}

View File

@@ -0,0 +1,52 @@
package com.landaiqing.infra.basic.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.landaiqing.infra.basic.entity.RolePermission;
import java.util.List;
/**
* (RolePermission)表服务接口
*
* @author makejava
* @since 2024-03-04 22:30:14
*/
public interface RolePermissionService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
RolePermission queryById(Long id);
/**
* 新增数据
*
* @param rolePermission 实例对象
* @return 实例对象
*/
RolePermission insert(RolePermission rolePermission);
/**
* 修改数据
*
* @param rolePermission 实例对象
* @return 实例对象
*/
RolePermission update(RolePermission rolePermission);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
List<Integer> queryPermissionById(Integer roleId);
}

View File

@@ -0,0 +1,48 @@
package com.landaiqing.infra.basic.service;
import com.landaiqing.infra.basic.entity.Role;
/**
* (Role)表服务接口
*
* @author makejava
* @since 2024-03-04 22:29:56
*/
public interface RoleService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
Role queryById(Long id);
/**
* 新增数据
*
* @param role 实例对象
* @return 实例对象
*/
Role insert(Role role);
/**
* 修改数据
*
* @param role 实例对象
* @return 实例对象
*/
Role update(Role role);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
}

View File

@@ -0,0 +1,51 @@
package com.landaiqing.infra.basic.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.landaiqing.infra.basic.entity.Student;
import com.landaiqing.infra.basic.entity.StudentRole;
/**
* (StudentRole)表服务接口
*
* @author makejava
* @since 2024-03-05 12:17:53
*/
public interface StudentRoleService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
StudentRole queryById(Integer id);
/**
* 新增数据
*
* @param studentRole 实例对象
* @return 实例对象
*/
StudentRole insert(StudentRole studentRole);
/**
* 修改数据
*
* @param studentRole 实例对象
* @return 实例对象
*/
StudentRole update(StudentRole studentRole);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Integer id);
Integer queryRoleById(Student student);
}

View File

@@ -0,0 +1,56 @@
package com.landaiqing.infra.basic.service;
import com.landaiqing.auth.common.entity.PageResult;
import com.landaiqing.infra.basic.entity.Student;
import java.util.List;
/**
* (Student)表服务接口
*
* @author makejava
* @since 2024-03-04 22:25:33
*/
public interface StudentService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
Student queryById(Long id);
/**
* 新增数据
*
* @param student 实例对象
* @return 实例对象
*/
Student insert(Student student);
/**
* 修改数据
*
* @param student 实例对象
* @return 实例对象
*/
Integer update(Student student);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
List<Student> queryPage(Student student,int start, Integer pageSize);
Integer selectCount();
Integer login(Student student);
}

View File

@@ -0,0 +1,47 @@
package com.landaiqing.infra.basic.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.landaiqing.infra.basic.entity.UserRole;
/**
* (UserRole)表服务接口
*
* @author makejava
* @since 2024-03-05 12:18:10
*/
public interface UserRoleService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
UserRole queryById(Long id);
/**
* 新增数据
*
* @param userRole 实例对象
* @return 实例对象
*/
UserRole insert(UserRole userRole);
/**
* 修改数据
*
* @param userRole 实例对象
* @return 实例对象
*/
UserRole update(UserRole userRole);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
}

View File

@@ -0,0 +1,47 @@
package com.landaiqing.infra.basic.service;
import com.landaiqing.infra.basic.entity.User;
/**
* (User)表服务接口
*
* @author makejava
* @since 2024-03-05 12:17:20
*/
public interface UserService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
User queryById(Integer id);
/**
* 新增数据
*
* @param user 实例对象
* @return 实例对象
*/
User insert(User user);
/**
* 修改数据
*
* @param user 实例对象
* @return 实例对象
*/
User update(User user);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Integer id);
}

View File

@@ -0,0 +1,69 @@
package com.landaiqing.infra.basic.service.impl;
import com.landaiqing.infra.basic.entity.Clazz;
import com.landaiqing.infra.basic.dao.ClazzDao;
import com.landaiqing.infra.basic.service.ClazzService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* (Clazz)表服务实现类
*
* @author makejava
* @since 2024-03-04 22:44:00
*/
@Service("clazzService")
public class ClazzServiceImpl implements ClazzService {
@Resource
private ClazzDao clazzDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public Clazz queryById(Integer id) {
return this.clazzDao.queryById(id);
}
/**
* 新增数据
*
* @param clazz 实例对象
* @return 实例对象
*/
@Override
public Clazz insert(Clazz clazz) {
this.clazzDao.insert(clazz);
return clazz;
}
/**
* 修改数据
*
* @param clazz 实例对象
* @return 实例对象
*/
@Override
public Clazz update(Clazz clazz) {
this.clazzDao.update(clazz);
return this.queryById(clazz.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Integer id) {
return this.clazzDao.deleteById(id) > 0;
}
}

View File

@@ -0,0 +1,70 @@
package com.landaiqing.infra.basic.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.landaiqing.infra.basic.entity.Grade;
import com.landaiqing.infra.basic.dao.GradeDao;
import com.landaiqing.infra.basic.service.GradeService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* (Grade)表服务实现类
*
* @author makejava
* @since 2024-03-04 22:29:20
*/
@Service("gradeService")
public class GradeServiceImpl implements GradeService {
@Resource
private GradeDao gradeDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public Grade queryById(Long id) {
return this.gradeDao.queryById(id);
}
/**
* 新增数据
*
* @param grade 实例对象
* @return 实例对象
*/
@Override
public Grade insert(Grade grade) {
this.gradeDao.insert(grade);
return grade;
}
/**
* 修改数据
*
* @param grade 实例对象
* @return 实例对象
*/
@Override
public Grade update(Grade grade) {
this.gradeDao.update(grade);
return this.queryById(grade.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.gradeDao.deleteById(id) > 0;
}
}

View File

@@ -0,0 +1,75 @@
package com.landaiqing.infra.basic.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.landaiqing.infra.basic.entity.Permission;
import com.landaiqing.infra.basic.dao.PermissionDao;
import com.landaiqing.infra.basic.service.PermissionService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* (Permission)表服务实现类
*
* @author makejava
* @since 2024-03-04 22:29:36
*/
@Service("permissionService")
public class PermissionServiceImpl implements PermissionService {
@Resource
private PermissionDao permissionDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public Permission queryById(Long id) {
return this.permissionDao.queryById(id);
}
/**
* 新增数据
*
* @param permission 实例对象
* @return 实例对象
*/
@Override
public Permission insert(Permission permission) {
this.permissionDao.insert(permission);
return permission;
}
/**
* 修改数据
*
* @param permission 实例对象
* @return 实例对象
*/
@Override
public Permission update(Permission permission) {
this.permissionDao.update(permission);
return this.queryById(permission.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.permissionDao.deleteById(id) > 0;
}
@Override
public List<Permission> queryPermission(List<Integer> permissionList) {
return this.permissionDao.queryPermission(permissionList);
}
}

View File

@@ -0,0 +1,76 @@
package com.landaiqing.infra.basic.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.landaiqing.infra.basic.entity.RolePermission;
import com.landaiqing.infra.basic.dao.RolePermissionDao;
import com.landaiqing.infra.basic.service.RolePermissionService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* (RolePermission)表服务实现类
*
* @author makejava
* @since 2024-03-04 22:30:15
*/
@Service("rolePermissionService")
public class RolePermissionServiceImpl implements RolePermissionService {
@Resource
private RolePermissionDao rolePermissionDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public RolePermission queryById(Long id) {
return this.rolePermissionDao.queryById(id);
}
/**
* 新增数据
*
* @param rolePermission 实例对象
* @return 实例对象
*/
@Override
public RolePermission insert(RolePermission rolePermission) {
this.rolePermissionDao.insert(rolePermission);
return rolePermission;
}
/**
* 修改数据
*
* @param rolePermission 实例对象
* @return 实例对象
*/
@Override
public RolePermission update(RolePermission rolePermission) {
this.rolePermissionDao.update(rolePermission);
return this.queryById(rolePermission.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.rolePermissionDao.deleteById(id) > 0;
}
@Override
public List<Integer> queryPermissionById(Integer roleId) {
return this.rolePermissionDao.queryPermissionById(roleId);
}
}

View File

@@ -0,0 +1,70 @@
package com.landaiqing.infra.basic.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.landaiqing.infra.basic.entity.Role;
import com.landaiqing.infra.basic.dao.RoleDao;
import com.landaiqing.infra.basic.service.RoleService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* (Role)表服务实现类
*
* @author makejava
* @since 2024-03-04 22:29:56
*/
@Service("roleService")
public class RoleServiceImpl implements RoleService {
@Resource
private RoleDao roleDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public Role queryById(Long id) {
return this.roleDao.queryById(id);
}
/**
* 新增数据
*
* @param role 实例对象
* @return 实例对象
*/
@Override
public Role insert(Role role) {
this.roleDao.insert(role);
return role;
}
/**
* 修改数据
*
* @param role 实例对象
* @return 实例对象
*/
@Override
public Role update(Role role) {
this.roleDao.update(role);
return this.queryById(role.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.roleDao.deleteById(id) > 0;
}
}

View File

@@ -0,0 +1,75 @@
package com.landaiqing.infra.basic.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.landaiqing.infra.basic.entity.Student;
import com.landaiqing.infra.basic.entity.StudentRole;
import com.landaiqing.infra.basic.dao.StudentRoleDao;
import com.landaiqing.infra.basic.service.StudentRoleService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* (StudentRole)表服务实现类
*
* @author makejava
* @since 2024-03-05 12:17:53
*/
@Service("studentRoleService")
public class StudentRoleServiceImpl implements StudentRoleService {
@Resource
private StudentRoleDao studentRoleDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public StudentRole queryById(Integer id) {
return this.studentRoleDao.queryById(id);
}
/**
* 新增数据
*
* @param studentRole 实例对象
* @return 实例对象
*/
@Override
public StudentRole insert(StudentRole studentRole) {
this.studentRoleDao.insert(studentRole);
return studentRole;
}
/**
* 修改数据
*
* @param studentRole 实例对象
* @return 实例对象
*/
@Override
public StudentRole update(StudentRole studentRole) {
this.studentRoleDao.update(studentRole);
return this.queryById(studentRole.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Integer id) {
return this.studentRoleDao.deleteById(id) > 0;
}
@Override
public Integer queryRoleById(Student student) {
return this.studentRoleDao.queryRoleById(student);
}
}

View File

@@ -0,0 +1,86 @@
package com.landaiqing.infra.basic.service.impl;
import com.landaiqing.auth.common.entity.PageResult;
import com.landaiqing.infra.basic.entity.Student;
import com.landaiqing.infra.basic.dao.StudentDao;
import com.landaiqing.infra.basic.service.StudentService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* (Student)表服务实现类
*
* @author makejava
* @since 2024-03-04 22:25:33
*/
@Service("studentService")
public class StudentServiceImpl implements StudentService {
@Resource
private StudentDao studentDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public Student queryById(Long id) {
return this.studentDao.queryById(id);
}
/**
* 新增数据
*
* @param student 实例对象
* @return 实例对象
*/
@Override
public Student insert(Student student) {
this.studentDao.insert(student);
return student;
}
/**
* 修改数据
*
* @param student 实例对象
* @return 实例对象
*/
@Override
public Integer update(Student student) {
return this.studentDao.update(student);
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.studentDao.deleteById(id) > 0;
}
@Override
public List<Student> queryPage(Student student,int start,Integer pageSize) {
return this.studentDao.queryPage(student,start,pageSize);
}
@Override
public Integer selectCount() {
return this.studentDao.selectCount();
}
@Override
public Integer login(Student student) {
return this.studentDao.login(student);
}
}

View File

@@ -0,0 +1,70 @@
package com.landaiqing.infra.basic.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.landaiqing.infra.basic.entity.UserRole;
import com.landaiqing.infra.basic.dao.UserRoleDao;
import com.landaiqing.infra.basic.service.UserRoleService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* (UserRole)表服务实现类
*
* @author makejava
* @since 2024-03-05 12:18:10
*/
@Service("userRoleService")
public class UserRoleServiceImpl implements UserRoleService {
@Resource
private UserRoleDao userRoleDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public UserRole queryById(Long id) {
return this.userRoleDao.queryById(id);
}
/**
* 新增数据
*
* @param userRole 实例对象
* @return 实例对象
*/
@Override
public UserRole insert(UserRole userRole) {
this.userRoleDao.insert(userRole);
return userRole;
}
/**
* 修改数据
*
* @param userRole 实例对象
* @return 实例对象
*/
@Override
public UserRole update(UserRole userRole) {
this.userRoleDao.update(userRole);
return this.queryById(userRole.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.userRoleDao.deleteById(id) > 0;
}
}

View File

@@ -0,0 +1,71 @@
package com.landaiqing.infra.basic.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.landaiqing.infra.basic.entity.User;
import com.landaiqing.infra.basic.dao.UserDao;
import com.landaiqing.infra.basic.service.UserService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* (User)表服务实现类
*
* @author makejava
* @since 2024-03-05 12:17:20
*/
@Service("userService")
public class UserServiceImpl implements UserService {
@Resource
private UserDao userDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public User queryById(Integer id) {
return this.userDao.queryById(id);
}
/**
* 新增数据
*
* @param user 实例对象
* @return 实例对象
*/
@Override
public User insert(User user) {
this.userDao.insert(user);
return user;
}
/**
* 修改数据
*
* @param user 实例对象
* @return 实例对象
*/
@Override
public User update(User user) {
this.userDao.update(user);
return this.queryById(user.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Integer id) {
return this.userDao.deleteById(id) > 0;
}
}

View File

@@ -0,0 +1,48 @@
package com.landaiqing.infra.basic.utils;
import com.alibaba.druid.filter.config.ConfigTools;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
/**
* 数据库加密util
*
* @author: landaiqing
* @date: 2024/2/7
*/
public class DruidEncryptUtil {
private static String publicKey;
private static String privateKey;
static {
try {
String[] keyPair = ConfigTools.genKeyPair(512);
privateKey=keyPair[0];
System.out.println("privateKey:"+privateKey);
publicKey=keyPair[1];
System.out.println("publicKey:"+publicKey);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (NoSuchProviderException e) {
throw new RuntimeException(e);
}
}
public static String encrypt(String plainText) throws Exception {
String encrypt = ConfigTools.encrypt(privateKey, plainText);
System.out.println("encrypt:"+encrypt);
return encrypt;
}
public static String decrypt(String encryptText) throws Exception {
String decrypt = ConfigTools.decrypt(publicKey, encryptText);
System.out.println("decrypt:"+decrypt);
return decrypt;
}
public static void main(String[] args) throws Exception {
String encrypt = encrypt("1611");
System.out.println("encrypt:"+encrypt);
}
}

View File

@@ -0,0 +1,99 @@
<?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.landaiqing.infra.basic.dao.ClazzDao">
<resultMap type="com.landaiqing.infra.basic.entity.Clazz" id="ClazzMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="className" column="class_name" jdbcType="VARCHAR"/>
<result property="num" column="num" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="ClazzMap">
select
id,class_name,num
from clazz
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="ClazzMap">
select
id,class_name,num
from clazz
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="className != null and className != ''">
and class_name = #{className}
</if>
<if test="num != null">
and num = #{num}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from clazz
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="className != null and className != ''">
and class_name = #{className}
</if>
<if test="num != null">
and num = #{num}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into clazz(class_name, num)
values (#{className}, #{num})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into clazz(class_name,num)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.className},#{entity.num})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into clazz(class_name,num)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.className},#{entity.num})
</foreach>
on duplicate key update
class_name = values(class_name)num = values(num)
</insert>
<!--通过主键修改数据-->
<update id="update">
update clazz
<set>
<if test="className != null and className != ''">
class_name = #{className},
</if>
<if test="num != null">
num = #{num},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from clazz where id = #{id}
</delete>
</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.landaiqing.infra.basic.dao.GradeDao">
<resultMap type="com.landaiqing.infra.basic.entity.Grade" id="GradeMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="gradeName" column="grade_name" jdbcType="VARCHAR"/>
<result property="num" column="num" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="GradeMap">
select id,grade_name,num
from grade
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="GradeMap">
select
id,grade_name,num
from grade
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="gradeName != null and gradeName != ''">
and grade_name = #{gradeName}
</if>
<if test="num != null">
and num = #{num}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from grade
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="gradeName != null and gradeName != ''">
and grade_name = #{gradeName}
</if>
<if test="num != null">
and num = #{num}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into grade(grade_name,num)
values (#{gradeName},#{num})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into grade(grade_name,num)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.gradeName},#{entity.num})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into grade(grade_name,num)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.gradeName},#{entity.num})
</foreach>
on duplicate key update
grade_name = values(grade_name)num = values(num)
</insert>
<!--通过主键修改数据-->
<update id="update">
update grade
<set>
<if test="gradeName != null and gradeName != ''">
grade_name = #{gradeName},
</if>
<if test="num != null">
num = #{num},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from grade
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,222 @@
<?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.landaiqing.infra.basic.dao.PermissionDao">
<resultMap type="com.landaiqing.infra.basic.entity.Permission" id="PermissionMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="parentId" column="parent_id" jdbcType="INTEGER"/>
<result property="type" column="type" jdbcType="INTEGER"/>
<result property="menuUrl" column="menu_url" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="show" column="show" jdbcType="INTEGER"/>
<result property="icon" column="icon" jdbcType="VARCHAR"/>
<result property="permissionKey" column="permission_key" jdbcType="VARCHAR"/>
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="isDeleted" column="is_deleted" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="PermissionMap">
select id,name,parent_id,`type`,menu_url,status,`show`,icon,permission_key,created_by,created_time,update_by,update_time,is_deleted
from permission
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="PermissionMap">
select id,name,parent_id,`type`,menu_url,status,`show`,icon,permission_key,created_by,created_time,update_by,update_time,is_deleted
from permission
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="name != null and name != ''">
and name = #{name}
</if>
<if test="parentId != null">
and parent_id = #{parentId}
</if>
<if test="type != null">
and `type` = #{type}
</if>
<if test="menuUrl != null and menuUrl != ''">
and menu_url = #{menuUrl}
</if>
<if test="status != null">
and `status` = #{status}
</if>
<if test="show != null">
and `show` = #{show}
</if>
<if test="icon != null and icon != ''">
and icon = #{icon}
</if>
<if test="permissionKey != null and permissionKey != ''">
and permission_key = #{permissionKey}
</if>
<if test="createdBy != null and createdBy != ''">
and created_by = #{createdBy}
</if>
<if test="createdTime != null">
and created_time = #{createdTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="isDeleted != null">
and is_deleted = #{isDeleted}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from permission
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="name != null and name != ''">
and name = #{name}
</if>
<if test="parentId != null">
and parent_id = #{parentId}
</if>
<if test="type != null">
and `type` = #{type}
</if>
<if test="menuUrl != null and menuUrl != ''">
and menu_url = #{menuUrl}
</if>
<if test="status != null">
and `status` = #{status}
</if>
<if test="show != null">
and `show` = #{show}
</if>
<if test="icon != null and icon != ''">
and icon = #{icon}
</if>
<if test="permissionKey != null and permissionKey != ''">
and permission_key = #{permissionKey}
</if>
<if test="createdBy != null and createdBy != ''">
and created_by = #{createdBy}
</if>
<if test="createdTime != null">
and created_time = #{createdTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="isDeleted != null">
and is_deleted = #{isDeleted}
</if>
</where>
</select>
<select id="queryPermission" resultMap="PermissionMap">
select *
from permission
where id in
<foreach open="(" close=")" collection="list" item="id" separator=",">
#{id}
</foreach>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into permission(name,parent_id,`type`,menu_url,status,`show`,icon,permission_key,created_by,created_time,update_by,update_time,is_deleted)
values (#{name},#{parentId},#{type},#{menuUrl},#{status},#{show},#{icon},#{permissionKey},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into
permission(name,parent_id,`type`,menu_url,status,`show`,icon,permission_key,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.name},#{entity.parentId},#{entity.type},#{entity.menuUrl},#{entity.status},#{entity.show},#{entity.icon},#{entity.permissionKey},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into
permission(name,parent_id,`type`,menu_url,status,`show`,icon,permission_key,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.name},#{entity.parentId},#{entity.type},#{entity.menuUrl},#{entity.status},#{entity.show},#{entity.icon},#{entity.permissionKey},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
name = values(name)parent_id = values(parent_id)type = values(type)menu_url = values(menu_url)status =
values(status)show = values(show)icon = values(icon)permission_key = values(permission_key)created_by =
values(created_by)created_time = values(created_time)update_by = values(update_by)update_time =
values(update_time)is_deleted = values(is_deleted)
</insert>
<!--通过主键修改数据-->
<update id="update">
update permission
<set>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="parentId != null">
parent_id = #{parentId},
</if>
<if test="type != null">
`type` = #{type},
</if>
<if test="menuUrl != null and menuUrl != ''">
menu_url = #{menuUrl},
</if>
<if test="status != null">
status = #{status},
</if>
<if test="show != null">
show = #{show},
</if>
<if test="icon != null and icon != ''">
icon = #{icon},
</if>
<if test="permissionKey != null and permissionKey != ''">
permission_key = #{permissionKey},
</if>
<if test="createdBy != null and createdBy != ''">
created_by = #{createdBy},
</if>
<if test="createdTime != null">
created_time = #{createdTime},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="isDeleted != null">
is_deleted = #{isDeleted},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from permission
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,152 @@
<?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.landaiqing.infra.basic.dao.RoleDao">
<resultMap type="com.landaiqing.infra.basic.entity.Role" id="RoleMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="roleName" column="role_name" jdbcType="VARCHAR"/>
<result property="roleKey" column="role_key" jdbcType="VARCHAR"/>
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="isDeleted" column="is_deleted" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="RoleMap">
select id,role_name,role_key,created_by,created_time,update_by,update_time,is_deleted
from role
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="RoleMap">
select
id,role_name,role_key,created_by,created_time,update_by,update_time,is_deleted
from role
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="roleName != null and roleName != ''">
and role_name = #{roleName}
</if>
<if test="roleKey != null and roleKey != ''">
and role_key = #{roleKey}
</if>
<if test="createdBy != null and createdBy != ''">
and created_by = #{createdBy}
</if>
<if test="createdTime != null">
and created_time = #{createdTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="isDeleted != null">
and is_deleted = #{isDeleted}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from role
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="roleName != null and roleName != ''">
and role_name = #{roleName}
</if>
<if test="roleKey != null and roleKey != ''">
and role_key = #{roleKey}
</if>
<if test="createdBy != null and createdBy != ''">
and created_by = #{createdBy}
</if>
<if test="createdTime != null">
and created_time = #{createdTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="isDeleted != null">
and is_deleted = #{isDeleted}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into role(role_name,role_key,created_by,created_time,update_by,update_time,is_deleted)
values (#{roleName},#{roleKey},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into role(role_name,role_key,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.roleName},#{entity.roleKey},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into role(role_name,role_key,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.roleName},#{entity.roleKey},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
role_name = values(role_name)role_key = values(role_key)created_by = values(created_by)created_time =
values(created_time)update_by = values(update_by)update_time = values(update_time)is_deleted =
values(is_deleted)
</insert>
<!--通过主键修改数据-->
<update id="update">
update role
<set>
<if test="roleName != null and roleName != ''">
role_name = #{roleName},
</if>
<if test="roleKey != null and roleKey != ''">
role_key = #{roleKey},
</if>
<if test="createdBy != null and createdBy != ''">
created_by = #{createdBy},
</if>
<if test="createdTime != null">
created_time = #{createdTime},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="isDeleted != null">
is_deleted = #{isDeleted},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from role
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,157 @@
<?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.landaiqing.infra.basic.dao.RolePermissionDao">
<resultMap type="com.landaiqing.infra.basic.entity.RolePermission" id="RolePermissionMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="roleId" column="role_id" jdbcType="INTEGER"/>
<result property="permissionId" column="permission_id" jdbcType="INTEGER"/>
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="isDeleted" column="is_deleted" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="RolePermissionMap">
select id,role_id,permission_id,created_by,created_time,update_by,update_time,is_deleted
from role_permission
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="RolePermissionMap">
select
id,role_id,permission_id,created_by,created_time,update_by,update_time,is_deleted
from role_permission
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="roleId != null">
and role_id = #{roleId}
</if>
<if test="permissionId != null">
and permission_id = #{permissionId}
</if>
<if test="createdBy != null and createdBy != ''">
and created_by = #{createdBy}
</if>
<if test="createdTime != null">
and created_time = #{createdTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="isDeleted != null">
and is_deleted = #{isDeleted}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from role_permission
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="roleId != null">
and role_id = #{roleId}
</if>
<if test="permissionId != null">
and permission_id = #{permissionId}
</if>
<if test="createdBy != null and createdBy != ''">
and created_by = #{createdBy}
</if>
<if test="createdTime != null">
and created_time = #{createdTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="isDeleted != null">
and is_deleted = #{isDeleted}
</if>
</where>
</select>
<select id="queryPermissionById" resultType="java.lang.Integer">
select role_permission.permission_id
from role_permission
where role_id=#{roleId}
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into role_permission(role_id,permission_id,created_by,created_time,update_by,update_time,is_deleted)
values (#{roleId},#{permissionId},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into role_permission(role_id,permission_id,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.roleId},#{entity.permissionId},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into role_permission(role_id,permission_id,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.roleId},#{entity.permissionId},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
role_id = values(role_id)permission_id = values(permission_id)created_by = values(created_by)created_time =
values(created_time)update_by = values(update_by)update_time = values(update_time)is_deleted =
values(is_deleted)
</insert>
<!--通过主键修改数据-->
<update id="update">
update role_permission
<set>
<if test="roleId != null">
role_id = #{roleId},
</if>
<if test="permissionId != null">
permission_id = #{permissionId},
</if>
<if test="createdBy != null and createdBy != ''">
created_by = #{createdBy},
</if>
<if test="createdTime != null">
created_time = #{createdTime},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="isDeleted != null">
is_deleted = #{isDeleted},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from role_permission
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,242 @@
<?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.landaiqing.infra.basic.dao.StudentDao">
<resultMap type="com.landaiqing.infra.basic.entity.Student" id="StudentMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="sno" column="sno" jdbcType="VARCHAR"/>
<result property="password" column="password" jdbcType="VARCHAR"/>
<result property="username" column="username" jdbcType="VARCHAR"/>
<result property="className" column="class_name" jdbcType="INTEGER"/>
<result property="grade" column="grade" jdbcType="INTEGER"/>
<result property="age" column="age" jdbcType="INTEGER"/>
<result property="sex" column="sex" jdbcType="INTEGER"/>
<result property="avatar" column="avatar" jdbcType="VARCHAR"/>
<result property="dateOfBirth" column="date_of_birth" jdbcType="TIMESTAMP"/>
<result property="email" column="email" jdbcType="VARCHAR"/>
<result property="phoneNumber" column="phone_number" jdbcType="VARCHAR"/>
<result property="classId" column="class_id" jdbcType="INTEGER"/>
<result property="gradeId" column="grade_id" jdbcType="INTEGER"/>
<result property="roleId" column="role_id" jdbcType="INTEGER"/>
<result property="isDeleted" column="is_deleted" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="StudentMap">
select
id,sno,password,username,class_name,grade,age,sex,avatar,date_of_birth,email,phone_number,class_id,grade_id,role_id,is_deleted
from student
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="StudentMap">
select
id,sno,password,username,class_name,grade,age,sex,avatar,date_of_birth,email,phone_number,class_id,grade_id,role_id,is_deleted
from student
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="sno != null and sno != ''">
and sno = #{sno}
</if>
<if test="password != null and password != ''">
and password = #{password}
</if>
<if test="username != null and username != ''">
and username = #{username}
</if>
<if test="className != null">
and class_name = #{className}
</if>
<if test="grade != null">
and grade = #{grade}
</if>
<if test="age != null">
and age = #{age}
</if>
<if test="sex != null">
and sex = #{sex}
</if>
<if test="avatar != null and avatar != ''">
and avatar = #{avatar}
</if>
<if test="dateOfBirth != null">
and date_of_birth = #{dateOfBirth}
</if>
<if test="email != null and email != ''">
and email = #{email}
</if>
<if test="phoneNumber != null and phoneNumber != ''">
and phone_number = #{phoneNumber}
</if>
<if test="classId != null">
and class_id = #{classId}
</if>
<if test="gradeId != null">
and grade_id = #{gradeId}
</if>
<if test="roleId != null">
and role_id = #{roleId}
</if>
<if test="isDeleted != null">
and is_deleted = #{isDeleted}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from student
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="sno != null and sno != ''">
and sno = #{sno}
</if>
<if test="password != null and password != ''">
and password = #{password}
</if>
<if test="username != null and username != ''">
and username = #{username}
</if>
<if test="className != null">
and class_name = #{className}
</if>
<if test="grade != null">
and grade = #{grade}
</if>
<if test="age != null">
and age = #{age}
</if>
<if test="sex != null">
and sex = #{sex}
</if>
<if test="avatar != null and avatar != ''">
and avatar = #{avatar}
</if>
<if test="dateOfBirth != null">
and date_of_birth = #{dateOfBirth}
</if>
<if test="email != null and email != ''">
and email = #{email}
</if>
<if test="phoneNumber != null and phoneNumber != ''">
and phone_number = #{phoneNumber}
</if>
<if test="classId != null">
and class_id = #{classId}
</if>
<if test="gradeId != null">
and grade_id = #{gradeId}
</if>
<if test="roleId != null">
and role_id = #{roleId}
</if>
<if test="isDeleted != null">
and is_deleted = #{isDeleted}
</if>
</where>
</select>
<select id="queryPage" resultMap="StudentMap">
select *
from student
limit #{start},#{pageSize}
</select>
<select id="selectCount" resultType="java.lang.Integer">
select count(1) from student
</select>
<select id="login" resultType="java.lang.Integer">
select * from student
where username=#{username}
and password=#{password}
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into student(sno,password,username,class_name,grade,age,sex,avatar,date_of_birth,email,phone_number,class_id,grade_id,role_id,is_deleted)
values (#{sno},#{password},#{username},#{className},#{grade},#{age},#{sex},#{avatar},#{dateOfBirth},#{email},#{phoneNumber},#{classId},#{gradeId},#{roleId},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into student(sno,password,username,class_name,grade,age,sex,avatar,date_of_birth,email,phone_number,class_id,grade_id,role_id,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.sno},#{entity.password},#{entity.username},#{entity.className},#{entity.grade},#{entity.age},#{entity.sex},#{entity.avatar},#{entity.dateOfBirth},#{entity.email},#{entity.phoneNumber},#{entity.classId},#{entity.gradeId},#{entity.roleId},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into student(sno,password,username,class_name,grade,age,sex,avatar,date_of_birth,email,phone_number,class_id,grade_id,role_id,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.sno},#{entity.password},#{entity.username},#{entity.className},#{entity.grade},#{entity.age},#{entity.sex},#{entity.avatar},#{entity.dateOfBirth},#{entity.email},#{entity.phoneNumber},#{entity.classId},#{entity.gradeId},#{entity.roleId},#{entity.isDeleted})
</foreach>
on duplicate key update
sno = values(sno)password = values(password)username = values(username)class_name = values(class_name)grade = values(grade)age = values(age)sex = values(sex)avatar = values(avatar)date_of_birth = values(date_of_birth)email = values(email)phone_number = values(phone_number)class_id = values(class_id)grade_id = values(grade_id)role_id = values(role_id)is_deleted = values(is_deleted)
</insert>
<!--通过主键修改数据-->
<update id="update">
update student
<set>
<if test="sno != null and sno != ''">
sno = #{sno},
</if>
<if test="password != null and password != ''">
`password` = #{password},
</if>
<if test="username != null and username != ''">
username = #{username},
</if>
<if test="className != null">
class_name = #{className},
</if>
<if test="grade != null">
grade = #{grade},
</if>
<if test="age != null">
age = #{age},
</if>
<if test="sex != null">
sex = #{sex},
</if>
<if test="avatar != null and avatar != ''">
avatar = #{avatar},
</if>
<if test="dateOfBirth != null">
date_of_birth = #{dateOfBirth},
</if>
<if test="email != null and email != ''">
email = #{email},
</if>
<if test="phoneNumber != null and phoneNumber != ''">
phone_number = #{phoneNumber},
</if>
<if test="classId != null">
class_id = #{classId},
</if>
<if test="gradeId != null">
grade_id = #{gradeId},
</if>
<if test="roleId != null">
role_id = #{roleId},
</if>
<if test="isDeleted != null">
is_deleted = #{isDeleted},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from student where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,105 @@
<?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.landaiqing.infra.basic.dao.StudentRoleDao">
<resultMap type="com.landaiqing.infra.basic.entity.StudentRole" id="StudentRoleMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="studentId" column="student_id" jdbcType="INTEGER"/>
<result property="roleId" column="role_id" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="StudentRoleMap">
select id,student_id,role_id
from student_role
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="StudentRoleMap">
select
id,student_id,role_id
from student_role
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="studentId != null">
and student_id = #{studentId}
</if>
<if test="roleId != null">
and role_id = #{roleId}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from student_role
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="studentId != null">
and student_id = #{studentId}
</if>
<if test="roleId != null">
and role_id = #{roleId}
</if>
</where>
</select>
<select id="queryRoleById" resultType="java.lang.Integer">
select role_id
from student_role
where student_id=#{id}
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into student_role(student_id,role_id)
values (#{studentId},#{roleId})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into student_role(student_id,role_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.studentId},#{entity.roleId})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into student_role(student_id,role_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.studentId},#{entity.roleId})
</foreach>
on duplicate key update
student_id = values(student_id)role_id = values(role_id)
</insert>
<!--通过主键修改数据-->
<update id="update">
update student_role
<set>
<if test="studentId != null">
student_id = #{studentId},
</if>
<if test="roleId != null">
role_id = #{roleId},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from student_role
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,99 @@
<?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.landaiqing.infra.basic.dao.UserDao">
<resultMap type="com.landaiqing.infra.basic.entity.User" id="UserMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="username" column="username" jdbcType="VARCHAR"/>
<result property="password" column="password" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="UserMap">
select
id,username,password
from user
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="UserMap">
select
id,username,password
from user
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="username != null and username != ''">
and username = #{username}
</if>
<if test="password != null and password != ''">
and password = #{password}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from user
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="username != null and username != ''">
and username = #{username}
</if>
<if test="password != null and password != ''">
and password = #{password}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into user(username,password)
values (#{username},#{password})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into user(username,password)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.username},#{entity.password})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into user(username,password)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.username},#{entity.password})
</foreach>
on duplicate key update
username = values(username)password = values(password)
</insert>
<!--通过主键修改数据-->
<update id="update">
update user
<set>
<if test="username != null and username != ''">
username = #{username},
</if>
<if test="password != null and password != ''">
password = #{password},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from user where id = #{id}
</delete>
</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.landaiqing.infra.basic.dao.UserRoleDao">
<resultMap type="com.landaiqing.infra.basic.entity.UserRole" id="UserRoleMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="roleId" column="role_id" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="UserRoleMap">
select id,user_id,role_id
from user_role
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="UserRoleMap">
select
id,user_id,role_id
from user_role
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="roleId != null">
and role_id = #{roleId}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from user_role
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="roleId != null">
and role_id = #{roleId}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into user_role(user_id,role_id)
values (#{userId},#{roleId})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into user_role(user_id,role_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.userId},#{entity.roleId})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into user_role(user_id,role_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.userId},#{entity.roleId})
</foreach>
on duplicate key update
user_id = values(user_id)role_id = values(role_id)
</insert>
<!--通过主键修改数据-->
<update id="update">
update user_role
<set>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="roleId != null">
role_id = #{roleId},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from user_role
where id = #{id}
</delete>
</mapper>