feat: 修改模块名称

This commit is contained in:
2024-02-19 19:48:33 +08:00
parent 2176bf8bd7
commit 9be9287a3e
218 changed files with 130 additions and 130 deletions

View File

@@ -0,0 +1,55 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.landaiqing</groupId>
<artifactId>qing-yu-club-subject</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>qing-yu-club-infra</artifactId>
<packaging>jar</packaging>
<name>qing-yu-club-infra</name>
<url>http://maven.apache.org</url>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<!--jdbcStarter-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>2.4.2</version>
</dependency>
<!--druid连接池-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.21</version>
</dependency>
<!--mysql-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
</dependency>
<!--mybatis plus-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>com.landaiqing</groupId>
<artifactId>qing-yu-club-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,17 @@
package com.landaiqing.subject.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.subject.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.subject.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,49 @@
package com.landaiqing.subject.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 简答题(SubjectBrief)实体类
*
* @author landaiqing
* @since 2024-02-15 14:29:44
*/
@Data
public class SubjectBrief implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 题目id
*/
private Integer subjectId;
/**
* 题目答案
*/
private String subjectAnswer;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
private Integer isDeleted;
}

View File

@@ -0,0 +1,59 @@
package com.landaiqing.subject.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 题目分类(SubjectCategory)实体类
*
* @author landaiqing
* @since 2024-02-07 16:17:17
*/
@Data
public class SubjectCategory implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 分类名称
*/
private String categoryName;
/**
* 分类类型
*/
private Integer categoryType;
/**
* 图标连接
*/
private String imageUrl;
/**
* 父级id
*/
private Long parentId;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 是否删除 0: 未删除 1: 已删除
*/
private Integer isDeleted;
}

View File

@@ -0,0 +1,67 @@
package com.landaiqing.subject.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 题目信息表(SubjectInfo)实体类
*
* @author landaiqing
* @since 2024-02-14 16:59:04
*/
@Data
public class SubjectInfo implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 题目名称
*/
private String subjectName;
/**
* 题目难度
*/
private Integer subjectDifficult;
/**
* 出题人名
*/
private String settleName;
/**
* 题目类型 1单选 2多选 3判断 4简答
*/
private Integer subjectType;
/**
* 题目分数
*/
private Integer subjectScore;
/**
* 题目解析
*/
private String subjectParse;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 修改人
*/
private String updateBy;
/**
* 修改时间
*/
private Date updateTime;
private Integer isDeleted;
}

View File

@@ -0,0 +1,49 @@
package com.landaiqing.subject.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 判断题(SubjectJudge)实体类
*
* @author landaiqing
* @since 2024-02-15 14:32:25
*/
@Data
public class SubjectJudge implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 题目id
*/
private Long subjectId;
/**
* 是否正确
*/
private Integer isCorrect;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
private Integer isDeleted;
}

View File

@@ -0,0 +1,51 @@
package com.landaiqing.subject.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 题目标签表(SubjectLabel)实体类
*
* @author landaiqing
* @since 2024-02-14 17:08:06
*/
@Data
public class SubjectLabel implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 标签分类
*/
private String labelName;
/**
* 排序
*/
private Integer sortNum;
private Long categoryId;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
private Integer isDeleted;
}

View File

@@ -0,0 +1,123 @@
package com.landaiqing.subject.infra.basic.entity;
import java.util.Date;
import java.io.Serializable;
/**
* 题目分类关系表(SubjectMapping)实体类
*
* @author landaiqing
* @since 2024-02-14 18:44:42
*/
public class SubjectMapping implements Serializable {
private static final long serialVersionUID = -84040462903129597L;
/**
* 主键
*/
private Long id;
/**
* 题目id
*/
private Long subjectId;
/**
* 分类id
*/
private Long categoryId;
/**
* 标签id
*/
private Long labelId;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 修改人
*/
private String updateBy;
/**
* 修改时间
*/
private Date updateTime;
private Integer isDeleted;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getSubjectId() {
return subjectId;
}
public void setSubjectId(Long subjectId) {
this.subjectId = subjectId;
}
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public Long getLabelId() {
return labelId;
}
public void setLabelId(Long labelId) {
this.labelId = labelId;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getIsDeleted() {
return isDeleted;
}
public void setIsDeleted(Integer isDeleted) {
this.isDeleted = isDeleted;
}
}

View File

@@ -0,0 +1,57 @@
package com.landaiqing.subject.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 多选题信息表(SubjectMultiple)实体类
*
* @author landaiqing
* @since 2024-02-15 14:32:48
*/
@Data
public class SubjectMultiple implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 题目id
*/
private Long subjectId;
/**
* 选项类型
*/
private Long optionType;
/**
* 选项内容
*/
private String optionContent;
/**
* 是否正确
*/
private Integer isCorrect;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
private Integer isDeleted;
}

View File

@@ -0,0 +1,56 @@
package com.landaiqing.subject.infra.basic.entity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* 单选题信息表(SubjectRadio)实体类
*
* @author landaiqing
* @since 2024-02-15 14:33:07
*/
@Data
public class SubjectRadio implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 题目id
*/
private Long subjectId;
/**
* a,b,c,d
*/
private Integer optionType;
/**
* 选项内容
*/
private String optionContent;
/**
* 是否正确
*/
private Integer isCorrect;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 修改人
*/
private String updateBy;
/**
* 修改时间
*/
private Date updateTime;
private Integer isDeleted;
}

View File

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

View File

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

View File

