Commit e5f98c165d9a498b70550edb3c9df97cb1dbf5b8

Authored by 徐泉
1 parent 123dbb81
Exists in master

招生咨询会

pom.xml
... ... @@ -108,7 +108,7 @@
108 108  
109 109 <build>
110 110 <!--打包文件名-->
111   - <finalName>student</finalName>
  111 + <finalName>enroll-student</finalName>
112 112 <!--打包方式-->
113 113 <plugins>
114 114  
... ...
src/main/java/com/sincere/student/controller/SysYxController.java 0 → 100644
... ... @@ -0,0 +1,133 @@
  1 +package com.sincere.student.controller;
  2 +
  3 +import com.sincere.student.dto.BaseDto;
  4 +import com.sincere.student.dto.yx.AddYxSchoolConsultVo;
  5 +import com.sincere.student.dto.yx.AddYxSchoolVo;
  6 +import com.sincere.student.model.yx.SysYxSchool;
  7 +import com.sincere.student.model.yx.SysYxSchoolConsult;
  8 +import com.sincere.student.service.SysYxColumnService;
  9 +import com.sincere.student.utils.Page;
  10 +import io.swagger.annotations.ApiOperation;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.web.bind.annotation.*;
  13 +
  14 +@RestController
  15 +@RequestMapping("sys/yx")
  16 +public class SysYxController {
  17 +
  18 + @Autowired
  19 + SysYxColumnService sysYxColumnService;
  20 +
  21 + @ApiOperation("获取学校列表")
  22 + @RequestMapping(value = "/schoolList", method = RequestMethod.POST)
  23 + public BaseDto<Page<SysYxSchool>> schoolList(@RequestBody AddYxSchoolVo vo) {
  24 + BaseDto<Page<SysYxSchool>> result = new BaseDto<>();
  25 + result.setData(sysYxColumnService.schoolList(vo));
  26 + return result;
  27 + }
  28 +
  29 + @ApiOperation("添加学校")
  30 + @PostMapping(value = "addSchool")
  31 + public BaseDto addSchool(@RequestBody AddYxSchoolVo vo) {
  32 + sysYxColumnService.addSchool(vo);
  33 + return new BaseDto();
  34 + }
  35 +
  36 + @ApiOperation("删除学校")
  37 + @GetMapping(value = "delSchool")
  38 + public BaseDto delSchool(@RequestParam Integer id) {
  39 + sysYxColumnService.delSchool(id);
  40 + return new BaseDto();
  41 + }
  42 +
  43 +
  44 +// /**
  45 +// * 栏目相关接口
  46 +// */
  47 +// @MemberAccess
  48 +// @ApiOperation("获取栏目列表(1 文章 2学校 3视频)")
  49 +// @PostMapping(value = "/column/columnList")
  50 +// public BaseDto<List<ColumnType>> columnList(@RequestBody ColumnDto columnDto) {
  51 +// BaseDto<List<ColumnType>> result = new BaseDto<>();
  52 +// ColumnEnums columnEnums = ColumnEnums.getByType(columnDto.getType());
  53 +// if (columnEnums != null) {
  54 +// List<ColumnType> data = sysYxColumnService.columnList(columnDto);
  55 +// result.setData(data);
  56 +// } else {
  57 +// result.setSuccess(false);
  58 +// result.setMessage("类型不匹配");
  59 +// }
  60 +// return result;
  61 +// }
  62 +
  63 +// @ApiOperation("创建栏目(type : 1 文章 2学校 3视频)")
  64 +// @PostMapping(value = "/addColumnType")
  65 +// public BaseDto addColumnType(@RequestBody ColumnType columnType) {
  66 +// BaseDto result = new BaseDto();
  67 +// sysYxColumnService.addColumnType(columnType);
  68 +// return result;
  69 +// }
  70 +//
  71 +// @ApiOperation("更新栏目(type : 1 文章 2学校 3视频)")
  72 +// @PostMapping(value = "/updateColumnType")
  73 +// public BaseDto updateColumn(@RequestBody ColumnType columnType) {
  74 +// BaseDto result = new BaseDto();
  75 +// if (columnType.getId() > 0) {
  76 +// sysYxColumnService.updateColumnType(columnType);
  77 +// } else {
  78 +// result.setSuccess(false);
  79 +// result.setMessage("id没传");
  80 +// }
  81 +// return result;
  82 +// }
  83 +
  84 + @ApiOperation("获取咨询列表")
  85 + @RequestMapping(value = "/consultList", method = RequestMethod.POST)
  86 + public BaseDto<Page<SysYxSchoolConsult>> consultList(@RequestBody AddYxSchoolConsultVo vo) {
  87 + BaseDto<Page<SysYxSchoolConsult>> result = new BaseDto<>();
  88 + result.setData(sysYxColumnService.consultList(vo));
  89 + return result;
  90 + }
  91 +
  92 +
  93 + @ApiOperation("新建咨询会相关接口")
  94 + @PostMapping(value = "/addConsult")
  95 + public BaseDto createConsult(@RequestBody AddYxSchoolConsultVo schoolConsultVo) {
  96 + BaseDto result = new BaseDto();
  97 + sysYxColumnService.createConsult(schoolConsultVo);
  98 + return result;
  99 + }
  100 +
  101 + @ApiOperation("修改咨询会相关接口")
  102 + @PostMapping(value = "/updateConsult")
  103 + public BaseDto updateConsult(@RequestBody AddYxSchoolConsultVo schoolConsultVo) {
  104 + BaseDto result = new BaseDto();
  105 + sysYxColumnService.createConsult(schoolConsultVo);
  106 + return result;
  107 + }
  108 +
  109 + @ApiOperation("删除咨询会(传主键)")
  110 + @GetMapping(value = "/delConsult")
  111 + public BaseDto deleteConsult(@RequestParam Integer id) {
  112 + BaseDto result = new BaseDto();
  113 + sysYxColumnService.delConsult(id);
  114 + return result;
  115 + }
  116 +
  117 + @ApiOperation("获取详情")
  118 + @GetMapping(value = "/getConsultDetail")
  119 + public BaseDto getConsultDetail(@RequestParam Integer id) {
  120 + BaseDto result = new BaseDto();
  121 + SysYxSchoolConsult consult = sysYxColumnService.getConsultDetail(id);
  122 + result.setData(consult);
  123 + return result;
  124 + }
  125 +
  126 + @ApiOperation("累加阅读量接口")
  127 + @GetMapping(value = "/updateRead")
  128 + public BaseDto updateRead(@RequestParam Integer id) {
  129 + BaseDto result = new BaseDto();
  130 + sysYxColumnService.updateRead(id);
  131 + return result;
  132 + }
  133 +}
