feat: 题目模块开发
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
@@ -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;
|
||||
}
|
||||
|
||||
}
|
@@ -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) {
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,49 @@
|
||||
package com.landaiqing.subject.infra.basic.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 简答题(SubjectBrief)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @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;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -13,7 +13,6 @@ import java.io.Serializable;
|
||||
*/
|
||||
@Data
|
||||
public class SubjectInfo implements Serializable {
|
||||
private static final long serialVersionUID = 969950536946065645L;
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
|
@@ -0,0 +1,49 @@
|
||||
package com.landaiqing.subject.infra.basic.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 判断题(SubjectJudge)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @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;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,57 @@
|
||||
package com.landaiqing.subject.infra.basic.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 多选题信息表(SubjectMultiple)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @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;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,56 @@
|
||||
package com.landaiqing.subject.infra.basic.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 单选题信息表(SubjectRadio)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @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;
|
||||
|
||||
}
|
||||
|
@@ -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 makejava
|
||||
* @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);
|
||||
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ 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;
|
||||
|
||||
/**
|
||||
@@ -78,5 +79,14 @@ public interface SubjectInfoDao {
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
|
@@ -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 makejava
|
||||
* @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);
|
||||
|
||||
}
|
||||
|
@@ -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 makejava
|
||||
* @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);
|
||||
|
||||
}
|
||||
|
@@ -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 makejava
|
||||
* @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);
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,50 @@
|
||||
package com.landaiqing.subject.infra.basic.service;
|
||||
|
||||
import com.landaiqing.subject.infra.basic.entity.SubjectBrief;
|
||||
|
||||
|
||||
/**
|
||||
* 简答题(SubjectBrief)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @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);
|
||||
}
|
@@ -2,6 +2,8 @@ package com.landaiqing.subject.infra.basic.service;
|
||||
|
||||
import com.landaiqing.subject.infra.basic.entity.SubjectInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 题目信息表(SubjectInfo)表服务接口
|
||||
*
|
||||
@@ -43,4 +45,7 @@ public interface SubjectInfoService {
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
@@ -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 makejava
|
||||
* @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);
|
||||
}
|
@@ -22,7 +22,6 @@ public interface SubjectMappingService {
|
||||
SubjectMapping queryById(Long id);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
@@ -46,12 +45,22 @@ public interface SubjectMappingService {
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Long id);
|
||||
/**
|
||||
* @description: 查询分类下的标签
|
||||
* @param: [subjectMapping]
|
||||
* @return: java.util.List<com.landaiqing.subject.infra.basic.entity.SubjectMapping>
|
||||
|
||||
/**
|
||||
* @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);
|
||||
}
|
||||
|
@@ -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 makejava
|
||||
* @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);
|
||||
}
|
@@ -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 makejava
|
||||
* @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);
|
||||
}
|
@@ -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 makejava
|
||||
* @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);
|
||||
}
|
||||
}
|
@@ -6,6 +6,7 @@ import com.landaiqing.subject.infra.basic.service.SubjectInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 题目信息表(SubjectInfo)表服务实现类
|
||||
@@ -65,4 +66,14 @@ public class SubjectInfoServiceImpl implements SubjectInfoService {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@@ -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 makejava
|
||||
* @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);
|
||||
}
|
||||
}
|
@@ -65,6 +65,7 @@ public class SubjectMappingServiceImpl implements SubjectMappingService {
|
||||
public boolean deleteById(Long id) {
|
||||
return this.subjectMappingDao.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询分类下的标签
|
||||
* @param: [subjectMapping]
|
||||
@@ -76,4 +77,9 @@ public class SubjectMappingServiceImpl implements SubjectMappingService {
|
||||
public List<SubjectMapping> queryLabelId(SubjectMapping subjectMapping) {
|
||||
return this.subjectMappingDao.queryDistinctLabelId(subjectMapping);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchInsert(List<SubjectMapping> mappingList) {
|
||||
this.subjectMappingDao.insertBatch(mappingList);
|
||||
}
|
||||
}
|
||||
|
@@ -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 makejava
|
||||
* @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);
|
||||
}
|
||||
}
|
@@ -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 makejava
|
||||
* @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);
|
||||
}
|
||||
}
|
@@ -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>
|
||||
|
@@ -19,8 +19,18 @@
|
||||
|
||||
<!--查询单个-->
|
||||
<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
|
||||
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>
|
||||
@@ -114,29 +124,83 @@ id,subject_name,subject_difficult,settle_name,subject_type,subject_score,subject
|
||||
</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">
|
||||
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})
|
||||
<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)
|
||||
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})
|
||||
(#{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)
|
||||
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)
|
||||
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>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
@@ -182,7 +246,9 @@ subject_name = values(subject_name)subject_difficult = values(subject_difficult)
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete from subject_info where id = #{id}
|
||||
delete
|
||||
from subject_info
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
@@ -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>
|
||||
|
@@ -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>
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user