@@ -0,0 +1,92 @@
package com.landaiqing.subject.infra.basic.mapper;
import com.landaiqing.subject.infra.basic.entity.SubjectInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 题目信息表(SubjectInfo)表数据库访问层
*
* @author landaiqing
* @since 2024-02-14 16:59:02
*/
public interface SubjectInfoDao {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectInfo queryById(Long id);
/**
* 查询指定行数据
*
* @param subjectInfo 查询条件
* @param subjectInfo 分页对象
* @return 对象列表
*/
List<SubjectInfo> queryAllByLimit(SubjectInfo subjectInfo);
/**
* 统计总行数
*
* @param subjectInfo 查询条件
* @return 总行数
*/
long count(SubjectInfo subjectInfo);
/**
* 新增数据
*
* @param subjectInfo 实例对象
* @return 影响行数
*/
int insert(SubjectInfo subjectInfo);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<SubjectInfo> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<SubjectInfo> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<SubjectInfo> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<SubjectInfo> entities);
/**
* 修改数据
*
* @param subjectInfo 实例对象
* @return 影响行数
*/
int update(SubjectInfo subjectInfo);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Long id);
int countByCondition(@Param("subjectInfo") SubjectInfo subjectInfo,
@Param("labelId") Long labelId,
@Param("categoryId") Long categoryId);
List<SubjectInfo> queryPage(@Param("subjectInfo") SubjectInfo subjectInfo,
@Param("categoryId") Long categoryId,
@Param("labelId") Long labelId,
@Param("start") int start,
@Param("pageSize") Integer pageSize);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,50 @@
package com.landaiqing.subject.infra.basic.service;
import com.landaiqing.subject.infra.basic.entity.SubjectBrief;
/**
* 简答题(SubjectBrief)表服务接口
*
* @author landaiqing
* @since 2024-02-15 14:29:45
*/
public interface SubjectBriefService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectBrief queryById(Long id);
/**
* 新增数据
*
* @param subjectBrief 实例对象
* @return 实例对象
*/
SubjectBrief insert(SubjectBrief subjectBrief);
/**
* 修改数据
*
* @param subjectBrief 实例对象
* @return 实例对象
*/
SubjectBrief update(SubjectBrief subjectBrief);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
/**
* 条件查询
*/
SubjectBrief queryByCondition(SubjectBrief subjectBrief);
}

View File

@@ -0,0 +1,52 @@
package com.landaiqing.subject.infra.basic.service;
import com.landaiqing.subject.infra.basic.entity.SubjectCategory;
import java.util.List;
/**
* 题目分类(SubjectCategory)表服务接口
*
* @author landaiqing
* @since 2024-02-07 16:17:20
*/
public interface SubjectCategoryService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectCategory queryById(Long id);
/**
* 新增数据
*
* @param subjectCategory 实例对象
* @return 实例对象
*/
SubjectCategory insert(SubjectCategory subjectCategory);
/**
* 修改数据
*
* @param subjectCategory 实例对象
* @return 实例对象
*/
int update(SubjectCategory subjectCategory);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
/**
* 查询岗位大类
* @return
*/
List<SubjectCategory> queryCategory(SubjectCategory subjectCategory);
}

View File

@@ -0,0 +1,51 @@
package com.landaiqing.subject.infra.basic.service;
import com.landaiqing.subject.infra.basic.entity.SubjectInfo;
import java.util.List;
/**
* 题目信息表(SubjectInfo)表服务接口
*
* @author landaiqing
* @since 2024-02-14 16:59:04
*/
public interface SubjectInfoService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectInfo queryById(Long id);
/**
* 新增数据
*
* @param subjectInfo 实例对象
* @return 实例对象
*/
SubjectInfo insert(SubjectInfo subjectInfo);
/**
* 修改数据
*
* @param subjectInfo 实例对象
* @return 实例对象
*/
SubjectInfo update(SubjectInfo subjectInfo);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
int countByCondition(SubjectInfo subjectInfo, Long labelId, Long categoryId);
List<SubjectInfo> queryPage(SubjectInfo subjectInfo, Long categoryId, Long labelId, int start, Integer pageSize);
}

View File

@@ -0,0 +1,49 @@
package com.landaiqing.subject.infra.basic.service;
import com.landaiqing.subject.infra.basic.entity.SubjectJudge;
import java.util.List;
/**
* 判断题(SubjectJudge)表服务接口
*
* @author landaiqing
* @since 2024-02-15 14:32:25
*/
public interface SubjectJudgeService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectJudge queryById(Long id);
/**
* 新增数据
*
* @param subjectJudge 实例对象
* @return 实例对象
*/
SubjectJudge insert(SubjectJudge subjectJudge);
/**
* 修改数据
*
* @param subjectJudge 实例对象
* @return 实例对象
*/
SubjectJudge update(SubjectJudge subjectJudge);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
List<SubjectJudge> queryByCondition(SubjectJudge subjectJudge);
}

View File

@@ -0,0 +1,54 @@
package com.landaiqing.subject.infra.basic.service;
import com.landaiqing.subject.infra.basic.entity.SubjectLabel;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 题目标签表(SubjectLabel)表服务接口
*
* @author landaiqing
* @since 2024-02-14 17:08:07
*/
public interface SubjectLabelService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectLabel queryById(Long id);
/**
* 新增数据
*
* @param subjectLabel 实例对象
* @return 实例对象
*/
int insert(SubjectLabel subjectLabel);
/**
* 修改数据
*
* @param subjectLabel 实例对象
* @return 实例对象
*/
int update(SubjectLabel subjectLabel);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
List<SubjectLabel> batchQueryById(@Param("list") List<Long> labelIdList);
List<SubjectLabel> queryByCondition(SubjectLabel subjectLabel);
}

View File