... ...
src/main/java/com/sincere/student/dto/yx/AddYxSchoolConsultVo.java 0 → 100644
... ... @@ -0,0 +1,130 @@
  1 +package com.sincere.student.dto.yx;
  2 +
  3 +import com.sincere.student.dto.PageDto;
  4 +import io.swagger.annotations.ApiModelProperty;
  5 +
  6 +import java.util.Date;
  7 +
  8 +public class AddYxSchoolConsultVo extends PageDto {
  9 +
  10 + @ApiModelProperty(value = "主键")
  11 + private Integer id;
  12 + @ApiModelProperty(value = "学校id")
  13 + private Integer schoolId;
  14 + @ApiModelProperty(value = "标题描述")
  15 + private Integer titleDesc;
  16 + @ApiModelProperty(value = "视频地址")
  17 + private String videoUrl;
  18 + @ApiModelProperty(value = "内容")
  19 + private String context;
  20 + @ApiModelProperty(value = "背景图片地址")
  21 + private String background;
  22 + @ApiModelProperty(value = "图片地址")
  23 + private String imgUrl;
  24 + @ApiModelProperty(value = "时间")
  25 + private Date createTime;
  26 + @ApiModelProperty(value = "排序")
  27 + private Integer sort;
  28 + @ApiModelProperty(value = "状态 0预览1发布")
  29 + private int status;
  30 + @ApiModelProperty(value = "阅读量")
  31 + private int readNumber;
  32 + @ApiModelProperty(value = "模板排版信息")
  33 + private String modelList;
  34 +
  35 + public Integer getId() {
  36 + return id;
  37 + }
  38 +
  39 + public void setId(Integer id) {
  40 + this.id = id;
  41 + }
  42 +
  43 + public Integer getSchoolId() {
  44 + return schoolId;
  45 + }
  46 +
  47 + public void setSchoolId(Integer schoolId) {
  48 + this.schoolId = schoolId;
  49 + }
  50 +
  51 + public Integer getTitleDesc() {
  52 + return titleDesc;
  53 + }
  54 +
  55 + public void setTitleDesc(Integer titleDesc) {
  56 + this.titleDesc = titleDesc;
  57 + }
  58 +
  59 + public String getVideoUrl() {
  60 + return videoUrl;
  61 + }
  62 +
  63 + public void setVideoUrl(String videoUrl) {
  64 + this.videoUrl = videoUrl;
  65 + }
  66 +
  67 + public String getContext() {
  68 + return context;
  69 + }
  70 +
  71 + public void setContext(String context) {
  72 + this.context = context;
  73 + }
  74 +
  75 + public String getBackground() {
  76 + return background;
  77 + }
  78 +
  79 + public void setBackground(String background) {
  80 + this.background = background;
  81 + }
  82 +
  83 + public String getImgUrl() {
  84 + return imgUrl;
  85 + }
  86 +
  87 + public void setImgUrl(String imgUrl) {
  88 + this.imgUrl = imgUrl;
  89 + }
  90 +
  91 + public Date getCreateTime() {
  92 + return createTime;
  93 + }
  94 +
  95 + public void setCreateTime(Date createTime) {
  96 + this.createTime = createTime;
  97 + }
  98 +
  99 + public Integer getSort() {
  100 + return sort;
  101 + }
  102 +
  103 + public void setSort(Integer sort) {
  104 + this.sort = sort;
  105 + }
  106 +
  107 + public int getStatus() {
  108 + return status;
  109 + }
  110 +
  111 + public void setStatus(int status) {
  112 + this.status = status;
  113 + }
  114 +
  115 + public int getReadNumber() {
  116 + return readNumber;
  117 + }
  118 +
  119 + public void setReadNumber(int readNumber) {
  120 + this.readNumber = readNumber;
  121 + }
  122 +
  123 + public String getModelList() {
  124 + return modelList;
  125 + }
  126 +
  127 + public void setModelList(String modelList) {
  128 + this.modelList = modelList;
  129 + }
  130 +}
... ...
src/main/java/com/sincere/student/dto/yx/AddYxSchoolVo.java 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +package com.sincere.student.dto.yx;
  2 +
  3 +import com.sincere.student.dto.PageDto;
  4 +
  5 +public class AddYxSchoolVo extends PageDto {
  6 +
  7 + private Integer id;
  8 +
  9 + private String schoolName;
  10 +
  11 + private Integer schoolType;
  12 +
  13 + public Integer getId() {
  14 + return id;
  15 + }
  16 +
  17 + public void setId(Integer id) {
  18 + this.id = id;
  19 + }
  20 +
  21 + public String getSchoolName() {
  22 + return schoolName;
  23 + }
  24 +
  25 + public void setSchoolName(String schoolName) {
  26 + this.schoolName = schoolName;
  27 + }
  28 +
  29 + public Integer getSchoolType() {
  30 + return schoolType;
  31 + }
  32 +
  33 + public void setSchoolType(Integer schoolType) {
  34 + this.schoolType = schoolType;
  35 + }
  36 +}
