31个文件已修改
1个文件已添加
4 文件已重命名
1个文件已删除
| | |
| | | <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>
|
| | |
| | | public void addInterceptors(InterceptorRegistry registry) { |
| | | registry.addInterceptor(this.Intercept()) |
| | | //需要验证请求路径 /*代表全部 |
| | | .addPathPatterns("/newsAdmin/text"); |
| | | .addPathPatterns("/newsAdmin/login"); |
| | | } |
| | | } |
New file |
| | |
| | | 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("上传失败!");
|
| | | }
|
| | | }
|
| | |
| | | * @return 所有数据
|
| | | */
|
| | | @GetMapping
|
| | | @ApiOperation(value = "查询所有数据")
|
| | | public R selectAll(Page<NewsAdmin> page, NewsAdmin newsAdmin) {
|
| | | return success(this.newsAdminService.page(page, new QueryWrapper<>(newsAdmin)));
|
| | | }
|
| | |
| | | * @return 单条数据
|
| | | */
|
| | | @GetMapping("{id}")
|
| | | @ApiOperation(value = "按id查询数据")
|
| | | public R selectOne(@PathVariable Serializable id) {
|
| | | return success(this.newsAdminService.getById(id));
|
| | | }
|
| | |
| | | * @return 新增结果
|
| | | */
|
| | | @PostMapping
|
| | | @ApiOperation(value = "新增数据")
|
| | | public R insert(@RequestBody NewsAdmin newsAdmin) {
|
| | | return success(this.newsAdminService.save(newsAdmin));
|
| | | }
|
| | |
| | | * @return 修改结果
|
| | | */
|
| | | @PutMapping
|
| | | @ApiOperation(value = "修改数据")
|
| | | public R update(@RequestBody NewsAdmin newsAdmin) {
|
| | | return success(this.newsAdminService.updateById(newsAdmin));
|
| | | }
|
| | |
| | | * @return 删除结果
|
| | | */
|
| | | @DeleteMapping
|
| | | @ApiOperation(value = "删除数据")
|
| | | public R delete(@RequestParam("idList") List<Long> idList) {
|
| | | return success(this.newsAdminService.removeByIds(idList));
|
| | | }
|
| | |
| | | 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;
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @RestController
|
| | | @RequestMapping("newsChannelColumn")
|
| | | @Api(tags = "频道栏目中间表控制层")
|
| | | public class NewsChannelColumnController extends ApiController {
|
| | | /**
|
| | | * 服务对象
|
| | | */
|
| | | @Resource
|
| | | private NewsChannelColumnService newsChannelColumnService;
|
| | |
|
| | | @Autowired
|
| | | private NewsColumnService newsColumnService;
|
| | |
|
| | | /**
|
| | | * 分页查询所有数据
|
| | |
| | | * @return 所有数据
|
| | | */
|
| | | @GetMapping
|
| | | @ApiOperation(value = "查询所有数据")
|
| | | public R selectAll(Page<NewsChannelColumn> page, NewsChannelColumn newsChannelColumn) {
|
| | | return success(this.newsChannelColumnService.page(page, new QueryWrapper<>(newsChannelColumn)));
|
| | | }
|
| | |
| | | * @return 单条数据
|
| | | */
|
| | | @GetMapping("{id}")
|
| | | @ApiOperation(value = "按id查询数据")
|
| | | public R selectOne(@PathVariable Serializable id) {
|
| | | return success(this.newsChannelColumnService.getById(id));
|
| | | }
|
| | |
| | | * @return 新增结果
|
| | | */
|
| | | @PostMapping
|
| | | @ApiOperation(value = "新增数据")
|
| | | public R insert(@RequestBody NewsChannelColumn newsChannelColumn) {
|
| | | return success(this.newsChannelColumnService.save(newsChannelColumn));
|
| | | }
|
| | |
| | | * @return 修改结果
|
| | | */
|
| | | @PutMapping
|
| | | @ApiOperation(value = "修改数据")
|
| | | public R update(@RequestBody NewsChannelColumn newsChannelColumn) {
|
| | | return success(this.newsChannelColumnService.updateById(newsChannelColumn));
|
| | | }
|
| | |
| | | * @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 = "按频道id查询栏目")
|
| | | 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);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | 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;
|
| | |
| | | */
|
| | | @RestController
|
| | | @RequestMapping("newsChannel")
|
| | | @Api(tags = "频道管理")
|
| | | public class NewsChannelController extends ApiController {
|
| | | /**
|
| | | * 服务对象
|
| | |
| | | @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());
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @return 单条数据
|
| | | */
|
| | | @GetMapping("{id}")
|
| | | @ApiOperation(value = "按id查询数据")
|
| | | public R selectOne(@PathVariable Serializable id) {
|
| | | return success(this.newsChannelService.getById(id));
|
| | | }
|
| | |
| | | * @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);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @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));
|
| | | }
|
| | |
|
| | |
| | | * @return 删除结果
|
| | | */
|
| | | @DeleteMapping
|
| | | @ApiOperation(value = "删除数据")
|
| | | public R delete(@RequestParam("idList") List<Long> idList) {
|
| | | return success(this.newsChannelService.removeByIds(idList));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
| | | 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;
|
| | |
| | | */
|
| | | @RestController
|
| | | @RequestMapping("newsColumn")
|
| | | @Api(tags = "栏目管理")
|
| | | public class NewsColumnController extends ApiController {
|
| | | /**
|
| | | * 服务对象
|
| | |
| | | * @return 所有数据
|
| | | */
|
| | | @GetMapping
|
| | | @ApiOperation(value = "查询所有数据")
|
| | | public R selectAll(Page<NewsColumn> page, NewsColumn newsColumn) {
|
| | | return success(this.newsColumnService.page(page, new QueryWrapper<>(newsColumn)));
|
| | | }
|
| | |
| | | * @return 单条数据
|
| | | */
|
| | | @GetMapping("{id}")
|
| | | @ApiOperation(value = "按id查询数据")
|
| | | public R selectOne(@PathVariable Serializable id) {
|
| | | return success(this.newsColumnService.getById(id));
|
| | | }
|
| | |
| | | * @return 新增结果
|
| | | */
|
| | | @PostMapping
|
| | | @ApiOperation(value = "新增数据")
|
| | | public R insert(@RequestBody NewsColumn newsColumn) {
|
| | | return success(this.newsColumnService.save(newsColumn));
|
| | | }
|
| | |
| | | * @return 修改结果
|
| | | */
|
| | | @PutMapping
|
| | | @ApiOperation(value = "修改数据")
|
| | | public R update(@RequestBody NewsColumn newsColumn) {
|
| | | return success(this.newsColumnService.updateById(newsColumn));
|
| | | }
|
| | |
| | | * @return 删除结果
|
| | | */
|
| | | @DeleteMapping
|
| | | @ApiOperation(value = "删除数据")
|
| | | public R delete(@RequestParam("idList") List<Long> idList) {
|
| | | return success(this.newsColumnService.removeByIds(idList));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
| | | 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;
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @RestController
|
| | | @RequestMapping("newsColumnInformation")
|
| | | @Api(tags = "栏目咨询中间表控制层")
|
| | | public class NewsColumnInformationController extends ApiController {
|
| | | /**
|
| | | * 服务对象
|
| | |
| | | @Resource
|
| | | private NewsColumnInformationService newsColumnInformationService;
|
| | |
|
| | | @Autowired
|
| | | private NewsInformationService newsInformationService;
|
| | | /**
|
| | | * 分页查询所有数据
|
| | | *
|
| | |
| | | * @return 所有数据
|
| | | */
|
| | | @GetMapping
|
| | | @ApiOperation(value = "查询所有数据")
|
| | | public R selectAll(Page<NewsColumnInformation> page, NewsColumnInformation newsColumnInformation) {
|
| | | return success(this.newsColumnInformationService.page(page, new QueryWrapper<>(newsColumnInformation)));
|
| | | }
|
| | |
| | | * @return 单条数据
|
| | | */
|
| | | @GetMapping("{id}")
|
| | | @ApiOperation(value = "按id查询数据")
|
| | | public R selectOne(@PathVariable Serializable id) {
|
| | | return success(this.newsColumnInformationService.getById(id));
|
| | | }
|
| | |
| | | * @return 新增结果
|
| | | */
|
| | | @PostMapping
|
| | | @ApiOperation(value = "新增数据")
|
| | | public R insert(@RequestBody NewsColumnInformation newsColumnInformation) {
|
| | | return success(this.newsColumnInformationService.save(newsColumnInformation));
|
| | | }
|
| | |
| | | * @return 修改结果
|
| | | */
|
| | | @PutMapping
|
| | | @ApiOperation(value = "修改数据")
|
| | | public R update(@RequestBody NewsColumnInformation newsColumnInformation) {
|
| | | return success(this.newsColumnInformationService.updateById(newsColumnInformation));
|
| | | }
|
| | |
| | | * @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);
|
| | | }}
|
| | |
|
| | |
| | | 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;
|
| | |
| | | */
|
| | | @RestController
|
| | | @RequestMapping("newsDepartment")
|
| | | @Api(tags = "机构管理")
|
| | | public class NewsDepartmentController extends ApiController {
|
| | | /**
|
| | | * 服务对象
|
| | |
| | | * @return 所有数据
|
| | | */
|
| | | @GetMapping
|
| | | @ApiOperation(value = "查询所有数据")
|
| | | public R selectAll(Page<NewsDepartment> page, NewsDepartment newsDepartment) {
|
| | | return success(this.newsDepartmentService.page(page, new QueryWrapper<>(newsDepartment)));
|
| | | }
|
| | |
| | | * @return 单条数据
|
| | | */
|
| | | @GetMapping("{id}")
|
| | | @ApiOperation(value = "按id查询数据")
|
| | | public R selectOne(@PathVariable Serializable id) {
|
| | | return success(this.newsDepartmentService.getById(id));
|
| | | }
|
| | |
| | | * @return 新增结果
|
| | | */
|
| | | @PostMapping
|
| | | @ApiOperation(value = "新增数据")
|
| | | public R insert(@RequestBody NewsDepartment newsDepartment) {
|
| | | return success(this.newsDepartmentService.save(newsDepartment));
|
| | | }
|
| | |
| | | * @return 修改结果
|
| | | */
|
| | | @PutMapping
|
| | | @ApiOperation(value = "修改数据")
|
| | | public R update(@RequestBody NewsDepartment newsDepartment) {
|
| | | return success(this.newsDepartmentService.updateById(newsDepartment));
|
| | | }
|
| | |
| | | * @return 删除结果
|
| | | */
|
| | | @DeleteMapping
|
| | | @ApiOperation(value = "删除数据")
|
| | | public R delete(@RequestParam("idList") List<Long> idList) {
|
| | | return success(this.newsDepartmentService.removeByIds(idList));
|
| | | }
|
| | |
| | | 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;
|
| | |
| | | */
|
| | | @RestController
|
| | | @RequestMapping("newsDuty")
|
| | | @Api(tags = "值班管理")
|
| | | public class NewsDutyController extends ApiController {
|
| | | /**
|
| | | * 服务对象
|
| | |
| | | * @return 所有数据
|
| | | */
|
| | | @GetMapping
|
| | | @ApiOperation(value = "查询所有数据")
|
| | | public R selectAll(Page<NewsDuty> page, NewsDuty newsDuty) {
|
| | | return success(this.newsDutyService.page(page, new QueryWrapper<>(newsDuty)));
|
| | | }
|
| | |
| | | * @return 单条数据
|
| | | */
|
| | | @GetMapping("{id}")
|
| | | @ApiOperation(value = "按id查询数据")
|
| | | public R selectOne(@PathVariable Serializable id) {
|
| | | return success(this.newsDutyService.getById(id));
|
| | | }
|
| | |
| | | * @return 新增结果
|
| | | */
|
| | | @PostMapping
|
| | | @ApiOperation(value = "新增数据")
|
| | | public R insert(@RequestBody NewsDuty newsDuty) {
|
| | | return success(this.newsDutyService.save(newsDuty));
|
| | | }
|
| | |
| | | * @return 修改结果
|
| | | */
|
| | | @PutMapping
|
| | | @ApiOperation(value = "修改数据")
|
| | | public R update(@RequestBody NewsDuty newsDuty) {
|
| | | return success(this.newsDutyService.updateById(newsDuty));
|
| | | }
|
| | |
| | | * @return 删除结果
|
| | | */
|
| | | @DeleteMapping
|
| | | @ApiOperation(value = "删除数据")
|
| | | public R delete(@RequestParam("idList") List<Long> idList) {
|
| | | return success(this.newsDutyService.removeByIds(idList));
|
| | | }
|
| | |
| | | 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)表控制层
|
| | |
| | | */
|
| | | @RestController
|
| | | @RequestMapping("newsInformation")
|
| | | @Api(tags = "资讯管理")
|
| | | public class NewsInformationController extends ApiController {
|
| | | /**
|
| | | * 服务对象
|
| | |
| | | /**
|
| | | * 分页查询所有数据
|
| | | *
|
| | | * @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());
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @return 单条数据
|
| | | */
|
| | | @GetMapping("{id}")
|
| | | @ApiOperation(value = "按id查询数据")
|
| | | public R selectOne(@PathVariable Serializable id) {
|
| | | return success(this.newsInformationService.getById(id));
|
| | | }
|
| | |
| | | */
|
| | | @Transactional(rollbackFor = SQLException.class)
|
| | | @PostMapping
|
| | | @ApiOperation(value = "新增数据")
|
| | | public R insert(@RequestBody NewsInformation newsInformation) {
|
| | | Integer saveResult = this.newsInformationService.insertOneInformation(newsInformation);
|
| | | Integer informationId=newsInformation.getId();
|
| | |
| | | * @return 修改结果
|
| | | */
|
| | | @PutMapping
|
| | | @ApiOperation(value = "修改数据")
|
| | | @Transactional
|
| | | public R update(@RequestBody NewsInformation newsInformation) {
|
| | | Integer informationId = newsInformation.getId();
|
| | | if (newsInformation.getIsSign()==0){
|
| | |
| | | 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));
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @return 删除结果
|
| | | */
|
| | | @DeleteMapping
|
| | | @ApiOperation(value = "删除数据")
|
| | | public R delete(@RequestParam("idList") List<Long> idList) {
|
| | | return success(this.newsInformationService.removeByIds(idList));
|
| | | }
|
| | |
| | | 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;
|
| | |
| | | */
|
| | | @RestController
|
| | | @RequestMapping("newsInformationPolice")
|
| | | @Api(tags = "资讯警员中间表控制层")
|
| | | public class NewsInformationPoliceController extends ApiController {
|
| | | /**
|
| | | * 服务对象
|
| | |
| | | * @return 所有数据
|
| | | */
|
| | | @GetMapping
|
| | | @ApiOperation(value = "查询所有数据")
|
| | | public R selectAll(Page<NewsInformationPolice> page, NewsInformationPolice newsInformationPolice) {
|
| | | return success(this.newsInformationPoliceService.page(page, new QueryWrapper<>(newsInformationPolice)));
|
| | | }
|
| | |
| | | * @return 单条数据
|
| | | */
|
| | | @GetMapping("{id}")
|
| | | @ApiOperation(value = "按id查询数据")
|
| | | public R selectOne(@PathVariable Serializable id) {
|
| | | return success(this.newsInformationPoliceService.getById(id));
|
| | | }
|
| | |
| | | * @return 新增结果
|
| | | */
|
| | | @PostMapping
|
| | | @ApiOperation(value = "新增数据")
|
| | | public R insert(@RequestBody NewsInformationPolice newsInformationPolice) {
|
| | | return success(this.newsInformationPoliceService.save(newsInformationPolice));
|
| | | }
|
| | |
| | | * @return 修改结果
|
| | | */
|
| | | @PutMapping
|
| | | @ApiOperation(value = "修改数据或签收状态")
|
| | | public R updateSignStatus(@RequestBody NewsInformationPolice newsInformationPolice) {
|
| | | if (newsInformationPolice.getId()==null){
|
| | | QueryWrapper<NewsInformationPolice> wrapper = new QueryWrapper<>();
|
| | |
| | | * @return 删除结果
|
| | | */
|
| | | @DeleteMapping
|
| | | @ApiOperation(value = "删除数据")
|
| | | public R delete(@RequestParam("idList") List<Long> idList) {
|
| | | return success(this.newsInformationPoliceService.removeByIds(idList));
|
| | | }
|
| | |
| | | * @return 单条数据
|
| | | */
|
| | | @GetMapping("information/{id}")
|
| | | @ApiOperation(value = "按资讯id查询总数和已阅人数")
|
| | | 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));
|
| | |
| | | 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.*;
|
| | |
| | | */
|
| | | @RestController
|
| | | @RequestMapping("newsPolice")
|
| | | @Api(tags = "警员管理")
|
| | | public class NewsPoliceController extends ApiController {
|
| | | /**
|
| | | * 服务对象
|
| | |
| | | * @return 所有数据
|
| | | */
|
| | | @GetMapping
|
| | | @ApiOperation(value = "查询所有数据")
|
| | | public R selectAll(Page<NewsPolice> page, NewsPolice newsPolice) {
|
| | | return success(this.newsPoliceService.page(page, new QueryWrapper<>(newsPolice)));
|
| | | }
|
| | |
| | | * @return 单条数据
|
| | | */
|
| | | @GetMapping("{id}")
|
| | | @ApiOperation(value = "按id查询数据")
|
| | | public R selectOne(@PathVariable Serializable id) {
|
| | | return success(this.newsPoliceService.getById(id));
|
| | | }
|
| | |
| | | */
|
| | | @Transactional(rollbackFor = SQLException.class)
|
| | | @PostMapping
|
| | | @ApiOperation(value = "新增数据")
|
| | | public R insert(@RequestBody NewsPolice newsPolice) {
|
| | | this.newsPoliceService.save(newsPolice);
|
| | | return success(newsAdminService.autoCreateAdmin(newsPolice));
|
| | |
| | | * @return 修改结果
|
| | | */
|
| | | @PutMapping
|
| | | @ApiOperation(value = "修改数据")
|
| | | public R update(@RequestBody NewsPolice newsPolice) {
|
| | | return success(this.newsPoliceService.updateById(newsPolice));
|
| | | }
|
| | |
| | | * @return 删除结果
|
| | | */
|
| | | @DeleteMapping
|
| | | @ApiOperation(value = "删除数据")
|
| | | public R delete(@RequestParam("idList") List<Long> idList) {
|
| | | return success(this.newsPoliceService.removeByIds(idList));
|
| | | }
|
| | |
| | |
|
| | |
|
| | | 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;
|
| | |
| | | //频道编码ps名称首字母
|
| | | private String code;
|
| | | //创建时间
|
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
| | | private Date createTime;
|
| | | //栏目id
|
| | | private List<String> columnId;
|
| | |
| | |
|
| | |
|
| | | import com.baomidou.mybatisplus.extension.activerecord.Model;
|
| | | import lombok.AllArgsConstructor;
|
| | | import lombok.Builder;
|
| | |
|
| | | import java.io.Serializable;
|
| | |
|
| | | /**
|
| | |
| | | * @since 2022-11-17 11:38:27
|
| | | */
|
| | | @SuppressWarnings("serial")
|
| | | @Builder
|
| | | @AllArgsConstructor
|
| | | public class NewsChannelColumn extends Model<NewsChannelColumn> {
|
| | |
|
| | | private Integer id;
|
| | |
| | | private Integer channelId;
|
| | | //栏目id
|
| | | private Integer columnId;
|
| | |
|
| | |
|
| | | public Integer getId() {
|
| | | return id;
|
| | |
| | | */
|
| | | int insertOrUpdateBatch(@Param("entities") List<NewsChannel> entities);
|
| | |
|
| | | int insertOneChannel(@Param("entity") NewsChannel entity);
|
| | |
|
| | | List<NewsChannel> selectAllChannel();
|
| | |
|
| | | }
|
| | |
|
| | |
| | |
|
| | | int insertOneInformation(@Param("entity") NewsInformation entity);
|
| | |
|
| | | NewsInformation selectInformationById(@Param("InformationId") Integer InformationId);
|
| | |
|
| | | List<NewsInformation> selectAllInformation();
|
| | |
|
| | | int updateInformationById(@Param("entity") NewsInformation entity);
|
| | | }
|
| | |
|
| | |
| | |
|
| | | import com.baomidou.mybatisplus.extension.service.IService;
|
| | | import com.ycl.entity.NewsChannel;
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | /**
|
| | | * 频道表(NewsChannel)表服务接口
|
| | |
| | | * @since 2022-11-17 11:38:27
|
| | | */
|
| | | public interface NewsChannelService extends IService<NewsChannel> {
|
| | | int insertOneChannel(@Param("entity") NewsChannel entity);
|
| | |
|
| | | List<NewsChannel> selectAllChannel();
|
| | | }
|
| | |
|
| | |
| | |
|
| | | import com.baomidou.mybatisplus.extension.service.IService;
|
| | | import com.ycl.entity.NewsInformation;
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | /**
|
| | | * 资讯表(NewsInformation)表服务接口
|
| | |
| | | */
|
| | | public interface NewsInformationService extends IService<NewsInformation> {
|
| | | int insertOneInformation(NewsInformation entity);
|
| | |
|
| | | NewsInformation selectInformationById(Integer InformationId);
|
| | |
|
| | | List<NewsInformation> selectAllInformation();
|
| | |
|
| | | int updateInformationById(NewsInformation entity);
|
| | | }
|
| | |
|
| | |
| | | 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;
|
| | |
| | | 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());
|
| | |
| | | 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)表服务实现类
|
| | |
| | | @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();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | 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)表服务实现类
|
| | |
| | | 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);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | 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:
|
| | |
| | | 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
|
| | |
| | | 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:
|
| | |
| | | (#{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>
|
| | |
|
| | |
| | | (#{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>
|
| | |
|
| | |
| | | (#{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>
|
| | |
|
| | |
| | | <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>
|
| | |
|
| | |
| | | (#{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>
|
| | |
|
| | |
| | | (#{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>
|
| | |
|
| | |
| | | (#{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>
|
| | |
|
| | |
| | | <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>
|
| | |
|