feat: 题目标签开发
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
package com.landaiqing.subject.application.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.landaiqing.subject.application.convert.SubjectLabelDTOConverter;
|
||||
import com.landaiqing.subject.application.dto.SubjectLabelDTO;
|
||||
import com.landaiqing.subject.common.entity.Result;
|
||||
import com.landaiqing.subject.domain.entity.SubjectLabelBO;
|
||||
import com.landaiqing.subject.domain.service.SubjectLabelDomainService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Classname SubjectLabelController
|
||||
* @BelongsProject: jc-club
|
||||
* @BelongsPackage: com.landaiqing.subject.application.controller
|
||||
* @Author: landaiqing
|
||||
* @CreateTime: 2024-02-14 17:03
|
||||
* @Description: 标签controller
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/subject/label")
|
||||
@Slf4j
|
||||
public class SubjectLabelController {
|
||||
@Resource
|
||||
private SubjectLabelDomainService subjectLabelDomainService;
|
||||
|
||||
/**
|
||||
* @description: 新增标签
|
||||
* @param: [subjectLabelDTO]
|
||||
* @return: com.landaiqing.subject.common.entity.Result<java.lang.Boolean>
|
||||
* @author landaiqing
|
||||
* @date: 2024/2/14 17:46
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result<Boolean> add(@RequestBody SubjectLabelDTO subjectLabelDTO) {
|
||||
|
||||
try {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("SubjectLabelController.add.dto:{}", JSON.toJSONString(subjectLabelDTO));
|
||||
}
|
||||
Preconditions.checkArgument(!StringUtils.isBlank(subjectLabelDTO.getLabelName()), "标签的名称不能为空!");
|
||||
SubjectLabelBO subjectLabelBO = SubjectLabelDTOConverter.INSTANCE.convertDtoToLabelBO(subjectLabelDTO);
|
||||
Boolean result = subjectLabelDomainService.add(subjectLabelBO);
|
||||
return Result.ok(result);
|
||||
} catch (Exception e) {
|
||||
log.error("SubjectLabelController.add.error:{}", e.getMessage(), e);
|
||||
return Result.fail("新增标签失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 更新标签
|
||||
* @param: [subjectLabelDTO]
|
||||
* @return: com.landaiqing.subject.common.entity.Result<java.lang.Boolean>
|
||||
* @author landaiqing
|
||||
* @date: 2024/2/14 17:53
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public Result<Boolean> update(@RequestBody SubjectLabelDTO subjectLabelDTO) {
|
||||
try {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("SubjectLabelController.update.dto:{}", JSON.toJSONString(subjectLabelDTO));
|
||||
}
|
||||
Preconditions.checkNotNull(subjectLabelDTO.getId(), "标签id不能为空");
|
||||
SubjectLabelBO subjectLabelBO = SubjectLabelDTOConverter.INSTANCE.convertDtoToLabelBO(subjectLabelDTO);
|
||||
Boolean result = subjectLabelDomainService.update(subjectLabelBO);
|
||||
return Result.ok(result);
|
||||
} catch (Exception e) {
|
||||
log.error("SubjectLabelController.update.error:{}", e.getMessage(), e);
|
||||
return Result.fail("更新标签失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 删除标签
|
||||
* @param: [subjectLabelDTO]
|
||||
* @return: com.landaiqing.subject.common.entity.Result<java.lang.Boolean>
|
||||
* @author landaiqing
|
||||
* @date: 2024/2/14 17:53
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public Result<Boolean> delete(@RequestBody SubjectLabelDTO subjectLabelDTO) {
|
||||
try {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("SubjectLabelController.delete.dto:{}", JSON.toJSONString(subjectLabelDTO));
|
||||
}
|
||||
Preconditions.checkNotNull(subjectLabelDTO.getId(), "标签id不能为空");
|
||||
SubjectLabelBO subjectLabelBO = SubjectLabelDTOConverter.INSTANCE.convertDtoToLabelBO(subjectLabelDTO);
|
||||
Boolean result = subjectLabelDomainService.delete(subjectLabelBO);
|
||||
return Result.ok(result);
|
||||
} catch (Exception e) {
|
||||
log.error("SubjectLabelController.delete.error:{}", e.getMessage(), e);
|
||||
return Result.fail("删除标签失败");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @description: 查询分类下的标签
|
||||
* @param: [subjectLabelDTO]
|
||||
* @return: com.landaiqing.subject.common.entity.Result<java.util.List<com.landaiqing.subject.application.dto.SubjectLabelDTO>>
|
||||
* @author landaiqing
|
||||
* @date: 2024/2/14 18:57
|
||||
*/
|
||||
@PostMapping("/queryLabelByCategoryId")
|
||||
public Result<List<SubjectLabelDTO>> queryLabelByCategoryId(@RequestBody SubjectLabelDTO subjectLabelDTO) {
|
||||
try {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("SubjectLabelController.queryLabelByCategoryId.dto:{}",
|
||||
JSON.toJSONString(subjectLabelDTO));
|
||||
}
|
||||
Preconditions.checkNotNull(subjectLabelDTO.getCategoryId(), "分类id不能为空");
|
||||
SubjectLabelBO subjectLabelBO = SubjectLabelDTOConverter.INSTANCE.convertDtoToLabelBO(subjectLabelDTO);
|
||||
List<SubjectLabelBO> resultList = subjectLabelDomainService.queryLabelByCategoryId(subjectLabelBO);
|
||||
List<SubjectLabelDTO> subjectLabelDTOS = SubjectLabelDTOConverter.INSTANCE.convertBOToLabelDTOList(resultList);
|
||||
return Result.ok(subjectLabelDTOS);
|
||||
} catch (Exception e) {
|
||||
log.error("SubjectLabelController.queryLabelByCategoryId.error:{}", e.getMessage(), e);
|
||||
return Result.fail("查询标签失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package com.landaiqing.subject.application.convert;
|
||||
|
||||
import com.landaiqing.subject.application.dto.SubjectLabelDTO;
|
||||
import com.landaiqing.subject.domain.entity.SubjectLabelBO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 标签dto转换器
|
||||
*
|
||||
* @author: landaiqing
|
||||
* @date: 2024/2/14
|
||||
*/
|
||||
@Mapper
|
||||
public interface SubjectLabelDTOConverter {
|
||||
SubjectLabelDTOConverter INSTANCE = Mappers.getMapper(SubjectLabelDTOConverter.class);
|
||||
|
||||
SubjectLabelBO convertDtoToLabelBO(SubjectLabelDTO subjectLabelDTO);
|
||||
|
||||
List<SubjectLabelDTO> convertBOToLabelDTOList(List<SubjectLabelBO> boList);
|
||||
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package com.landaiqing.subject.application.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 题目标签DTO
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-02-14 17:08:06
|
||||
*/
|
||||
@Data
|
||||
public class SubjectLabelDTO implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
private Long categoryId;
|
||||
/**
|
||||
* 标签分类
|
||||
*/
|
||||
private String labelName;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sortNum;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,19 @@
|
||||
package com.landaiqing.subject.domain.convert;
|
||||
|
||||
import com.landaiqing.subject.domain.entity.SubjectCategoryBO;
|
||||
import com.landaiqing.subject.domain.entity.SubjectLabelBO;
|
||||
import com.landaiqing.subject.infra.basic.entity.SubjectCategory;
|
||||
import com.landaiqing.subject.infra.basic.entity.SubjectLabel;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface SubjectLabelConverter {
|
||||
SubjectLabelConverter INSTANCE = Mappers.getMapper(SubjectLabelConverter.class);
|
||||
|
||||
SubjectLabel convertBoToLabel(SubjectLabelBO subjectLabelBO);
|
||||
List<SubjectLabelBO> convertLabelToBoList(List<SubjectLabel> subjectLabelList);
|
||||
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
package com.landaiqing.subject.domain.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 题目标签Bo
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-02-14 17:08:06
|
||||
*/
|
||||
@Data
|
||||
public class SubjectLabelBO implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
private Long categoryId;
|
||||
/**
|
||||
* 标签分类
|
||||
*/
|
||||
private String labelName;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sortNum;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,34 @@
|
||||
package com.landaiqing.subject.domain.service;
|
||||
|
||||
import com.landaiqing.subject.domain.entity.SubjectLabelBO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @description: 题目标签领域服务
|
||||
*
|
||||
* @author landaiqing
|
||||
* @date: 2024/2/14 17:22
|
||||
*/
|
||||
public interface SubjectLabelDomainService {
|
||||
/**
|
||||
* 新增标签
|
||||
*/
|
||||
Boolean add(SubjectLabelBO subjectLabelBO);
|
||||
|
||||
/**
|
||||
* 更新标签
|
||||
*/
|
||||
Boolean update(SubjectLabelBO subjectLabelBO);
|
||||
|
||||
/**
|
||||
* 删除标签
|
||||
*/
|
||||
Boolean delete(SubjectLabelBO subjectLabelBO);
|
||||
|
||||
/**
|
||||
* 查询分类下标签
|
||||
*/
|
||||
List<SubjectLabelBO> queryLabelByCategoryId(SubjectLabelBO subjectLabelBO);
|
||||
}
|
@@ -0,0 +1,114 @@
|
||||
package com.landaiqing.subject.domain.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.landaiqing.subject.common.enums.IsDeletedFlagEnum;
|
||||
import com.landaiqing.subject.domain.convert.SubjectLabelConverter;
|
||||
import com.landaiqing.subject.domain.entity.SubjectLabelBO;
|
||||
import com.landaiqing.subject.domain.service.SubjectLabelDomainService;
|
||||
import com.landaiqing.subject.infra.basic.entity.SubjectLabel;
|
||||
import com.landaiqing.subject.infra.basic.entity.SubjectMapping;
|
||||
import com.landaiqing.subject.infra.basic.service.SubjectLabelService;
|
||||
import com.landaiqing.subject.infra.basic.service.SubjectMappingService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SubjectLabelDomainServiceImpl implements SubjectLabelDomainService {
|
||||
@Resource
|
||||
private SubjectLabelService subjectLabelService;
|
||||
@Resource
|
||||
private SubjectMappingService subjectMappingService;
|
||||
|
||||
/**
|
||||
* @description: 新增标签
|
||||
* @param: [subjectLabelBO]
|
||||
* @return: java.lang.Boolean
|
||||
* @author landaiqing
|
||||
* @date: 2024/2/14 17:27
|
||||
*/
|
||||
@Override
|
||||
public Boolean add(SubjectLabelBO subjectLabelBO) {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("SubjectLabelDomainServiceImpl.add.bo:{}", JSON.toJSONString(subjectLabelBO));
|
||||
}
|
||||
SubjectLabel subjectLabel = SubjectLabelConverter.INSTANCE
|
||||
.convertBoToLabel(subjectLabelBO);
|
||||
subjectLabel.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
|
||||
int count = subjectLabelService.insert(subjectLabel);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 更新标签
|
||||
* @param: [subjectLabelBO]
|
||||
* @return: java.lang.Boolean
|
||||
* @author landaiqing
|
||||
* @date: 2024/2/14 18:33
|
||||
*/
|
||||
@Override
|
||||
public Boolean update(SubjectLabelBO subjectLabelBO) {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("SubjectLabelDomainServiceImpl.update.bo:{}", JSON.toJSONString(subjectLabelBO));
|
||||
}
|
||||
SubjectLabel subjectLabel = SubjectLabelConverter.INSTANCE
|
||||
.convertBoToLabel(subjectLabelBO);
|
||||
int count = subjectLabelService.update(subjectLabel);
|
||||
return count > 0;
|
||||
}
|
||||
/**
|
||||
* @description: 删除标签
|
||||
* @param: [subjectLabelBO]
|
||||
* @return: java.lang.Boolean
|
||||
* @author landaiqing
|
||||
* @date: 2024/2/14 18:58
|
||||
*/
|
||||
@Override
|
||||
public Boolean delete(SubjectLabelBO subjectLabelBO) {
|
||||
if (log.isInfoEnabled()) {
|
||||
log.info("SubjectLabelDomainServiceImpl.update.bo:{}", JSON.toJSONString(subjectLabelBO));
|
||||
}
|
||||
SubjectLabel subjectLabel = SubjectLabelConverter.INSTANCE
|
||||
.convertBoToLabel(subjectLabelBO);
|
||||
subjectLabel.setIsDeleted(IsDeletedFlagEnum.DELETED.getCode());
|
||||
int count = subjectLabelService.update(subjectLabel);
|
||||
return count > 0;
|
||||
}
|
||||
/**
|
||||
* @description: 查询分类下的标签
|
||||
* @param: [subjectLabelBO]
|
||||
* @return: java.util.List<com.landaiqing.subject.domain.entity.SubjectLabelBO>
|
||||
* @author landaiqing
|
||||
* @date: 2024/2/14 19:08
|
||||
*/
|
||||
@Override
|
||||
public List<SubjectLabelBO> queryLabelByCategoryId(SubjectLabelBO subjectLabelBO) {
|
||||
Long categoryId = subjectLabelBO.getCategoryId();
|
||||
SubjectMapping subjectMapping=new SubjectMapping();
|
||||
subjectMapping.setCategoryId(categoryId);
|
||||
subjectMapping.setIsDeleted(IsDeletedFlagEnum.UN_DELETED.getCode());
|
||||
List<SubjectMapping> mappingList= subjectMappingService.queryLabelId(subjectMapping);
|
||||
if(CollectionUtils.isEmpty(mappingList)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<Long> labelIdList = mappingList.stream().map(SubjectMapping::getLabelId).collect(Collectors.toList());
|
||||
List<SubjectLabel> labelList= subjectLabelService.batchQueryById(labelIdList);
|
||||
List<SubjectLabelBO> boList=new LinkedList<>();
|
||||
labelList.forEach(label->{
|
||||
SubjectLabelBO bo=new SubjectLabelBO();
|
||||
bo.setId(label.getId());
|
||||
bo.setLabelName(label.getLabelName());
|
||||
bo.setCategoryId(categoryId);
|
||||
bo.setSortNum(label.getSortNum());
|
||||
boList.add(bo);
|
||||
});
|
||||
return boList;
|
||||
}
|
||||
}
|
@@ -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