... ...
src/main/java/com/sincere/student/mapper/SysYxColumnTypeMapper.java 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +package com.sincere.student.mapper;
  2 +
  3 +import com.sincere.student.model.yx.SysYxColumnType;
  4 +import org.apache.ibatis.annotations.Param;
  5 +
  6 +import java.util.List;
  7 +
  8 +public interface SysYxColumnTypeMapper {
  9 + int deleteByPrimaryKey(Integer id);
  10 +
  11 + int insertSelective(SysYxColumnType record);
  12 +
  13 + SysYxColumnType selectByPrimaryKey(Integer id);
  14 +
  15 + int updateByPrimaryKeySelective(SysYxColumnType record);
  16 +
  17 + List<SysYxColumnType> selectList(SysYxColumnType record);
  18 +
  19 + List<SysYxColumnType> countSort(@Param(value = "sort") int sort, @Param(value = "type") int type, @Param(value = "flag") int flag, @Param(value = "id") Integer id);
  20 +}
0 21 \ No newline at end of file
... ...
src/main/java/com/sincere/student/mapper/SysYxSchoolConsultMapper.java 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +package com.sincere.student.mapper;
  2 +
  3 +import com.sincere.student.dto.yx.AddYxSchoolConsultVo;
  4 +import com.sincere.student.model.yx.SysYxSchoolConsult;
  5 +import org.apache.ibatis.annotations.Param;
  6 +
  7 +import java.util.List;
  8 +
  9 +public interface SysYxSchoolConsultMapper {
  10 + int deleteByPrimaryKey(Integer id);
  11 +
  12 + int insertSelective(SysYxSchoolConsult record);
  13 +
  14 + SysYxSchoolConsult selectByPrimaryKey(Integer id);
  15 +
  16 + int updateByPrimaryKeySelective(SysYxSchoolConsult record);
  17 +
  18 + List<SysYxSchoolConsult> selectList(AddYxSchoolConsultVo record);
  19 +
  20 + int getListCount(AddYxSchoolConsultVo record);
  21 +
  22 + List<SysYxSchoolConsult> countSort(@Param(value = "sort") int sort, @Param(value = "flag") int flag, @Param(value = "id") Integer id);
  23 +
  24 + int updateSort(SysYxSchoolConsult record);
  25 +}
0 26 \ No newline at end of file
... ...
src/main/java/com/sincere/student/mapper/SysYxSchoolMapper.java 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +package com.sincere.student.mapper;
  2 +
  3 +import com.sincere.student.dto.yx.AddYxSchoolVo;
  4 +import com.sincere.student.model.yx.SysYxSchool;
  5 +
  6 +import java.util.List;
  7 +
  8 +public interface SysYxSchoolMapper {
  9 +
  10 + int deleteByPrimaryKey(Integer id);
  11 +
  12 + int insertSelective(SysYxSchool record);
  13 +
  14 + SysYxSchool selectByPrimaryKey(Integer id);
  15 +
  16 + int updateByPrimaryKeySelective(SysYxSchool record);
  17 +
  18 + List<SysYxSchool> selectList(AddYxSchoolVo vo);
  19 +
  20 + int getListCount(AddYxSchoolVo vo);
  21 +}
0 22 \ No newline at end of file
... ...
src/main/java/com/sincere/student/model/yx/SysYxColumnType.java 0 → 100644
... ... @@ -0,0 +1,55 @@
  1 +package com.sincere.student.model.yx;
  2 +
  3 +import java.util.Date;
  4 +
  5 +public class SysYxColumnType {
  6 + private Integer id;
  7 +
  8 + private String columnName;
  9 +
  10 + private Integer columnType;
  11 +
  12 + private Integer sort;
  13 +
  14 + private Date createTime;
  15 +
  16 + public Integer getId() {
  17 + return id;
  18 + }
  19 +
  20 + public void setId(Integer id) {
  21 + this.id = id;
  22 + }
  23 +
  24 + public String getColumnName() {
  25 + return columnName;
  26 + }
  27 +
  28 + public void setColumnName(String columnName) {
  29 + this.columnName = columnName;
  30 + }
  31 +
  32 + public Integer getColumnType() {
  33 + return columnType;
  34 + }
  35 +
  36 + public void setColumnType(Integer columnType) {
  37 + this.columnType = columnType;
  38 + }
  39 +
  40 + public Integer getSort() {
  41 + return sort;
  42 + }
  43 +
  44 + public void setSort(Integer sort) {
  45 + this.sort = sort;
  46 + }
  47 +
  48 + public Date getCreateTime() {
  49 + return createTime;
  50 + }
  51 +
  52 + public void setCreateTime(Date createTime) {
  53 + this.createTime = createTime;
  54 + }
  55 +}
0 56 \ No newline at end of file
... ...
src/main/java/com/sincere/student/model/yx/SysYxSchool.java 0 → 100644
... ... @@ -0,0 +1,45 @@
  1 +package com.sincere.student.model.yx;
  2 +
  3 +import java.util.Date;
  4 +
  5 +public class SysYxSchool {
  6 + private Integer id;
  7 +
  8 + private String schoolName;
  9 +
  10 + private Integer schoolType;
  11 +
  12 + private Date createTime;
  13 +
  14 + public Integer getId() {
  15 + return id;
  16 + }
  17 +
  18 + public void setId(Integer id) {
  19 + this.id = id;
  20 + }
  21 +
  22 + public String getSchoolName() {
  23 + return schoolName;
  24 + }
  25 +
  26 + public void setSchoolName(String schoolName) {
  27 + this.schoolName = schoolName == null ? null : schoolName.trim();
  28 + }
  29 +
  30 + public Integer getSchoolType() {
  31 + return schoolType;
  32 + }
  33 +
  34 + public void setSchoolType(Integer schoolType) {
  35 + this.schoolType = schoolType;
  36 + }
  37 +
  38 + public Date getCreateTime() {
  39 + return createTime;
  40 + }
  41 +
  42 + public void setCreateTime(Date createTime) {
  43 + this.createTime = createTime;
  44 + }
  45 +}