@@ -0,0 +1,66 @@
package com.landaiqing.subject.infra.basic.service;
import com.landaiqing.subject.infra.basic.entity.SubjectMapping;
import java.util.List;
/**
* 题目分类关系表(SubjectMapping)表服务接口
*
* @author landaiqing
* @since 2024-02-14 18:44:42
*/
public interface SubjectMappingService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectMapping queryById(Long id);
/**
* 新增数据
*
* @param subjectMapping 实例对象
* @return 实例对象
*/
SubjectMapping insert(SubjectMapping subjectMapping);
/**
* 修改数据
*
* @param subjectMapping 实例对象
* @return 实例对象
*/
int update(SubjectMapping subjectMapping);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
/**
* @description: 查询分类下的标签
* @param: [subjectMapping]
* @return: java.util.List<com.landaiqing.subject.infra.basic.entity.SubjectMapping>
* @author landaiqing
* @date: 2024/2/14 19:13
*/
List<SubjectMapping> queryLabelId(SubjectMapping subjectMapping);
/**
* @description: 批量插入
* @param: [mappingList]
* @return: void
* @author landaiqing
* @date: 2024/2/15 17:33
*/
void batchInsert(List<SubjectMapping> mappingList);
}

View File

@@ -0,0 +1,51 @@
package com.landaiqing.subject.infra.basic.service;
import com.landaiqing.subject.infra.basic.entity.SubjectMultiple;
import java.util.List;
/**
* 多选题信息表(SubjectMultiple)表服务接口
*
* @author landaiqing
* @since 2024-02-15 14:32:48
*/
public interface SubjectMultipleService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectMultiple queryById(Long id);
/**
* 新增数据
*
* @param subjectMultiple 实例对象
* @return 实例对象
*/
SubjectMultiple insert(SubjectMultiple subjectMultiple);
/**
* 修改数据
*
* @param subjectMultiple 实例对象
* @return 实例对象
*/
SubjectMultiple update(SubjectMultiple subjectMultiple);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
void batchInsert(List<SubjectMultiple> subjectMultipleList);
List<SubjectMultiple> queryByCondition(SubjectMultiple subjectMultiple);
}

View File

@@ -0,0 +1,56 @@
package com.landaiqing.subject.infra.basic.service;
import com.landaiqing.subject.infra.basic.entity.SubjectRadio;
import java.util.List;
/**
* 单选题信息表(SubjectRadio)表服务接口
*
* @author landaiqing
* @since 2024-02-15 14:33:07
*/
public interface SubjectRadioService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
SubjectRadio queryById(Long id);
/**
* 新增数据
*
* @param subjectRadio 实例对象
* @return 实例对象
*/
SubjectRadio insert(SubjectRadio subjectRadio);
/**
* 批量插入
*
* @param subjectRadioList 实例对象
* @return 实例对象
*/
void batchInsert(List<SubjectRadio> subjectRadioList);
/**
* 修改数据
*
* @param subjectRadio 实例对象
* @return 实例对象
*/
SubjectRadio update(SubjectRadio subjectRadio);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Long id);
List<SubjectRadio> queryByCondition(SubjectRadio subjectRadio);
}

View File

