Commit 2adcf808db3dd6852298dfa6a6aaa2a1caa76d77
1 parent
622765d9ad
Exists in
master
and in
1 other branch
根据疾病iid获取文章序号(0-100)
Showing 4 changed files with 38 additions and 1 deletions
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsArticleMapper.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsArticleService.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsArticleServiceImpl.java
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ArticleController.java
View file @
2adcf80
| ... | ... | @@ -302,7 +302,7 @@ |
| 302 | 302 | * 文章序号是否重复 |
| 303 | 303 | * @param aid 修改时用 |
| 304 | 304 | * @param iid 疾病id |
| 305 | - * @param serialNumber 序号(0-100) | |
| 305 | + * @param serialNumber 序号(1-100) | |
| 306 | 306 | * @return true 可以使用,false已经存在 |
| 307 | 307 | */ |
| 308 | 308 | @GetMapping("getSerialNumberYn") |
| ... | ... | @@ -324,6 +324,32 @@ |
| 324 | 324 | } |
| 325 | 325 | baseResponse.setErrormsg("成功"); |
| 326 | 326 | } catch (Exception e) { |
| 327 | + baseResponse.setErrormsg("失败"); | |
| 328 | + e.printStackTrace(); | |
| 329 | + } | |
| 330 | + return baseResponse; | |
| 331 | + } | |
| 332 | + /** | |
| 333 | + * 根据疾病iid获取文章序号 | |
| 334 | + * @param iid 疾病id | |
| 335 | + * @return int serialNumber(0-100) | |
| 336 | + */ | |
| 337 | + @GetMapping("getSerialNumber") | |
| 338 | + public BaseResponse getSerialNumber(Integer iid){ | |
| 339 | + BaseResponse baseResponse=new BaseResponse(); | |
| 340 | + try { | |
| 341 | + Integer serialNumber=lymsArticleService.getSerialNumber(iid); | |
| 342 | + if(null==serialNumber){ | |
| 343 | + baseResponse.setObject(1); | |
| 344 | + }else { | |
| 345 | + if(serialNumber<100){//序号100的时候返回null(前端处理不许再添加) | |
| 346 | + baseResponse.setObject(serialNumber+1); | |
| 347 | + } | |
| 348 | + } | |
| 349 | + baseResponse.setErrorcode(0); | |
| 350 | + baseResponse.setErrormsg("成功"); | |
| 351 | + } catch (Exception e) { | |
| 352 | + baseResponse.setErrorcode(1); | |
| 327 | 353 | baseResponse.setErrormsg("失败"); |
| 328 | 354 | e.printStackTrace(); |
| 329 | 355 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsArticleMapper.java
View file @
2adcf80
| ... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 | import com.lyms.talkonlineweb.domain.LymsArticle; |
| 4 | 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| 5 | 5 | import com.sun.corba.se.impl.ior.OldJIDLObjectKeyTemplate; |
| 6 | +import org.apache.ibatis.annotations.Param; | |
| 6 | 7 | import org.apache.ibatis.annotations.Select; |
| 7 | 8 | |
| 8 | 9 | import java.util.List; |
| ... | ... | @@ -28,5 +29,8 @@ |
| 28 | 29 | |
| 29 | 30 | @Select("SELECT COUNT(1) cnt FROM lyms_pushedart") |
| 30 | 31 | Map<String, Object> sumPush(); |
| 32 | + | |
| 33 | + @Select("SELECT MAX(serial_number) FROM `lyms_article` WHERE iid=#{iid}") | |
| 34 | + Integer getSerialNumber(@Param("iid") Integer iid); | |
| 31 | 35 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsArticleService.java
View file @
2adcf80
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsArticleServiceImpl.java
View file @
2adcf80