0 46 \ No newline at end of file
... ...
src/main/java/com/sincere/student/model/yx/SysYxSchoolConsult.java 0 → 100644
... ... @@ -0,0 +1,125 @@
  1 +package com.sincere.student.model.yx;
  2 +
  3 +import java.util.Date;
  4 +
  5 +public class SysYxSchoolConsult {
  6 + private Integer id;
  7 +
  8 + private Integer schoolId;
  9 +
  10 + private Integer columnType;
  11 +
  12 + private String videoUrl;
  13 +
  14 + private String context;
  15 +
  16 + private String imgUrl;
  17 +
  18 + private Integer sort;
  19 +
  20 + private Integer status;
  21 +
  22 + private Integer readNumber;
  23 +
  24 + private String background;
  25 +
  26 + private Date createTime;
  27 +
  28 + private String modelList;
  29 +
  30 + public Integer getId() {
  31 + return id;
  32 + }
  33 +
  34 + public void setId(Integer id) {
  35 + this.id = id;
  36 + }
  37 +
  38 + public Integer getSchoolId() {
  39 + return schoolId;
  40 + }
  41 +
  42 + public void setSchoolId(Integer schoolId) {
  43 + this.schoolId = schoolId;
  44 + }
  45 +
  46 + public Integer getColumnType() {
  47 + return columnType;
  48 + }
  49 +
  50 + public void setColumnType(Integer columnType) {
  51 + this.columnType = columnType;
  52 + }
  53 +
  54 + public String getVideoUrl() {
  55 + return videoUrl;
  56 + }
  57 +
  58 + public void setVideoUrl(String videoUrl) {
  59 + this.videoUrl = videoUrl == null ? null : videoUrl.trim();
  60 + }
  61 +
  62 + public String getContext() {
  63 + return context;
  64 + }
  65 +
  66 + public void setContext(String context) {
  67 + this.context = context == null ? null : context.trim();
  68 + }
  69 +
  70 + public String getImgUrl() {
  71 + return imgUrl;
  72 + }
  73 +
  74 + public void setImgUrl(String imgUrl) {
  75 + this.imgUrl = imgUrl == null ? null : imgUrl.trim();
  76 + }
  77 +
  78 + public Integer getSort() {
  79 + return sort;
  80 + }
  81 +
  82 + public void setSort(Integer sort) {
  83 + this.sort = sort;
  84 + }
  85 +
  86 + public Integer getStatus() {
  87 + return status;
  88 + }
  89 +
  90 + public void setStatus(Integer status) {
  91 + this.status = status;
  92 + }
  93 +
  94 + public Integer getReadNumber() {
  95 + return readNumber;
  96 + }
  97 +
  98 + public void setReadNumber(Integer readNumber) {
  99 + this.readNumber = readNumber;
  100 + }
  101 +
  102 + public String getBackground() {
  103 + return background;
  104 + }
  105 +
  106 + public void setBackground(String background) {
  107 + this.background = background == null ? null : background.trim();
  108 + }
  109 +
  110 + public Date getCreateTime() {
  111 + return createTime;
  112 + }
  113 +
  114 + public void setCreateTime(Date createTime) {
  115 + this.createTime = createTime;
  116 + }
  117 +
  118 + public String getModelList() {
  119 + return modelList;
  120 + }
  121 +
  122 + public void setModelList(String modelList) {
  123 + this.modelList = modelList == null ? null : modelList.trim();
  124 + }
  125 +}
0 126 \ No newline at end of file
... ...
src/main/java/com/sincere/student/service/SysYxColumnService.java 0 → 100644
... ... @@ -0,0 +1,33 @@
  1 +package com.sincere.student.service;
  2 +
  3 +import com.sincere.student.dto.yx.AddYxSchoolConsultVo;
  4 +import com.sincere.student.dto.yx.AddYxSchoolVo;
  5 +import com.sincere.student.model.ColumnType;
  6 +import com.sincere.student.model.yx.SysYxSchool;
  7 +import com.sincere.student.model.yx.SysYxSchoolConsult;
  8 +import com.sincere.student.utils.Page;
  9 +
  10 +public interface SysYxColumnService {
  11 +
  12 + void addSchool(AddYxSchoolVo vo);
  13 +
  14 + void delSchool(Integer id);
  15 +
  16 + Page<SysYxSchool> schoolList(AddYxSchoolVo vo);
  17 +
  18 + void addColumnType(ColumnType columnType);
  19 +
  20 + void updateColumnType(ColumnType columnType);
  21 +
  22 + void delColumnType(Integer id);
  23 +
  24 + Page<SysYxSchoolConsult> consultList(AddYxSchoolConsultVo vo);
  25 +
  26 + void createConsult(AddYxSchoolConsultVo schoolConsultVo);
  27 +
  28 + void delConsult(Integer id);
  29 +
  30 + SysYxSchoolConsult getConsultDetail(Integer id);
  31 +
  32 + void updateRead(Integer id);
  33 +}
