From c435158ed1ff587939314e84347ee6e38e8f25ec Mon Sep 17 00:00:00 2001 From: fangyuan <527392886@qq.com> Date: 星期一, 21 十一月 2022 13:49:59 +0800 Subject: [PATCH] 接口调整及文件上传接口 --- ycl-platform/src/main/java/com/ycl/service/NewsInformationService.java | 9 + ycl-platform/src/main/java/com/ycl/mapper/NewsInformationDao.java | 5 ycl-platform/src/main/resources/mapper/NewsInformationPoliceDao.xml | 0 ycl-platform/src/main/resources/application-dev.yml | 46 ++-- ycl-platform/src/main/resources/mapper/NewsChannelColumnDao.xml | 3 ycl-platform/src/main/java/com/ycl/service/impl/NewsInformationServiceImpl.java | 18 ++ ycl-platform/src/main/java/com/ycl/controller/ImageUploadController.java | 55 ++++++ ycl-platform/src/main/java/com/ycl/controller/NewsInformationPoliceController.java | 9 + ycl-platform/src/main/java/com/ycl/controller/NewsChannelColumnController.java | 32 ++++ ycl-platform/src/main/resources/mapper/NewsDepartmentDao.xml | 0 ycl-platform/target/classes/mapper/NewsInformationDao.xml | 14 + ycl-platform/src/main/java/com/ycl/controller/NewsDepartmentController.java | 8 + ycl-platform/src/main/java/com/ycl/controller/NewsColumnInformationController.java | 32 +++ ycl-platform/src/main/java/com/ycl/service/impl/NewsAdminServiceImpl.java | 3 ycl-platform/target/classes/mapper/NewsChannelDao.xml | 11 + ycl-platform/src/main/java/com/ycl/entity/NewsChannelColumn.java | 6 ycl-platform/src/main/java/com/ycl/controller/NewsDutyController.java | 8 + ycl-platform/src/main/java/com/ycl/controller/NewsInformationController.java | 23 +- ycl-platform/src/main/java/com/ycl/service/impl/NewsChannelServiceImpl.java | 15 + ycl-platform/src/main/resources/mapper/NewsAdminDao.xml | 0 ycl-platform/src/main/java/com/ycl/controller/NewsColumnController.java | 10 + ycl-platform/src/main/java/com/ycl/mapper/NewsChannelDao.java | 4 ycl-platform/src/main/java/com/ycl/service/NewsChannelService.java | 5 ycl-platform/src/main/java/com/ycl/controller/NewsAdminController.java | 5 ycl-platform/src/main/resources/mapper/NewsColumnInformationDao.xml | 3 /dev/null | 66 -------- ycl-platform/src/main/java/com/ycl/controller/NewsPoliceController.java | 8 + ycl-platform/src/main/resources/mapper/NewsInformationDao.xml | 14 + ycl-platform/src/main/java/com/ycl/config/WebMvcConfig.java | 2 ycl-platform/src/main/java/com/ycl/controller/NewsChannelController.java | 29 +++ ycl-platform/src/main/java/com/ycl/entity/NewsChannel.java | 3 .idea/compiler.xml | 2 ycl-platform/src/main/resources/application.yml | 14 ycl-platform/target/classes/mapper/NewsColumnInformationDao.xml | 3 ycl-platform/src/main/resources/mapper/NewsPoliceDao.xml | 0 ycl-platform/target/classes/mapper/NewsChannelColumnDao.xml | 3 ycl-platform/src/main/resources/mapper/NewsChannelDao.xml | 11 + 37 files changed, 356 insertions(+), 123 deletions(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index efcd749..5c2e59d 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -7,8 +7,8 @@ <sourceOutputDir name="target/generated-sources/annotations" /> <sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> <outputRelativeToContentRoot value="true" /> - <module name="ycl-common" /> <module name="ycl-platform" /> + <module name="ycl-common" /> </profile> </annotationProcessing> </component> diff --git a/ycl-common/src/main/java/com/ycl/bo/AdminUserDetails.java b/ycl-common/src/main/java/com/ycl/bo/AdminUserDetails.java deleted file mode 100644 index 825e5e1..0000000 --- a/ycl-common/src/main/java/com/ycl/bo/AdminUserDetails.java +++ /dev/null @@ -1,66 +0,0 @@ -//package com.ycl.bo; -// -//import com.ycl.entity.user.UmsAdmin; -//import com.ycl.entity.user.UmsMenu; -//import org.springframework.security.core.GrantedAuthority; -//import org.springframework.security.core.authority.SimpleGrantedAuthority; -//import org.springframework.security.core.userdetails.UserDetails; -// -//import java.util.Collection; -//import java.util.List; -//import java.util.stream.Collectors; -// -///** -// * SpringSecurity闇�瑕佺殑鐢ㄦ埛璇︽儏 -// */ -//public class AdminUserDetails implements UserDetails { -// private UmsAdmin umsAdmin; -// private List<UmsMenu> resourceList; -// -// public AdminUserDetails(UmsAdmin umsAdmin, List<UmsMenu> resourceList) { -// this.umsAdmin = umsAdmin; -// this.resourceList = resourceList; -// } -// -// @Override -// public Collection<? extends GrantedAuthority> getAuthorities() { -// //杩斿洖褰撳墠鐢ㄦ埛鐨勮鑹� -// return resourceList.stream() -// .map(role -> new SimpleGrantedAuthority(role.getId() + ":" + role.getTitle())) -// .collect(Collectors.toList()); -// } -// -// @Override -// public String getPassword() { -// return umsAdmin.getPassword(); -// } -// -// @Override -// public String getUsername() { -// return umsAdmin.getUsername(); -// } -// -// @Override -// public boolean isAccountNonExpired() { -// return true; -// } -// -// @Override -// public boolean isAccountNonLocked() { -// return true; -// } -// -// @Override -// public boolean isCredentialsNonExpired() { -// return true; -// } -// -// @Override -// public boolean isEnabled() { -// return umsAdmin.getStatus().equals(1); -// } -// -// public Long getUserId() { -// return umsAdmin.getId(); -// } -//} diff --git a/ycl-platform/src/main/java/com/ycl/config/WebMvcConfig.java b/ycl-platform/src/main/java/com/ycl/config/WebMvcConfig.java index b0b122d..79aaed1 100644 --- a/ycl-platform/src/main/java/com/ycl/config/WebMvcConfig.java +++ b/ycl-platform/src/main/java/com/ycl/config/WebMvcConfig.java @@ -17,6 +17,6 @@ public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(this.Intercept()) //闇�瑕侀獙璇佽姹傝矾寰� /*浠h〃鍏ㄩ儴 - .addPathPatterns("/newsAdmin/text"); + .addPathPatterns("/newsAdmin/login"); } } diff --git a/ycl-platform/src/main/java/com/ycl/controller/ImageUploadController.java b/ycl-platform/src/main/java/com/ycl/controller/ImageUploadController.java new file mode 100644 index 0000000..681daa0 --- /dev/null +++ b/ycl-platform/src/main/java/com/ycl/controller/ImageUploadController.java @@ -0,0 +1,55 @@ +package com.ycl.controller; + +import com.ycl.api.CommonResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.io.IOUtils; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.UUID; + +@RestController +@RequestMapping("upload") +@Api(tags = "鍥剧墖涓婁紶") +public class ImageUploadController { + + @ApiOperation(value="涓婁紶鍥剧墖") + @RequestMapping(value = "/image", method = RequestMethod.POST) + public CommonResult uploadImage(HttpServletRequest request, MultipartFile image) throws IOException { + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + String filePath = "/images/" + sdf.format(new Date()); + String imageFolderPath = request.getServletContext().getRealPath(filePath); + File imageFolder = new File(imageFolderPath); + if (!imageFolder.exists()) { + imageFolder.mkdirs(); + } + + StringBuilder imageUrl= new StringBuilder(); + imageUrl.append(request.getScheme()) + .append("://") + .append(request.getServerName()) + .append(":") + .append(request.getServerPort()) + .append(request.getContextPath()) + .append(filePath); + String imageName = UUID.randomUUID() + "_" + image.getOriginalFilename().replaceAll(" ", ""); + try { + IOUtils.write(image.getBytes(), new FileOutputStream(new File(imageFolder, imageName))); + imageUrl.append("/").append(imageName); + return CommonResult.success(imageUrl.toString()); + } catch (IOException e) { + e.printStackTrace(); + } + return CommonResult.failed("涓婁紶澶辫触!"); + } +} diff --git a/ycl-platform/src/main/java/com/ycl/controller/NewsAdminController.java b/ycl-platform/src/main/java/com/ycl/controller/NewsAdminController.java index e25419f..0635f69 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/NewsAdminController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/NewsAdminController.java @@ -64,6 +64,7 @@ * @return 鎵�鏈夋暟鎹� */ @GetMapping + @ApiOperation(value = "鏌ヨ鎵�鏈夋暟鎹�") public R selectAll(Page<NewsAdmin> page, NewsAdmin newsAdmin) { return success(this.newsAdminService.page(page, new QueryWrapper<>(newsAdmin))); } @@ -75,6 +76,7 @@ * @return 鍗曟潯鏁版嵁 */ @GetMapping("{id}") + @ApiOperation(value = "鎸塱d鏌ヨ鏁版嵁") public R selectOne(@PathVariable Serializable id) { return success(this.newsAdminService.getById(id)); } @@ -86,6 +88,7 @@ * @return 鏂板缁撴灉 */ @PostMapping + @ApiOperation(value = "鏂板鏁版嵁") public R insert(@RequestBody NewsAdmin newsAdmin) { return success(this.newsAdminService.save(newsAdmin)); } @@ -97,6 +100,7 @@ * @return 淇敼缁撴灉 */ @PutMapping + @ApiOperation(value = "淇敼鏁版嵁") public R update(@RequestBody NewsAdmin newsAdmin) { return success(this.newsAdminService.updateById(newsAdmin)); } @@ -108,6 +112,7 @@ * @return 鍒犻櫎缁撴灉 */ @DeleteMapping + @ApiOperation(value = "鍒犻櫎鏁版嵁") public R delete(@RequestParam("idList") List<Long> idList) { return success(this.newsAdminService.removeByIds(idList)); } diff --git a/ycl-platform/src/main/java/com/ycl/controller/NewsChannelColumnController.java b/ycl-platform/src/main/java/com/ycl/controller/NewsChannelColumnController.java index 733019b..50e52f9 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/NewsChannelColumnController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/NewsChannelColumnController.java @@ -7,11 +7,17 @@ import com.baomidou.mybatisplus.extension.api.R; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ycl.entity.NewsChannelColumn; +import com.ycl.entity.NewsColumn; import com.ycl.service.NewsChannelColumnService; +import com.ycl.service.NewsColumnService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -22,12 +28,16 @@ */ @RestController @RequestMapping("newsChannelColumn") +@Api(tags = "棰戦亾鏍忕洰涓棿琛ㄦ帶鍒跺眰") public class NewsChannelColumnController extends ApiController { /** * 鏈嶅姟瀵硅薄 */ @Resource private NewsChannelColumnService newsChannelColumnService; + + @Autowired + private NewsColumnService newsColumnService; /** * 鍒嗛〉鏌ヨ鎵�鏈夋暟鎹� @@ -37,6 +47,7 @@ * @return 鎵�鏈夋暟鎹� */ @GetMapping + @ApiOperation(value = "鏌ヨ鎵�鏈夋暟鎹�") public R selectAll(Page<NewsChannelColumn> page, NewsChannelColumn newsChannelColumn) { return success(this.newsChannelColumnService.page(page, new QueryWrapper<>(newsChannelColumn))); } @@ -48,6 +59,7 @@ * @return 鍗曟潯鏁版嵁 */ @GetMapping("{id}") + @ApiOperation(value = "鎸塱d鏌ヨ鏁版嵁") public R selectOne(@PathVariable Serializable id) { return success(this.newsChannelColumnService.getById(id)); } @@ -59,6 +71,7 @@ * @return 鏂板缁撴灉 */ @PostMapping + @ApiOperation(value = "鏂板鏁版嵁") public R insert(@RequestBody NewsChannelColumn newsChannelColumn) { return success(this.newsChannelColumnService.save(newsChannelColumn)); } @@ -70,6 +83,7 @@ * @return 淇敼缁撴灉 */ @PutMapping + @ApiOperation(value = "淇敼鏁版嵁") public R update(@RequestBody NewsChannelColumn newsChannelColumn) { return success(this.newsChannelColumnService.updateById(newsChannelColumn)); } @@ -81,8 +95,26 @@ * @return 鍒犻櫎缁撴灉 */ @DeleteMapping + @ApiOperation(value = "鍒犻櫎鏁版嵁") public R delete(@RequestParam("idList") List<Long> idList) { return success(this.newsChannelColumnService.removeByIds(idList)); } + + /** + * 閫氳繃棰戦亾id鏌ュ搴旀爮鐩� + * + * @param id 棰戦亾id + * @return 鍒犻櫎缁撴灉 + */ + @GetMapping("channel/{id}") + @ApiOperation(value = "鎸夐閬搃d鏌ヨ鏍忕洰") + public R selectColumnByChannelId(@PathVariable Serializable id) { + List<NewsChannelColumn> newsChannelColumns = newsChannelColumnService.list(new QueryWrapper<NewsChannelColumn>().eq("channel_id", id)); + List<NewsColumn> resultList=new ArrayList<>(); + for (NewsChannelColumn newsChannelColumn:newsChannelColumns){ + resultList.add(newsColumnService.getById(newsChannelColumn.getColumnId())); + } + return success(resultList); + } } diff --git a/ycl-platform/src/main/java/com/ycl/controller/NewsChannelController.java b/ycl-platform/src/main/java/com/ycl/controller/NewsChannelController.java index 8af1561..070ef4e 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/NewsChannelController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/NewsChannelController.java @@ -7,7 +7,12 @@ import com.baomidou.mybatisplus.extension.api.R; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ycl.entity.NewsChannel; +import com.ycl.entity.NewsChannelColumn; +import com.ycl.service.NewsChannelColumnService; import com.ycl.service.NewsChannelService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -22,6 +27,7 @@ */ @RestController @RequestMapping("newsChannel") +@Api(tags = "棰戦亾绠$悊") public class NewsChannelController extends ApiController { /** * 鏈嶅姟瀵硅薄 @@ -29,16 +35,18 @@ @Resource private NewsChannelService newsChannelService; + @Autowired + private NewsChannelColumnService newsChannelColumnService; + /** * 鍒嗛〉鏌ヨ鎵�鏈夋暟鎹� * - * @param page 鍒嗛〉瀵硅薄 - * @param newsChannel 鏌ヨ瀹炰綋 * @return 鎵�鏈夋暟鎹� */ @GetMapping - public R selectAll(Page<NewsChannel> page, NewsChannel newsChannel) { - return success(this.newsChannelService.page(page, new QueryWrapper<>(newsChannel))); + @ApiOperation(value = "鏌ヨ鎵�鏈夋暟鎹�") + public R selectAll() { + return success(this.newsChannelService.selectAllChannel()); } /** @@ -48,6 +56,7 @@ * @return 鍗曟潯鏁版嵁 */ @GetMapping("{id}") + @ApiOperation(value = "鎸塱d鏌ヨ鏁版嵁") public R selectOne(@PathVariable Serializable id) { return success(this.newsChannelService.getById(id)); } @@ -59,8 +68,12 @@ * @return 鏂板缁撴灉 */ @PostMapping + @ApiOperation(value = "鏂板鏁版嵁") public R insert(@RequestBody NewsChannel newsChannel) { - return success(this.newsChannelService.save(newsChannel)); + int result = this.newsChannelService.insertOneChannel(newsChannel); + List<String> columnId = newsChannel.getColumnId(); + columnId.stream().forEach(item->newsChannelColumnService.save(NewsChannelColumn.builder().channelId(newsChannel.getId()).columnId(Integer.parseInt(item)).build())); + return success(result); } /** @@ -70,7 +83,11 @@ * @return 淇敼缁撴灉 */ @PutMapping + @ApiOperation(value = "淇敼鏁版嵁") public R update(@RequestBody NewsChannel newsChannel) { + List<String> columnId = newsChannel.getColumnId(); + newsChannelColumnService.remove(new QueryWrapper<NewsChannelColumn>().eq("channel_id",newsChannel.getId())); + columnId.stream().forEach(item->newsChannelColumnService.save(NewsChannelColumn.builder().channelId(newsChannel.getId()).columnId(Integer.parseInt(item)).build())); return success(this.newsChannelService.updateById(newsChannel)); } @@ -81,8 +98,10 @@ * @return 鍒犻櫎缁撴灉 */ @DeleteMapping + @ApiOperation(value = "鍒犻櫎鏁版嵁") public R delete(@RequestParam("idList") List<Long> idList) { return success(this.newsChannelService.removeByIds(idList)); } + } diff --git a/ycl-platform/src/main/java/com/ycl/controller/NewsColumnController.java b/ycl-platform/src/main/java/com/ycl/controller/NewsColumnController.java index 63916a4..716e22b 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/NewsColumnController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/NewsColumnController.java @@ -6,8 +6,11 @@ import com.baomidou.mybatisplus.extension.api.ApiController; import com.baomidou.mybatisplus.extension.api.R; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ycl.entity.NewsChannel; import com.ycl.entity.NewsColumn; import com.ycl.service.NewsColumnService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -22,6 +25,7 @@ */ @RestController @RequestMapping("newsColumn") +@Api(tags = "鏍忕洰绠$悊") public class NewsColumnController extends ApiController { /** * 鏈嶅姟瀵硅薄 @@ -37,6 +41,7 @@ * @return 鎵�鏈夋暟鎹� */ @GetMapping + @ApiOperation(value = "鏌ヨ鎵�鏈夋暟鎹�") public R selectAll(Page<NewsColumn> page, NewsColumn newsColumn) { return success(this.newsColumnService.page(page, new QueryWrapper<>(newsColumn))); } @@ -48,6 +53,7 @@ * @return 鍗曟潯鏁版嵁 */ @GetMapping("{id}") + @ApiOperation(value = "鎸塱d鏌ヨ鏁版嵁") public R selectOne(@PathVariable Serializable id) { return success(this.newsColumnService.getById(id)); } @@ -59,6 +65,7 @@ * @return 鏂板缁撴灉 */ @PostMapping + @ApiOperation(value = "鏂板鏁版嵁") public R insert(@RequestBody NewsColumn newsColumn) { return success(this.newsColumnService.save(newsColumn)); } @@ -70,6 +77,7 @@ * @return 淇敼缁撴灉 */ @PutMapping + @ApiOperation(value = "淇敼鏁版嵁") public R update(@RequestBody NewsColumn newsColumn) { return success(this.newsColumnService.updateById(newsColumn)); } @@ -81,8 +89,10 @@ * @return 鍒犻櫎缁撴灉 */ @DeleteMapping + @ApiOperation(value = "鍒犻櫎鏁版嵁") public R delete(@RequestParam("idList") List<Long> idList) { return success(this.newsColumnService.removeByIds(idList)); } + } diff --git a/ycl-platform/src/main/java/com/ycl/controller/NewsColumnInformationController.java b/ycl-platform/src/main/java/com/ycl/controller/NewsColumnInformationController.java index f3ec01d..3602d24 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/NewsColumnInformationController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/NewsColumnInformationController.java @@ -7,11 +7,17 @@ import com.baomidou.mybatisplus.extension.api.R; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ycl.entity.NewsColumnInformation; +import com.ycl.entity.NewsInformation; import com.ycl.service.NewsColumnInformationService; +import com.ycl.service.NewsInformationService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -22,6 +28,7 @@ */ @RestController @RequestMapping("newsColumnInformation") +@Api(tags = "鏍忕洰鍜ㄨ涓棿琛ㄦ帶鍒跺眰") public class NewsColumnInformationController extends ApiController { /** * 鏈嶅姟瀵硅薄 @@ -29,6 +36,8 @@ @Resource private NewsColumnInformationService newsColumnInformationService; + @Autowired + private NewsInformationService newsInformationService; /** * 鍒嗛〉鏌ヨ鎵�鏈夋暟鎹� * @@ -37,6 +46,7 @@ * @return 鎵�鏈夋暟鎹� */ @GetMapping + @ApiOperation(value = "鏌ヨ鎵�鏈夋暟鎹�") public R selectAll(Page<NewsColumnInformation> page, NewsColumnInformation newsColumnInformation) { return success(this.newsColumnInformationService.page(page, new QueryWrapper<>(newsColumnInformation))); } @@ -48,6 +58,7 @@ * @return 鍗曟潯鏁版嵁 */ @GetMapping("{id}") + @ApiOperation(value = "鎸塱d鏌ヨ鏁版嵁") public R selectOne(@PathVariable Serializable id) { return success(this.newsColumnInformationService.getById(id)); } @@ -59,6 +70,7 @@ * @return 鏂板缁撴灉 */ @PostMapping + @ApiOperation(value = "鏂板鏁版嵁") public R insert(@RequestBody NewsColumnInformation newsColumnInformation) { return success(this.newsColumnInformationService.save(newsColumnInformation)); } @@ -70,6 +82,7 @@ * @return 淇敼缁撴灉 */ @PutMapping + @ApiOperation(value = "淇敼鏁版嵁") public R update(@RequestBody NewsColumnInformation newsColumnInformation) { return success(this.newsColumnInformationService.updateById(newsColumnInformation)); } @@ -81,8 +94,25 @@ * @return 鍒犻櫎缁撴灉 */ @DeleteMapping + @ApiOperation(value = "鍒犻櫎鏁版嵁") public R delete(@RequestParam("idList") List<Long> idList) { return success(this.newsColumnInformationService.removeByIds(idList)); } -} + + /** + * 閫氳繃鏍忕洰id鏌ュ搴旇祫璁� + * + * @param id 鏍忕洰id + * @return 璧勮鏌ヨ缁撴灉 + */ + @GetMapping("column/{id}") + @ApiOperation(value = "鎸�") + public R selectInformationByColumnId(@PathVariable Serializable id) { + List<NewsColumnInformation> newsColumnInformationList = newsColumnInformationService.list(new QueryWrapper<NewsColumnInformation>().eq("column_id", id)); + List<NewsInformation> resultList=new ArrayList<>(); + for (NewsColumnInformation newsColumnInformation:newsColumnInformationList){ + resultList.add(newsInformationService.selectInformationById(newsColumnInformation.getInformationId())); + } + return success(resultList); + }} diff --git a/ycl-platform/src/main/java/com/ycl/controller/NewsDepartmentController.java b/ycl-platform/src/main/java/com/ycl/controller/NewsDepartmentController.java index 6ff967e..4468ebe 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/NewsDepartmentController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/NewsDepartmentController.java @@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ycl.entity.NewsDepartment; import com.ycl.service.NewsDepartmentService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -22,6 +24,7 @@ */ @RestController @RequestMapping("newsDepartment") +@Api(tags = "鏈烘瀯绠$悊") public class NewsDepartmentController extends ApiController { /** * 鏈嶅姟瀵硅薄 @@ -37,6 +40,7 @@ * @return 鎵�鏈夋暟鎹� */ @GetMapping + @ApiOperation(value = "鏌ヨ鎵�鏈夋暟鎹�") public R selectAll(Page<NewsDepartment> page, NewsDepartment newsDepartment) { return success(this.newsDepartmentService.page(page, new QueryWrapper<>(newsDepartment))); } @@ -48,6 +52,7 @@ * @return 鍗曟潯鏁版嵁 */ @GetMapping("{id}") + @ApiOperation(value = "鎸塱d鏌ヨ鏁版嵁") public R selectOne(@PathVariable Serializable id) { return success(this.newsDepartmentService.getById(id)); } @@ -59,6 +64,7 @@ * @return 鏂板缁撴灉 */ @PostMapping + @ApiOperation(value = "鏂板鏁版嵁") public R insert(@RequestBody NewsDepartment newsDepartment) { return success(this.newsDepartmentService.save(newsDepartment)); } @@ -70,6 +76,7 @@ * @return 淇敼缁撴灉 */ @PutMapping + @ApiOperation(value = "淇敼鏁版嵁") public R update(@RequestBody NewsDepartment newsDepartment) { return success(this.newsDepartmentService.updateById(newsDepartment)); } @@ -81,6 +88,7 @@ * @return 鍒犻櫎缁撴灉 */ @DeleteMapping + @ApiOperation(value = "鍒犻櫎鏁版嵁") public R delete(@RequestParam("idList") List<Long> idList) { return success(this.newsDepartmentService.removeByIds(idList)); } diff --git a/ycl-platform/src/main/java/com/ycl/controller/NewsDutyController.java b/ycl-platform/src/main/java/com/ycl/controller/NewsDutyController.java index 67f3011..0f7d55f 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/NewsDutyController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/NewsDutyController.java @@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ycl.entity.NewsDuty; import com.ycl.service.NewsDutyService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -22,6 +24,7 @@ */ @RestController @RequestMapping("newsDuty") +@Api(tags = "鍊肩彮绠$悊") public class NewsDutyController extends ApiController { /** * 鏈嶅姟瀵硅薄 @@ -37,6 +40,7 @@ * @return 鎵�鏈夋暟鎹� */ @GetMapping + @ApiOperation(value = "鏌ヨ鎵�鏈夋暟鎹�") public R selectAll(Page<NewsDuty> page, NewsDuty newsDuty) { return success(this.newsDutyService.page(page, new QueryWrapper<>(newsDuty))); } @@ -48,6 +52,7 @@ * @return 鍗曟潯鏁版嵁 */ @GetMapping("{id}") + @ApiOperation(value = "鎸塱d鏌ヨ鏁版嵁") public R selectOne(@PathVariable Serializable id) { return success(this.newsDutyService.getById(id)); } @@ -59,6 +64,7 @@ * @return 鏂板缁撴灉 */ @PostMapping + @ApiOperation(value = "鏂板鏁版嵁") public R insert(@RequestBody NewsDuty newsDuty) { return success(this.newsDutyService.save(newsDuty)); } @@ -70,6 +76,7 @@ * @return 淇敼缁撴灉 */ @PutMapping + @ApiOperation(value = "淇敼鏁版嵁") public R update(@RequestBody NewsDuty newsDuty) { return success(this.newsDutyService.updateById(newsDuty)); } @@ -81,6 +88,7 @@ * @return 鍒犻櫎缁撴灉 */ @DeleteMapping + @ApiOperation(value = "鍒犻櫎鏁版嵁") public R delete(@RequestParam("idList") List<Long> idList) { return success(this.newsDutyService.removeByIds(idList)); } diff --git a/ycl-platform/src/main/java/com/ycl/controller/NewsInformationController.java b/ycl-platform/src/main/java/com/ycl/controller/NewsInformationController.java index 9eef60c..bc16c12 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/NewsInformationController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/NewsInformationController.java @@ -5,23 +5,24 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.api.ApiController; import com.baomidou.mybatisplus.extension.api.R; -import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ycl.entity.NewsColumnInformation; import com.ycl.entity.NewsInformation; import com.ycl.entity.NewsInformationPolice; import com.ycl.entity.NewsPolice; import com.ycl.service.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.io.IOUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; +import sun.nio.ch.IOUtil; import javax.annotation.Resource; import java.io.Serializable; import java.sql.SQLException; -import java.util.Collections; import java.util.List; -import java.util.stream.Collectors; /** * 璧勮琛�(NewsInformation)琛ㄦ帶鍒跺眰 @@ -31,6 +32,7 @@ */ @RestController @RequestMapping("newsInformation") +@Api(tags = "璧勮绠$悊") public class NewsInformationController extends ApiController { /** * 鏈嶅姟瀵硅薄 @@ -49,13 +51,13 @@ /** * 鍒嗛〉鏌ヨ鎵�鏈夋暟鎹� * - * @param page 鍒嗛〉瀵硅薄 - * @param newsInformation 鏌ヨ瀹炰綋 * @return 鎵�鏈夋暟鎹� */ @GetMapping - public R selectAll(Page<NewsInformation> page, NewsInformation newsInformation) { - return success(this.newsInformationService.page(page, new QueryWrapper<>(newsInformation).orderByDesc("publish_time"))); + @ApiOperation(value = "鏌ヨ鎵�鏈夋暟鎹�") + public R selectAll() { + return success(this.newsInformationService.selectAllInformation()); + } /** @@ -65,6 +67,7 @@ * @return 鍗曟潯鏁版嵁 */ @GetMapping("{id}") + @ApiOperation(value = "鎸塱d鏌ヨ鏁版嵁") public R selectOne(@PathVariable Serializable id) { return success(this.newsInformationService.getById(id)); } @@ -77,6 +80,7 @@ */ @Transactional(rollbackFor = SQLException.class) @PostMapping + @ApiOperation(value = "鏂板鏁版嵁") public R insert(@RequestBody NewsInformation newsInformation) { Integer saveResult = this.newsInformationService.insertOneInformation(newsInformation); Integer informationId=newsInformation.getId(); @@ -107,6 +111,8 @@ * @return 淇敼缁撴灉 */ @PutMapping + @ApiOperation(value = "淇敼鏁版嵁") + @Transactional public R update(@RequestBody NewsInformation newsInformation) { Integer informationId = newsInformation.getId(); if (newsInformation.getIsSign()==0){ @@ -127,7 +133,7 @@ for (String columnId:newsInformation.getColumnId()){ newsColumnInformationService.save(NewsColumnInformation.builder().columnId(Integer.parseInt(columnId)).informationId(informationId).build()); } - return success(this.newsInformationService.updateById(newsInformation)); + return success(this.newsInformationService.updateInformationById(newsInformation)); } /** @@ -137,6 +143,7 @@ * @return 鍒犻櫎缁撴灉 */ @DeleteMapping + @ApiOperation(value = "鍒犻櫎鏁版嵁") public R delete(@RequestParam("idList") List<Long> idList) { return success(this.newsInformationService.removeByIds(idList)); } diff --git a/ycl-platform/src/main/java/com/ycl/controller/NewsInformationPoliceController.java b/ycl-platform/src/main/java/com/ycl/controller/NewsInformationPoliceController.java index 48cf832..119cedc 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/NewsInformationPoliceController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/NewsInformationPoliceController.java @@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ycl.entity.NewsInformationPolice; import com.ycl.service.NewsInformationPoliceService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -22,6 +24,7 @@ */ @RestController @RequestMapping("newsInformationPolice") +@Api(tags = "璧勮璀﹀憳涓棿琛ㄦ帶鍒跺眰") public class NewsInformationPoliceController extends ApiController { /** * 鏈嶅姟瀵硅薄 @@ -37,6 +40,7 @@ * @return 鎵�鏈夋暟鎹� */ @GetMapping + @ApiOperation(value = "鏌ヨ鎵�鏈夋暟鎹�") public R selectAll(Page<NewsInformationPolice> page, NewsInformationPolice newsInformationPolice) { return success(this.newsInformationPoliceService.page(page, new QueryWrapper<>(newsInformationPolice))); } @@ -48,6 +52,7 @@ * @return 鍗曟潯鏁版嵁 */ @GetMapping("{id}") + @ApiOperation(value = "鎸塱d鏌ヨ鏁版嵁") public R selectOne(@PathVariable Serializable id) { return success(this.newsInformationPoliceService.getById(id)); } @@ -59,6 +64,7 @@ * @return 鏂板缁撴灉 */ @PostMapping + @ApiOperation(value = "鏂板鏁版嵁") public R insert(@RequestBody NewsInformationPolice newsInformationPolice) { return success(this.newsInformationPoliceService.save(newsInformationPolice)); } @@ -70,6 +76,7 @@ * @return 淇敼缁撴灉 */ @PutMapping + @ApiOperation(value = "淇敼鏁版嵁鎴栫鏀剁姸鎬�") public R updateSignStatus(@RequestBody NewsInformationPolice newsInformationPolice) { if (newsInformationPolice.getId()==null){ QueryWrapper<NewsInformationPolice> wrapper = new QueryWrapper<>(); @@ -88,6 +95,7 @@ * @return 鍒犻櫎缁撴灉 */ @DeleteMapping + @ApiOperation(value = "鍒犻櫎鏁版嵁") public R delete(@RequestParam("idList") List<Long> idList) { return success(this.newsInformationPoliceService.removeByIds(idList)); } @@ -99,6 +107,7 @@ * @return 鍗曟潯鏁版嵁 */ @GetMapping("information/{id}") + @ApiOperation(value = "鎸夎祫璁痠d鏌ヨ鎬绘暟鍜屽凡闃呬汉鏁�") public R selectListByInformationId(@PathVariable Serializable id) { int sum = this.newsInformationPoliceService.count(new QueryWrapper<NewsInformationPolice>().eq("news_information_id", id)); int sign = this.newsInformationPoliceService.count(new QueryWrapper<NewsInformationPolice>().eq("news_information_id", id).eq("is_sign",1)); diff --git a/ycl-platform/src/main/java/com/ycl/controller/NewsPoliceController.java b/ycl-platform/src/main/java/com/ycl/controller/NewsPoliceController.java index 6c8d759..37feae5 100644 --- a/ycl-platform/src/main/java/com/ycl/controller/NewsPoliceController.java +++ b/ycl-platform/src/main/java/com/ycl/controller/NewsPoliceController.java @@ -9,6 +9,8 @@ import com.ycl.entity.NewsPolice; import com.ycl.service.NewsAdminService; import com.ycl.service.NewsPoliceService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; @@ -27,6 +29,7 @@ */ @RestController @RequestMapping("newsPolice") +@Api(tags = "璀﹀憳绠$悊") public class NewsPoliceController extends ApiController { /** * 鏈嶅姟瀵硅薄 @@ -45,6 +48,7 @@ * @return 鎵�鏈夋暟鎹� */ @GetMapping + @ApiOperation(value = "鏌ヨ鎵�鏈夋暟鎹�") public R selectAll(Page<NewsPolice> page, NewsPolice newsPolice) { return success(this.newsPoliceService.page(page, new QueryWrapper<>(newsPolice))); } @@ -56,6 +60,7 @@ * @return 鍗曟潯鏁版嵁 */ @GetMapping("{id}") + @ApiOperation(value = "鎸塱d鏌ヨ鏁版嵁") public R selectOne(@PathVariable Serializable id) { return success(this.newsPoliceService.getById(id)); } @@ -68,6 +73,7 @@ */ @Transactional(rollbackFor = SQLException.class) @PostMapping + @ApiOperation(value = "鏂板鏁版嵁") public R insert(@RequestBody NewsPolice newsPolice) { this.newsPoliceService.save(newsPolice); return success(newsAdminService.autoCreateAdmin(newsPolice)); @@ -80,6 +86,7 @@ * @return 淇敼缁撴灉 */ @PutMapping + @ApiOperation(value = "淇敼鏁版嵁") public R update(@RequestBody NewsPolice newsPolice) { return success(this.newsPoliceService.updateById(newsPolice)); } @@ -91,6 +98,7 @@ * @return 鍒犻櫎缁撴灉 */ @DeleteMapping + @ApiOperation(value = "鍒犻櫎鏁版嵁") public R delete(@RequestParam("idList") List<Long> idList) { return success(this.newsPoliceService.removeByIds(idList)); } diff --git a/ycl-platform/src/main/java/com/ycl/entity/NewsChannel.java b/ycl-platform/src/main/java/com/ycl/entity/NewsChannel.java index ed0ecd2..7a3f875 100644 --- a/ycl-platform/src/main/java/com/ycl/entity/NewsChannel.java +++ b/ycl-platform/src/main/java/com/ycl/entity/NewsChannel.java @@ -2,6 +2,8 @@ import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonFormat; + import java.io.Serializable; import java.sql.Date; import java.util.List; @@ -21,6 +23,7 @@ //棰戦亾缂栫爜ps鍚嶇О棣栧瓧姣� private String code; //鍒涘缓鏃堕棿 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Date createTime; //鏍忕洰id private List<String> columnId; diff --git a/ycl-platform/src/main/java/com/ycl/entity/NewsChannelColumn.java b/ycl-platform/src/main/java/com/ycl/entity/NewsChannelColumn.java index 52d1236..f4d926f 100644 --- a/ycl-platform/src/main/java/com/ycl/entity/NewsChannelColumn.java +++ b/ycl-platform/src/main/java/com/ycl/entity/NewsChannelColumn.java @@ -2,6 +2,9 @@ import com.baomidou.mybatisplus.extension.activerecord.Model; +import lombok.AllArgsConstructor; +import lombok.Builder; + import java.io.Serializable; /** @@ -11,6 +14,8 @@ * @since 2022-11-17 11:38:27 */ @SuppressWarnings("serial") +@Builder +@AllArgsConstructor public class NewsChannelColumn extends Model<NewsChannelColumn> { private Integer id; @@ -18,7 +23,6 @@ private Integer channelId; //鏍忕洰id private Integer columnId; - public Integer getId() { return id; diff --git a/ycl-platform/src/main/java/com/ycl/mapper/NewsChannelDao.java b/ycl-platform/src/main/java/com/ycl/mapper/NewsChannelDao.java index 007e4df..f06b340 100644 --- a/ycl-platform/src/main/java/com/ycl/mapper/NewsChannelDao.java +++ b/ycl-platform/src/main/java/com/ycl/mapper/NewsChannelDao.java @@ -31,5 +31,9 @@ */ int insertOrUpdateBatch(@Param("entities") List<NewsChannel> entities); +int insertOneChannel(@Param("entity") NewsChannel entity); + +List<NewsChannel> selectAllChannel(); + } diff --git a/ycl-platform/src/main/java/com/ycl/mapper/NewsInformationDao.java b/ycl-platform/src/main/java/com/ycl/mapper/NewsInformationDao.java index b92231b..76cc06a 100644 --- a/ycl-platform/src/main/java/com/ycl/mapper/NewsInformationDao.java +++ b/ycl-platform/src/main/java/com/ycl/mapper/NewsInformationDao.java @@ -33,5 +33,10 @@ int insertOneInformation(@Param("entity") NewsInformation entity); +NewsInformation selectInformationById(@Param("InformationId") Integer InformationId); + +List<NewsInformation> selectAllInformation(); + +int updateInformationById(@Param("entity") NewsInformation entity); } diff --git a/ycl-platform/src/main/java/com/ycl/service/NewsChannelService.java b/ycl-platform/src/main/java/com/ycl/service/NewsChannelService.java index f2e940c..1674242 100644 --- a/ycl-platform/src/main/java/com/ycl/service/NewsChannelService.java +++ b/ycl-platform/src/main/java/com/ycl/service/NewsChannelService.java @@ -2,6 +2,9 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ycl.entity.NewsChannel; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 棰戦亾琛�(NewsChannel)琛ㄦ湇鍔℃帴鍙� @@ -10,6 +13,8 @@ * @since 2022-11-17 11:38:27 */ public interface NewsChannelService extends IService<NewsChannel> { + int insertOneChannel(@Param("entity") NewsChannel entity); + List<NewsChannel> selectAllChannel(); } diff --git a/ycl-platform/src/main/java/com/ycl/service/NewsInformationService.java b/ycl-platform/src/main/java/com/ycl/service/NewsInformationService.java index a5fbfd6..71bb300 100644 --- a/ycl-platform/src/main/java/com/ycl/service/NewsInformationService.java +++ b/ycl-platform/src/main/java/com/ycl/service/NewsInformationService.java @@ -2,6 +2,9 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ycl.entity.NewsInformation; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 璧勮琛�(NewsInformation)琛ㄦ湇鍔℃帴鍙� @@ -11,5 +14,11 @@ */ public interface NewsInformationService extends IService<NewsInformation> { int insertOneInformation(NewsInformation entity); + + NewsInformation selectInformationById(Integer InformationId); + + List<NewsInformation> selectAllInformation(); + + int updateInformationById(NewsInformation entity); } diff --git a/ycl-platform/src/main/java/com/ycl/service/impl/NewsAdminServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/impl/NewsAdminServiceImpl.java index 5d4aaf2..f3ea73d 100644 --- a/ycl-platform/src/main/java/com/ycl/service/impl/NewsAdminServiceImpl.java +++ b/ycl-platform/src/main/java/com/ycl/service/impl/NewsAdminServiceImpl.java @@ -5,6 +5,7 @@ import com.ycl.entity.NewsAdmin; import com.ycl.entity.NewsPolice; import com.ycl.service.NewsAdminService; +import com.ycl.utils.MD5Util; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -33,7 +34,7 @@ public Integer autoCreateAdmin(NewsPolice newsPolice) { NewsAdmin admin = new NewsAdmin(); admin.setUsername(newsPolice.getRname()); - admin.setPassword(defaultPassword); + admin.setPassword(MD5Util.md5Encrypt32Lower(defaultPassword)); admin.setCreateTime(new Date()); admin.setStatus(1); admin.setNewsPoliceId(newsPolice.getId()); diff --git a/ycl-platform/src/main/java/com/ycl/service/impl/NewsChannelServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/impl/NewsChannelServiceImpl.java index 4577571..51931a7 100644 --- a/ycl-platform/src/main/java/com/ycl/service/impl/NewsChannelServiceImpl.java +++ b/ycl-platform/src/main/java/com/ycl/service/impl/NewsChannelServiceImpl.java @@ -4,7 +4,10 @@ import com.ycl.mapper.NewsChannelDao; import com.ycl.entity.NewsChannel; import com.ycl.service.NewsChannelService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + +import java.util.List; /** * 棰戦亾琛�(NewsChannel)琛ㄦ湇鍔″疄鐜扮被 @@ -15,5 +18,17 @@ @Service("newsChannelService") public class NewsChannelServiceImpl extends ServiceImpl<NewsChannelDao, NewsChannel> implements NewsChannelService { + @Autowired + NewsChannelDao newsChannelDao; + + @Override + public int insertOneChannel(NewsChannel entity) { + return newsChannelDao.insertOneChannel(entity); + } + + @Override + public List<NewsChannel> selectAllChannel() { + return newsChannelDao.selectAllChannel(); + } } diff --git a/ycl-platform/src/main/java/com/ycl/service/impl/NewsInformationServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/impl/NewsInformationServiceImpl.java index bffdf7b..f4667b8 100644 --- a/ycl-platform/src/main/java/com/ycl/service/impl/NewsInformationServiceImpl.java +++ b/ycl-platform/src/main/java/com/ycl/service/impl/NewsInformationServiceImpl.java @@ -4,9 +4,10 @@ import com.ycl.mapper.NewsInformationDao; import com.ycl.entity.NewsInformation; import com.ycl.service.NewsInformationService; -import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + +import java.util.List; /** * 璧勮琛�(NewsInformation)琛ㄦ湇鍔″疄鐜扮被 @@ -24,5 +25,20 @@ public int insertOneInformation(NewsInformation entity) { return newsInformationDao.insertOneInformation(entity); } + + @Override + public NewsInformation selectInformationById(Integer InformationId) { + return newsInformationDao.selectInformationById(InformationId); + } + + @Override + public List<NewsInformation> selectAllInformation() { + return newsInformationDao.selectAllInformation(); + } + + @Override + public int updateInformationById(NewsInformation entity) { + return newsInformationDao.updateInformationById(entity); + } } diff --git a/ycl-platform/src/main/resources/application-dev.yml b/ycl-platform/src/main/resources/application-dev.yml index 49c9401..7551e16 100644 --- a/ycl-platform/src/main/resources/application-dev.yml +++ b/ycl-platform/src/main/resources/application-dev.yml @@ -6,20 +6,20 @@ context-path: /air compression: true -fdfs: - fileUrl: http://140.143.152.226:8410/ - groupName: sczhzf - soTimeout: 1500 - connectTimeout: 600 - trackerList: #TrackerList鍙傛暟,鏀寔澶氫釜 - - 140.143.152.226:22122 +#fdfs: +# fileUrl: http://140.143.152.226:8410/ +# groupName: sczhzf +# soTimeout: 1500 +# connectTimeout: 600 +# trackerList: #TrackerList鍙傛暟,鏀寔澶氫釜 +# - 140.143.152.226:22122 -cfg: - res: d://resources - media-res: 140.143.152.226/media/ - snow-flake: - datacenterId: 1 - machineId: 1 +#cfg: +# res: d://resources +# media-res: 140.143.152.226/media/ +# snow-flake: +# datacenterId: 1 +# machineId: 1 spring: redis: @@ -53,16 +53,16 @@ testOnReturn: false poolPreparedStatements: true maxOpenPreparedStatements: 20 -e-mail: - sendHost: smtp.qq.com - username: 1723292425@qq.com - password: qizcitupatzoeeij - -SMS: - ecName: ycl - apId: 1 - sign: sign - url: http://localhost:8082/sccg/text/sms_res +#e-mail: +# sendHost: smtp.qq.com +# username: 1723292425@qq.com +# password: qizcitupatzoeeij +# +#SMS: +# ecName: ycl +# apId: 1 +# sign: sign +# url: http://localhost:8082/sccg/text/sms_res admin: defaultPassword: 111111 diff --git a/ycl-platform/src/main/resources/application.yml b/ycl-platform/src/main/resources/application.yml index 0ec856e..7d4a767 100644 --- a/ycl-platform/src/main/resources/application.yml +++ b/ycl-platform/src/main/resources/application.yml @@ -32,13 +32,13 @@ expiration: 604800 #JWT鐨勮秴鏈熼檺鏃堕棿(60*60*24*7) tokenHead: 'Bearer ' #JWT璐熻浇涓嬁鍒板紑澶� -redis: - database: sccg - key: - admin: 'ums:admin' - resourceList: 'ums:menuList' - expire: - common: 86400 # 24灏忔椂 +#redis: +# database: sccg +# key: +# admin: 'ums:admin' +# resourceList: 'ums:menuList' +# expire: +# common: 86400 # 24灏忔椂 #MP閰嶇疆 mybatis-plus: diff --git a/ycl-platform/src/main/resources/dao/NewsAdminDao.xml b/ycl-platform/src/main/resources/mapper/NewsAdminDao.xml similarity index 100% rename from ycl-platform/src/main/resources/dao/NewsAdminDao.xml rename to ycl-platform/src/main/resources/mapper/NewsAdminDao.xml diff --git a/ycl-platform/src/main/resources/mapper/NewsChannelColumnDao.xml b/ycl-platform/src/main/resources/mapper/NewsChannelColumnDao.xml index 2fc4316..ec9b0f7 100644 --- a/ycl-platform/src/main/resources/mapper/NewsChannelColumnDao.xml +++ b/ycl-platform/src/main/resources/mapper/NewsChannelColumnDao.xml @@ -24,7 +24,8 @@ (#{entity.channelId}, #{entity.columnId}) </foreach> on duplicate key update - channel_id = values(channel_id) , column_id = values(column_id) </insert> + channel_id = values(channel_id) , column_id = values(column_id) + </insert> </mapper> diff --git a/ycl-platform/src/main/resources/mapper/NewsChannelDao.xml b/ycl-platform/src/main/resources/mapper/NewsChannelDao.xml index 7d18317..8ef9d38 100644 --- a/ycl-platform/src/main/resources/mapper/NewsChannelDao.xml +++ b/ycl-platform/src/main/resources/mapper/NewsChannelDao.xml @@ -25,7 +25,16 @@ (#{entity.name}, #{entity.code}, #{entity.createTime}) </foreach> on duplicate key update - name = values(name) , code = values(code) , create_time = values(create_time) </insert> + name = values(name) , code = values(code) , create_time = values(create_time) + </insert> + <insert id="insertOneChannel" keyProperty="id" useGeneratedKeys="true"> + insert into news_website.news_channel(name, code, create_time) + values (#{entity.name}, #{entity.code}, #{entity.createTime}) + </insert> + + <select id="selectAllChannel" resultType="com.ycl.entity.NewsChannel"> + select * from news_channel + </select> </mapper> diff --git a/ycl-platform/src/main/resources/mapper/NewsColumnInformationDao.xml b/ycl-platform/src/main/resources/mapper/NewsColumnInformationDao.xml index 900c2fa..caa706d 100644 --- a/ycl-platform/src/main/resources/mapper/NewsColumnInformationDao.xml +++ b/ycl-platform/src/main/resources/mapper/NewsColumnInformationDao.xml @@ -24,7 +24,8 @@ (#{entity.columnId}, #{entity.informationId}) </foreach> on duplicate key update - column_id = values(column_id) , information_id = values(information_id) </insert> + column_id = values(column_id) , information_id = values(information_id) + </insert> </mapper> diff --git a/ycl-platform/src/main/resources/dao/NewsDepartmentDao.xml b/ycl-platform/src/main/resources/mapper/NewsDepartmentDao.xml similarity index 100% rename from ycl-platform/src/main/resources/dao/NewsDepartmentDao.xml rename to ycl-platform/src/main/resources/mapper/NewsDepartmentDao.xml diff --git a/ycl-platform/src/main/resources/mapper/NewsInformationDao.xml b/ycl-platform/src/main/resources/mapper/NewsInformationDao.xml index 1c30fe2..a2921bd 100644 --- a/ycl-platform/src/main/resources/mapper/NewsInformationDao.xml +++ b/ycl-platform/src/main/resources/mapper/NewsInformationDao.xml @@ -34,7 +34,19 @@ <insert id="insertOneInformation" keyProperty="id" useGeneratedKeys="true"> insert into news_website.news_information(title, content, publish_time, is_sign, create_time, send_to, image_url) values (#{entity.title}, #{entity.content}, #{entity.publishTime}, #{entity.isSign}, #{entity.createTime}, #{entity.sendTo}, #{entity.imageUrl}) - </insert> + + <select id="selectInformationById" resultType="com.ycl.entity.NewsInformation" parameterType="int"> + select * from news_information where id=#{InformationId} + </select> + + <select id="selectAllInformation" resultType="com.ycl.entity.NewsInformation"> + select * from news_information + </select> + + <update id="updateInformationById" parameterType="com.ycl.entity.NewsInformation"> + update news_information set title=#{entity.title},content=#{entity.content},publish_time=#{entity.publishTime}, is_sign=#{entity.isSign}, create_time=#{entity.createTime}, send_to=#{entity.sendTo}, image_url=#{entity.imageUrl} + where id=#{entity.id} + </update> </mapper> diff --git a/ycl-platform/src/main/resources/dao/NewsInformationPoliceDao.xml b/ycl-platform/src/main/resources/mapper/NewsInformationPoliceDao.xml similarity index 100% rename from ycl-platform/src/main/resources/dao/NewsInformationPoliceDao.xml rename to ycl-platform/src/main/resources/mapper/NewsInformationPoliceDao.xml diff --git a/ycl-platform/src/main/resources/dao/NewsPoliceDao.xml b/ycl-platform/src/main/resources/mapper/NewsPoliceDao.xml similarity index 100% rename from ycl-platform/src/main/resources/dao/NewsPoliceDao.xml rename to ycl-platform/src/main/resources/mapper/NewsPoliceDao.xml diff --git a/ycl-platform/target/classes/mapper/NewsChannelColumnDao.xml b/ycl-platform/target/classes/mapper/NewsChannelColumnDao.xml index 2fc4316..ec9b0f7 100644 --- a/ycl-platform/target/classes/mapper/NewsChannelColumnDao.xml +++ b/ycl-platform/target/classes/mapper/NewsChannelColumnDao.xml @@ -24,7 +24,8 @@ (#{entity.channelId}, #{entity.columnId}) </foreach> on duplicate key update - channel_id = values(channel_id) , column_id = values(column_id) </insert> + channel_id = values(channel_id) , column_id = values(column_id) + </insert> </mapper> diff --git a/ycl-platform/target/classes/mapper/NewsChannelDao.xml b/ycl-platform/target/classes/mapper/NewsChannelDao.xml index 7d18317..8ef9d38 100644 --- a/ycl-platform/target/classes/mapper/NewsChannelDao.xml +++ b/ycl-platform/target/classes/mapper/NewsChannelDao.xml @@ -25,7 +25,16 @@ (#{entity.name}, #{entity.code}, #{entity.createTime}) </foreach> on duplicate key update - name = values(name) , code = values(code) , create_time = values(create_time) </insert> + name = values(name) , code = values(code) , create_time = values(create_time) + </insert> + <insert id="insertOneChannel" keyProperty="id" useGeneratedKeys="true"> + insert into news_website.news_channel(name, code, create_time) + values (#{entity.name}, #{entity.code}, #{entity.createTime}) + </insert> + + <select id="selectAllChannel" resultType="com.ycl.entity.NewsChannel"> + select * from news_channel + </select> </mapper> diff --git a/ycl-platform/target/classes/mapper/NewsColumnInformationDao.xml b/ycl-platform/target/classes/mapper/NewsColumnInformationDao.xml index 900c2fa..caa706d 100644 --- a/ycl-platform/target/classes/mapper/NewsColumnInformationDao.xml +++ b/ycl-platform/target/classes/mapper/NewsColumnInformationDao.xml @@ -24,7 +24,8 @@ (#{entity.columnId}, #{entity.informationId}) </foreach> on duplicate key update - column_id = values(column_id) , information_id = values(information_id) </insert> + column_id = values(column_id) , information_id = values(information_id) + </insert> </mapper> diff --git a/ycl-platform/target/classes/mapper/NewsInformationDao.xml b/ycl-platform/target/classes/mapper/NewsInformationDao.xml index 1c30fe2..a2921bd 100644 --- a/ycl-platform/target/classes/mapper/NewsInformationDao.xml +++ b/ycl-platform/target/classes/mapper/NewsInformationDao.xml @@ -34,7 +34,19 @@ <insert id="insertOneInformation" keyProperty="id" useGeneratedKeys="true"> insert into news_website.news_information(title, content, publish_time, is_sign, create_time, send_to, image_url) values (#{entity.title}, #{entity.content}, #{entity.publishTime}, #{entity.isSign}, #{entity.createTime}, #{entity.sendTo}, #{entity.imageUrl}) - </insert> + + <select id="selectInformationById" resultType="com.ycl.entity.NewsInformation" parameterType="int"> + select * from news_information where id=#{InformationId} + </select> + + <select id="selectAllInformation" resultType="com.ycl.entity.NewsInformation"> + select * from news_information + </select> + + <update id="updateInformationById" parameterType="com.ycl.entity.NewsInformation"> + update news_information set title=#{entity.title},content=#{entity.content},publish_time=#{entity.publishTime}, is_sign=#{entity.isSign}, create_time=#{entity.createTime}, send_to=#{entity.sendTo}, image_url=#{entity.imageUrl} + where id=#{entity.id} + </update> </mapper> -- Gitblit v1.8.0