feat: 题目标签开发
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
package com.landaiqing.subject.infra.basic.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 题目信息表(SubjectInfo)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-02-14 16:59:04
|
||||
*/
|
||||
@Data
|
||||
public class SubjectInfo implements Serializable {
|
||||
private static final long serialVersionUID = 969950536946065645L;
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
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;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,51 @@
|
||||
package com.landaiqing.subject.infra.basic.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 题目标签表(SubjectLabel)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @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;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,123 @@
|
||||
package com.landaiqing.subject.infra.basic.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 题目分类关系表(SubjectMapping)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,82 @@
|
||||
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 makejava
|
||||
* @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);
|
||||
|
||||
}
|
||||
|
@@ -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 makejava
|
||||
* @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> queryAllByLimit(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);
|
||||
}
|
||||
|
@@ -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 makejava
|
||||
* @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);
|
||||
}
|
||||
|
@@ -0,0 +1,46 @@
|
||||
package com.landaiqing.subject.infra.basic.service;
|
||||
|
||||
import com.landaiqing.subject.infra.basic.entity.SubjectInfo;
|
||||
|
||||
/**
|
||||
* 题目信息表(SubjectInfo)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @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);
|
||||
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
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 makejava
|
||||
* @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);
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
package com.landaiqing.subject.infra.basic.service;
|
||||
|
||||
import com.landaiqing.subject.infra.basic.entity.SubjectMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 题目分类关系表(SubjectMapping)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @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);
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 题目信息表(SubjectInfo)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
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 makejava
|
||||
* @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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,79 @@
|
||||
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 makejava
|
||||
* @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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,189 @@
|
||||
<?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>
|
||||
|
||||
<!--新增所有列-->
|
||||
<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})
|
||||
</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>
|
||||
|
@@ -0,0 +1,171 @@
|
||||
<?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="queryAllByLimit" 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>
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</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>
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user