... ...
src/main/java/com/sincere/student/service/impl/SysYxColumnServiceImpl.java 0 → 100644
... ... @@ -0,0 +1,191 @@
  1 +package com.sincere.student.service.impl;
  2 +
  3 +import com.github.pagehelper.PageHelper;
  4 +import com.sincere.student.dto.yx.AddYxSchoolConsultVo;
  5 +import com.sincere.student.dto.yx.AddYxSchoolVo;
  6 +import com.sincere.student.mapper.SysYxColumnTypeMapper;
  7 +import com.sincere.student.mapper.SysYxSchoolConsultMapper;
  8 +import com.sincere.student.mapper.SysYxSchoolMapper;
  9 +import com.sincere.student.model.ColumnType;
  10 +import com.sincere.student.model.yx.SysYxColumnType;
  11 +import com.sincere.student.model.yx.SysYxSchool;
  12 +import com.sincere.student.model.yx.SysYxSchoolConsult;
  13 +import com.sincere.student.service.SysYxColumnService;
  14 +import com.sincere.student.utils.Page;
  15 +import org.springframework.beans.BeanUtils;
  16 +import org.springframework.beans.factory.annotation.Autowired;
  17 +import org.springframework.stereotype.Service;
  18 +import org.springframework.util.CollectionUtils;
  19 +
  20 +import java.util.Date;
  21 +import java.util.List;
  22 +
  23 +@Service
  24 +public class SysYxColumnServiceImpl implements SysYxColumnService {
  25 +
  26 + @Autowired
  27 + SysYxSchoolMapper sysYxSchoolMapper;
  28 + @Autowired
  29 + SysYxColumnTypeMapper sysYxColumnTypeMapper;
  30 + @Autowired
  31 + SysYxSchoolConsultMapper sysYxSchoolConsultMapper;
  32 +
  33 + @Override
  34 + public Page<SysYxSchool> schoolList(AddYxSchoolVo vo) {
  35 + Page<SysYxSchool> result = new Page<>(vo.getPage(), vo.getPageSize());
  36 + PageHelper.startPage(vo.getPage(), vo.getPageSize());
  37 + List<SysYxSchool> list = sysYxSchoolMapper.selectList(vo);
  38 + result.setList(list);
  39 + result.setCount(sysYxSchoolMapper.getListCount(vo));
  40 + return result;
  41 + }
  42 +
  43 + @Override
  44 + public void addSchool(AddYxSchoolVo vo) {
  45 + SysYxSchool school = new SysYxSchool();
  46 + BeanUtils.copyProperties(vo,school);
  47 + school.setCreateTime(new Date());
  48 + if(vo.getId()==null){
  49 + school.setId(null);
  50 + sysYxSchoolMapper.insertSelective(school);
  51 + }else{
  52 + sysYxSchoolMapper.updateByPrimaryKeySelective(school);
  53 + }
  54 + }
  55 +
  56 + @Override
  57 + public void delSchool(Integer id) {
  58 + sysYxSchoolMapper.deleteByPrimaryKey(id);
  59 + }
  60 +
  61 + @Override
  62 + public void addColumnType(ColumnType columnType) {
  63 + Integer type = columnType.getType();
  64 + Integer sort = columnType.getSort();
  65 + String name = columnType.getName();
  66 +
  67 + SysYxColumnType sysYxColumnType = new SysYxColumnType();
  68 + sysYxColumnType.setColumnType(type);
  69 + sysYxColumnType.setColumnName(name);
  70 + sysYxColumnType.setSort(sort);
  71 + sysYxColumnType.setCreateTime(new Date());
  72 +
  73 + List<SysYxColumnType> countList = sysYxColumnTypeMapper.countSort(sort.intValue(), type.intValue(), 1, null);
  74 + if (!CollectionUtils.isEmpty(countList)) {
  75 + int i = 1;
  76 + for (SysYxColumnType oldType : countList) {
  77 + int addSort = i + sort;
  78 + if (addSort > oldType.getSort()) {
  79 + //若已存在自增1
  80 + oldType.setSort(oldType.getSort() + 1);
  81 + sysYxColumnTypeMapper.updateByPrimaryKeySelective(oldType);
  82 + }
  83 + i++;
  84 + }
  85 + }
  86 + sysYxColumnTypeMapper.insertSelective(sysYxColumnType);
  87 + }
  88 +
  89 + @Override
  90 + public void updateColumnType(ColumnType columnType) {
  91 + SysYxColumnType sysYxColumnType = sysYxColumnTypeMapper.selectByPrimaryKey(columnType.getId());
  92 + if(sysYxColumnType==null){
  93 + return;
  94 + }
  95 + Integer type = columnType.getType();
  96 + Integer sort = columnType.getSort();
  97 + String name = columnType.getName();
  98 +
  99 + SysYxColumnType newType = new SysYxColumnType();
  100 + newType.setColumnType(type);
  101 + newType.setColumnName(name);
  102 + newType.setSort(sort);
  103 + newType.setCreateTime(new Date());
  104 +
  105 + List<SysYxColumnType> countList = sysYxColumnTypeMapper.countSort(sort.intValue(), type.intValue(), 2, columnType.getId());
  106 + if (!CollectionUtils.isEmpty(countList)) {
  107 + int i = 1;
  108 + for (SysYxColumnType oldType : countList) {
  109 + int addSort = i + sort;
  110 + if (addSort > oldType.getSort()) {
  111 + //若已存在自增1
  112 + oldType.setSort(oldType.getSort() + 1);
  113 + sysYxColumnTypeMapper.updateByPrimaryKeySelective(oldType);
  114 + }
  115 + i++;
  116 + }
  117 + }
  118 + sysYxColumnType.setId(columnType.getId());
  119 + sysYxColumnTypeMapper.updateByPrimaryKeySelective(sysYxColumnType);
  120 + }
  121 +
  122 + @Override
  123 + public void delColumnType(Integer id) {
  124 +
  125 + }
  126 +
  127 + @Override
  128 + public void createConsult(AddYxSchoolConsultVo schoolConsultVo) {
  129 + //排序
  130 + Integer sort = schoolConsultVo.getSort();
  131 + SysYxSchoolConsult consult = new SysYxSchoolConsult();
  132 + BeanUtils.copyProperties(schoolConsultVo,consult);
  133 +
  134 + List<SysYxSchoolConsult> consultList = null;
  135 + if(schoolConsultVo.getId() != null){
  136 + consultList = sysYxSchoolConsultMapper.countSort(sort.intValue(), 2, schoolConsultVo.getId());
  137 + }else{
  138 + consultList = sysYxSchoolConsultMapper.countSort(sort.intValue(), 1, null);
  139 + }
  140 + if (!CollectionUtils.isEmpty(consultList)) {
  141 + int i = 1;
  142 + for (SysYxSchoolConsult oldConsult : consultList) {
  143 + int addSort = i + sort;
  144 + if (addSort > oldConsult.getSort()) {
  145 + //若已存在自增1
  146 + oldConsult.setSort(oldConsult.getSort() + 1);
  147 + sysYxSchoolConsultMapper.updateSort(oldConsult);
  148 + }
  149 + i++;
  150 + }
  151 + }
  152 + if(schoolConsultVo.getId() != null){
  153 + sysYxSchoolConsultMapper.updateByPrimaryKeySelective(consult);
  154 + }else {
  155 + consult.setId(null);
  156 + consult.setStatus(1);
  157 + sysYxSchoolConsultMapper.insertSelective(consult);
  158 + }
  159 + }
  160 +
  161 + @Override
  162 + public void delConsult(Integer id) {
  163 + sysYxSchoolConsultMapper.deleteByPrimaryKey(id);
  164 + }
  165 +
  166 + @Override
  167 + public SysYxSchoolConsult getConsultDetail(Integer id) {
  168 + return sysYxSchoolConsultMapper.selectByPrimaryKey(id);
  169 + }
  170 +
  171 + @Override
  172 + public void updateRead(Integer id) {
  173 + SysYxSchoolConsult consult = sysYxSchoolConsultMapper.selectByPrimaryKey(id);
  174 + if(consult!=null){
  175 + int num = consult.getReadNumber();
  176 + num = num+1;
  177 + consult.setReadNumber(num);
  178 + sysYxSchoolConsultMapper.updateByPrimaryKeySelective(consult);
  179 + }
  180 + }
  181 +
  182 + @Override
  183 + public Page<SysYxSchoolConsult> consultList(AddYxSchoolConsultVo vo) {
  184 + Page<SysYxSchoolConsult> result = new Page<>(vo.getPage(), vo.getPageSize());
  185 + PageHelper.startPage(vo.getPage(), vo.getPageSize());
  186 + List<SysYxSchoolConsult> list = sysYxSchoolConsultMapper.selectList(vo);
  187 + result.setList(list);
  188 + result.setCount(sysYxSchoolConsultMapper.getListCount(vo));
  189 + return result;
  190 + }
  191 +}
