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 | 9 | </parent> | 
| 10 | 10 | <modelVersion>4.0.0</modelVersion> | 
| 11 | 11 | |
| 12 | - <artifactId>EnrollStudent_independent</artifactId> | |
| 12 | + <artifactId>enrollStudent</artifactId> | |
| 13 | 13 | |
| 14 | 14 | <dependencies> | 
| 15 | 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 | 16 | <groupId>org.mybatis.generator</groupId> | 
| 41 | 17 | <artifactId>mybatis-generator-core</artifactId> | 
| 42 | 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 | 12 | import com.sincere.student.utils.ResultException; | 
| 13 | 13 | import com.sincere.student.utils.TokenUtils; | 
| 14 | 14 | import io.swagger.annotations.ApiOperation; | 
| 15 | +import org.apache.commons.lang3.StringUtils; | |
| 15 | 16 | import org.springframework.beans.factory.annotation.Autowired; | 
| 16 | 17 | import org.springframework.web.bind.annotation.*; | 
| 17 | 18 | |
| ... | ... | @@ -180,6 +181,7 @@ public class AdminController { | 
| 180 | 181 | @RequestMapping(value = "/consult/getList" , method = RequestMethod.POST) | 
| 181 | 182 | public BaseDto<Page<Consult>> getConsultList(@RequestBody ConsultSearchDto consultSearchDto){ | 
| 182 | 183 | BaseDto<Page<Consult>> result = new BaseDto<>() ; | 
| 184 | + consultSearchDto.setStatus(0); | |
| 183 | 185 | Page<Consult> page = consultService.getList(consultSearchDto); | 
| 184 | 186 | result.setData(page); | 
| 185 | 187 | return result ; | 
| ... | ... | @@ -229,6 +231,7 @@ public class AdminController { | 
| 229 | 231 | @RequestMapping(value = "/video/getList" , method = RequestMethod.POST) | 
| 230 | 232 | public BaseDto<Page<Video>> getVideoList(@RequestBody VideoSearchDto videoSearchDto){ | 
| 231 | 233 | BaseDto<Page<Video>> result = new BaseDto<>() ; | 
| 234 | + videoSearchDto.setStatus(0); | |
| 232 | 235 | Page<Video> page = videoService.getList(videoSearchDto); | 
| 233 | 236 | result.setData(page); | 
| 234 | 237 | return result ; | 
| ... | ... | @@ -402,6 +405,7 @@ public class AdminController { | 
| 402 | 405 | @RequestMapping(value = "/article/getList" , method = RequestMethod.POST) | 
| 403 | 406 | public BaseDto<Page<Article>> getArticleList(@RequestBody ArticleSearchDto articleSearchDto){ | 
| 404 | 407 | BaseDto<Page<Article>> result = new BaseDto<>() ; | 
| 408 | + articleSearchDto.setStatus(0); | |
| 405 | 409 | Page<Article> page = articleService.getList(articleSearchDto); | 
| 406 | 410 | result.setData(page); | 
| 407 | 411 | return result ; | 
| ... | ... | @@ -479,8 +483,13 @@ public class AdminController { | 
| 479 | 483 | @RequestMapping(value = "/advert/createBanner" , method = RequestMethod.POST) | 
| 480 | 484 | public BaseDto createBanner(@RequestBody Advert advert){ | 
| 481 | 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 | 493 | return result ; | 
| 485 | 494 | } | 
| 486 | 495 | ... | ... | 
src/main/java/com/sincere/student/controller/AppController.java
| ... | ... | @@ -121,6 +121,7 @@ public class AppController { | 
| 121 | 121 | @RequestMapping(value = "/consult/getList" , method = RequestMethod.POST) | 
| 122 | 122 | public BaseDto<Page<Consult>> getConsultList(@RequestBody ConsultSearchDto consultSearchDto){ | 
| 123 | 123 | BaseDto<Page<Consult>> result = new BaseDto<>() ; | 
| 124 | + consultSearchDto.setStatus(1); | |
| 124 | 125 | Page<Consult> page = consultService.getList(consultSearchDto); | 
| 125 | 126 | result.setData(page); | 
| 126 | 127 | return result ; | 
| ... | ... | @@ -161,6 +162,7 @@ public class AppController { | 
| 161 | 162 | @RequestMapping(value = "/article/getList" , method = RequestMethod.POST) | 
| 162 | 163 | public BaseDto<Page<Article>> getArticleList(@RequestBody ArticleSearchDto articleSearchDto){ | 
| 163 | 164 | BaseDto<Page<Article>> result = new BaseDto<>() ; | 
| 165 | + articleSearchDto.setStatus(1); | |
| 164 | 166 | Page<Article> page = articleService.getList(articleSearchDto); | 
| 165 | 167 | result.setData(page); | 
| 166 | 168 | return result ; | 
| ... | ... | @@ -224,6 +226,7 @@ public class AppController { | 
| 224 | 226 | @RequestMapping(value = "/video/getList" , method = RequestMethod.POST) | 
| 225 | 227 | public BaseDto<Page<Video>> getVideoList(@RequestBody VideoSearchDto videoSearchDto){ | 
| 226 | 228 | BaseDto<Page<Video>> result = new BaseDto<>() ; | 
| 229 | + videoSearchDto.setStatus(1); | |
| 227 | 230 | Page<Video> page = videoService.getList(videoSearchDto); | 
| 228 | 231 | result.setData(page); | 
| 229 | 232 | return result ; | ... | ... | 
src/main/java/com/sincere/student/controller/IndexController.java
| 1 | 1 | package com.sincere.student.controller; | 
| 2 | 2 | |
| 3 | -import com.sincere.student.utils.HttpClientUtils; | |
| 4 | 3 | import org.springframework.stereotype.Controller; | 
| 5 | 4 | import org.springframework.web.bind.annotation.RequestMapping; | 
| 6 | 5 | import org.springframework.web.bind.annotation.RequestMethod; | 
| ... | ... | @@ -24,37 +23,6 @@ public class IndexController { | 
| 24 | 23 | @ResponseBody | 
| 25 | 24 | @RequestMapping(value = "upload" ,method = RequestMethod.POST) | 
| 26 | 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 | 12 | private String title ; | 
| 13 | 13 | @ApiModelProperty(value = "文章栏目") | 
| 14 | 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 | 26 | public int getArticleType() { | 
| 17 | 27 | return articleType; | ... | ... | 
src/main/java/com/sincere/student/dto/ConsultSearchDto.java
| ... | ... | @@ -16,6 +16,16 @@ public class ConsultSearchDto extends PageDto { | 
| 16 | 16 | private String city ; | 
| 17 | 17 | @ApiModelProperty(value = "专业") | 
| 18 | 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 | 30 | public int getColumnType() { | 
| 21 | 31 | return columnType; | ... | ... | 
src/main/java/com/sincere/student/dto/VideoSearchDto.java
| ... | ... | @@ -11,7 +11,16 @@ public class VideoSearchDto extends PageDto { | 
| 11 | 11 | |
| 12 | 12 | @ApiModelProperty(value = "查询名称") | 
| 13 | 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 | 24 | public int getColumnTypeId() { | 
| 16 | 25 | return columnTypeId; | 
| 17 | 26 | } | ... | ... | 
src/main/java/com/sincere/student/model/Article.java
| ... | ... | @@ -36,7 +36,16 @@ public class Article { | 
| 36 | 36 | private Date createTime ; | 
| 37 | 37 | @ApiModelProperty(value = "文章类型 1广告文章 2权威解读 ") | 
| 38 | 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 | 49 | public int getType() { | 
| 41 | 50 | return type; | 
| 42 | 51 | } | ... | ... | 
src/main/java/com/sincere/student/model/UniversityConsult.java
| ... | ... | @@ -26,7 +26,16 @@ public class UniversityConsult { | 
| 26 | 26 | private Integer sort; | 
| 27 | 27 | @ApiModelProperty(value = "4个栏目") | 
| 28 | 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 | 39 | public List<UniversityConsultDetail> getList() { | 
| 31 | 40 | return list; | 
| 32 | 41 | } | ... | ... | 
src/main/java/com/sincere/student/model/Video.java
| ... | ... | @@ -24,6 +24,16 @@ public class Video { | 
| 24 | 24 | private String universityName; | 
| 25 | 25 | @ApiModelProperty(value = "学校编码 展示用") | 
| 26 | 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 | 38 | public String getUniversityCode() { | 
| 29 | 39 | return universityCode; | ... | ... | 
src/main/java/com/sincere/student/utils/ExcelUtils.java
| ... | ... | @@ -38,8 +38,8 @@ public class ExcelUtils { | 
| 38 | 38 | // 获得工作簿 | 
| 39 | 39 | String file = excelFile.getName(); | 
| 40 | 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 | 43 | if(inputStream == null){ | 
| 44 | 44 | throw new ResultException(901,"路径错误"); | 
| 45 | 45 | } | ... | ... | 
src/main/java/com/sincere/student/utils/HttpClientUtils.java
| ... | ... | @@ -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 | 17 | <result column="look_number" property="lookNumber"/> | 
| 18 | 18 | <result column="create_time" property="createTime"/> | 
| 19 | 19 | <result column="type" property="type"/> | 
| 20 | + <result column="status" property="status" /> | |
| 20 | 21 | </resultMap> | 
| 21 | 22 | |
| 22 | 23 | |
| ... | ... | @@ -32,6 +33,12 @@ | 
| 32 | 33 | <if test="articleType != 0"> | 
| 33 | 34 | and type = #{articleType} | 
| 34 | 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 | 42 | </where> | 
| 36 | 43 | </select> | 
| 37 | 44 | |
| ... | ... | @@ -47,6 +54,12 @@ | 
| 47 | 54 | <if test="articleType != 0"> | 
| 48 | 55 | and type = #{articleType} | 
| 49 | 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 | 63 | </where> | 
| 51 | 64 | order by sort | 
| 52 | 65 | </select> | 
| ... | ... | @@ -60,8 +73,8 @@ | 
| 60 | 73 | </select> | 
| 61 | 74 | |
| 62 | 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 | 78 | </insert> | 
| 66 | 79 | |
| 67 | 80 | <delete id="delete" parameterType="java.lang.Integer"> | 
| ... | ... | @@ -74,16 +87,16 @@ | 
| 74 | 87 | <if test="title!=null"> | 
| 75 | 88 | title=#{title}, | 
| 76 | 89 | </if> | 
| 77 | - <if test="columnType!=null"> | |
| 90 | + <if test="columnType!=0"> | |
| 78 | 91 | column_type=#{columnType}, | 
| 79 | 92 | </if> | 
| 80 | 93 | <if test="universityName!=null"> | 
| 81 | 94 | university_name=#{universityName}, | 
| 82 | 95 | </if> | 
| 83 | - <if test="universityId!=null"> | |
| 96 | + <if test="universityId!=0"> | |
| 84 | 97 | university_id=#{universityId}, | 
| 85 | 98 | </if> | 
| 86 | - <if test="sort!=null"> | |
| 99 | + <if test="sort!=0"> | |
| 87 | 100 | sort=#{sort}, | 
| 88 | 101 | </if> | 
| 89 | 102 | <if test="context!=null"> | 
| ... | ... | @@ -101,12 +114,15 @@ | 
| 101 | 114 | <if test="articleLink!=null"> | 
| 102 | 115 | article_link=#{articleLink}, | 
| 103 | 116 | </if> | 
| 104 | - <if test="goodNumber!=null"> | |
| 117 | + <if test="goodNumber!=0"> | |
| 105 | 118 | good_number=#{goodNumber}, | 
| 106 | 119 | </if> | 
| 107 | - <if test="lookNumber!=null"> | |
| 120 | + <if test="lookNumber!=0"> | |
| 108 | 121 | look_number=#{lookNumber}, | 
| 109 | 122 | </if> | 
| 123 | + <if test="status!=-1"> | |
| 124 | + status=#{status}, | |
| 125 | + </if> | |
| 110 | 126 | </trim> | 
| 111 | 127 | where id = #{id} | 
| 112 | 128 | </update> | ... | ... | 
src/main/resources/mapper/UniversityConsultMapper.xml
| ... | ... | @@ -9,6 +9,7 @@ | 
| 9 | 9 | <result column="code" property="code" /> | 
| 10 | 10 | <result column="sort" property="sort" /> | 
| 11 | 11 | <result column="img_url" property="imgUrl" /> | 
| 12 | + <result column="status" property="status" /> | |
| 12 | 13 | </resultMap> | 
| 13 | 14 | |
| 14 | 15 | <select id="getListCount" parameterType="com.sincere.student.dto.ConsultSearchDto" resultType="java.lang.Integer"> | 
| ... | ... | @@ -35,6 +36,12 @@ | 
| 35 | 36 | <if test="majorName != null"> | 
| 36 | 37 | and m.major like #{majorName} | 
| 37 | 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 | 45 | </where> | 
| 39 | 46 | </select> | 
| 40 | 47 | |
| ... | ... | @@ -62,6 +69,12 @@ | 
| 62 | 69 | <if test="majorName != null"> | 
| 63 | 70 | and m.major like #{majorName} | 
| 64 | 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 | 78 | </where> | 
| 66 | 79 | order by c.sort | 
| 67 | 80 | </select> | 
| ... | ... | @@ -69,13 +82,13 @@ | 
| 69 | 82 | <select id="getColumnListCount" parameterType="java.lang.Integer" resultType="java.lang.Integer"> | 
| 70 | 83 | select count(DISTINCT c.id) from university_consult c | 
| 71 | 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 | 86 | </select> | 
| 74 | 87 | |
| 75 | 88 | <select id="getColumnList" parameterType="java.lang.Integer" resultMap="ListMap"> | 
| 76 | 89 | select DISTINCT c.id , info.id as universityId , c.img_url ,c.sort , info.name , info.code from university_consult c | 
| 77 | 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 | 92 | order by c.sort | 
| 80 | 93 | </select> | 
| 81 | 94 | ... | ... | 
src/main/resources/mapper/VideoMapper.xml
| ... | ... | @@ -11,6 +11,7 @@ | 
| 11 | 11 | <result column="create_time" property="createTime"/> | 
| 12 | 12 | <result column="name" property="universityName"/> | 
| 13 | 13 | <result column="code" property="universityCode"/> | 
| 14 | + <result column="status" property="status" /> | |
| 14 | 15 | </resultMap> | 
| 15 | 16 | |
| 16 | 17 | <select id="getById" parameterType="java.lang.Integer" resultMap="VideoMap"> | 
| ... | ... | @@ -20,8 +21,8 @@ | 
| 20 | 21 | <select id="getListCount" parameterType="com.sincere.student.dto.VideoSearchDto" resultType="java.lang.Integer"> | 
| 21 | 22 | select count(0) from university_video v join university_info info on v.university_id = info.id | 
| 22 | 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 | 26 | </if> | 
| 26 | 27 | <if test="universityName == 0"> | 
| 27 | 28 | and 1 = 1 | 
| ... | ... | @@ -29,22 +30,37 @@ | 
| 29 | 30 | <if test="universityName != null"> | 
| 30 | 31 | and info.name like #{universityName} | 
| 31 | 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 | 39 | </where> | 
| 33 | 40 | </select> | 
| 34 | 41 | |
| 35 | 42 | <select id="getList" parameterType="com.sincere.student.dto.ArticleSearchDto" resultMap="VideoMap"> | 
| 36 | 43 | select v.*,info.name,info.code from university_video v join university_info info on v.university_id = info.id | 
| 37 | 44 | <where> | 
| 45 | + <if test="columnTypeId != 0"> | |
| 46 | + and v.column_type = #{columnTypeId} | |
| 47 | + </if> | |
| 38 | 48 | <if test="universityName != null"> | 
| 39 | 49 | and info.name like #{universityName} | 
| 40 | 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 | 57 | </where> | 
| 42 | 58 | order by sort | 
| 43 | 59 | </select> | 
| 44 | 60 | |
| 45 | 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 | 64 | </insert> | 
| 49 | 65 | |
| 50 | 66 | <delete id="delete" parameterType="java.lang.Integer"> | 
| ... | ... | @@ -57,18 +73,21 @@ | 
| 57 | 73 | <if test="videoUrl!=null"> | 
| 58 | 74 | video_url=#{videoUrl}, | 
| 59 | 75 | </if> | 
| 60 | - <if test="columnType!=null"> | |
| 76 | + <if test="columnType!=0"> | |
| 61 | 77 | column_type=#{columnType}, | 
| 62 | 78 | </if> | 
| 63 | 79 | <if test="universityName!=null"> | 
| 64 | 80 | university_name=#{universityName}, | 
| 65 | 81 | </if> | 
| 66 | - <if test="universityId!=null"> | |
| 82 | + <if test="universityId!=0"> | |
| 67 | 83 | university_id=#{universityId}, | 
| 68 | 84 | </if> | 
| 69 | - <if test="sort!=null"> | |
| 85 | + <if test="sort!=0"> | |
| 70 | 86 | sort=#{sort}, | 
| 71 | 87 | </if> | 
| 88 | + <if test="status!=-1"> | |
| 89 | + status=#{status}, | |
| 90 | + </if> | |
| 72 | 91 | </trim> | 
| 73 | 92 | where id = #{id} | 
| 74 | 93 | </update> | ... | ... | 
src/main/resources/templates/index.html
| ... | ... | @@ -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 | 0 | \ No newline at end of file |