Commit be5d580a9198748eea380df6e5502abb63447a38
1 parent
b9411514
Exists in
master
加发布 预览功能
Showing
16 changed files
with
139 additions
and
201 deletions
Show diff stats
pom.xml
| @@ -9,34 +9,10 @@ | @@ -9,34 +9,10 @@ | ||
| 9 | </parent> | 9 | </parent> |
| 10 | <modelVersion>4.0.0</modelVersion> | 10 | <modelVersion>4.0.0</modelVersion> |
| 11 | 11 | ||
| 12 | - <artifactId>EnrollStudent_independent</artifactId> | 12 | + <artifactId>enrollStudent</artifactId> |
| 13 | 13 | ||
| 14 | <dependencies> | 14 | <dependencies> |
| 15 | <dependency> | 15 | <dependency> |
| 16 | - <groupId>org.apache.httpcomponents</groupId> | ||
| 17 | - <artifactId>httpclient</artifactId> | ||
| 18 | - <version>4.3</version> | ||
| 19 | - </dependency> | ||
| 20 | - <dependency> | ||
| 21 | - <groupId>org.apache.httpcomponents</groupId> | ||
| 22 | - <artifactId>httpmime</artifactId> | ||
| 23 | - <version>4.5.3</version> | ||
| 24 | - </dependency> | ||
| 25 | - <dependency> | ||
| 26 | - <groupId>org.thymeleaf</groupId> | ||
| 27 | - <artifactId>thymeleaf</artifactId> | ||
| 28 | - <version>3.0.9.RELEASE</version> | ||
| 29 | - </dependency> | ||
| 30 | - <dependency> | ||
| 31 | - <groupId>org.thymeleaf</groupId> | ||
| 32 | - <artifactId>thymeleaf-spring4</artifactId> | ||
| 33 | - <version>3.0.9.RELEASE</version> | ||
| 34 | - </dependency> | ||
| 35 | - <dependency> | ||
| 36 | - <groupId>org.springframework.boot</groupId> | ||
| 37 | - <artifactId>spring-boot-starter-thymeleaf</artifactId> | ||
| 38 | - </dependency> | ||
| 39 | - <dependency> | ||
| 40 | <groupId>org.mybatis.generator</groupId> | 16 | <groupId>org.mybatis.generator</groupId> |
| 41 | <artifactId>mybatis-generator-core</artifactId> | 17 | <artifactId>mybatis-generator-core</artifactId> |
| 42 | <version>1.3.5</version> | 18 | <version>1.3.5</version> |
src/main/java/com/sincere/student/controller/AdminController.java
| @@ -12,6 +12,7 @@ import com.sincere.student.utils.Page; | @@ -12,6 +12,7 @@ import com.sincere.student.utils.Page; | ||
| 12 | import com.sincere.student.utils.ResultException; | 12 | import com.sincere.student.utils.ResultException; |
| 13 | import com.sincere.student.utils.TokenUtils; | 13 | import com.sincere.student.utils.TokenUtils; |
| 14 | import io.swagger.annotations.ApiOperation; | 14 | import io.swagger.annotations.ApiOperation; |
| 15 | +import org.apache.commons.lang3.StringUtils; | ||
| 15 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | import org.springframework.web.bind.annotation.*; | 17 | import org.springframework.web.bind.annotation.*; |
| 17 | 18 | ||
| @@ -180,6 +181,7 @@ public class AdminController { | @@ -180,6 +181,7 @@ public class AdminController { | ||
| 180 | @RequestMapping(value = "/consult/getList" , method = RequestMethod.POST) | 181 | @RequestMapping(value = "/consult/getList" , method = RequestMethod.POST) |
| 181 | public BaseDto<Page<Consult>> getConsultList(@RequestBody ConsultSearchDto consultSearchDto){ | 182 | public BaseDto<Page<Consult>> getConsultList(@RequestBody ConsultSearchDto consultSearchDto){ |
| 182 | BaseDto<Page<Consult>> result = new BaseDto<>() ; | 183 | BaseDto<Page<Consult>> result = new BaseDto<>() ; |
| 184 | + consultSearchDto.setStatus(0); | ||
| 183 | Page<Consult> page = consultService.getList(consultSearchDto); | 185 | Page<Consult> page = consultService.getList(consultSearchDto); |
| 184 | result.setData(page); | 186 | result.setData(page); |
| 185 | return result ; | 187 | return result ; |
| @@ -229,6 +231,7 @@ public class AdminController { | @@ -229,6 +231,7 @@ public class AdminController { | ||
| 229 | @RequestMapping(value = "/video/getList" , method = RequestMethod.POST) | 231 | @RequestMapping(value = "/video/getList" , method = RequestMethod.POST) |
| 230 | public BaseDto<Page<Video>> getVideoList(@RequestBody VideoSearchDto videoSearchDto){ | 232 | public BaseDto<Page<Video>> getVideoList(@RequestBody VideoSearchDto videoSearchDto){ |
| 231 | BaseDto<Page<Video>> result = new BaseDto<>() ; | 233 | BaseDto<Page<Video>> result = new BaseDto<>() ; |
| 234 | + videoSearchDto.setStatus(0); | ||
| 232 | Page<Video> page = videoService.getList(videoSearchDto); | 235 | Page<Video> page = videoService.getList(videoSearchDto); |
| 233 | result.setData(page); | 236 | result.setData(page); |
| 234 | return result ; | 237 | return result ; |
| @@ -402,6 +405,7 @@ public class AdminController { | @@ -402,6 +405,7 @@ public class AdminController { | ||
| 402 | @RequestMapping(value = "/article/getList" , method = RequestMethod.POST) | 405 | @RequestMapping(value = "/article/getList" , method = RequestMethod.POST) |
| 403 | public BaseDto<Page<Article>> getArticleList(@RequestBody ArticleSearchDto articleSearchDto){ | 406 | public BaseDto<Page<Article>> getArticleList(@RequestBody ArticleSearchDto articleSearchDto){ |
| 404 | BaseDto<Page<Article>> result = new BaseDto<>() ; | 407 | BaseDto<Page<Article>> result = new BaseDto<>() ; |
| 408 | + articleSearchDto.setStatus(0); | ||
| 405 | Page<Article> page = articleService.getList(articleSearchDto); | 409 | Page<Article> page = articleService.getList(articleSearchDto); |
| 406 | result.setData(page); | 410 | result.setData(page); |
| 407 | return result ; | 411 | return result ; |
| @@ -479,8 +483,13 @@ public class AdminController { | @@ -479,8 +483,13 @@ public class AdminController { | ||
| 479 | @RequestMapping(value = "/advert/createBanner" , method = RequestMethod.POST) | 483 | @RequestMapping(value = "/advert/createBanner" , method = RequestMethod.POST) |
| 480 | public BaseDto createBanner(@RequestBody Advert advert){ | 484 | public BaseDto createBanner(@RequestBody Advert advert){ |
| 481 | BaseDto result = new BaseDto(); | 485 | BaseDto result = new BaseDto(); |
| 482 | - advert.setType(AdvertEnums.banner.getType()); | ||
| 483 | - advertService.create(advert); | 486 | + if(StringUtils.isBlank(advert.getImgUrl())){ |
| 487 | + result.setSuccess(false); | ||
| 488 | + result.setMessage("图片地址不能为空"); | ||
| 489 | + }else { | ||
| 490 | + advert.setType(AdvertEnums.banner.getType()); | ||
| 491 | + advertService.create(advert); | ||
| 492 | + } | ||
| 484 | return result ; | 493 | return result ; |
| 485 | } | 494 | } |
| 486 | 495 |
src/main/java/com/sincere/student/controller/AppController.java
| @@ -121,6 +121,7 @@ public class AppController { | @@ -121,6 +121,7 @@ public class AppController { | ||
| 121 | @RequestMapping(value = "/consult/getList" , method = RequestMethod.POST) | 121 | @RequestMapping(value = "/consult/getList" , method = RequestMethod.POST) |
| 122 | public BaseDto<Page<Consult>> getConsultList(@RequestBody ConsultSearchDto consultSearchDto){ | 122 | public BaseDto<Page<Consult>> getConsultList(@RequestBody ConsultSearchDto consultSearchDto){ |
| 123 | BaseDto<Page<Consult>> result = new BaseDto<>() ; | 123 | BaseDto<Page<Consult>> result = new BaseDto<>() ; |
| 124 | + consultSearchDto.setStatus(1); | ||
| 124 | Page<Consult> page = consultService.getList(consultSearchDto); | 125 | Page<Consult> page = consultService.getList(consultSearchDto); |
| 125 | result.setData(page); | 126 | result.setData(page); |
| 126 | return result ; | 127 | return result ; |
| @@ -161,6 +162,7 @@ public class AppController { | @@ -161,6 +162,7 @@ public class AppController { | ||
| 161 | @RequestMapping(value = "/article/getList" , method = RequestMethod.POST) | 162 | @RequestMapping(value = "/article/getList" , method = RequestMethod.POST) |
| 162 | public BaseDto<Page<Article>> getArticleList(@RequestBody ArticleSearchDto articleSearchDto){ | 163 | public BaseDto<Page<Article>> getArticleList(@RequestBody ArticleSearchDto articleSearchDto){ |
| 163 | BaseDto<Page<Article>> result = new BaseDto<>() ; | 164 | BaseDto<Page<Article>> result = new BaseDto<>() ; |
| 165 | + articleSearchDto.setStatus(1); | ||
| 164 | Page<Article> page = articleService.getList(articleSearchDto); | 166 | Page<Article> page = articleService.getList(articleSearchDto); |
| 165 | result.setData(page); | 167 | result.setData(page); |
| 166 | return result ; | 168 | return result ; |
| @@ -224,6 +226,7 @@ public class AppController { | @@ -224,6 +226,7 @@ public class AppController { | ||
| 224 | @RequestMapping(value = "/video/getList" , method = RequestMethod.POST) | 226 | @RequestMapping(value = "/video/getList" , method = RequestMethod.POST) |
| 225 | public BaseDto<Page<Video>> getVideoList(@RequestBody VideoSearchDto videoSearchDto){ | 227 | public BaseDto<Page<Video>> getVideoList(@RequestBody VideoSearchDto videoSearchDto){ |
| 226 | BaseDto<Page<Video>> result = new BaseDto<>() ; | 228 | BaseDto<Page<Video>> result = new BaseDto<>() ; |
| 229 | + videoSearchDto.setStatus(1); | ||
| 227 | Page<Video> page = videoService.getList(videoSearchDto); | 230 | Page<Video> page = videoService.getList(videoSearchDto); |
| 228 | result.setData(page); | 231 | result.setData(page); |
| 229 | return result ; | 232 | return result ; |
src/main/java/com/sincere/student/controller/IndexController.java
| 1 | package com.sincere.student.controller; | 1 | package com.sincere.student.controller; |
| 2 | 2 | ||
| 3 | -import com.sincere.student.utils.HttpClientUtils; | ||
| 4 | import org.springframework.stereotype.Controller; | 3 | import org.springframework.stereotype.Controller; |
| 5 | import org.springframework.web.bind.annotation.RequestMapping; | 4 | import org.springframework.web.bind.annotation.RequestMapping; |
| 6 | import org.springframework.web.bind.annotation.RequestMethod; | 5 | import org.springframework.web.bind.annotation.RequestMethod; |
| @@ -24,37 +23,6 @@ public class IndexController { | @@ -24,37 +23,6 @@ public class IndexController { | ||
| 24 | @ResponseBody | 23 | @ResponseBody |
| 25 | @RequestMapping(value = "upload" ,method = RequestMethod.POST) | 24 | @RequestMapping(value = "upload" ,method = RequestMethod.POST) |
| 26 | public String upload(@RequestParam("file") MultipartFile file) throws Exception{ | 25 | public String upload(@RequestParam("file") MultipartFile file) throws Exception{ |
| 27 | - //return file.getOriginalFilename() ; | ||
| 28 | - return HttpClientUtils.upload("http://121.40.109.21:8083/file-center/file/fileUpload",multipartFileToFile(file),file.getOriginalFilename()); | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | - public File multipartFileToFile(MultipartFile file) throws Exception { | ||
| 32 | - | ||
| 33 | - File toFile = null; | ||
| 34 | - if (file.equals("") || file.getSize() <= 0) { | ||
| 35 | - file = null; | ||
| 36 | - } else { | ||
| 37 | - InputStream ins = null; | ||
| 38 | - ins = file.getInputStream(); | ||
| 39 | - toFile = new File(file.getOriginalFilename()); | ||
| 40 | - inputStreamToFile(ins, toFile); | ||
| 41 | - ins.close(); | ||
| 42 | - } | ||
| 43 | - return toFile; | ||
| 44 | - } | ||
| 45 | - | ||
| 46 | - private void inputStreamToFile(InputStream ins, File file) { | ||
| 47 | - try { | ||
| 48 | - OutputStream os = new FileOutputStream(file); | ||
| 49 | - int bytesRead = 0; | ||
| 50 | - byte[] buffer = new byte[8192]; | ||
| 51 | - while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) { | ||
| 52 | - os.write(buffer, 0, bytesRead); | ||
| 53 | - } | ||
| 54 | - os.close(); | ||
| 55 | - ins.close(); | ||
| 56 | - } catch (Exception e) { | ||
| 57 | - e.printStackTrace(); | ||
| 58 | - } | 26 | + return file.getOriginalFilename() ; |
| 59 | } | 27 | } |
| 60 | } | 28 | } |
src/main/java/com/sincere/student/dto/ArticleSearchDto.java
| @@ -12,6 +12,16 @@ public class ArticleSearchDto extends PageDto{ | @@ -12,6 +12,16 @@ public class ArticleSearchDto extends PageDto{ | ||
| 12 | private String title ; | 12 | private String title ; |
| 13 | @ApiModelProperty(value = "文章栏目") | 13 | @ApiModelProperty(value = "文章栏目") |
| 14 | private int columnType ; | 14 | private int columnType ; |
| 15 | + @ApiModelProperty(value = "状态 0预览1发布 都不用传") | ||
| 16 | + private int status ; | ||
| 17 | + | ||
| 18 | + public int getStatus() { | ||
| 19 | + return status; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + public void setStatus(int status) { | ||
| 23 | + this.status = status; | ||
| 24 | + } | ||
| 15 | 25 | ||
| 16 | public int getArticleType() { | 26 | public int getArticleType() { |
| 17 | return articleType; | 27 | return articleType; |
src/main/java/com/sincere/student/dto/ConsultSearchDto.java
| @@ -16,6 +16,16 @@ public class ConsultSearchDto extends PageDto { | @@ -16,6 +16,16 @@ public class ConsultSearchDto extends PageDto { | ||
| 16 | private String city ; | 16 | private String city ; |
| 17 | @ApiModelProperty(value = "专业") | 17 | @ApiModelProperty(value = "专业") |
| 18 | private String majorName ; | 18 | private String majorName ; |
| 19 | + @ApiModelProperty(value = "状态 0预览1发布 都不用传") | ||
| 20 | + private int status ; | ||
| 21 | + | ||
| 22 | + public int getStatus() { | ||
| 23 | + return status; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public void setStatus(int status) { | ||
| 27 | + this.status = status; | ||
| 28 | + } | ||
| 19 | 29 | ||
| 20 | public int getColumnType() { | 30 | public int getColumnType() { |
| 21 | return columnType; | 31 | return columnType; |
src/main/java/com/sincere/student/dto/VideoSearchDto.java
| @@ -11,7 +11,16 @@ public class VideoSearchDto extends PageDto { | @@ -11,7 +11,16 @@ public class VideoSearchDto extends PageDto { | ||
| 11 | 11 | ||
| 12 | @ApiModelProperty(value = "查询名称") | 12 | @ApiModelProperty(value = "查询名称") |
| 13 | private String universityName ; | 13 | private String universityName ; |
| 14 | + @ApiModelProperty(value = "状态 0预览1发布 都不用传") | ||
| 15 | + private int status ; | ||
| 14 | 16 | ||
| 17 | + public int getStatus() { | ||
| 18 | + return status; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + public void setStatus(int status) { | ||
| 22 | + this.status = status; | ||
| 23 | + } | ||
| 15 | public int getColumnTypeId() { | 24 | public int getColumnTypeId() { |
| 16 | return columnTypeId; | 25 | return columnTypeId; |
| 17 | } | 26 | } |
src/main/java/com/sincere/student/model/Article.java
| @@ -36,7 +36,16 @@ public class Article { | @@ -36,7 +36,16 @@ public class Article { | ||
| 36 | private Date createTime ; | 36 | private Date createTime ; |
| 37 | @ApiModelProperty(value = "文章类型 1广告文章 2权威解读 ") | 37 | @ApiModelProperty(value = "文章类型 1广告文章 2权威解读 ") |
| 38 | private int type ; | 38 | private int type ; |
| 39 | + @ApiModelProperty(value = "状态 0预览1发布") | ||
| 40 | + private int status ; | ||
| 39 | 41 | ||
| 42 | + public int getStatus() { | ||
| 43 | + return status; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public void setStatus(int status) { | ||
| 47 | + this.status = status; | ||
| 48 | + } | ||
| 40 | public int getType() { | 49 | public int getType() { |
| 41 | return type; | 50 | return type; |
| 42 | } | 51 | } |
src/main/java/com/sincere/student/model/UniversityConsult.java
| @@ -26,7 +26,16 @@ public class UniversityConsult { | @@ -26,7 +26,16 @@ public class UniversityConsult { | ||
| 26 | private Integer sort; | 26 | private Integer sort; |
| 27 | @ApiModelProperty(value = "4个栏目") | 27 | @ApiModelProperty(value = "4个栏目") |
| 28 | private List<UniversityConsultDetail> list; | 28 | private List<UniversityConsultDetail> list; |
| 29 | + @ApiModelProperty(value = "状态 0预览1发布") | ||
| 30 | + private int status ; | ||
| 29 | 31 | ||
| 32 | + public int getStatus() { | ||
| 33 | + return status; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public void setStatus(int status) { | ||
| 37 | + this.status = status; | ||
| 38 | + } | ||
| 30 | public List<UniversityConsultDetail> getList() { | 39 | public List<UniversityConsultDetail> getList() { |
| 31 | return list; | 40 | return list; |
| 32 | } | 41 | } |
src/main/java/com/sincere/student/model/Video.java
| @@ -24,6 +24,16 @@ public class Video { | @@ -24,6 +24,16 @@ public class Video { | ||
| 24 | private String universityName; | 24 | private String universityName; |
| 25 | @ApiModelProperty(value = "学校编码 展示用") | 25 | @ApiModelProperty(value = "学校编码 展示用") |
| 26 | private String universityCode; | 26 | private String universityCode; |
| 27 | + @ApiModelProperty(value = "状态 0预览1发布") | ||
| 28 | + private int status ; | ||
| 29 | + | ||
| 30 | + public int getStatus() { | ||
| 31 | + return status; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public void setStatus(int status) { | ||
| 35 | + this.status = status; | ||
| 36 | + } | ||
| 27 | 37 | ||
| 28 | public String getUniversityCode() { | 38 | public String getUniversityCode() { |
| 29 | return universityCode; | 39 | return universityCode; |
src/main/java/com/sincere/student/utils/ExcelUtils.java
| @@ -38,8 +38,8 @@ public class ExcelUtils { | @@ -38,8 +38,8 @@ public class ExcelUtils { | ||
| 38 | // 获得工作簿 | 38 | // 获得工作簿 |
| 39 | String file = excelFile.getName(); | 39 | String file = excelFile.getName(); |
| 40 | Workbook workbook = null; | 40 | Workbook workbook = null; |
| 41 | - //InputStream inputStream = GetFileInputStream(url); | ||
| 42 | - InputStream inputStream = new FileInputStream(url); | 41 | + InputStream inputStream = GetFileInputStream(url); |
| 42 | + //InputStream inputStream = new FileInputStream(url); | ||
| 43 | if(inputStream == null){ | 43 | if(inputStream == null){ |
| 44 | throw new ResultException(901,"路径错误"); | 44 | throw new ResultException(901,"路径错误"); |
| 45 | } | 45 | } |
src/main/java/com/sincere/student/utils/HttpClientUtils.java
| @@ -1,81 +0,0 @@ | @@ -1,81 +0,0 @@ | ||
| 1 | -package com.sincere.student.utils; | ||
| 2 | - | ||
| 3 | -import org.apache.http.HttpEntity; | ||
| 4 | -import org.apache.http.client.ClientProtocolException; | ||
| 5 | -import org.apache.http.client.config.RequestConfig; | ||
| 6 | -import org.apache.http.client.methods.CloseableHttpResponse; | ||
| 7 | -import org.apache.http.client.methods.HttpPost; | ||
| 8 | -import org.apache.http.entity.ContentType; | ||
| 9 | -import org.apache.http.entity.mime.MultipartEntityBuilder; | ||
| 10 | -import org.apache.http.entity.mime.content.FileBody; | ||
| 11 | -import org.apache.http.entity.mime.content.StringBody; | ||
| 12 | -import org.apache.http.impl.client.CloseableHttpClient; | ||
| 13 | -import org.apache.http.impl.client.HttpClients; | ||
| 14 | -import org.apache.http.util.EntityUtils; | ||
| 15 | - | ||
| 16 | -import java.io.File; | ||
| 17 | -import java.io.IOException; | ||
| 18 | - | ||
| 19 | -/** | ||
| 20 | - * HttpClient4.3工具类 | ||
| 21 | - * @author chen | ||
| 22 | - * @version 1.0 | ||
| 23 | - * @date 2019/10/11 0011 10:17 | ||
| 24 | - */ | ||
| 25 | -public class HttpClientUtils { | ||
| 26 | - | ||
| 27 | - private static RequestConfig requestConfig = null; | ||
| 28 | - | ||
| 29 | - static { | ||
| 30 | - // 设置请求和传输超时时间 | ||
| 31 | - requestConfig = RequestConfig.custom().setSocketTimeout(5000).setConnectTimeout(5000).build(); | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | - public static void main(String[] args){ | ||
| 35 | -// String url = "http://http://zhktest.114school.com.cn/szkjapi/toyxy/addTeacherOrg" ; | ||
| 36 | -// String json = "{\"name\": \"子部门\",\"groupname\": \"父部门\",\"schoolid\": \"16\",\"token\": \"05719991\"}" ; | ||
| 37 | -// JSONObject jsonObject = HttpClientUtils.httpPostJson(url,json); | ||
| 38 | -// System.out.println(jsonObject.toJSONString()); | ||
| 39 | - } | ||
| 40 | - | ||
| 41 | - | ||
| 42 | - public static String upload(String url, File file, String filename) { | ||
| 43 | - CloseableHttpClient httpclient = HttpClients.createDefault(); | ||
| 44 | - try { | ||
| 45 | - HttpPost httppost = new HttpPost(url); | ||
| 46 | - RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(200000).setSocketTimeout(200000).build(); | ||
| 47 | - httppost.setConfig(requestConfig); | ||
| 48 | - FileBody bin = new FileBody(file); | ||
| 49 | - StringBody comment = new StringBody(filename, ContentType.TEXT_PLAIN); | ||
| 50 | - HttpEntity reqEntity = MultipartEntityBuilder.create().addPart("file", bin).addPart("filename", comment).build(); | ||
| 51 | - httppost.setEntity(reqEntity); | ||
| 52 | - httppost.setHeader("ossPath","test"); | ||
| 53 | - System.out.println("executing request " + httppost.getRequestLine()); | ||
| 54 | - CloseableHttpResponse response = httpclient.execute(httppost); | ||
| 55 | - try { | ||
| 56 | - System.out.println(response.getStatusLine()); | ||
| 57 | - HttpEntity resEntity = response.getEntity(); | ||
| 58 | - if (resEntity != null) { | ||
| 59 | - String responseEntityStr = EntityUtils.toString(response.getEntity()); | ||
| 60 | - System.out.println(responseEntityStr); | ||
| 61 | - return responseEntityStr ; | ||
| 62 | - } | ||
| 63 | - EntityUtils.consume(resEntity); | ||
| 64 | - } finally { | ||
| 65 | - response.close(); | ||
| 66 | - } | ||
| 67 | - } catch (ClientProtocolException e) { | ||
| 68 | - e.printStackTrace(); | ||
| 69 | - } catch (IOException e) { | ||
| 70 | - e.printStackTrace(); | ||
| 71 | - } finally { | ||
| 72 | - try { | ||
| 73 | - httpclient.close(); | ||
| 74 | - } catch (IOException e) { | ||
| 75 | - e.printStackTrace(); | ||
| 76 | - } | ||
| 77 | - } | ||
| 78 | - return null ; | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - } |
src/main/resources/mapper/ArticleMapper.xml
| @@ -17,6 +17,7 @@ | @@ -17,6 +17,7 @@ | ||
| 17 | <result column="look_number" property="lookNumber"/> | 17 | <result column="look_number" property="lookNumber"/> |
| 18 | <result column="create_time" property="createTime"/> | 18 | <result column="create_time" property="createTime"/> |
| 19 | <result column="type" property="type"/> | 19 | <result column="type" property="type"/> |
| 20 | + <result column="status" property="status" /> | ||
| 20 | </resultMap> | 21 | </resultMap> |
| 21 | 22 | ||
| 22 | 23 | ||
| @@ -32,6 +33,12 @@ | @@ -32,6 +33,12 @@ | ||
| 32 | <if test="articleType != 0"> | 33 | <if test="articleType != 0"> |
| 33 | and type = #{articleType} | 34 | and type = #{articleType} |
| 34 | </if> | 35 | </if> |
| 36 | + <if test="status == 1"> | ||
| 37 | + and status = 1 | ||
| 38 | + </if> | ||
| 39 | + <if test="status != 1"> | ||
| 40 | + and 1 = 1 | ||
| 41 | + </if> | ||
| 35 | </where> | 42 | </where> |
| 36 | </select> | 43 | </select> |
| 37 | 44 | ||
| @@ -47,6 +54,12 @@ | @@ -47,6 +54,12 @@ | ||
| 47 | <if test="articleType != 0"> | 54 | <if test="articleType != 0"> |
| 48 | and type = #{articleType} | 55 | and type = #{articleType} |
| 49 | </if> | 56 | </if> |
| 57 | + <if test="status == 1"> | ||
| 58 | + and status = 1 | ||
| 59 | + </if> | ||
| 60 | + <if test="status != 1"> | ||
| 61 | + and 1 = 1 | ||
| 62 | + </if> | ||
| 50 | </where> | 63 | </where> |
| 51 | order by sort | 64 | order by sort |
| 52 | </select> | 65 | </select> |
| @@ -60,8 +73,8 @@ | @@ -60,8 +73,8 @@ | ||
| 60 | </select> | 73 | </select> |
| 61 | 74 | ||
| 62 | <insert id="create" parameterType="com.sincere.student.model.Article" > | 75 | <insert id="create" parameterType="com.sincere.student.model.Article" > |
| 63 | - insert into university_article (title,column_type,university_id,sort,context,author,image_url,video_url,article_link,good_number,look_number,create_time,type) | ||
| 64 | - values (#{title},#{columnType},#{universityId},#{sort},#{context},#{author},#{imageUrl},#{videoUrl},#{articleLink},#{goodNumber},#{lookNumber},GETDATE(),#{type}) | 76 | + insert into university_article (title,column_type,university_id,sort,context,author,image_url,video_url,article_link,good_number,look_number,create_time,type,status) |
| 77 | + values (#{title},#{columnType},#{universityId},#{sort},#{context},#{author},#{imageUrl},#{videoUrl},#{articleLink},#{goodNumber},#{lookNumber},GETDATE(),#{type},#{status}) | ||
| 65 | </insert> | 78 | </insert> |
| 66 | 79 | ||
| 67 | <delete id="delete" parameterType="java.lang.Integer"> | 80 | <delete id="delete" parameterType="java.lang.Integer"> |
| @@ -74,16 +87,16 @@ | @@ -74,16 +87,16 @@ | ||
| 74 | <if test="title!=null"> | 87 | <if test="title!=null"> |
| 75 | title=#{title}, | 88 | title=#{title}, |
| 76 | </if> | 89 | </if> |
| 77 | - <if test="columnType!=null"> | 90 | + <if test="columnType!=0"> |
| 78 | column_type=#{columnType}, | 91 | column_type=#{columnType}, |
| 79 | </if> | 92 | </if> |
| 80 | <if test="universityName!=null"> | 93 | <if test="universityName!=null"> |
| 81 | university_name=#{universityName}, | 94 | university_name=#{universityName}, |
| 82 | </if> | 95 | </if> |
| 83 | - <if test="universityId!=null"> | 96 | + <if test="universityId!=0"> |
| 84 | university_id=#{universityId}, | 97 | university_id=#{universityId}, |
| 85 | </if> | 98 | </if> |
| 86 | - <if test="sort!=null"> | 99 | + <if test="sort!=0"> |
| 87 | sort=#{sort}, | 100 | sort=#{sort}, |
| 88 | </if> | 101 | </if> |
| 89 | <if test="context!=null"> | 102 | <if test="context!=null"> |
| @@ -101,12 +114,15 @@ | @@ -101,12 +114,15 @@ | ||
| 101 | <if test="articleLink!=null"> | 114 | <if test="articleLink!=null"> |
| 102 | article_link=#{articleLink}, | 115 | article_link=#{articleLink}, |
| 103 | </if> | 116 | </if> |
| 104 | - <if test="goodNumber!=null"> | 117 | + <if test="goodNumber!=0"> |
| 105 | good_number=#{goodNumber}, | 118 | good_number=#{goodNumber}, |
| 106 | </if> | 119 | </if> |
| 107 | - <if test="lookNumber!=null"> | 120 | + <if test="lookNumber!=0"> |
| 108 | look_number=#{lookNumber}, | 121 | look_number=#{lookNumber}, |
| 109 | </if> | 122 | </if> |
| 123 | + <if test="status!=-1"> | ||
| 124 | + status=#{status}, | ||
| 125 | + </if> | ||
| 110 | </trim> | 126 | </trim> |
| 111 | where id = #{id} | 127 | where id = #{id} |
| 112 | </update> | 128 | </update> |
src/main/resources/mapper/UniversityConsultMapper.xml
| @@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
| 9 | <result column="code" property="code" /> | 9 | <result column="code" property="code" /> |
| 10 | <result column="sort" property="sort" /> | 10 | <result column="sort" property="sort" /> |
| 11 | <result column="img_url" property="imgUrl" /> | 11 | <result column="img_url" property="imgUrl" /> |
| 12 | + <result column="status" property="status" /> | ||
| 12 | </resultMap> | 13 | </resultMap> |
| 13 | 14 | ||
| 14 | <select id="getListCount" parameterType="com.sincere.student.dto.ConsultSearchDto" resultType="java.lang.Integer"> | 15 | <select id="getListCount" parameterType="com.sincere.student.dto.ConsultSearchDto" resultType="java.lang.Integer"> |
| @@ -35,6 +36,12 @@ | @@ -35,6 +36,12 @@ | ||
| 35 | <if test="majorName != null"> | 36 | <if test="majorName != null"> |
| 36 | and m.major like #{majorName} | 37 | and m.major like #{majorName} |
| 37 | </if> | 38 | </if> |
| 39 | + <if test="status == 1"> | ||
| 40 | + and c.status = 1 | ||
| 41 | + </if> | ||
| 42 | + <if test="status != 1"> | ||
| 43 | + and 1 = 1 | ||
| 44 | + </if> | ||
| 38 | </where> | 45 | </where> |
| 39 | </select> | 46 | </select> |
| 40 | 47 | ||
| @@ -62,6 +69,12 @@ | @@ -62,6 +69,12 @@ | ||
| 62 | <if test="majorName != null"> | 69 | <if test="majorName != null"> |
| 63 | and m.major like #{majorName} | 70 | and m.major like #{majorName} |
| 64 | </if> | 71 | </if> |
| 72 | + <if test="status == 1"> | ||
| 73 | + and c.status = 1 | ||
| 74 | + </if> | ||
| 75 | + <if test="status != 1"> | ||
| 76 | + and 1 = 1 | ||
| 77 | + </if> | ||
| 65 | </where> | 78 | </where> |
| 66 | order by c.sort | 79 | order by c.sort |
| 67 | </select> | 80 | </select> |
| @@ -69,13 +82,13 @@ | @@ -69,13 +82,13 @@ | ||
| 69 | <select id="getColumnListCount" parameterType="java.lang.Integer" resultType="java.lang.Integer"> | 82 | <select id="getColumnListCount" parameterType="java.lang.Integer" resultType="java.lang.Integer"> |
| 70 | select count(DISTINCT c.id) from university_consult c | 83 | select count(DISTINCT c.id) from university_consult c |
| 71 | join university_info info on c.university_id = info.id | 84 | join university_info info on c.university_id = info.id |
| 72 | - where c.column_type = #{columnType} | 85 | + where c.column_type = #{columnType} and c.status = 1 |
| 73 | </select> | 86 | </select> |
| 74 | 87 | ||
| 75 | <select id="getColumnList" parameterType="java.lang.Integer" resultMap="ListMap"> | 88 | <select id="getColumnList" parameterType="java.lang.Integer" resultMap="ListMap"> |
| 76 | select DISTINCT c.id , info.id as universityId , c.img_url ,c.sort , info.name , info.code from university_consult c | 89 | select DISTINCT c.id , info.id as universityId , c.img_url ,c.sort , info.name , info.code from university_consult c |
| 77 | join university_info info on c.university_id = info.id | 90 | join university_info info on c.university_id = info.id |
| 78 | - where c.column_type = #{columnType} | 91 | + where c.column_type = #{columnType} and c.status = 1 |
| 79 | order by c.sort | 92 | order by c.sort |
| 80 | </select> | 93 | </select> |
| 81 | 94 |
src/main/resources/mapper/VideoMapper.xml
| @@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
| 11 | <result column="create_time" property="createTime"/> | 11 | <result column="create_time" property="createTime"/> |
| 12 | <result column="name" property="universityName"/> | 12 | <result column="name" property="universityName"/> |
| 13 | <result column="code" property="universityCode"/> | 13 | <result column="code" property="universityCode"/> |
| 14 | + <result column="status" property="status" /> | ||
| 14 | </resultMap> | 15 | </resultMap> |
| 15 | 16 | ||
| 16 | <select id="getById" parameterType="java.lang.Integer" resultMap="VideoMap"> | 17 | <select id="getById" parameterType="java.lang.Integer" resultMap="VideoMap"> |
| @@ -20,8 +21,8 @@ | @@ -20,8 +21,8 @@ | ||
| 20 | <select id="getListCount" parameterType="com.sincere.student.dto.VideoSearchDto" resultType="java.lang.Integer"> | 21 | <select id="getListCount" parameterType="com.sincere.student.dto.VideoSearchDto" resultType="java.lang.Integer"> |
| 21 | select count(0) from university_video v join university_info info on v.university_id = info.id | 22 | select count(0) from university_video v join university_info info on v.university_id = info.id |
| 22 | <where> | 23 | <where> |
| 23 | - <if test="universityName != 0"> | ||
| 24 | - and v.column_type = #{columnType} | 24 | + <if test="columnTypeId != 0"> |
| 25 | + and v.column_type = #{columnTypeId} | ||
| 25 | </if> | 26 | </if> |
| 26 | <if test="universityName == 0"> | 27 | <if test="universityName == 0"> |
| 27 | and 1 = 1 | 28 | and 1 = 1 |
| @@ -29,22 +30,37 @@ | @@ -29,22 +30,37 @@ | ||
| 29 | <if test="universityName != null"> | 30 | <if test="universityName != null"> |
| 30 | and info.name like #{universityName} | 31 | and info.name like #{universityName} |
| 31 | </if> | 32 | </if> |
| 33 | + <if test="status == 1"> | ||
| 34 | + and status = 1 | ||
| 35 | + </if> | ||
| 36 | + <if test="status != 1"> | ||
| 37 | + and 1 = 1 | ||
| 38 | + </if> | ||
| 32 | </where> | 39 | </where> |
| 33 | </select> | 40 | </select> |
| 34 | 41 | ||
| 35 | <select id="getList" parameterType="com.sincere.student.dto.ArticleSearchDto" resultMap="VideoMap"> | 42 | <select id="getList" parameterType="com.sincere.student.dto.ArticleSearchDto" resultMap="VideoMap"> |
| 36 | select v.*,info.name,info.code from university_video v join university_info info on v.university_id = info.id | 43 | select v.*,info.name,info.code from university_video v join university_info info on v.university_id = info.id |
| 37 | <where> | 44 | <where> |
| 45 | + <if test="columnTypeId != 0"> | ||
| 46 | + and v.column_type = #{columnTypeId} | ||
| 47 | + </if> | ||
| 38 | <if test="universityName != null"> | 48 | <if test="universityName != null"> |
| 39 | and info.name like #{universityName} | 49 | and info.name like #{universityName} |
| 40 | </if> | 50 | </if> |
| 51 | + <if test="status == 1"> | ||
| 52 | + and status = 1 | ||
| 53 | + </if> | ||
| 54 | + <if test="status != 1"> | ||
| 55 | + and 1 = 1 | ||
| 56 | + </if> | ||
| 41 | </where> | 57 | </where> |
| 42 | order by sort | 58 | order by sort |
| 43 | </select> | 59 | </select> |
| 44 | 60 | ||
| 45 | <insert id="create" parameterType="com.sincere.student.model.Video" > | 61 | <insert id="create" parameterType="com.sincere.student.model.Video" > |
| 46 | - insert into university_video (column_type,university_id,sort,video_url,create_time) | ||
| 47 | - values (#{columnType},#{universityId},#{sort},#{videoUrl},GETDATE()) | 62 | + insert into university_video (column_type,university_id,sort,video_url,create_time,status) |
| 63 | + values (#{columnType},#{universityId},#{sort},#{videoUrl},GETDATE(),#{status}) | ||
| 48 | </insert> | 64 | </insert> |
| 49 | 65 | ||
| 50 | <delete id="delete" parameterType="java.lang.Integer"> | 66 | <delete id="delete" parameterType="java.lang.Integer"> |
| @@ -57,18 +73,21 @@ | @@ -57,18 +73,21 @@ | ||
| 57 | <if test="videoUrl!=null"> | 73 | <if test="videoUrl!=null"> |
| 58 | video_url=#{videoUrl}, | 74 | video_url=#{videoUrl}, |
| 59 | </if> | 75 | </if> |
| 60 | - <if test="columnType!=null"> | 76 | + <if test="columnType!=0"> |
| 61 | column_type=#{columnType}, | 77 | column_type=#{columnType}, |
| 62 | </if> | 78 | </if> |
| 63 | <if test="universityName!=null"> | 79 | <if test="universityName!=null"> |
| 64 | university_name=#{universityName}, | 80 | university_name=#{universityName}, |
| 65 | </if> | 81 | </if> |
| 66 | - <if test="universityId!=null"> | 82 | + <if test="universityId!=0"> |
| 67 | university_id=#{universityId}, | 83 | university_id=#{universityId}, |
| 68 | </if> | 84 | </if> |
| 69 | - <if test="sort!=null"> | 85 | + <if test="sort!=0"> |
| 70 | sort=#{sort}, | 86 | sort=#{sort}, |
| 71 | </if> | 87 | </if> |
| 88 | + <if test="status!=-1"> | ||
| 89 | + status=#{status}, | ||
| 90 | + </if> | ||
| 72 | </trim> | 91 | </trim> |
| 73 | where id = #{id} | 92 | where id = #{id} |
| 74 | </update> | 93 | </update> |
src/main/resources/templates/index.html
| @@ -1,42 +0,0 @@ | @@ -1,42 +0,0 @@ | ||
| 1 | -<!DOCTYPE html> | ||
| 2 | -<html lang="en"> | ||
| 3 | -<head> | ||
| 4 | - <meta charset="UTF-8"> | ||
| 5 | - <title>action is everything</title> | ||
| 6 | -</head> | ||
| 7 | -<body> | ||
| 8 | -<div data-th-fragment="header"> | ||
| 9 | - <h1> 图片q </h1> | ||
| 10 | -</div> | ||
| 11 | -<form> | ||
| 12 | - <input type="file" id="file" name="file"> | ||
| 13 | - <button type="button" onclick="submitForm()">提交</button> | ||
| 14 | - | ||
| 15 | -</form> | ||
| 16 | -</body> | ||
| 17 | -<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> | ||
| 18 | -<script> | ||
| 19 | - function submitForm() { | ||
| 20 | - var formData = new FormData(); //将需要提交的参数封装起来 | ||
| 21 | - formData.append("file", $("#file")[0].files[0]); | ||
| 22 | - $.ajax({ | ||
| 23 | - //url:'upload', | ||
| 24 | - url : 'http://121.40.109.21:8083/file-center/file/fileUpload', | ||
| 25 | - beforeSend: function(xhr) { | ||
| 26 | - xhr.setRequestHeader("ossPath","test"); | ||
| 27 | - }, | ||
| 28 | - type : 'post', | ||
| 29 | - data : formData, | ||
| 30 | - processData : false, | ||
| 31 | - contentType : false, | ||
| 32 | - success : function(value) { | ||
| 33 | - alert(value); | ||
| 34 | - }, | ||
| 35 | - error:function (value) { | ||
| 36 | - alert(value); | ||
| 37 | - } | ||
| 38 | - }); | ||
| 39 | - | ||
| 40 | - } | ||
| 41 | -</script> | ||
| 42 | -</html> | ||
| 43 | \ No newline at end of file | 0 | \ No newline at end of file |