... ...
src/main/resources/application.yaml
... ... @@ -31,4 +31,5 @@ mybatis:
31 31  
32 32 logging:
33 33 level:
34   - com.sincere.student.mapper: info
35 34 \ No newline at end of file
  35 +# com.sincere.student.mapper: info
  36 + com.sincere.student.mapper: DEBUG
36 37 \ No newline at end of file
... ...
src/main/resources/mapper/SysYxColumnTypeMapper.xml 0 → 100644
... ... @@ -0,0 +1,107 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.sincere.student.mapper.SysYxColumnTypeMapper">
  4 + <resultMap id="BaseResultMap" type="com.sincere.student.model.yx.SysYxColumnType">
  5 + <id column="id" jdbcType="INTEGER" property="id" />
  6 + <result column="column_name" jdbcType="VARCHAR" property="columnName" />
  7 + <result column="column_type" jdbcType="INTEGER" property="columnType" />
  8 + <result column="sort" jdbcType="INTEGER" property="sort" />
  9 + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  10 + </resultMap>
  11 + <sql id="Base_Column_List">
  12 + id, column_name, column_type, sort, create_time
  13 + </sql>
  14 + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  15 + select
  16 + <include refid="Base_Column_List" />
  17 + from sys_yx_column_type
  18 + where id = #{id,jdbcType=INTEGER}
  19 + </select>
  20 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  21 + delete from sys_yx_column_type
  22 + where id = #{id,jdbcType=INTEGER}
  23 + </delete>
  24 +
  25 + <select id="selectList" parameterType="com.sincere.student.model.yx.SysYxColumnType" resultMap="BaseResultMap">
  26 + select
  27 + <include refid="Base_Column_List"/>
  28 + from sys_yx_column_type
  29 + <where>
  30 + <if test="columnName != null and columnName !=''">
  31 + and column_name = #{columnName}
  32 + </if>
  33 + <if test="columnType != null">
  34 + and column_type = #{columnType}
  35 + </if>
  36 + </where>
  37 + </select>
  38 +
  39 + <insert id="insertSelective" parameterType="com.sincere.student.model.yx.SysYxColumnType">
  40 + insert into sys_yx_column_type
  41 + <trim prefix="(" suffix=")" suffixOverrides=",">
  42 + <if test="id != null">
  43 + id,
  44 + </if>
  45 + <if test="columnName != null">
  46 + column_name,
  47 + </if>
  48 + <if test="columnType != null">
  49 + column_type,
  50 + </if>
  51 + <if test="sort != null">
  52 + sort,
  53 + </if>
  54 + <if test="createTime != null">
  55 + create_time,
  56 + </if>
  57 + </trim>
  58 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  59 + <if test="id != null">
  60 + #{id,jdbcType=INTEGER},
  61 + </if>
  62 + <if test="columnName != null">
  63 + #{columnName,jdbcType=VARCHAR},
  64 + </if>
  65 + <if test="columnType != null">
  66 + #{columnType,jdbcType=INTEGER},
  67 + </if>
  68 + <if test="sort != null">
  69 + #{sort,jdbcType=INTEGER},
  70 + </if>
  71 + <if test="createTime != null">
  72 + #{createTime,jdbcType=TIMESTAMP},
  73 + </if>
  74 + </trim>
  75 + </insert>
  76 + <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.yx.SysYxColumnType">
  77 + update sys_yx_column_type
  78 + <set>
  79 + <if test="columnName != null">
  80 + column_name = #{columnName,jdbcType=VARCHAR},
  81 + </if>
  82 + <if test="columnType != null">
  83 + column_type = #{columnType,jdbcType=INTEGER},
  84 + </if>
  85 + <if test="sort != null">
  86 + sort = #{sort,jdbcType=INTEGER},
  87 + </if>
  88 + <if test="createTime != null">
  89 + create_time = #{createTime,jdbcType=TIMESTAMP},
  90 + </if>
  91 + </set>
  92 + where id = #{id,jdbcType=INTEGER}
  93 + </update>
  94 +
  95 + <select id="countSort" resultMap="BaseResultMap">
  96 + select * from university_column_type where type = #{type}
  97 + <choose>
  98 + <when test="flag ==1">
  99 + and sort >= #{sort}
  100 + </when>
  101 + <when test="flag ==2">
  102 + and sort >= #{sort} and id != #{id}
  103 + </when>
  104 + </choose>
  105 + order by sort asc
  106 + </select>
  107 +</mapper>
