diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/common/CourseController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/common/CourseController.java new file mode 100644 index 0000000..1ed9a3d --- /dev/null +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/common/CourseController.java @@ -0,0 +1,55 @@ +package com.sztzjy.financial_bigdata.controller.common; + +import com.github.pagehelper.PageInfo; +import com.sztzjy.financial_bigdata.entity.SysCourse; +import com.sztzjy.financial_bigdata.service.common.ICourseService; +import com.sztzjy.financial_bigdata.util.ResultEntity; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.*; + +@RestController +@Api(tags = "课程相关") +@RequestMapping("api/common/chapterController") +public class CourseController { + @Autowired + ICourseService courseService; + + //查看课程 + @GetMapping("selectCourse") + @ApiOperation("查看课程") + public ResultEntity<PageInfo<SysCourse>> selectCourse(@RequestParam String schoolId, + @RequestParam Integer index, + @RequestParam Integer size) { + PageInfo<SysCourse> pageInfo = courseService.selectCourse(schoolId, index, size); + return new ResultEntity(HttpStatus.OK, "展示成功", pageInfo); + } + + //增加课程 + @PostMapping("insertCourse") + @ApiOperation("增加课程") + public ResultEntity insertCourse(@ApiParam("新增课程对象") @RequestBody SysCourse course) { + Boolean flag = courseService.insertCourse(course); + if (flag){ + return new ResultEntity<>(HttpStatus.OK,"新增课程成功"); + }else { + return new ResultEntity<>(HttpStatus.BAD_REQUEST,"新增课程失败"); + } + } + + //删除课程 + @GetMapping("deleteCourse") + @ApiOperation("删除课程") + public ResultEntity deleteCourse(@ApiParam("删除课程Id") @RequestParam String courseId, + @RequestParam String schoolId){ + Boolean flag = courseService.deleteCourse(courseId,schoolId); + if (flag){ + return new ResultEntity<>(HttpStatus.OK,"删除课程成功"); + }else { + return new ResultEntity<>(HttpStatus.BAD_REQUEST,"删除课程失败"); + } + } +} diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenter.java b/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenter.java new file mode 100644 index 0000000..d3a49a4 --- /dev/null +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenter.java @@ -0,0 +1,76 @@ +package com.sztzjy.financial_bigdata.entity; + +import io.swagger.annotations.ApiModelProperty; +/** + * 资源中心表 + * + * @author xcj + * tea_resource_center + */ +public class TeaResourceCenter { + @ApiModelProperty("资源ID") + private String resourceId; + + @ApiModelProperty("章节ID") + private String chapterId; + + @ApiModelProperty("资源地址") + private String resourceUrl; + + @ApiModelProperty("图片地址") + private String imageUrl; + + @ApiModelProperty("资源名称") + private String resourceName; + + @ApiModelProperty("学校ID") + private String schoolId; + + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId == null ? null : resourceId.trim(); + } + + public String getChapterId() { + return chapterId; + } + + public void setChapterId(String chapterId) { + this.chapterId = chapterId == null ? null : chapterId.trim(); + } + + public String getResourceUrl() { + return resourceUrl; + } + + public void setResourceUrl(String resourceUrl) { + this.resourceUrl = resourceUrl == null ? null : resourceUrl.trim(); + } + + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl == null ? null : imageUrl.trim(); + } + + public String getResourceName() { + return resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName == null ? null : resourceName.trim(); + } + + public String getSchoolId() { + return schoolId; + } + + public void setSchoolId(String schoolId) { + this.schoolId = schoolId == null ? null : schoolId.trim(); + } +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenterExample.java b/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenterExample.java new file mode 100644 index 0000000..aa97e8a --- /dev/null +++ b/src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenterExample.java @@ -0,0 +1,619 @@ +package com.sztzjy.financial_bigdata.entity; + +import java.util.ArrayList; +import java.util.List; + +public class TeaResourceCenterExample { + protected String orderByClause; + + protected boolean distinct; + + protected List<Criteria> oredCriteria; + + public TeaResourceCenterExample() { + oredCriteria = new ArrayList<>(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List<Criteria> getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List<Criterion> criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List<Criterion> getAllCriteria() { + return criteria; + } + + public List<Criterion> getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andResourceIdIsNull() { + addCriterion("resource_id is null"); + return (Criteria) this; + } + + public Criteria andResourceIdIsNotNull() { + addCriterion("resource_id is not null"); + return (Criteria) this; + } + + public Criteria andResourceIdEqualTo(String value) { + addCriterion("resource_id =", value, "resourceId"); + return (Criteria) this; + } + + public Criteria andResourceIdNotEqualTo(String value) { + addCriterion("resource_id <>", value, "resourceId"); + return (Criteria) this; + } + + public Criteria andResourceIdGreaterThan(String value) { + addCriterion("resource_id >", value, "resourceId"); + return (Criteria) this; + } + + public Criteria andResourceIdGreaterThanOrEqualTo(String value) { + addCriterion("resource_id >=", value, "resourceId"); + return (Criteria) this; + } + + public Criteria andResourceIdLessThan(String value) { + addCriterion("resource_id <", value, "resourceId"); + return (Criteria) this; + } + + public Criteria andResourceIdLessThanOrEqualTo(String value) { + addCriterion("resource_id <=", value, "resourceId"); + return (Criteria) this; + } + + public Criteria andResourceIdLike(String value) { + addCriterion("resource_id like", value, "resourceId"); + return (Criteria) this; + } + + public Criteria andResourceIdNotLike(String value) { + addCriterion("resource_id not like", value, "resourceId"); + return (Criteria) this; + } + + public Criteria andResourceIdIn(List<String> values) { + addCriterion("resource_id in", values, "resourceId"); + return (Criteria) this; + } + + public Criteria andResourceIdNotIn(List<String> values) { + addCriterion("resource_id not in", values, "resourceId"); + return (Criteria) this; + } + + public Criteria andResourceIdBetween(String value1, String value2) { + addCriterion("resource_id between", value1, value2, "resourceId"); + return (Criteria) this; + } + + public Criteria andResourceIdNotBetween(String value1, String value2) { + addCriterion("resource_id not between", value1, value2, "resourceId"); + return (Criteria) this; + } + + public Criteria andChapterIdIsNull() { + addCriterion("chapter_id is null"); + return (Criteria) this; + } + + public Criteria andChapterIdIsNotNull() { + addCriterion("chapter_id is not null"); + return (Criteria) this; + } + + public Criteria andChapterIdEqualTo(String value) { + addCriterion("chapter_id =", value, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdNotEqualTo(String value) { + addCriterion("chapter_id <>", value, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdGreaterThan(String value) { + addCriterion("chapter_id >", value, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdGreaterThanOrEqualTo(String value) { + addCriterion("chapter_id >=", value, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdLessThan(String value) { + addCriterion("chapter_id <", value, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdLessThanOrEqualTo(String value) { + addCriterion("chapter_id <=", value, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdLike(String value) { + addCriterion("chapter_id like", value, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdNotLike(String value) { + addCriterion("chapter_id not like", value, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdIn(List<String> values) { + addCriterion("chapter_id in", values, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdNotIn(List<String> values) { + addCriterion("chapter_id not in", values, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdBetween(String value1, String value2) { + addCriterion("chapter_id between", value1, value2, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdNotBetween(String value1, String value2) { + addCriterion("chapter_id not between", value1, value2, "chapterId"); + return (Criteria) this; + } + + public Criteria andResourceUrlIsNull() { + addCriterion("resource_url is null"); + return (Criteria) this; + } + + public Criteria andResourceUrlIsNotNull() { + addCriterion("resource_url is not null"); + return (Criteria) this; + } + + public Criteria andResourceUrlEqualTo(String value) { + addCriterion("resource_url =", value, "resourceUrl"); + return (Criteria) this; + } + + public Criteria andResourceUrlNotEqualTo(String value) { + addCriterion("resource_url <>", value, "resourceUrl"); + return (Criteria) this; + } + + public Criteria andResourceUrlGreaterThan(String value) { + addCriterion("resource_url >", value, "resourceUrl"); + return (Criteria) this; + } + + public Criteria andResourceUrlGreaterThanOrEqualTo(String value) { + addCriterion("resource_url >=", value, "resourceUrl"); + return (Criteria) this; + } + + public Criteria andResourceUrlLessThan(String value) { + addCriterion("resource_url <", value, "resourceUrl"); + return (Criteria) this; + } + + public Criteria andResourceUrlLessThanOrEqualTo(String value) { + addCriterion("resource_url <=", value, "resourceUrl"); + return (Criteria) this; + } + + public Criteria andResourceUrlLike(String value) { + addCriterion("resource_url like", value, "resourceUrl"); + return (Criteria) this; + } + + public Criteria andResourceUrlNotLike(String value) { + addCriterion("resource_url not like", value, "resourceUrl"); + return (Criteria) this; + } + + public Criteria andResourceUrlIn(List<String> values) { + addCriterion("resource_url in", values, "resourceUrl"); + return (Criteria) this; + } + + public Criteria andResourceUrlNotIn(List<String> values) { + addCriterion("resource_url not in", values, "resourceUrl"); + return (Criteria) this; + } + + public Criteria andResourceUrlBetween(String value1, String value2) { + addCriterion("resource_url between", value1, value2, "resourceUrl"); + return (Criteria) this; + } + + public Criteria andResourceUrlNotBetween(String value1, String value2) { + addCriterion("resource_url not between", value1, value2, "resourceUrl"); + return (Criteria) this; + } + + public Criteria andImageUrlIsNull() { + addCriterion("image_url is null"); + return (Criteria) this; + } + + public Criteria andImageUrlIsNotNull() { + addCriterion("image_url is not null"); + return (Criteria) this; + } + + public Criteria andImageUrlEqualTo(String value) { + addCriterion("image_url =", value, "imageUrl"); + return (Criteria) this; + } + + public Criteria andImageUrlNotEqualTo(String value) { + addCriterion("image_url <>", value, "imageUrl"); + return (Criteria) this; + } + + public Criteria andImageUrlGreaterThan(String value) { + addCriterion("image_url >", value, "imageUrl"); + return (Criteria) this; + } + + public Criteria andImageUrlGreaterThanOrEqualTo(String value) { + addCriterion("image_url >=", value, "imageUrl"); + return (Criteria) this; + } + + public Criteria andImageUrlLessThan(String value) { + addCriterion("image_url <", value, "imageUrl"); + return (Criteria) this; + } + + public Criteria andImageUrlLessThanOrEqualTo(String value) { + addCriterion("image_url <=", value, "imageUrl"); + return (Criteria) this; + } + + public Criteria andImageUrlLike(String value) { + addCriterion("image_url like", value, "imageUrl"); + return (Criteria) this; + } + + public Criteria andImageUrlNotLike(String value) { + addCriterion("image_url not like", value, "imageUrl"); + return (Criteria) this; + } + + public Criteria andImageUrlIn(List<String> values) { + addCriterion("image_url in", values, "imageUrl"); + return (Criteria) this; + } + + public Criteria andImageUrlNotIn(List<String> values) { + addCriterion("image_url not in", values, "imageUrl"); + return (Criteria) this; + } + + public Criteria andImageUrlBetween(String value1, String value2) { + addCriterion("image_url between", value1, value2, "imageUrl"); + return (Criteria) this; + } + + public Criteria andImageUrlNotBetween(String value1, String value2) { + addCriterion("image_url not between", value1, value2, "imageUrl"); + return (Criteria) this; + } + + public Criteria andResourceNameIsNull() { + addCriterion("resource_name is null"); + return (Criteria) this; + } + + public Criteria andResourceNameIsNotNull() { + addCriterion("resource_name is not null"); + return (Criteria) this; + } + + public Criteria andResourceNameEqualTo(String value) { + addCriterion("resource_name =", value, "resourceName"); + return (Criteria) this; + } + + public Criteria andResourceNameNotEqualTo(String value) { + addCriterion("resource_name <>", value, "resourceName"); + return (Criteria) this; + } + + public Criteria andResourceNameGreaterThan(String value) { + addCriterion("resource_name >", value, "resourceName"); + return (Criteria) this; + } + + public Criteria andResourceNameGreaterThanOrEqualTo(String value) { + addCriterion("resource_name >=", value, "resourceName"); + return (Criteria) this; + } + + public Criteria andResourceNameLessThan(String value) { + addCriterion("resource_name <", value, "resourceName"); + return (Criteria) this; + } + + public Criteria andResourceNameLessThanOrEqualTo(String value) { + addCriterion("resource_name <=", value, "resourceName"); + return (Criteria) this; + } + + public Criteria andResourceNameLike(String value) { + addCriterion("resource_name like", value, "resourceName"); + return (Criteria) this; + } + + public Criteria andResourceNameNotLike(String value) { + addCriterion("resource_name not like", value, "resourceName"); + return (Criteria) this; + } + + public Criteria andResourceNameIn(List<String> values) { + addCriterion("resource_name in", values, "resourceName"); + return (Criteria) this; + } + + public Criteria andResourceNameNotIn(List<String> values) { + addCriterion("resource_name not in", values, "resourceName"); + return (Criteria) this; + } + + public Criteria andResourceNameBetween(String value1, String value2) { + addCriterion("resource_name between", value1, value2, "resourceName"); + return (Criteria) this; + } + + public Criteria andResourceNameNotBetween(String value1, String value2) { + addCriterion("resource_name not between", value1, value2, "resourceName"); + return (Criteria) this; + } + + public Criteria andSchoolIdIsNull() { + addCriterion("school_id is null"); + return (Criteria) this; + } + + public Criteria andSchoolIdIsNotNull() { + addCriterion("school_id is not null"); + return (Criteria) this; + } + + public Criteria andSchoolIdEqualTo(String value) { + addCriterion("school_id =", value, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdNotEqualTo(String value) { + addCriterion("school_id <>", value, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdGreaterThan(String value) { + addCriterion("school_id >", value, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdGreaterThanOrEqualTo(String value) { + addCriterion("school_id >=", value, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdLessThan(String value) { + addCriterion("school_id <", value, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdLessThanOrEqualTo(String value) { + addCriterion("school_id <=", value, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdLike(String value) { + addCriterion("school_id like", value, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdNotLike(String value) { + addCriterion("school_id not like", value, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdIn(List<String> values) { + addCriterion("school_id in", values, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdNotIn(List<String> values) { + addCriterion("school_id not in", values, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdBetween(String value1, String value2) { + addCriterion("school_id between", value1, value2, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdNotBetween(String value1, String value2) { + addCriterion("school_id not between", value1, value2, "schoolId"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List<?>) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/financial_bigdata/mapper/TeaResourceCenterMapper.java b/src/main/java/com/sztzjy/financial_bigdata/mapper/TeaResourceCenterMapper.java new file mode 100644 index 0000000..91adec1 --- /dev/null +++ b/src/main/java/com/sztzjy/financial_bigdata/mapper/TeaResourceCenterMapper.java @@ -0,0 +1,32 @@ +package com.sztzjy.financial_bigdata.mapper; + +import com.sztzjy.financial_bigdata.entity.TeaResourceCenter; +import com.sztzjy.financial_bigdata.entity.TeaResourceCenterExample; +import java.util.List; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +@Mapper +public interface TeaResourceCenterMapper { + long countByExample(TeaResourceCenterExample example); + + int deleteByExample(TeaResourceCenterExample example); + + int deleteByPrimaryKey(String resourceId); + + int insert(TeaResourceCenter record); + + int insertSelective(TeaResourceCenter record); + + List<TeaResourceCenter> selectByExample(TeaResourceCenterExample example); + + TeaResourceCenter selectByPrimaryKey(String resourceId); + + int updateByExampleSelective(@Param("record") TeaResourceCenter record, @Param("example") TeaResourceCenterExample example); + + int updateByExample(@Param("record") TeaResourceCenter record, @Param("example") TeaResourceCenterExample example); + + int updateByPrimaryKeySelective(TeaResourceCenter record); + + int updateByPrimaryKey(TeaResourceCenter record); +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/financial_bigdata/service/common/ICourseService.java b/src/main/java/com/sztzjy/financial_bigdata/service/common/ICourseService.java new file mode 100644 index 0000000..f322542 --- /dev/null +++ b/src/main/java/com/sztzjy/financial_bigdata/service/common/ICourseService.java @@ -0,0 +1,14 @@ +package com.sztzjy.financial_bigdata.service.common; + +import com.github.pagehelper.PageInfo; +import com.sztzjy.financial_bigdata.entity.SysCourse; + + +public interface ICourseService { + + PageInfo<SysCourse> selectCourse(String schoolId, Integer index, Integer size); + + Boolean insertCourse(SysCourse course); + + Boolean deleteCourse(String courseId, String schoolId); +} diff --git a/src/main/java/com/sztzjy/financial_bigdata/service/common/impl/CourseServiceImpl.java b/src/main/java/com/sztzjy/financial_bigdata/service/common/impl/CourseServiceImpl.java new file mode 100644 index 0000000..29048e9 --- /dev/null +++ b/src/main/java/com/sztzjy/financial_bigdata/service/common/impl/CourseServiceImpl.java @@ -0,0 +1,59 @@ +package com.sztzjy.financial_bigdata.service.common.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.sztzjy.financial_bigdata.entity.SysCourse; +import com.sztzjy.financial_bigdata.entity.SysCourseChapter; +import com.sztzjy.financial_bigdata.entity.SysCourseExample; +import com.sztzjy.financial_bigdata.mapper.SysCourseMapper; +import com.sztzjy.financial_bigdata.service.common.ICourseService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.UUID; + +@Service +public class CourseServiceImpl implements ICourseService { + @Autowired + SysCourseMapper courseMapper; + + @Override + public PageInfo<SysCourse> selectCourse(String schoolId, Integer index, Integer size) { + PageHelper.startPage(index, size); + List<SysCourse> sysCourse = courseMapper.selectCourse(schoolId); + PageInfo<SysCourse> pageInfo = new PageInfo<>(sysCourse); + return pageInfo; + } + + @Override + public Boolean insertCourse(SysCourse course) { + PageHelper.startPage(1, 1); + SysCourseExample example=new SysCourseExample(); + example.createCriteria().andSchoolIdEqualTo(course.getSchoolId()); + example.setOrderByClause("sequence DESC"); + List<SysCourse> sysCourses = courseMapper.selectByExample(example); + course.setCourseId(String.valueOf(UUID.randomUUID())); + if(sysCourses.isEmpty()){ + course.setSequence(1); + }else { + course.setSequence(sysCourses.get(0).getSequence()+1); + } + if ("999999999".equals(course.getSchoolId())) { //代表内置数据传递 + course.setInputType("1"); + } else { //老师自主上传 + course.setInputType("0"); + } + int i = courseMapper.insertSelective(course); + return i == 1 ? true : false; + } + + @Override + public Boolean deleteCourse(String courseId, String schoolId) { + SysCourseExample example=new SysCourseExample(); + SysCourseExample.Criteria criteria = example.createCriteria(); + criteria.andCourseIdEqualTo(courseId).andSchoolIdEqualTo(schoolId); + int i = courseMapper.deleteByExample(example); + return i == 1 ? true : false; + } +} diff --git a/src/main/resources/mapper/TeaResourceCenterMapper.xml b/src/main/resources/mapper/TeaResourceCenterMapper.xml new file mode 100644 index 0000000..f8e234c --- /dev/null +++ b/src/main/resources/mapper/TeaResourceCenterMapper.xml @@ -0,0 +1,228 @@ +<?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.financial_bigdata.mapper.TeaResourceCenterMapper"> + <resultMap id="BaseResultMap" type="com.sztzjy.financial_bigdata.entity.TeaResourceCenter"> + <id column="resource_id" jdbcType="VARCHAR" property="resourceId" /> + <result column="chapter_id" jdbcType="VARCHAR" property="chapterId" /> + <result column="resource_url" jdbcType="VARCHAR" property="resourceUrl" /> + <result column="image_url" jdbcType="VARCHAR" property="imageUrl" /> + <result column="resource_name" jdbcType="VARCHAR" property="resourceName" /> + <result column="school_id" jdbcType="VARCHAR" property="schoolId" /> + </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> + </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> + </where> + </sql> + <sql id="Base_Column_List"> + resource_id, chapter_id, resource_url, image_url, resource_name, school_id + </sql> + <select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.TeaResourceCenterExample" resultMap="BaseResultMap"> + select + <if test="distinct"> + distinct + </if> + <include refid="Base_Column_List" /> + from tea_resource_center + <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 tea_resource_center + where resource_id = #{resourceId,jdbcType=VARCHAR} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> + delete from tea_resource_center + where resource_id = #{resourceId,jdbcType=VARCHAR} + </delete> + <delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.TeaResourceCenterExample"> + delete from tea_resource_center + <if test="_parameter != null"> + <include refid="Example_Where_Clause" /> + </if> + </delete> + <insert id="insert" parameterType="com.sztzjy.financial_bigdata.entity.TeaResourceCenter"> + insert into tea_resource_center (resource_id, chapter_id, resource_url, + image_url, resource_name, school_id + ) + values (#{resourceId,jdbcType=VARCHAR}, #{chapterId,jdbcType=VARCHAR}, #{resourceUrl,jdbcType=VARCHAR}, + #{imageUrl,jdbcType=VARCHAR}, #{resourceName,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR} + ) + </insert> + <insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.TeaResourceCenter"> + insert into tea_resource_center + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="resourceId != null"> + resource_id, + </if> + <if test="chapterId != null"> + chapter_id, + </if> + <if test="resourceUrl != null"> + resource_url, + </if> + <if test="imageUrl != null"> + image_url, + </if> + <if test="resourceName != null"> + resource_name, + </if> + <if test="schoolId != null"> + school_id, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="resourceId != null"> + #{resourceId,jdbcType=VARCHAR}, + </if> + <if test="chapterId != null"> + #{chapterId,jdbcType=VARCHAR}, + </if> + <if test="resourceUrl != null"> + #{resourceUrl,jdbcType=VARCHAR}, + </if> + <if test="imageUrl != null"> + #{imageUrl,jdbcType=VARCHAR}, + </if> + <if test="resourceName != null"> + #{resourceName,jdbcType=VARCHAR}, + </if> + <if test="schoolId != null"> + #{schoolId,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.TeaResourceCenterExample" resultType="java.lang.Long"> + select count(*) from tea_resource_center + <if test="_parameter != null"> + <include refid="Example_Where_Clause" /> + </if> + </select> + <update id="updateByExampleSelective" parameterType="map"> + update tea_resource_center + <set> + <if test="record.resourceId != null"> + resource_id = #{record.resourceId,jdbcType=VARCHAR}, + </if> + <if test="record.chapterId != null"> + chapter_id = #{record.chapterId,jdbcType=VARCHAR}, + </if> + <if test="record.resourceUrl != null"> + resource_url = #{record.resourceUrl,jdbcType=VARCHAR}, + </if> + <if test="record.imageUrl != null"> + image_url = #{record.imageUrl,jdbcType=VARCHAR}, + </if> + <if test="record.resourceName != null"> + resource_name = #{record.resourceName,jdbcType=VARCHAR}, + </if> + <if test="record.schoolId != null"> + school_id = #{record.schoolId,jdbcType=VARCHAR}, + </if> + </set> + <if test="_parameter != null"> + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByExample" parameterType="map"> + update tea_resource_center + set resource_id = #{record.resourceId,jdbcType=VARCHAR}, + chapter_id = #{record.chapterId,jdbcType=VARCHAR}, + resource_url = #{record.resourceUrl,jdbcType=VARCHAR}, + image_url = #{record.imageUrl,jdbcType=VARCHAR}, + resource_name = #{record.resourceName,jdbcType=VARCHAR}, + school_id = #{record.schoolId,jdbcType=VARCHAR} + <if test="_parameter != null"> + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.financial_bigdata.entity.TeaResourceCenter"> + update tea_resource_center + <set> + <if test="chapterId != null"> + chapter_id = #{chapterId,jdbcType=VARCHAR}, + </if> + <if test="resourceUrl != null"> + resource_url = #{resourceUrl,jdbcType=VARCHAR}, + </if> + <if test="imageUrl != null"> + image_url = #{imageUrl,jdbcType=VARCHAR}, + </if> + <if test="resourceName != null"> + resource_name = #{resourceName,jdbcType=VARCHAR}, + </if> + <if test="schoolId != null"> + school_id = #{schoolId,jdbcType=VARCHAR}, + </if> + </set> + where resource_id = #{resourceId,jdbcType=VARCHAR} + </update> + <update id="updateByPrimaryKey" parameterType="com.sztzjy.financial_bigdata.entity.TeaResourceCenter"> + update tea_resource_center + set chapter_id = #{chapterId,jdbcType=VARCHAR}, + resource_url = #{resourceUrl,jdbcType=VARCHAR}, + image_url = #{imageUrl,jdbcType=VARCHAR}, + resource_name = #{resourceName,jdbcType=VARCHAR}, + school_id = #{schoolId,jdbcType=VARCHAR} + where resource_id = #{resourceId,jdbcType=VARCHAR} + </update> +</mapper> \ No newline at end of file