新增三方接口

master
xiaoCJ 8 months ago
parent 6b35c97fb0
commit dfcb513a1b

@ -4,10 +4,12 @@ import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sztzjy.resource_center.annotation.AnonymousAccess;
import com.sztzjy.resource_center.entity.SysCaseQuestionExample;
import com.sztzjy.resource_center.entity.SysResource;
import com.sztzjy.resource_center.entity.SysResourceAndCourse;
import com.sztzjy.resource_center.entity.SysResourceAndCourseExample;
import com.sztzjy.resource_center.entity.dto.SysResourceDto;
import com.sztzjy.resource_center.mapper.SysCaseQuestionMapper;
import com.sztzjy.resource_center.mapper.SysResourceAndCourseMapper;
import com.sztzjy.resource_center.mapper.SysResourceMapper;
import com.sztzjy.resource_center.util.ResultEntity;
@ -38,6 +40,8 @@ public class CourseConfigController {
@Autowired
private SysResourceAndCourseMapper sysResourceAndCourseMapper;
@Autowired
private SysCaseQuestionMapper sysCaseQuestionMapper;
@Autowired
private IFileUtil fileUtil;
@AnonymousAccess
@ -137,9 +141,21 @@ public class CourseConfigController {
@AnonymousAccess
@ApiOperation("课程配置删除资源") //只删除绑定关系
@PostMapping("deleteResource")
public ResultEntity<String> deleteResource(@RequestParam String id) {
public ResultEntity<String> deleteResource(@RequestParam String id,
@RequestParam(required = false) String oneId,
@RequestParam(required = false) String twoId,
@RequestParam(required = false) String threeId) {
SysResourceAndCourseExample example = new SysResourceAndCourseExample();
example.createCriteria().andResourceIdEqualTo(id);
SysResourceAndCourseExample.Criteria criteria = example.createCriteria().andResourceIdEqualTo(id);
if (StringUtils.isNotBlank(oneId)) {
criteria.andOneIdEqualTo(oneId);
}
if (StringUtils.isNotBlank(twoId)) {
criteria.andTwoIdEqualTo(twoId);
}
if (StringUtils.isNotBlank(threeId)) {
criteria.andThreeIdEqualTo(threeId);
}
try {
sysResourceAndCourseMapper.deleteByExample(example);
} catch (Exception e) {

@ -89,9 +89,22 @@ public class KnowledgeSummaryController {
@AnonymousAccess
@ApiOperation("知识概要删除绑定关系")
@PostMapping("deleteKnowledgeSummaryBind")
public ResultEntity<String> deleteKnowledgeSummaryBind(@RequestParam String id) {
public ResultEntity<String> deleteKnowledgeSummaryBind(@RequestParam String id,
@RequestParam(required = false) String oneId,
@RequestParam(required = false) String twoId,
@RequestParam(required = false) String threeId) {
SysKnowledgeAndCourseExample example = new SysKnowledgeAndCourseExample();
example.createCriteria().andKnowledgeSummaryIdEqualTo(id);
SysKnowledgeAndCourseExample.Criteria criteria = example.createCriteria();
criteria.andKnowledgeSummaryIdEqualTo(id);
if (StringUtils.isNotBlank(oneId)) {
criteria.andOneIdEqualTo(oneId);
}
if (StringUtils.isNotBlank(twoId)) {
criteria.andTwoIdEqualTo(twoId);
}
if (StringUtils.isNotBlank(threeId)) {
criteria.andThreeIdEqualTo(threeId);
}
List<SysKnowledgeAndCourse> sysKnowledgeAndCourses = knowledgeAndCourseMapper.selectByExample(example);
if (sysKnowledgeAndCourses == null || sysKnowledgeAndCourses.isEmpty()) {
return new ResultEntity<>(HttpStatus.INTERNAL_SERVER_ERROR, "该知识概要暂无绑定关系!");

@ -69,12 +69,12 @@ public class TopicResourceController {
if (StringUtils.isBlank(objectiveQuestion.getOneID())) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "所属课程不能为空!");
}
if (objectiveQuestion.getType().equals("1") || objectiveQuestion.getType().equals("2")) {
if (objectiveQuestion.getType().equals("1") || objectiveQuestion.getType().equals("0")) {
if (StringUtils.isBlank(objectiveQuestion.getQuestionA()) || StringUtils.isBlank(objectiveQuestion.getQuestionB())
|| StringUtils.isBlank(objectiveQuestion.getQuestionC()) || StringUtils.isBlank(objectiveQuestion.getQuestionD()))
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "选择题至少有四个选项!");
}
if (objectiveQuestion.getType().equals("1")) {
if (objectiveQuestion.getType().equals("2")) {
if (StringUtils.isBlank(objectiveQuestion.getQuestionA()) || StringUtils.isBlank(objectiveQuestion.getQuestionB()))
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "判断题必须有两个选项!");
}
@ -140,7 +140,7 @@ public class TopicResourceController {
try {
sysTopicAndCourseMapper.batchInsert(list);
} catch (Exception e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "删除失败,请联系管理员!");
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "导入失败,请联系管理员!");
}
return new ResultEntity<>(HttpStatus.OK, "添加成功!");
}

@ -9,13 +9,11 @@ import com.sztzjy.resource_center.mapper.SysCaseQuestionMapper;
import com.sztzjy.resource_center.mapper.SysCaseQuestionStepMapper;
import com.sztzjy.resource_center.mapper.SysOneCatalogMapper;
import com.sztzjy.resource_center.mapper.SysTopicAndCourseMapper;
import com.sztzjy.resource_center.util.ResultEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
@ -24,7 +22,7 @@ import java.util.UUID;
@RestController
@Api(tags = "课程方面API")
@RequestMapping("api/sys/CaseApi")
@RequestMapping("api/tea/CaseApi")
public class CaseApi {
@Autowired
@ -44,7 +42,7 @@ public class CaseApi {
if (("3").equals(sysCaseQuestion.getType())) {
return false;
}
if (StringUtils.isBlank(sysCaseQuestion.getOneId())) { //todo 目前二级三级ID可以为空
if (StringUtils.isBlank(sysCaseQuestion.getOneName())) { //todo 目前二级三级ID可以为空
return false;
}
if (StringUtils.isBlank(sysCaseQuestion.getContent()) || StringUtils.isBlank(sysCaseQuestion.getTitle())) {
@ -71,10 +69,10 @@ public class CaseApi {
sysTopicAndCourse.setId(IdUtil.randomUUID());
sysTopicAndCourse.setTopicType("1");
sysTopicAndCourse.setTopicId(uuid);
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(sysCaseQuestion.getOneId()); //name放在ID传过来
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(sysCaseQuestion.getOneName());
String oneId = sysOneCatalogs.getOneId();
sysTopicAndCourse.setOneId(oneId);
sysTopicAndCourse.setOneName(sysCaseQuestion.getOneId());
sysTopicAndCourse.setOneName(sysCaseQuestion.getOneName());
if (StringUtils.isNotBlank(sysCaseQuestion.getTwoId())) {
sysTopicAndCourse.setTwoId(sysCaseQuestion.getTwoId());
}
@ -95,53 +93,49 @@ public class CaseApi {
//案例题列表查询 schoolId keyword index size systemOwner
@AnonymousAccess
@ApiOperation("案例题页面查询")
@PostMapping("selectCaseByConditions")
public ResultEntity<PageInfo<SysCaseQuestion>> selectCaseByConditions(@RequestParam Integer index,
@RequestParam Integer size,
@RequestParam(required = false) String keyword,
@RequestParam(required = false) String systemOwner,
@RequestParam(required = false) String schoolId) {
@PostMapping("selectCaseList")
public PageInfo<SysCaseQuestion> selectCaseByConditions(@RequestParam Integer index,
@RequestParam Integer size,
@RequestParam(required = false) String keyword,
@RequestParam(required = false) String systemOwner,
@RequestParam(required = false) String schoolId) {
PageHelper.startPage(index, size);
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
String oneId = sysOneCatalogs.getOneId();
List<SysCaseQuestion> list = caseQuestionMapper.selectCaseByConditions(keyword, oneId, schoolId);
PageInfo pageInfo = new PageInfo<SysCaseQuestion>(list);
return new ResultEntity<PageInfo<SysCaseQuestion>>(pageInfo);
PageInfo<SysCaseQuestion> pageInfo = new PageInfo<SysCaseQuestion>(list);
return pageInfo;
}
//案例题详情查询 caseId
@AnonymousAccess
@ApiOperation("案例题详细内容展示")
@PostMapping("selectCaseByConditionsByID")
public ResultEntity<SysCaseQuestion> selectCaseByConditionsByID(@RequestParam String caseId) {
SysCaseQuestion sysCaseQuestion = caseQuestionMapper.selectByPrimaryKey(caseId);
return new ResultEntity<SysCaseQuestion>(sysCaseQuestion);
@PostMapping("selectCaseDetails")
public SysCaseQuestion selectCaseByConditionsByID(@RequestParam String caseId) {
return caseQuestionMapper.selectByPrimaryKey(caseId);
}
//案例题删除 caseId
@AnonymousAccess
@ApiOperation("案例题删除") //逻辑删除
@PostMapping("deleteCase")
@PostMapping("caseDelete")
public Boolean deleteCase(@RequestParam String caseId) {
List<SysTopicAndCourse> sysTopicAndCourses = getSysTopicAndCourses(caseId);
if (!sysTopicAndCourses.isEmpty()) {
return false;
SysCaseQuestion sysCaseQuestion = caseQuestionMapper.selectByPrimaryKey(caseId);
String source = sysCaseQuestion.getSource();
//todo 管理员任意删除 老师只能删除自己上传的
if (!"管理员".equals(source)) {
SysCaseQuestion dataSysCaseQuestion = caseQuestionMapper.selectByPrimaryKey(sysCaseQuestion.getCaseId());
dataSysCaseQuestion.setUnmountStatus(true);
caseQuestionMapper.updateByPrimaryKey(dataSysCaseQuestion);
return true;
} else {
SysCaseQuestion sysCaseQuestion = caseQuestionMapper.selectByPrimaryKey(caseId);
String source = sysCaseQuestion.getSource();
//todo 管理员任意删除 老师只能删除自己上传的
if (!"管理员".equals(source)) {
SysCaseQuestion dataSysCaseQuestion = caseQuestionMapper.selectByPrimaryKey(sysCaseQuestion.getCaseId());
dataSysCaseQuestion.setUnmountStatus(true);
caseQuestionMapper.updateByPrimaryKey(dataSysCaseQuestion);
return true;
} else {
return false;
}
return false;
}
}
private List<SysTopicAndCourse> getSysTopicAndCourses(String caseId) {
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
example.createCriteria().andTopicIdEqualTo(caseId).andTopicTypeEqualTo("1");
@ -168,20 +162,19 @@ public class CaseApi {
//案例题步骤信息查询 caseId
@AnonymousAccess
@ApiOperation("案例步骤展示")
@PostMapping("selectCaseStep")
public ResultEntity<List<SysCaseQuestionStepWithBLOBs>> selectCaseStep(@ApiParam("案例题ID") @RequestParam String caseId) {
@PostMapping("selectCaseStepDetailByCaseId")
public List<SysCaseQuestionStepWithBLOBs> selectCaseStep(@ApiParam("案例题ID") @RequestParam String caseId) {
SysCaseQuestionStepExample example = new SysCaseQuestionStepExample();
example.createCriteria().andCaseIdEqualTo(caseId);
example.setOrderByClause("sort ASC");
List<SysCaseQuestionStepWithBLOBs> stepList = caseQuestionStepMapper.selectByExampleWithBLOBs(example);
return new ResultEntity<>(stepList);
return caseQuestionStepMapper.selectByExampleWithBLOBs(example);
}
//案例题步骤新增 SysCaseQuestionStep
@AnonymousAccess
@ApiOperation("案例题添加步骤")
@PostMapping("insertCaseStepByCaseId")
@PostMapping("insertCaseStep")
public Boolean insertCaseStepByCaseId(@RequestBody SysCaseQuestionStepWithBLOBs caseQuestionStep) {
if (caseQuestionStep.getCaseId().isEmpty()) {
return false;
@ -233,9 +226,8 @@ public class CaseApi {
//案例题步骤内容查看 caseStepId
@PostMapping("selectCaseStepDetails")
@ApiOperation("案例题步骤内容查看")
public ResultEntity<SysCaseQuestionStep> selectCaseStepDetails(@ApiParam("案例题步骤ID") @RequestParam String caseStepId) {
SysCaseQuestionStep sysCaseQuestionStep = caseQuestionStepMapper.selectByPrimaryKey(caseStepId);
return new ResultEntity<>(HttpStatus.OK, "案例题步骤内容查看成功", sysCaseQuestionStep);
public SysCaseQuestionStep selectCaseStepDetails(@ApiParam("案例题步骤ID") @RequestParam String caseStepId) {
return caseQuestionStepMapper.selectByPrimaryKey(caseStepId);
}
}

@ -19,6 +19,9 @@ public class SysCaseQuestionStepWithBLOBs extends SysCaseQuestionStep {
@ApiModelProperty("步骤答案")
private String answer;
@ApiModelProperty("练习答案")
private String practiceAnswer;
@ApiModelProperty("内容原始数据")
private String contentOriginal;
@ -28,6 +31,9 @@ public class SysCaseQuestionStepWithBLOBs extends SysCaseQuestionStep {
@ApiModelProperty("答案原始数据")
private String answerOriginal;
@ApiModelProperty("练习答案原始数据")
private String practiceAnswerOriginal;
public String getTitle() {
return title;
}
@ -60,6 +66,14 @@ public class SysCaseQuestionStepWithBLOBs extends SysCaseQuestionStep {
this.answer = answer == null ? null : answer.trim();
}
public String getPracticeAnswer() {
return practiceAnswer;
}
public void setPracticeAnswer(String practiceAnswer) {
this.practiceAnswer = practiceAnswer == null ? null : practiceAnswer.trim();
}
public String getContentOriginal() {
return contentOriginal;
}
@ -83,4 +97,12 @@ public class SysCaseQuestionStepWithBLOBs extends SysCaseQuestionStep {
public void setAnswerOriginal(String answerOriginal) {
this.answerOriginal = answerOriginal == null ? null : answerOriginal.trim();
}
public String getPracticeAnswerOriginal() {
return practiceAnswerOriginal;
}
public void setPracticeAnswerOriginal(String practiceAnswerOriginal) {
this.practiceAnswerOriginal = practiceAnswerOriginal == null ? null : practiceAnswerOriginal.trim();
}
}

@ -1,11 +1,14 @@
package com.sztzjy.resource_center.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
*
* @author xcj
* sys_topic_and_course
*/
@Data
public class SysTopicAndCourse {
private String id;

@ -41,13 +41,13 @@
</javaClientGenerator>
<!-- 需要生成的表 -->
<!-- <table tableName="sys_case_questions" domainObjectName="SysCaseQuestion" />-->
<!-- <table tableName="sys_case_question_steps" domainObjectName="SysCaseQuestionStep" />-->
<table tableName="sys_case_question_steps" domainObjectName="SysCaseQuestionStep" />
<!-- <table tableName="sys_model" domainObjectName="SysModel" />-->
<!-- <table tableName="sys_model_question" domainObjectName="SysModelQuestion" />-->
<!-- <table tableName="sys_objective_questions" domainObjectName="SysObjectiveQuestions" />-->
<!-- <table tableName="sys_one_catalog" domainObjectName="SysOneCatalog" />-->
<!-- <table tableName="sys_resource" domainObjectName="SysResource" />-->
<table tableName="sys_resource_and_course" domainObjectName="SysResourceAndCourse" />
<!-- <table tableName="sys_resource_and_course" domainObjectName="SysResourceAndCourse" />-->
<!-- <table tableName="sys_resource_data" domainObjectName="SysResourceData" />-->
<!-- <table tableName="sys_school" domainObjectName="SysSchool" />-->
<!-- <table tableName="sys_three_catalog" domainObjectName="SysThreeCatalog" />-->

@ -12,9 +12,11 @@
<result column="content" jdbcType="LONGVARCHAR" property="content" />
<result column="question" jdbcType="LONGVARCHAR" property="question" />
<result column="answer" jdbcType="LONGVARCHAR" property="answer" />
<result column="practice_answer" jdbcType="LONGVARCHAR" property="practiceAnswer" />
<result column="content_original" jdbcType="LONGVARCHAR" property="contentOriginal" />
<result column="question_original" jdbcType="LONGVARCHAR" property="questionOriginal" />
<result column="answer_original" jdbcType="LONGVARCHAR" property="answerOriginal" />
<result column="practice_answer_original" jdbcType="LONGVARCHAR" property="practiceAnswerOriginal" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -78,7 +80,8 @@
case_step_id, case_id, sort, score
</sql>
<sql id="Blob_Column_List">
title, content, question, answer, content_original, question_original, answer_original
title, content, question, answer, practice_answer, content_original, question_original,
answer_original, practice_answer_original
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.sztzjy.resource_center.entity.SysCaseQuestionStepExample" resultMap="ResultMapWithBLOBs">
select
@ -131,13 +134,15 @@
<insert id="insert" parameterType="com.sztzjy.resource_center.entity.SysCaseQuestionStepWithBLOBs">
insert into sys_case_question_steps (case_step_id, case_id, sort,
score, title, content,
question, answer, content_original,
question_original, answer_original
question, answer, practice_answer,
content_original, question_original,
answer_original, practice_answer_original
)
values (#{caseStepId,jdbcType=VARCHAR}, #{caseId,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER},
#{score,jdbcType=DECIMAL}, #{title,jdbcType=LONGVARCHAR}, #{content,jdbcType=LONGVARCHAR},
#{question,jdbcType=LONGVARCHAR}, #{answer,jdbcType=LONGVARCHAR}, #{contentOriginal,jdbcType=LONGVARCHAR},
#{questionOriginal,jdbcType=LONGVARCHAR}, #{answerOriginal,jdbcType=LONGVARCHAR}
#{question,jdbcType=LONGVARCHAR}, #{answer,jdbcType=LONGVARCHAR}, #{practiceAnswer,jdbcType=LONGVARCHAR},
#{contentOriginal,jdbcType=LONGVARCHAR}, #{questionOriginal,jdbcType=LONGVARCHAR},
#{answerOriginal,jdbcType=LONGVARCHAR}, #{practiceAnswerOriginal,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.resource_center.entity.SysCaseQuestionStepWithBLOBs">
@ -167,6 +172,9 @@
<if test="answer != null">
answer,
</if>
<if test="practiceAnswer != null">
practice_answer,
</if>
<if test="contentOriginal != null">
content_original,
</if>
@ -176,6 +184,9 @@
<if test="answerOriginal != null">
answer_original,
</if>
<if test="practiceAnswerOriginal != null">
practice_answer_original,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="caseStepId != null">
@ -202,6 +213,9 @@
<if test="answer != null">
#{answer,jdbcType=LONGVARCHAR},
</if>
<if test="practiceAnswer != null">
#{practiceAnswer,jdbcType=LONGVARCHAR},
</if>
<if test="contentOriginal != null">
#{contentOriginal,jdbcType=LONGVARCHAR},
</if>
@ -211,6 +225,9 @@
<if test="answerOriginal != null">
#{answerOriginal,jdbcType=LONGVARCHAR},
</if>
<if test="practiceAnswerOriginal != null">
#{practiceAnswerOriginal,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.resource_center.entity.SysCaseQuestionStepExample" resultType="java.lang.Long">
@ -246,6 +263,9 @@
<if test="record.answer != null">
answer = #{record.answer,jdbcType=LONGVARCHAR},
</if>
<if test="record.practiceAnswer != null">
practice_answer = #{record.practiceAnswer,jdbcType=LONGVARCHAR},
</if>
<if test="record.contentOriginal != null">
content_original = #{record.contentOriginal,jdbcType=LONGVARCHAR},
</if>
@ -255,6 +275,9 @@
<if test="record.answerOriginal != null">
answer_original = #{record.answerOriginal,jdbcType=LONGVARCHAR},
</if>
<if test="record.practiceAnswerOriginal != null">
practice_answer_original = #{record.practiceAnswerOriginal,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -270,9 +293,11 @@
content = #{record.content,jdbcType=LONGVARCHAR},
question = #{record.question,jdbcType=LONGVARCHAR},
answer = #{record.answer,jdbcType=LONGVARCHAR},
practice_answer = #{record.practiceAnswer,jdbcType=LONGVARCHAR},
content_original = #{record.contentOriginal,jdbcType=LONGVARCHAR},
question_original = #{record.questionOriginal,jdbcType=LONGVARCHAR},
answer_original = #{record.answerOriginal,jdbcType=LONGVARCHAR}
answer_original = #{record.answerOriginal,jdbcType=LONGVARCHAR},
practice_answer_original = #{record.practiceAnswerOriginal,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -311,6 +336,9 @@
<if test="answer != null">
answer = #{answer,jdbcType=LONGVARCHAR},
</if>
<if test="practiceAnswer != null">
practice_answer = #{practiceAnswer,jdbcType=LONGVARCHAR},
</if>
<if test="contentOriginal != null">
content_original = #{contentOriginal,jdbcType=LONGVARCHAR},
</if>
@ -320,6 +348,9 @@
<if test="answerOriginal != null">
answer_original = #{answerOriginal,jdbcType=LONGVARCHAR},
</if>
<if test="practiceAnswerOriginal != null">
practice_answer_original = #{practiceAnswerOriginal,jdbcType=LONGVARCHAR},
</if>
</set>
where case_step_id = #{caseStepId,jdbcType=VARCHAR}
</update>
@ -332,9 +363,11 @@
content = #{content,jdbcType=LONGVARCHAR},
question = #{question,jdbcType=LONGVARCHAR},
answer = #{answer,jdbcType=LONGVARCHAR},
practice_answer = #{practiceAnswer,jdbcType=LONGVARCHAR},
content_original = #{contentOriginal,jdbcType=LONGVARCHAR},
question_original = #{questionOriginal,jdbcType=LONGVARCHAR},
answer_original = #{answerOriginal,jdbcType=LONGVARCHAR}
answer_original = #{answerOriginal,jdbcType=LONGVARCHAR},
practice_answer_original = #{practiceAnswerOriginal,jdbcType=LONGVARCHAR}
where case_step_id = #{caseStepId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.resource_center.entity.SysCaseQuestionStep">

@ -273,7 +273,7 @@
<!-- 批量新增 -->
<insert id="batchInsert" parameterType="java.util.List">
INSERT INTO sys_resource_and_course (id, resource_id, one_id, two_id, three_id)
INSERT INTO sys_resource_and_course (id, resource_id, one_id, two_id, three_id,one_name,two_name,three_name)
VALUES
<foreach collection="resourceAndCourses" item="resourceAndCourse" separator=",">
(
@ -281,7 +281,10 @@
#{resourceAndCourse.resourceId},
#{resourceAndCourse.oneId},
#{resourceAndCourse.twoId},
#{resourceAndCourse.threeId}
#{resourceAndCourse.threeId},
#{resourceAndCourse.oneName},
#{resourceAndCourse.twoName},
#{resourceAndCourse.threeName}
)
</foreach>
</insert>

@ -374,11 +374,11 @@
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
</resultMap>
<!--重复 join-->
<!--重复-->
<select id="selectResourceByRepeat" parameterType="java.lang.String" resultMap="DtoMap">
SELECT sc.*,sr.resource_name,sr.url,sr.picture_url,sr.resource_type,sr.source,sr.status,sr.create_time
SELECT sc.one_id,sc.two_id,sc.three_id,sc.one_name,sc.two_name,sc.three_name,sr.resource_name,sr.resource_id,sr.url,sr.picture_url,sr.resource_type,sr.source,sr.status,sr.create_time
FROM sys_resource sr
JOIN
left JOIN
sys_resource_and_course sc
on sr.resource_id =sc.resource_id
<where>
@ -398,9 +398,9 @@
order by sr.create_time
</select>
<!--不重复 leftjoin-->
<!--不重复-->
<select id="selectResource" parameterType="java.lang.String" resultMap="DtoMap">
SELECT sc.*,sr.resource_name,sr.url,sr.picture_url,sr.resource_type,sr.source,sr.status,sr.create_time
SELECT DISTINCT sc.one_id,sc.two_id,sc.three_id,sc.one_name,sc.two_name,sc.three_name,sr.resource_name,sr.resource_id,sr.url,sr.picture_url,sr.resource_type,sr.source,sr.status,sr.create_time
FROM sys_resource sr
left JOIN
sys_resource_and_course sc

@ -1,293 +1,298 @@
<?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.sztzjy.resource_center.mapper.SysTopicAndCourseMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.resource_center.entity.SysTopicAndCourse">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="topic_id" jdbcType="VARCHAR" property="topicId" />
<result column="one_id" jdbcType="VARCHAR" property="oneId" />
<result column="one_name" jdbcType="VARCHAR" property="oneName" />
<result column="two_id" jdbcType="VARCHAR" property="twoId" />
<result column="two_name" jdbcType="VARCHAR" property="twoName" />
<result column="three_id" jdbcType="VARCHAR" property="threeId" />
<result column="three_name" jdbcType="VARCHAR" property="threeName" />
<result column="topic_type" jdbcType="VARCHAR" property="topicType" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
<resultMap id="BaseResultMap" type="com.sztzjy.resource_center.entity.SysTopicAndCourse">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="topic_id" jdbcType="VARCHAR" property="topicId"/>
<result column="one_id" jdbcType="VARCHAR" property="oneId"/>
<result column="one_name" jdbcType="VARCHAR" property="oneName"/>
<result column="two_id" jdbcType="VARCHAR" property="twoId"/>
<result column="two_name" jdbcType="VARCHAR" property="twoName"/>
<result column="three_id" jdbcType="VARCHAR" property="threeId"/>
<result column="three_name" jdbcType="VARCHAR" property="threeName"/>
<result column="topic_type" jdbcType="VARCHAR" property="topicType"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</trim>
</where>
</sql>
<sql id="Base_Column_List">
id
, topic_id, one_id, one_name, two_id, two_name, three_id, three_name, topic_type
</sql>
<select id="selectByExample" parameterType="com.sztzjy.resource_center.entity.SysTopicAndCourseExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from sys_topic_and_course
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from sys_topic_and_course
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete
from sys_topic_and_course
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.resource_center.entity.SysTopicAndCourseExample">
delete from sys_topic_and_course
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, topic_id, one_id, one_name, two_id, two_name, three_id, three_name, topic_type
</sql>
<select id="selectByExample" parameterType="com.sztzjy.resource_center.entity.SysTopicAndCourseExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sys_topic_and_course
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys_topic_and_course
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from sys_topic_and_course
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.resource_center.entity.SysTopicAndCourseExample">
delete from sys_topic_and_course
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.resource_center.entity.SysTopicAndCourse">
insert into sys_topic_and_course (id, topic_id, one_id,
one_name, two_id, two_name,
three_id, three_name, topic_type
)
values (#{id,jdbcType=VARCHAR}, #{topicId,jdbcType=VARCHAR}, #{oneId,jdbcType=VARCHAR},
#{oneName,jdbcType=VARCHAR}, #{twoId,jdbcType=VARCHAR}, #{twoName,jdbcType=VARCHAR},
#{threeId,jdbcType=VARCHAR}, #{threeName,jdbcType=VARCHAR}, #{topicType,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.resource_center.entity.SysTopicAndCourse">
insert into sys_topic_and_course
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="topicId != null">
topic_id,
</if>
<if test="oneId != null">
one_id,
</if>
<if test="oneName != null">
one_name,
</if>
<if test="twoId != null">
two_id,
</if>
<if test="twoName != null">
two_name,
</if>
<if test="threeId != null">
three_id,
</if>
<if test="threeName != null">
three_name,
</if>
<if test="topicType != null">
topic_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="topicId != null">
#{topicId,jdbcType=VARCHAR},
</if>
<if test="oneId != null">
#{oneId,jdbcType=VARCHAR},
</if>
<if test="oneName != null">
#{oneName,jdbcType=VARCHAR},
</if>
<if test="twoId != null">
#{twoId,jdbcType=VARCHAR},
</if>
<if test="twoName != null">
#{twoName,jdbcType=VARCHAR},
</if>
<if test="threeId != null">
#{threeId,jdbcType=VARCHAR},
</if>
<if test="threeName != null">
#{threeName,jdbcType=VARCHAR},
</if>
<if test="topicType != null">
#{topicType,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.resource_center.entity.SysTopicAndCourseExample" resultType="java.lang.Long">
select count(*) from sys_topic_and_course
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sys_topic_and_course
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.topicId != null">
</delete>
<insert id="insert" parameterType="com.sztzjy.resource_center.entity.SysTopicAndCourse">
insert into sys_topic_and_course (id, topic_id, one_id,
one_name, two_id, two_name,
three_id, three_name, topic_type)
values (#{id,jdbcType=VARCHAR}, #{topicId,jdbcType=VARCHAR}, #{oneId,jdbcType=VARCHAR},
#{oneName,jdbcType=VARCHAR}, #{twoId,jdbcType=VARCHAR}, #{twoName,jdbcType=VARCHAR},
#{threeId,jdbcType=VARCHAR}, #{threeName,jdbcType=VARCHAR}, #{topicType,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.resource_center.entity.SysTopicAndCourse">
insert into sys_topic_and_course
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="topicId != null">
topic_id,
</if>
<if test="oneId != null">
one_id,
</if>
<if test="oneName != null">
one_name,
</if>
<if test="twoId != null">
two_id,
</if>
<if test="twoName != null">
two_name,
</if>
<if test="threeId != null">
three_id,
</if>
<if test="threeName != null">
three_name,
</if>
<if test="topicType != null">
topic_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="topicId != null">
#{topicId,jdbcType=VARCHAR},
</if>
<if test="oneId != null">
#{oneId,jdbcType=VARCHAR},
</if>
<if test="oneName != null">
#{oneName,jdbcType=VARCHAR},
</if>
<if test="twoId != null">
#{twoId,jdbcType=VARCHAR},
</if>
<if test="twoName != null">
#{twoName,jdbcType=VARCHAR},
</if>
<if test="threeId != null">
#{threeId,jdbcType=VARCHAR},
</if>
<if test="threeName != null">
#{threeName,jdbcType=VARCHAR},
</if>
<if test="topicType != null">
#{topicType,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.resource_center.entity.SysTopicAndCourseExample"
resultType="java.lang.Long">
select count(*) from sys_topic_and_course
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sys_topic_and_course
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.topicId != null">
topic_id = #{record.topicId,jdbcType=VARCHAR},
</if>
<if test="record.oneId != null">
one_id = #{record.oneId,jdbcType=VARCHAR},
</if>
<if test="record.oneName != null">
one_name = #{record.oneName,jdbcType=VARCHAR},
</if>
<if test="record.twoId != null">
two_id = #{record.twoId,jdbcType=VARCHAR},
</if>
<if test="record.twoName != null">
two_name = #{record.twoName,jdbcType=VARCHAR},
</if>
<if test="record.threeId != null">
three_id = #{record.threeId,jdbcType=VARCHAR},
</if>
<if test="record.threeName != null">
three_name = #{record.threeName,jdbcType=VARCHAR},
</if>
<if test="record.topicType != null">
topic_type = #{record.topicType,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update sys_topic_and_course
set id = #{record.id,jdbcType=VARCHAR},
topic_id = #{record.topicId,jdbcType=VARCHAR},
</if>
<if test="record.oneId != null">
one_id = #{record.oneId,jdbcType=VARCHAR},
</if>
<if test="record.oneName != null">
one_name = #{record.oneName,jdbcType=VARCHAR},
</if>
<if test="record.twoId != null">
two_id = #{record.twoId,jdbcType=VARCHAR},
</if>
<if test="record.twoName != null">
two_name = #{record.twoName,jdbcType=VARCHAR},
</if>
<if test="record.threeId != null">
three_id = #{record.threeId,jdbcType=VARCHAR},
</if>
<if test="record.threeName != null">
three_name = #{record.threeName,jdbcType=VARCHAR},
</if>
<if test="record.topicType != null">
topic_type = #{record.topicType,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update sys_topic_and_course
set id = #{record.id,jdbcType=VARCHAR},
topic_id = #{record.topicId,jdbcType=VARCHAR},
one_id = #{record.oneId,jdbcType=VARCHAR},
one_name = #{record.oneName,jdbcType=VARCHAR},
two_id = #{record.twoId,jdbcType=VARCHAR},
two_name = #{record.twoName,jdbcType=VARCHAR},
three_id = #{record.threeId,jdbcType=VARCHAR},
three_name = #{record.threeName,jdbcType=VARCHAR},
topic_type = #{record.topicType,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.resource_center.entity.SysTopicAndCourse">
update sys_topic_and_course
<set>
<if test="topicId != null">
topic_id = #{topicId,jdbcType=VARCHAR},
</if>
<if test="oneId != null">
one_id = #{oneId,jdbcType=VARCHAR},
</if>
<if test="oneName != null">
one_name = #{oneName,jdbcType=VARCHAR},
</if>
<if test="twoId != null">
two_id = #{twoId,jdbcType=VARCHAR},
</if>
<if test="twoName != null">
two_name = #{twoName,jdbcType=VARCHAR},
</if>
<if test="threeId != null">
three_id = #{threeId,jdbcType=VARCHAR},
</if>
<if test="threeName != null">
three_name = #{threeName,jdbcType=VARCHAR},
</if>
<if test="topicType != null">
topic_type = #{topicType,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.resource_center.entity.SysTopicAndCourse">
update sys_topic_and_course
set topic_id = #{topicId,jdbcType=VARCHAR},
one_id = #{oneId,jdbcType=VARCHAR},
one_name = #{oneName,jdbcType=VARCHAR},
two_id = #{twoId,jdbcType=VARCHAR},
two_name = #{twoName,jdbcType=VARCHAR},
three_id = #{threeId,jdbcType=VARCHAR},
three_name = #{threeName,jdbcType=VARCHAR},
topic_type = #{topicType,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<!-- 批量新增 -->
<insert id="batchInsert" parameterType="java.util.List">
INSERT INTO sys_resource_and_course (id, topic_id, one_id, two_id, three_id, topic_type)
VALUES
<foreach collection="list" item="topic" separator=",">
(
#{topic.id},
#{topic.topic_id},
#{topic.topicType},
#{topic.oneId},
#{topic.oneName},
#{topic.twoId}
#{topic.threeId}
#{topic.twoName}
#{topic.threeName}
)
</foreach>
</insert>
topic_type = #{record.topicType,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.resource_center.entity.SysTopicAndCourse">
update sys_topic_and_course
<set>
<if test="topicId != null">
topic_id = #{topicId,jdbcType=VARCHAR},
</if>
<if test="oneId != null">
one_id = #{oneId,jdbcType=VARCHAR},
</if>
<if test="oneName != null">
one_name = #{oneName,jdbcType=VARCHAR},
</if>
<if test="twoId != null">
two_id = #{twoId,jdbcType=VARCHAR},
</if>
<if test="twoName != null">
two_name = #{twoName,jdbcType=VARCHAR},
</if>
<if test="threeId != null">
three_id = #{threeId,jdbcType=VARCHAR},
</if>
<if test="threeName != null">
three_name = #{threeName,jdbcType=VARCHAR},
</if>
<if test="topicType != null">
topic_type = #{topicType,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.resource_center.entity.SysTopicAndCourse">
update sys_topic_and_course
set topic_id = #{topicId,jdbcType=VARCHAR},
one_id = #{oneId,jdbcType=VARCHAR},
one_name = #{oneName,jdbcType=VARCHAR},
two_id = #{twoId,jdbcType=VARCHAR},
two_name = #{twoName,jdbcType=VARCHAR},
three_id = #{threeId,jdbcType=VARCHAR},
three_name = #{threeName,jdbcType=VARCHAR},
topic_type = #{topicType,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<!-- 批量新增 -->
<insert id="batchInsert" parameterType="java.util.List">
INSERT INTO sys_topic_and_course (id, topic_id, one_id,one_name, two_id,two_name, three_id,
three_name,topic_type)
VALUES
<foreach collection="list" item="topic" separator=",">
(
#{topic.id},
#{topic.topicId},
#{topic.oneId},
#{topic.oneName},
#{topic.twoId},
#{topic.twoName},
#{topic.threeId},
#{topic.threeName},
#{topic.topicType}
)
</foreach>
</insert>
</mapper>
Loading…
Cancel
Save