0 108 \ No newline at end of file
... ...
src/main/resources/mapper/SysYxSchoolConsultMapper.xml 0 → 100644
... ... @@ -0,0 +1,199 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.sincere.student.mapper.SysYxSchoolConsultMapper">
  4 + <resultMap id="BaseResultMap" type="com.sincere.student.model.yx.SysYxSchoolConsult">
  5 + <id column="id" jdbcType="INTEGER" property="id" />
  6 + <result column="school_id" jdbcType="INTEGER" property="schoolId" />
  7 + <result column="title_desc" jdbcType="VARCHAR" property="titleDesc" />
  8 + <result column="video_url" jdbcType="VARCHAR" property="videoUrl" />
  9 + <result column="context" jdbcType="VARCHAR" property="context" />
  10 + <result column="img_url" jdbcType="VARCHAR" property="imgUrl" />
  11 + <result column="sort" jdbcType="INTEGER" property="sort" />
  12 + <result column="status" jdbcType="INTEGER" property="status" />
  13 + <result column="read_number" jdbcType="INTEGER" property="readNumber" />
  14 + <result column="background" jdbcType="VARCHAR" property="background" />
  15 + <result column="model_list" jdbcType="VARCHAR" property="modelList" />
  16 + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  17 + </resultMap>
  18 + <sql id="Base_Column_List">
  19 + id, school_id, title_desc, video_url, context, img_url, sort, status, read_number,
  20 + background, model_list,create_time
  21 + </sql>
  22 + <sql id="Blob_Column_List">
  23 + model_list
  24 + </sql>
  25 + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  26 + select
  27 + <include refid="Base_Column_List" />
  28 + from sys_yx_school_consult
  29 + where id = #{id,jdbcType=INTEGER}
  30 + </select>
  31 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  32 + delete from sys_yx_school_consult
  33 + where id = #{id,jdbcType=INTEGER}
  34 + </delete>
  35 +
  36 + <select id="selectList" parameterType="com.sincere.student.dto.yx.AddYxSchoolConsultVo" resultMap="BaseResultMap">
  37 + select
  38 + id, school_id, title_desc, video_url, context, img_url, sort, status, read_number,background,create_time
  39 + from sys_yx_school_consult
  40 + <where>
  41 + <if test="schoolId != null">
  42 + and school_id = #{schoolId}
  43 + </if>
  44 + <if test="titleDesc != null and titleDesc !=''">
  45 + and title_desc = #{titleDesc}
  46 + </if>
  47 + </where>
  48 + </select>
  49 +
  50 + <select id="getListCount" parameterType="com.sincere.student.dto.yx.AddYxSchoolConsultVo" resultMap="BaseResultMap">
  51 + select
  52 + count(1)
  53 + from sys_yx_school_consult
  54 + <where>
  55 + <if test="schoolId != null">
  56 + and school_id = #{schoolId}
  57 + </if>
  58 + <if test="titleDesc != null">
  59 + and title_desc like #{titleDesc}
  60 + </if>
  61 + </where>
  62 + </select>
  63 +
  64 + <insert id="insertSelective" parameterType="com.sincere.student.model.yx.SysYxSchoolConsult">
  65 + insert into sys_yx_school_consult
  66 + <trim prefix="(" suffix=")" suffixOverrides=",">
  67 + <if test="id != null">
  68 + id,
  69 + </if>
  70 + <if test="schoolId != null">
  71 + school_id,
  72 + </if>
  73 + <if test="titleDesc != null">
  74 + title_desc,
  75 + </if>
  76 + <if test="videoUrl != null">
  77 + video_url,
  78 + </if>
  79 + <if test="context != null">
  80 + context,
  81 + </if>
  82 + <if test="imgUrl != null">
  83 + img_url,
  84 + </if>
  85 + <if test="sort != null">
  86 + sort,
  87 + </if>
  88 + <if test="status != null">
  89 + status,
  90 + </if>
  91 + <if test="readNumber != null">
  92 + read_number,
  93 + </if>
  94 + <if test="background != null">
  95 + background,
  96 + </if>
  97 + <if test="createTime != null">
  98 + create_time,
  99 + </if>
  100 + <if test="modelList != null">
  101 + model_list,
  102 + </if>
  103 + </trim>
  104 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  105 + <if test="id != null">
  106 + #{id,jdbcType=INTEGER},
  107 + </if>
  108 + <if test="schoolId != null">
  109 + #{schoolId,jdbcType=INTEGER},
  110 + </if>
  111 + <if test="titleDesc != null">
  112 + #{titleDesc,jdbcType=VARCHAR},
  113 + </if>
  114 + <if test="videoUrl != null">
  115 + #{videoUrl,jdbcType=VARCHAR},
  116 + </if>
  117 + <if test="context != null">
  118 + #{context,jdbcType=VARCHAR},
  119 + </if>
  120 + <if test="imgUrl != null">
  121 + #{imgUrl,jdbcType=VARCHAR},
  122 + </if>
  123 + <if test="sort != null">
  124 + #{sort,jdbcType=INTEGER},
  125 + </if>
  126 + <if test="status != null">
  127 + #{status,jdbcType=INTEGER},
  128 + </if>
  129 + <if test="readNumber != null">
  130 + #{readNumber,jdbcType=INTEGER},
  131 + </if>
  132 + <if test="background != null">
  133 + #{background,jdbcType=VARCHAR},
  134 + </if>
  135 + <if test="createTime != null">
  136 + #{createTime,jdbcType=TIMESTAMP},
  137 + </if>
  138 + <if test="modelList != null">
  139 + #{modelList,jdbcType=LONGVARCHAR},
  140 + </if>
  141 + </trim>
  142 + </insert>
  143 + <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.yx.SysYxSchoolConsult">
  144 + update sys_yx_school_consult
  145 + <set>
  146 + <if test="schoolId != null">
  147 + school_id = #{schoolId,jdbcType=INTEGER},
  148 + </if>
  149 + <if test="titleDesc != null">
  150 + title_desc = #{titleDesc,jdbcType=VARCHAR},
  151 + </if>
  152 + <if test="videoUrl != null">
  153 + video_url = #{videoUrl,jdbcType=VARCHAR},
  154 + </if>
  155 + <if test="context != null">
  156 + context = #{context,jdbcType=VARCHAR},
  157 + </if>
  158 + <if test="imgUrl != null">
  159 + img_url = #{imgUrl,jdbcType=VARCHAR},
  160 + </if>
  161 + <if test="sort != null">
  162 + sort = #{sort,jdbcType=INTEGER},
  163 + </if>
  164 + <if test="status != null">
  165 + status = #{status,jdbcType=INTEGER},
  166 + </if>
  167 + <if test="readNumber != null">
  168 + read_number = #{readNumber,jdbcType=INTEGER},
  169 + </if>
  170 + <if test="background != null">
  171 + background = #{background,jdbcType=VARCHAR},
  172 + </if>
  173 + <if test="createTime != null">
  174 + create_time = #{createTime,jdbcType=TIMESTAMP},
  175 + </if>
  176 + <if test="modelList != null">
  177 + model_list = #{modelList,jdbcType=LONGVARCHAR},
  178 + </if>
  179 + </set>
  180 + where id = #{id,jdbcType=INTEGER}
  181 + </update>
  182 +
  183 + <select id="countSort" resultMap="BaseResultMap">
  184 + select * from university_consult where
  185 + <choose>
  186 + <when test="flag ==1">
  187 + sort >= #{sort}
  188 + </when>
  189 + <when test="flag ==2">
  190 + sort >= #{sort} and id != #{id}
  191 + </when>
  192 + </choose>
  193 + order by sort asc
  194 + </select>
  195 +
  196 + <update id="updateSort" parameterType="com.sincere.student.model.yx.SysYxSchoolConsult">
  197 + update university_consult set sort = #{sort} where id=#{id}
  198 + </update>
  199 +</mapper>
