From 650eb495a57093f973a4350ca6d138736f0d1215 Mon Sep 17 00:00:00 2001 From: yz <3614508250@qq.com> Date: Tue, 12 Mar 2024 18:23:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E4=B8=AD=E5=BF=83=E9=83=A8?= =?UTF-8?q?=E5=88=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/common/CourseController.java | 55 ++ .../entity/TeaResourceCenter.java | 76 +++ .../entity/TeaResourceCenterExample.java | 619 ++++++++++++++++++ .../mapper/TeaResourceCenterMapper.java | 32 + .../service/common/ICourseService.java | 14 + .../common/impl/CourseServiceImpl.java | 59 ++ .../mapper/TeaResourceCenterMapper.xml | 228 +++++++ 7 files changed, 1083 insertions(+) create mode 100644 src/main/java/com/sztzjy/financial_bigdata/controller/common/CourseController.java create mode 100644 src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenter.java create mode 100644 src/main/java/com/sztzjy/financial_bigdata/entity/TeaResourceCenterExample.java create mode 100644 src/main/java/com/sztzjy/financial_bigdata/mapper/TeaResourceCenterMapper.java create mode 100644 src/main/java/com/sztzjy/financial_bigdata/service/common/ICourseService.java create mode 100644 src/main/java/com/sztzjy/financial_bigdata/service/common/impl/CourseServiceImpl.java create mode 100644 src/main/resources/mapper/TeaResourceCenterMapper.xml 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> selectCourse(@RequestParam String schoolId, + @RequestParam Integer index, + @RequestParam Integer size) { + PageInfo 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 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 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 criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List 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 values) { + addCriterion("resource_id in", values, "resourceId"); + return (Criteria) this; + } + + public Criteria andResourceIdNotIn(List 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 values) { + addCriterion("chapter_id in", values, "chapterId"); + return (Criteria) this; + } + + public Criteria andChapterIdNotIn(List 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 values) { + addCriterion("resource_url in", values, "resourceUrl"); + return (Criteria) this; + } + + public Criteria andResourceUrlNotIn(List 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 values) { + addCriterion("image_url in", values, "imageUrl"); + return (Criteria) this; + } + + public Criteria andImageUrlNotIn(List 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 values) { + addCriterion("resource_name in", values, "resourceName"); + return (Criteria) this; + } + + public Criteria andResourceNameNotIn(List 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 values) { + addCriterion("school_id in", values, "schoolId"); + return (Criteria) this; + } + + public Criteria andSchoolIdNotIn(List 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 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 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 selectCourse(String schoolId, Integer index, Integer size) { + PageHelper.startPage(index, size); + List sysCourse = courseMapper.selectCourse(schoolId); + PageInfo 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 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 @@ + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + resource_id, chapter_id, resource_url, image_url, resource_name, school_id + + + + + delete from tea_resource_center + where resource_id = #{resourceId,jdbcType=VARCHAR} + + + delete from tea_resource_center + + + + + + 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 into tea_resource_center + + + resource_id, + + + chapter_id, + + + resource_url, + + + image_url, + + + resource_name, + + + school_id, + + + + + #{resourceId,jdbcType=VARCHAR}, + + + #{chapterId,jdbcType=VARCHAR}, + + + #{resourceUrl,jdbcType=VARCHAR}, + + + #{imageUrl,jdbcType=VARCHAR}, + + + #{resourceName,jdbcType=VARCHAR}, + + + #{schoolId,jdbcType=VARCHAR}, + + + + + + update tea_resource_center + + + 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}, + + + + + + + + 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} + + + + + + update tea_resource_center + + + 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 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} + + \ No newline at end of file