@@ -0,0 +1,72 @@
package com.landaiqing.subject.infra.basic.service.impl;
import com.landaiqing.subject.infra.basic.entity.SubjectBrief;
import com.landaiqing.subject.infra.basic.mapper.SubjectBriefDao;
import com.landaiqing.subject.infra.basic.service.SubjectBriefService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 简答题(SubjectBrief)表服务实现类
*
* @author landaiqing
* @since 2024-02-15 14:29:45
*/
@Service("subjectBriefService")
public class SubjectBriefServiceImpl implements SubjectBriefService {
@Resource
private SubjectBriefDao subjectBriefDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SubjectBrief queryById(Long id) {
return this.subjectBriefDao.queryById(id);
}
/**
* 新增数据
*
* @param subjectBrief 实例对象
* @return 实例对象
*/
@Override
public SubjectBrief insert(SubjectBrief subjectBrief) {
this.subjectBriefDao.insert(subjectBrief);
return subjectBrief;
}
/**
* 修改数据
*
* @param subjectBrief 实例对象
* @return 实例对象
*/
@Override
public SubjectBrief update(SubjectBrief subjectBrief) {
this.subjectBriefDao.update(subjectBrief);
return this.queryById(subjectBrief.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.subjectBriefDao.deleteById(id) > 0;
}
@Override
public SubjectBrief queryByCondition(SubjectBrief subjectBrief) {
return this.subjectBriefDao.queryAllByLimit(subjectBrief);
}
}

View File

@@ -0,0 +1,78 @@
package com.landaiqing.subject.infra.basic.service.impl;
import com.alibaba.fastjson.JSON;
import com.landaiqing.subject.infra.basic.entity.SubjectCategory;
import com.landaiqing.subject.infra.basic.mapper.SubjectCategoryDao;
import com.landaiqing.subject.infra.basic.service.SubjectCategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 题目分类(SubjectCategory)表服务实现类
*
* @author landaiqing
* @since 2024-02-07 16:17:20
*/
@Service("subjectCategoryService")
@Slf4j
public class SubjectCategoryServiceImpl implements SubjectCategoryService {
@Resource
private SubjectCategoryDao subjectCategoryDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SubjectCategory queryById(Long id) {
return this.subjectCategoryDao.queryById(id);
}
/**
* 新增数据
*
* @param subjectCategory 实例对象
* @return 实例对象
*/
@Override
public SubjectCategory insert(SubjectCategory subjectCategory) {
if (log.isInfoEnabled()) {
log.info("SubjectCategoryController.add.subjectCategory:{}", JSON.toJSONString(subjectCategory));
}
this.subjectCategoryDao.insert(subjectCategory);
return subjectCategory;
}
/**
* 修改数据
*
* @param subjectCategory 实例对象
* @return 实例对象
*/
@Override
public int update(SubjectCategory subjectCategory) {
return this.subjectCategoryDao.update(subjectCategory);
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.subjectCategoryDao.deleteById(id) > 0;
}
@Override
public List<SubjectCategory> queryCategory(SubjectCategory subjectCategory) {
return this.subjectCategoryDao.queryCategory(subjectCategory);
}
}

View File

@@ -0,0 +1,79 @@
package com.landaiqing.subject.infra.basic.service.impl;
import com.landaiqing.subject.infra.basic.entity.SubjectInfo;
import com.landaiqing.subject.infra.basic.mapper.SubjectInfoDao;
import com.landaiqing.subject.infra.basic.service.SubjectInfoService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 题目信息表(SubjectInfo)表服务实现类
*
* @author landaiqing
* @since 2024-02-14 16:59:04
*/
@Service("subjectInfoService")
public class SubjectInfoServiceImpl implements SubjectInfoService {
@Resource
private SubjectInfoDao subjectInfoDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SubjectInfo queryById(Long id) {
return this.subjectInfoDao.queryById(id);
}
/**
* 新增数据
*
* @param subjectInfo 实例对象
* @return 实例对象
*/
@Override
public SubjectInfo insert(SubjectInfo subjectInfo) {
this.subjectInfoDao.insert(subjectInfo);
return subjectInfo;
}
/**
* 修改数据
*
* @param subjectInfo 实例对象
* @return 实例对象
*/
@Override
public SubjectInfo update(SubjectInfo subjectInfo) {
this.subjectInfoDao.update(subjectInfo);
return this.queryById(subjectInfo.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.subjectInfoDao.deleteById(id) > 0;
}
@Override
public int countByCondition(SubjectInfo subjectInfo, Long labelId, Long categoryId) {
return this.subjectInfoDao.countByCondition(subjectInfo,labelId,categoryId);
}
@Override
public List<SubjectInfo> queryPage(SubjectInfo subjectInfo, Long categoryId, Long labelId, int start, Integer pageSize) {
return this.subjectInfoDao.queryPage(subjectInfo,categoryId,labelId,start,pageSize);
}
}

View File

@@ -0,0 +1,74 @@
package com.landaiqing.subject.infra.basic.service.impl;
import com.landaiqing.subject.infra.basic.entity.SubjectJudge;
import com.landaiqing.subject.infra.basic.mapper.SubjectJudgeDao;
import com.landaiqing.subject.infra.basic.service.SubjectJudgeService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 判断题(SubjectJudge)表服务实现类
*
* @author landaiqing
* @since 2024-02-15 14:32:25
*/
@Service("subjectJudgeService")
public class SubjectJudgeServiceImpl implements SubjectJudgeService {
@Resource
private SubjectJudgeDao subjectJudgeDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SubjectJudge queryById(Long id) {
return this.subjectJudgeDao.queryById(id);
}
/**
* 新增数据
*
* @param subjectJudge 实例对象
* @return 实例对象
*/
@Override
public SubjectJudge insert(SubjectJudge subjectJudge) {
this.subjectJudgeDao.insert(subjectJudge);
return subjectJudge;
}
/**
* 修改数据
*
* @param subjectJudge 实例对象
* @return 实例对象
*/
@Override
public SubjectJudge update(SubjectJudge subjectJudge) {
this.subjectJudgeDao.update(subjectJudge);
return this.queryById(subjectJudge.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.subjectJudgeDao.deleteById(id) > 0;
}
@Override
public List<SubjectJudge> queryByCondition(SubjectJudge subjectJudge) {
return this.subjectJudgeDao.queryAllByLimit(subjectJudge);
}
}

View File

@@ -0,0 +1,79 @@
package com.landaiqing.subject.infra.basic.service.impl;
import com.landaiqing.subject.infra.basic.entity.SubjectLabel;
import com.landaiqing.subject.infra.basic.mapper.SubjectLabelDao;
import com.landaiqing.subject.infra.basic.service.SubjectLabelService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 题目标签表(SubjectLabel)表服务实现类
*
* @author landaiqing
* @since 2024-02-14 17:08:07
*/
@Service("subjectLabelService")
public class SubjectLabelServiceImpl implements SubjectLabelService {
@Resource
private SubjectLabelDao subjectLabelDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SubjectLabel queryById(Long id) {
return this.subjectLabelDao.queryById(id);
}
/**
* 新增数据
*
* @param subjectLabel 实例对象
* @return 实例对象
*/
@Override
public int insert(SubjectLabel subjectLabel) {
return this.subjectLabelDao.insert(subjectLabel);
}
/**
* 修改数据
*
* @param subjectLabel 实例对象
* @return 实例对象
*/
@Override
public int update(SubjectLabel subjectLabel) {
return this.subjectLabelDao.update(subjectLabel);
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.subjectLabelDao.deleteById(id) > 0;
}
@Override
public List<SubjectLabel> batchQueryById(List<Long> labelIdList) {
return this.subjectLabelDao.batchQueryById(labelIdList);
}
@Override
public List<SubjectLabel> queryByCondition(SubjectLabel subjectLabel) {
return this.subjectLabelDao.queryByCondition(subjectLabel);
}
}

View File

@@ -0,0 +1,85 @@
package com.landaiqing.subject.infra.basic.service.impl;
import com.landaiqing.subject.infra.basic.entity.SubjectMapping;
import com.landaiqing.subject.infra.basic.mapper.SubjectMappingDao;
import com.landaiqing.subject.infra.basic.service.SubjectMappingService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 题目分类关系表(SubjectMapping)表服务实现类
*
* @author landaiqing
* @since 2024-02-14 18:44:42
*/
@Service("subjectMappingService")
public class SubjectMappingServiceImpl implements SubjectMappingService {
@Resource
private SubjectMappingDao subjectMappingDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SubjectMapping queryById(Long id) {
return this.subjectMappingDao.queryById(id);
}
/**
* 新增数据
*
* @param subjectMapping 实例对象
* @return 实例对象
*/
@Override
public SubjectMapping insert(SubjectMapping subjectMapping) {
this.subjectMappingDao.insert(subjectMapping);
return subjectMapping;
}
/**
* 修改数据
*
* @param subjectMapping 实例对象
* @return 实例对象
*/
@Override
public int update(SubjectMapping subjectMapping) {
return this.subjectMappingDao.update(subjectMapping);
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.subjectMappingDao.deleteById(id) > 0;
}
/**
* @description: 查询分类下的标签
* @param: [subjectMapping]
* @return: java.util.List<com.landaiqing.subject.infra.basic.entity.SubjectMapping>
* @author landaiqing
* @date: 2024/2/14 19:13
*/
@Override
public List<SubjectMapping> queryLabelId(SubjectMapping subjectMapping) {
return this.subjectMappingDao.queryDistinctLabelId(subjectMapping);
}
@Override
public void batchInsert(List<SubjectMapping> mappingList) {
this.subjectMappingDao.insertBatch(mappingList);
}
}

View File

@@ -0,0 +1,78 @@
package com.landaiqing.subject.infra.basic.service.impl;
import com.landaiqing.subject.infra.basic.entity.SubjectMultiple;
import com.landaiqing.subject.infra.basic.mapper.SubjectMultipleDao;
import com.landaiqing.subject.infra.basic.service.SubjectMultipleService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 多选题信息表(SubjectMultiple)表服务实现类
*
* @author landaiqing
* @since 2024-02-15 14:32:49
*/
@Service("subjectMultipleService")
public class SubjectMultipleServiceImpl implements SubjectMultipleService {
@Resource
private SubjectMultipleDao subjectMultipleDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SubjectMultiple queryById(Long id) {
return this.subjectMultipleDao.queryById(id);
}
/**
* 新增数据
*
* @param subjectMultiple 实例对象
* @return 实例对象
*/
@Override
public SubjectMultiple insert(SubjectMultiple subjectMultiple) {
this.subjectMultipleDao.insert(subjectMultiple);
return subjectMultiple;
}
/**
* 修改数据
*
* @param subjectMultiple 实例对象
* @return 实例对象
*/
@Override
public SubjectMultiple update(SubjectMultiple subjectMultiple) {
this.subjectMultipleDao.update(subjectMultiple);
return this.queryById(subjectMultiple.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.subjectMultipleDao.deleteById(id) > 0;
}
@Override
public void batchInsert(List<SubjectMultiple> subjectMultipleList) {
this.subjectMultipleDao.insertBatch(subjectMultipleList);
}
@Override
public List<SubjectMultiple> queryByCondition(SubjectMultiple subjectMultiple) {
return this.subjectMultipleDao.queryAllByLimit(subjectMultiple);
}
}

View File

@@ -0,0 +1,77 @@
package com.landaiqing.subject.infra.basic.service.impl;
import com.landaiqing.subject.infra.basic.entity.SubjectRadio;
import com.landaiqing.subject.infra.basic.mapper.SubjectRadioDao;
import com.landaiqing.subject.infra.basic.service.SubjectRadioService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 单选题信息表(SubjectRadio)表服务实现类
*
* @author landaiqing
* @since 2024-02-15 14:33:07
*/
@Service("subjectRadioService")
public class SubjectRadioServiceImpl implements SubjectRadioService {
@Resource
private SubjectRadioDao subjectRadioDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public SubjectRadio queryById(Long id) {
return this.subjectRadioDao.queryById(id);
}
/**
* 新增数据
*
* @param subjectRadio 实例对象
* @return 实例对象
*/
@Override
public SubjectRadio insert(SubjectRadio subjectRadio) {
this.subjectRadioDao.insert(subjectRadio);
return subjectRadio;
}
@Override
public void batchInsert(List<SubjectRadio> subjectRadioList) {
this.subjectRadioDao.insertBatch(subjectRadioList);
}
/**
* 修改数据
*
* @param subjectRadio 实例对象
* @return 实例对象
*/
@Override
public SubjectRadio update(SubjectRadio subjectRadio) {
this.subjectRadioDao.update(subjectRadio);
return this.queryById(subjectRadio.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long id) {
return this.subjectRadioDao.deleteById(id) > 0;
}
@Override
public List<SubjectRadio> queryByCondition(SubjectRadio subjectRadio) {
return this.subjectRadioDao.queryAllByLimit(subjectRadio);
}
}

View File

@@ -0,0 +1,48 @@
package com.landaiqing.subject.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("$LDQ20020618xxx$");
System.out.println("encrypt:"+encrypt);
}
}

View File

@@ -0,0 +1,151 @@
<?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.subject.infra.basic.mapper.SubjectBriefDao">
<resultMap type="com.landaiqing.subject.infra.basic.entity.SubjectBrief" id="SubjectBriefMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="subjectId" column="subject_id" jdbcType="INTEGER"/>
<result property="subjectAnswer" column="subject_answer" 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="SubjectBriefMap">
select id,subject_id,subject_answer,created_by,created_time,update_by,update_time,is_deleted
from subject_brief
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SubjectBriefMap">
select
id,subject_id,subject_answer,created_by,created_time,update_by,update_time,is_deleted
from subject_brief
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="subjectAnswer != null and subjectAnswer != ''">
and subject_answer = #{subjectAnswer}
</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="count" resultType="java.lang.Long">
select count(1)
from subject_brief
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="subjectAnswer != null and subjectAnswer != ''">
and subject_answer = #{subjectAnswer}
</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 subject_brief(subject_id,subject_answer,created_by,created_time,update_by,update_time,is_deleted)
values (#{subjectId},#{subjectAnswer},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_brief(subject_id,subject_answer,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.subjectAnswer},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_brief(subject_id,subject_answer,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.subjectAnswer},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
subject_id = values(subject_id)subject_answer = values(subject_answer)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 subject_brief
<set>
<if test="subjectId != null">
subject_id = #{subjectId},
</if>
<if test="subjectAnswer != null and subjectAnswer != ''">
subject_answer = #{subjectAnswer},
</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 subject_brief
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,188 @@
<?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.subject.infra.basic.mapper.SubjectCategoryDao">
<resultMap type="com.landaiqing.subject.infra.basic.entity.SubjectCategory" id="SubjectCategoryMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="categoryName" column="category_name" jdbcType="VARCHAR"/>
<result property="categoryType" column="category_type" jdbcType="INTEGER"/>
<result property="imageUrl" column="image_url" jdbcType="VARCHAR"/>
<result property="parentId" column="parent_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="SubjectCategoryMap">
select id,
category_name,
category_type,
image_url,
parent_id,
created_by,
created_time,
update_by,
update_time
from subject_category
where id = #{id}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from subject_category
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="categoryName != null and categoryName != ''">
and category_name = #{categoryName}
</if>
<if test="categoryType != null">
and category_type = #{categoryType}
</if>
<if test="imageUrl != null and imageUrl != ''">
and image_url = #{imageUrl}
</if>
<if test="parentId != null">
and parent_id = #{parentId}
</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="queryCategory" resultMap="SubjectCategoryMap">
select * from subject_category
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="categoryName != null and categoryName != ''">
and category_name = #{categoryName}
</if>
<if test="categoryType != null">
and category_type = #{categoryType}
</if>
<if test="imageUrl != null and imageUrl != ''">
and image_url = #{imageUrl}
</if>
<if test="parentId != null">
and parent_id = #{parentId}
</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 subject_category(category_name, category_type, image_url, parent_id, created_by, created_time,
update_by, update_time, is_deleted)
values (#{categoryName}, #{categoryType}, #{imageUrl}, #{parentId}, #{createdBy}, #{createdTime}, #{updateBy},
#{updateTime}, #{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_category(category_name, category_type, image_url, parent_id, created_by, created_time,
update_by, update_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.categoryName}, #{entity.categoryType}, #{entity.imageUrl}, #{entity.parentId},
#{entity.createdBy}, #{entity.createdTime}, #{entity.updateBy}, #{entity.updateTime})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_category(category_name, category_type, image_url, parent_id, created_by, created_time,
update_by, update_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.categoryName}, #{entity.categoryType}, #{entity.imageUrl}, #{entity.parentId},
#{entity.createdBy}, #{entity.createdTime}, #{entity.updateBy}, #{entity.updateTime})
</foreach>
on duplicate key update
category_name = values(category_name),
category_type = values(category_type),
image_url = values(image_url),
parent_id = values(parent_id),
created_by = values(created_by),
created_time = values(created_time),
update_by = values(update_by),
update_time = values(update_time)
</insert>
<!--通过主键修改数据-->
<update id="update">
update subject_category
<set>
<if test="categoryName != null and categoryName != ''">
category_name = #{categoryName},
</if>
<if test="categoryType != null">
category_type = #{categoryType},
</if>
<if test="imageUrl != null and imageUrl != ''">
image_url = #{imageUrl},
</if>
<if test="parentId != null">
parent_id = #{parentId},
</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 subject_category where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,255 @@
<?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.subject.infra.basic.mapper.SubjectInfoDao">
<resultMap type="com.landaiqing.subject.infra.basic.entity.SubjectInfo" id="SubjectInfoMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="subjectName" column="subject_name" jdbcType="VARCHAR"/>
<result property="subjectDifficult" column="subject_difficult" jdbcType="INTEGER"/>
<result property="settleName" column="settle_name" jdbcType="VARCHAR"/>
<result property="subjectType" column="subject_type" jdbcType="INTEGER"/>
<result property="subjectScore" column="subject_score" jdbcType="INTEGER"/>
<result property="subjectParse" column="subject_parse" 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="SubjectInfoMap">
select id,
subject_name,
subject_difficult,
settle_name,
subject_type,
subject_score,
subject_parse,
created_by,
created_time,
update_by,
update_time,
is_deleted
from subject_info
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SubjectInfoMap">
select
id,subject_name,subject_difficult,settle_name,subject_type,subject_score,subject_parse,created_by,created_time,update_by,update_time,is_deleted
from subject_info
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectName != null and subjectName != ''">
and subject_name = #{subjectName}
</if>
<if test="subjectDifficult != null">
and subject_difficult = #{subjectDifficult}
</if>
<if test="settleName != null and settleName != ''">
and settle_name = #{settleName}
</if>
<if test="subjectType != null">
and subject_type = #{subjectType}
</if>
<if test="subjectScore != null">
and subject_score = #{subjectScore}
</if>
<if test="subjectParse != null and subjectParse != ''">
and subject_parse = #{subjectParse}
</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 subject_info
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectName != null and subjectName != ''">
and subject_name = #{subjectName}
</if>
<if test="subjectDifficult != null">
and subject_difficult = #{subjectDifficult}
</if>
<if test="settleName != null and settleName != ''">
and settle_name = #{settleName}
</if>
<if test="subjectType != null">
and subject_type = #{subjectType}
</if>
<if test="subjectScore != null">
and subject_score = #{subjectScore}
</if>
<if test="subjectParse != null and subjectParse != ''">
and subject_parse = #{subjectParse}
</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="countByCondition" resultType="java.lang.Integer">
select count(1)
from subject_info a,
subject_mapping b
where a.id = b.subject_id
and b.label_id = #{labelId}
and b.category_id = #{categoryId}
and a.is_deleted = 0
and b.is_deleted = 0
<if test="subjectInfo.subjectDifficult != null">
and a.subject_difficult = #{subjectInfo.subjectDifficult}
</if>
<if test="subjectInfo.subjectType != null">
and a.subject_type = #{subjectInfo.subjectType}
</if>
</select>
<select id="queryPage" resultMap="SubjectInfoMap">
select a.id,
a.subject_name,
a.subject_difficult,
a.settle_name,
a.subject_type,
a.subject_score,
a.subject_parse,
a.created_by,
a.created_time,
a. update_by,
a.update_time,
a.is_deleted
from subject_info a,
subject_mapping b
where a.id = b.subject_id
and b.label_id = #{labelId}
and b.category_id = #{categoryId}
and a.is_deleted = 0
and b.is_deleted = 0
<if test="subjectInfo.subjectDifficult != null">
and a.subject_difficult = #{subjectInfo.subjectDifficult}
</if>
<if test="subjectInfo.subjectType != null">
and a.subject_type = #{subjectInfo.subjectType}
</if>
limit #{start},#{pageSize}
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
<selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER">
SELECT LAST_INSERT_ID()
</selectKey>
insert into
subject_info(subject_name,subject_difficult,settle_name,subject_type,subject_score,subject_parse,created_by,created_time,update_by,update_time,is_deleted)
values
(#{subjectName},#{subjectDifficult},#{settleName},#{subjectType},#{subjectScore},#{subjectParse},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into
subject_info(subject_name,subject_difficult,settle_name,subject_type,subject_score,subject_parse,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectName},#{entity.subjectDifficult},#{entity.settleName},#{entity.subjectType},#{entity.subjectScore},#{entity.subjectParse},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into
subject_info(subject_name,subject_difficult,settle_name,subject_type,subject_score,subject_parse,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectName},#{entity.subjectDifficult},#{entity.settleName},#{entity.subjectType},#{entity.subjectScore},#{entity.subjectParse},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
subject_name = values(subject_name)subject_difficult = values(subject_difficult)settle_name =
values(settle_name)subject_type = values(subject_type)subject_score = values(subject_score)subject_parse =
values(subject_parse)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 subject_info
<set>
<if test="subjectName != null and subjectName != ''">
subject_name = #{subjectName},
</if>
<if test="subjectDifficult != null">
subject_difficult = #{subjectDifficult},
</if>
<if test="settleName != null and settleName != ''">
settle_name = #{settleName},
</if>
<if test="subjectType != null">
subject_type = #{subjectType},
</if>
<if test="subjectScore != null">
subject_score = #{subjectScore},
</if>
<if test="subjectParse != null and subjectParse != ''">
subject_parse = #{subjectParse},
</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 subject_info
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,151 @@
<?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.subject.infra.basic.mapper.SubjectJudgeDao">
<resultMap type="com.landaiqing.subject.infra.basic.entity.SubjectJudge" id="SubjectJudgeMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="subjectId" column="subject_id" jdbcType="INTEGER"/>
<result property="isCorrect" column="is_correct" 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="SubjectJudgeMap">
select id,subject_id,is_correct,created_by,created_time,update_by,update_time,is_deleted
from subject_judge
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SubjectJudgeMap">
select
id,subject_id,is_correct,created_by,created_time,update_by,update_time,is_deleted
from subject_judge
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="isCorrect != null">
and is_correct = #{isCorrect}
</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="count" resultType="java.lang.Long">
select count(1)
from subject_judge
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="isCorrect != null">
and is_correct = #{isCorrect}
</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 subject_judge(subject_id,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values (#{subjectId},#{isCorrect},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_judge(subject_id,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.isCorrect},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_judge(subject_id,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.isCorrect},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
subject_id = values(subject_id)is_correct = values(is_correct)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 subject_judge
<set>
<if test="subjectId != null">
subject_id = #{subjectId},
</if>
<if test="isCorrect != null">
is_correct = #{isCorrect},
</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 subject_judge
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,170 @@
<?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.subject.infra.basic.mapper.SubjectLabelDao">
<resultMap type="com.landaiqing.subject.infra.basic.entity.SubjectLabel" id="SubjectLabelMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="labelName" column="label_name" jdbcType="VARCHAR"/>
<result property="sortNum" column="sort_num" jdbcType="INTEGER"/>
<result property="categoryId" column="category_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="SubjectLabelMap">
select id,label_name,sort_num,category_id,created_by,created_time,update_by,update_time,is_deleted
from subject_label
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryByCondition" resultMap="SubjectLabelMap">
select
id,label_name,sort_num,category_id,created_by,created_time,update_by,update_time,is_deleted
from subject_label
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="labelName != null and labelName != ''">
and label_name = #{labelName}
</if>
<if test="sortNum != null">
and sort_num = #{sortNum}
</if>
<if test="categoryId != null">
and category_id = #{categoryId}
</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="count" resultType="java.lang.Long">
select count(1)
from subject_label
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="labelName != null and labelName != ''">
and label_name = #{labelName}
</if>
<if test="sortNum != null">
and sort_num = #{sortNum}
</if>
<if test="categoryId != null">
and category_id = #{categoryId}
</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="batchQueryById" resultMap="SubjectLabelMap">
select
id,label_name,sort_num,category_id,created_by,created_time,update_by,update_time,is_deleted
from subject_label
where id in
<foreach open="(" close=")" collection="list" item="id" separator=",">
#{id}
</foreach>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into subject_label(label_name,sort_num,category_id,created_by,created_time,update_by,update_time,is_deleted)
values (#{labelName},#{sortNum},#{categoryId},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_label(label_name,sort_num,category_id,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.labelName},#{entity.sortNum},#{entity.categoryId},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_label(label_name,sort_num,category_id,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.labelName},#{entity.sortNum},#{entity.categoryId},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
label_name = values(label_name)sort_num = values(sort_num)category_id = values(category_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 subject_label
<set>
<if test="labelName != null and labelName != ''">
label_name = #{labelName},
</if>
<if test="sortNum != null">
sort_num = #{sortNum},
</if>
<if test="categoryId != null">
category_id = #{categoryId},
</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 subject_label
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,196 @@
<?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.subject.infra.basic.mapper.SubjectMappingDao">
<resultMap type="com.landaiqing.subject.infra.basic.entity.SubjectMapping" id="SubjectMappingMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="subjectId" column="subject_id" jdbcType="INTEGER"/>
<result property="categoryId" column="category_id" jdbcType="INTEGER"/>
<result property="labelId" column="label_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="SubjectMappingMap">
select id,subject_id,category_id,label_id,created_by,created_time,update_by,update_time,is_deleted
from subject_mapping
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SubjectMappingMap">
select
id,subject_id,category_id,label_id,created_by,created_time,update_by,update_time,is_deleted
from subject_mapping
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="categoryId != null">
and category_id = #{categoryId}
</if>
<if test="labelId != null">
and label_id = #{labelId}
</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 subject_mapping
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="categoryId != null">
and category_id = #{categoryId}
</if>
<if test="labelId != null">
and label_id = #{labelId}
</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="queryDistinctLabelId" resultMap="SubjectMappingMap">
select
distinct label_id
from subject_mapping
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="categoryId != null">
and category_id = #{categoryId}
</if>
<if test="labelId != null">
and label_id = #{labelId}
</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 subject_mapping(subject_id,category_id,label_id,created_by,created_time,update_by,update_time,is_deleted)
values (#{subjectId},#{categoryId},#{labelId},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_mapping(subject_id,category_id,label_id,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.categoryId},#{entity.labelId},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into subject_mapping(subject_id,category_id,label_id,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.categoryId},#{entity.labelId},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
subject_id = values(subject_id)category_id = values(category_id)label_id = values(label_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 subject_mapping
<set>
<if test="subjectId != null">
subject_id = #{subjectId},
</if>
<if test="categoryId != null">
category_id = #{categoryId},
</if>
<if test="labelId != null">
label_id = #{labelId},
</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 subject_mapping
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,174 @@
<?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.subject.infra.basic.mapper.SubjectMultipleDao">
<resultMap type="com.landaiqing.subject.infra.basic.entity.SubjectMultiple" id="SubjectMultipleMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="subjectId" column="subject_id" jdbcType="INTEGER"/>
<result property="optionType" column="option_type" jdbcType="INTEGER"/>
<result property="optionContent" column="option_content" jdbcType="VARCHAR"/>
<result property="isCorrect" column="is_correct" 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="SubjectMultipleMap">
select id,subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted
from subject_multiple
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SubjectMultipleMap">
select
id,subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted
from subject_multiple
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="optionType != null">
and option_type = #{optionType}
</if>
<if test="optionContent != null and optionContent != ''">
and option_content = #{optionContent}
</if>
<if test="isCorrect != null">
and is_correct = #{isCorrect}
</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="count" resultType="java.lang.Long">
select count(1)
from subject_multiple
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="optionType != null">
and option_type = #{optionType}
</if>
<if test="optionContent != null and optionContent != ''">
and option_content = #{optionContent}
</if>
<if test="isCorrect != null">
and is_correct = #{isCorrect}
</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 subject_multiple(subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values (#{subjectId},#{optionType},#{optionContent},#{isCorrect},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into
subject_multiple(subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.optionType},#{entity.optionContent},#{entity.isCorrect},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into
subject_multiple(subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.optionType},#{entity.optionContent},#{entity.isCorrect},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
subject_id = values(subject_id)option_type = values(option_type)option_content =
values(option_content)is_correct = values(is_correct)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 subject_multiple
<set>
<if test="subjectId != null">
subject_id = #{subjectId},
</if>
<if test="optionType != null">
option_type = #{optionType},
</if>
<if test="optionContent != null and optionContent != ''">
option_content = #{optionContent},
</if>
<if test="isCorrect != null">
is_correct = #{isCorrect},
</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 subject_multiple
where id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,174 @@
<?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.subject.infra.basic.mapper.SubjectRadioDao">
<resultMap type="com.landaiqing.subject.infra.basic.entity.SubjectRadio" id="SubjectRadioMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="subjectId" column="subject_id" jdbcType="INTEGER"/>
<result property="optionType" column="option_type" jdbcType="INTEGER"/>
<result property="optionContent" column="option_content" jdbcType="VARCHAR"/>
<result property="isCorrect" column="is_correct" 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="SubjectRadioMap">
select id,subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted
from subject_radio
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SubjectRadioMap">
select
id,subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted
from subject_radio
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="optionType != null">
and option_type = #{optionType}
</if>
<if test="optionContent != null and optionContent != ''">
and option_content = #{optionContent}
</if>
<if test="isCorrect != null">
and is_correct = #{isCorrect}
</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="count" resultType="java.lang.Long">
select count(1)
from subject_radio
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="subjectId != null">
and subject_id = #{subjectId}
</if>
<if test="optionType != null">
and option_type = #{optionType}
</if>
<if test="optionContent != null and optionContent != ''">
and option_content = #{optionContent}
</if>
<if test="isCorrect != null">
and is_correct = #{isCorrect}
</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 subject_radio(subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values (#{subjectId},#{optionType},#{optionContent},#{isCorrect},#{createdBy},#{createdTime},#{updateBy},#{updateTime},#{isDeleted})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into
subject_radio(subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.optionType},#{entity.optionContent},#{entity.isCorrect},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into
subject_radio(subject_id,option_type,option_content,is_correct,created_by,created_time,update_by,update_time,is_deleted)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.subjectId},#{entity.optionType},#{entity.optionContent},#{entity.isCorrect},#{entity.createdBy},#{entity.createdTime},#{entity.updateBy},#{entity.updateTime},#{entity.isDeleted})
</foreach>
on duplicate key update
subject_id = values(subject_id)option_type = values(option_type)option_content =
values(option_content)is_correct = values(is_correct)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 subject_radio
<set>
<if test="subjectId != null">
subject_id = #{subjectId},
</if>
<if test="optionType != null">
option_type = #{optionType},
</if>
<if test="optionContent != null and optionContent != ''">
option_content = #{optionContent},
</if>
<if test="isCorrect != null">
is_correct = #{isCorrect},
</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 subject_radio
where id = #{id}
</delete>
</mapper>