0 200 \ No newline at end of file
... ...
src/main/resources/mapper/SysYxSchoolMapper.xml 0 → 100644
... ... @@ -0,0 +1,98 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.sincere.student.mapper.SysYxSchoolMapper">
  4 + <resultMap id="BaseResultMap" type="com.sincere.student.model.yx.SysYxSchool">
  5 + <id column="id" jdbcType="INTEGER" property="id" />
  6 + <result column="school_name" jdbcType="VARCHAR" property="schoolName" />
  7 + <result column="school_type" jdbcType="INTEGER" property="schoolType" />
  8 + <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  9 + </resultMap>
  10 + <sql id="Base_Column_List">
  11 + id, school_name, school_type, create_time
  12 + </sql>
  13 + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  14 + select
  15 + <include refid="Base_Column_List" />
  16 + from sys_yx_school
  17 + where id = #{id,jdbcType=INTEGER}
  18 + </select>
  19 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  20 + delete from sys_yx_school
  21 + where id = #{id,jdbcType=INTEGER}
  22 + </delete>
  23 +
  24 + <select id="selectList" parameterType="com.sincere.student.dto.yx.AddYxSchoolVo" resultMap="BaseResultMap">
  25 + select
  26 + <include refid="Base_Column_List"/>
  27 + from sys_yx_school
  28 + <where>
  29 + <if test="schoolName != null and schoolName !=''">
  30 + and school_name = #{schoolName}
  31 + </if>
  32 + <if test="schoolType != null">
  33 + and school_type = #{schoolType}
  34 + </if>
  35 + </where>
  36 + </select>
  37 +
  38 + <select id="getListCount" parameterType="com.sincere.student.dto.yx.AddYxSchoolVo" resultType="java.lang.Integer">
  39 + select
  40 + count(0)
  41 + from sys_yx_school
  42 + <where>
  43 + <if test="schoolName != null">
  44 + and school_name = #{schoolName}
  45 + </if>
  46 + <if test="schoolType != null">
  47 + and school_type = #{schoolType}
  48 + </if>
  49 + </where>
  50 + </select>
  51 +
  52 + <insert id="insertSelective" parameterType="com.sincere.student.model.yx.SysYxSchool">
  53 + insert into sys_yx_school
  54 + <trim prefix="(" suffix=")" suffixOverrides=",">
  55 + <if test="id != null">
  56 + id,
  57 + </if>
  58 + <if test="schoolName != null">
  59 + school_name,
  60 + </if>
  61 + <if test="schoolType != null">
  62 + school_type,
  63 + </if>
  64 + <if test="createTime != null">
  65 + create_time,
  66 + </if>
  67 + </trim>
  68 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  69 + <if test="id != null">
  70 + #{id,jdbcType=INTEGER},
  71 + </if>
  72 + <if test="schoolName != null">
  73 + #{schoolName,jdbcType=VARCHAR},
  74 + </if>
  75 + <if test="schoolType != null">
  76 + #{schoolType,jdbcType=INTEGER},
  77 + </if>
  78 + <if test="createTime != null">
  79 + #{createTime,jdbcType=TIMESTAMP},
  80 + </if>
  81 + </trim>
  82 + </insert>
  83 + <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.yx.SysYxSchool">
  84 + update sys_yx_school
  85 + <set>
  86 + <if test="schoolName != null">
  87 + school_name = #{schoolName,jdbcType=VARCHAR},
  88 + </if>
  89 + <if test="schoolType != null">
  90 + school_type = #{schoolType,jdbcType=INTEGER},
  91 + </if>
  92 + <if test="createTime != null">
  93 + create_time = #{createTime,jdbcType=TIMESTAMP},
  94 + </if>
  95 + </set>
  96 + where id = #{id,jdbcType=INTEGER}
  97 + </update>
  98 +</mapper>
0 99 \ No newline at end of file
... ...