fangyuan
2023-01-16 ecad870fe1896c8c3e48506d50bb5818974253bf
机场公安前后端联调内容
21个文件已修改
2个文件已添加
412 ■■■■■ 已修改文件
pom.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-common/src/main/java/com/ycl/config/WebConfig.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/pom.xml 101 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/config/Intercept.java 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/config/Knife4jSwaggerConfig.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/config/PageHelperConfig.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/config/WebMvcConfig.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/controller/NewsAdminController.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/controller/NewsChannelController.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/controller/NewsColumnController.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/controller/NewsColumnInformationController.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/controller/NewsDepartmentController.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/controller/NewsDutyController.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/controller/NewsInformationController.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/dto/ColumnDto.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/entity/NewsAdmin.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/entity/NewsChannel.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/entity/NewsColumn.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/entity/NewsDuty.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/mapper/NewsInformationDao.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/resources/application-dev.yml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/resources/application.yml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/resources/mapper/NewsInformationDao.xml 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml
@@ -51,7 +51,6 @@
    <modules>
        <module>ycl-platform</module>
        <module>ycl-common</module>
<!--        <module>ycl-generator</module>-->
    </modules>
    <dependencies>
ycl-common/src/main/java/com/ycl/config/WebConfig.java
@@ -23,7 +23,8 @@
        // 允许cookies跨域
        config.setAllowCredentials(true);
        // #允许向该服务器提交请求的URI,*表示全部允许,在SpringMVC中,如果设成*,会自动转成当前请求头中的Origin
        config.addAllowedOrigin("*");
//        config.addAllowedOrigin("*");
        config.addAllowedOriginPattern("*");
        // #允许访问的头信息,*表示全部
        config.addAllowedHeader("*");
        // 预检请求的缓存时间(秒),即在这个时间段里,对于相同的跨域请求不会再预检了
ycl-platform/pom.xml
@@ -1,51 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.ycl</groupId>
        <artifactId>ycl-airport-server</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <groupId>com.ycl</groupId>
    <artifactId>ycl-platform</artifactId>
    <version>1.0.0</version>
    <name>ycl-platform</name>
    <description>后端模块</description>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.ycl</groupId>
            <artifactId>ycl-common</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
<!--        <dependency>-->
<!--            <groupId>com.ycl</groupId>-->
<!--            <artifactId>ycl-generator</artifactId>-->
<!--            <version>1.0.0</version>-->
<!--            <scope>compile</scope>-->
<!--        </dependency>-->
    </dependencies>
    <build>
        <finalName>ycl-platform</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.ycl</groupId>
        <artifactId>ycl-airport-server</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <groupId>com.ycl</groupId>
    <artifactId>ycl-platform</artifactId>
    <version>1.0.0</version>
    <name>ycl-platform</name>
    <description>后端模块</description>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.ycl</groupId>
            <artifactId>ycl-common</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper</artifactId>
            <version>4.1.6</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>ycl-platform</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
ycl-platform/src/main/java/com/ycl/config/Intercept.java
@@ -21,32 +21,31 @@
public class Intercept implements HandlerInterceptor {
    @Resource
    NewsAdminService newsAdminService;
    @Resource
    NewsIpService newsIpService;
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException {
        List<String> ips = newsIpService.list().stream().map(item->item.getIpAddess()).collect(Collectors.toList());
        if (!ips.contains(request.getRemoteAddr())){
        List<String> ips = newsIpService.list().stream().map(item -> item.getIpAddess()).collect(Collectors.toList());
        if (!ips.contains(request.getRemoteAddr())) {
            return false;
        }
        String token = request.getHeader("token");
        JwtTokenUtil jwtTokenUtil = new JwtTokenUtil();
        if (token==null||token.isEmpty()){
//        String token = request.getHeader("token");
//        JwtTokenUtil jwtTokenUtil = new JwtTokenUtil();
//        if (token==null||token.isEmpty()){
//            response.sendRedirect("");
//            return true;
            throw new ApiException("用户未登录");
        }
        AuthInfo authInfo = jwtTokenUtil.parseToken(token);
        if (authInfo == null) {
            throw new ApiException("未认证用户");
        }
        if (newsAdminService.getOne(new LambdaQueryWrapper<NewsAdmin>().eq(NewsAdmin::getUsername, authInfo.getUsername())) == null) {
            throw new ApiException("不是系统用户");
        } else {
//            throw new ApiException("用户未登录");
//        }
//        AuthInfo authInfo = jwtTokenUtil.parseToken(token);
//        if (authInfo == null) {
//            throw new ApiException("未认证用户");
//        }
//        if (newsAdminService.getOne(new LambdaQueryWrapper<NewsAdmin>().eq(NewsAdmin::getUsername, authInfo.getUsername())) == null) {
//            throw new ApiException("不是系统用户");
//        } else {
            return true;
        }
//        }
    }
ycl-platform/src/main/java/com/ycl/config/Knife4jSwaggerConfig.java
@@ -38,7 +38,7 @@
        return new ApiInfoBuilder()
                .title("机场公安文档管理系统")
                .description("机场公安后台模块")
                .version("1.0").contact(new Contact("lyq",null,null))
                .version("1.0").contact(new Contact("fy",null,null))
                .build();
    }
ycl-platform/src/main/java/com/ycl/config/PageHelperConfig.java
New file
@@ -0,0 +1,32 @@
package com.ycl.config;
import com.github.pagehelper.PageHelper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Properties;
/***
 * 分页配置
 * @author:lcj
 */
@Configuration
public class PageHelperConfig {
    /**
     * 配置mybatis的分页插件pageHelper
     *
     * @return
     */
    @Bean
    public PageHelper pageHelper() {
        PageHelper pageHelper = new PageHelper();
        Properties properties = new Properties();
        properties.setProperty("offsetAsPageNum", "true");
        properties.setProperty("rowBoundsWithCount", "true");
        properties.setProperty("reasonable", "true");
        properties.setProperty("dialect", "postgresql");//配置postgresql数据库的方言支持Oracle,Mysql,MariaDB,SQLite,Hsqldb,PostgreSQL六种数据库
        pageHelper.setProperties(properties);
        return pageHelper;
    }
}
ycl-platform/src/main/java/com/ycl/config/WebMvcConfig.java
@@ -19,9 +19,9 @@
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(this.Intercept())
                //需要验证请求路径 /*代表全部
                .addPathPatterns("/*")
                .excludePathPatterns(urlsConfig.getUrls());
        registry.addInterceptor(this.Intercept());
//                需要验证请求路径 /*代表全部
//                .addPathPatterns("/*")
//                .excludePathPatterns(urlsConfig.getUrls());
    }
}
ycl-platform/src/main/java/com/ycl/controller/NewsAdminController.java
@@ -7,6 +7,7 @@
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.ycl.api.CommonResult;
import com.ycl.entity.NewsAdmin;
import com.ycl.pojo.dto.LoginParam;
@@ -50,8 +51,25 @@
        } else {
            if (admin.getPassword().equals(MD5Util.md5Encrypt32Lower(loginParam.getPassword()))) {
                JwtTokenUtil jwtTokenUtil = new JwtTokenUtil();
                return CommonResult.success(jwtTokenUtil.generateToken(admin.getId(), admin.getUsername()));
            } else {
                return CommonResult.failed("密码错误");
            }
        }
    }
    @PostMapping("/login/reception")
    @ApiOperation(value = "前台登录")
    @SneakyThrows
    public CommonResult Reception(@RequestBody LoginParam loginParam) {
        NewsAdmin admin = newsAdminService.getOne(new LambdaQueryWrapper<NewsAdmin>().eq(NewsAdmin::getUsername, loginParam.getUsername()));
        if (admin == null) {
            return CommonResult.failed("用户不存在");
        } else {
            if (admin.getPassword().equals(MD5Util.md5Encrypt32Lower(loginParam.getPassword()))) {
                return CommonResult.success(admin.getNewsPoliceId());
            } else {
                return CommonResult.failed("密码错误");
            }
@@ -67,6 +85,8 @@
    @GetMapping
    @ApiOperation(value = "查询所有数据")
    public R selectAll(Page<NewsAdmin> page, NewsAdmin newsAdmin) {
        page.setTotal(newsAdminService.count());
        PageHelper.startPage(new Long(page.getCurrent()).intValue(),new Long(page.getSize()).intValue());
        return success(this.newsAdminService.page(page, new QueryWrapper<>(newsAdmin)));
    }
ycl-platform/src/main/java/com/ycl/controller/NewsChannelController.java
@@ -35,8 +35,6 @@
    @Resource
    private NewsChannelService newsChannelService;
    @Autowired
    private NewsChannelColumnService newsChannelColumnService;
    /**
     * 分页查询所有数据
@@ -55,11 +53,11 @@
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("{id}")
    @ApiOperation(value = "按id查询数据")
    public R selectOne(@PathVariable Serializable id) {
        return success(this.newsChannelService.getById(id));
    }
//    @GetMapping("{id}")
//    @ApiOperation(value = "按id查询数据")
//    public R selectOne(@PathVariable Serializable id) {
//        return success(this.newsChannelService.getById(id));
//    }
    /**
     * 新增数据
@@ -71,8 +69,8 @@
    @ApiOperation(value = "新增数据")
    public R insert(@RequestBody NewsChannel 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()));
//        List<String> columnId = newsChannel.getColumnId();
//        columnId.stream().forEach(item->newsChannelColumnService.save(NewsChannelColumn.builder().channelId(newsChannel.getId()).columnId(Integer.parseInt(item)).build()));
        return success(result);
    }
@@ -85,9 +83,9 @@
    @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()));
//        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));
    }
ycl-platform/src/main/java/com/ycl/controller/NewsColumnController.java
@@ -6,11 +6,14 @@
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.dto.ColumnDto;
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;
@@ -32,6 +35,9 @@
     */
    @Resource
    private NewsColumnService newsColumnService;
    @Autowired
    private NewsChannelColumnService newsChannelColumnService;
    /**
     * 分页查询所有数据
@@ -61,13 +67,16 @@
    /**
     * 新增数据
     *
     * @param newsColumn 实体对象
     * @param columnDto 实体对象
     * @return 新增结果
     */
    @PostMapping
    @ApiOperation(value = "新增数据")
    public R insert(@RequestBody NewsColumn newsColumn) {
        return success(this.newsColumnService.save(newsColumn));
    public R insert(@RequestBody ColumnDto columnDto) {
        List<String> columnId = columnDto.getChannelId();
        this.newsColumnService.save(columnDto.getNewsColumn());
        columnId.stream().forEach(item->newsChannelColumnService.save(NewsChannelColumn.builder().channelId(Integer.parseInt(item)).columnId(columnDto.getNewsColumn().getId()).build()));
        return success(columnDto).setMsg("执行成功");
    }
    /**
ycl-platform/src/main/java/com/ycl/controller/NewsColumnInformationController.java
@@ -3,13 +3,17 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ycl.entity.NewsColumnInformation;
import com.ycl.entity.NewsInformation;
import com.ycl.service.NewsColumnInformationService;
import com.ycl.service.NewsInformationService;
import com.ycl.vo.depart.UmsDepartVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -18,7 +22,10 @@
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
 * 栏目咨询中间表(NewsColumnInformation)表控制层
@@ -106,13 +113,39 @@
     * @return 资讯查询结果
     */
    @GetMapping("column/{id}")
    @ApiOperation(value = "按")
    public R selectInformationByColumnId(@PathVariable Serializable id) {
    @ApiOperation(value = "按栏目id查询讯息")
    public R selectInformationByColumnId(@PathVariable Serializable id ,@RequestParam(value = "pageNum", required = false,defaultValue = "1")Integer pageNum,@RequestParam(value = "pageSize", required = false,defaultValue = "10")Integer pageSize) {
        List<NewsColumnInformation> newsColumnInformationList = newsColumnInformationService.list(new QueryWrapper<NewsColumnInformation>().eq("column_id", id));
        List<NewsInformation> resultList=new ArrayList<>();
        IPage<NewsInformation> page = new Page<>(pageNum, pageSize);
        for (NewsColumnInformation newsColumnInformation:newsColumnInformationList){
            resultList.add(newsInformationService.selectInformationById(newsColumnInformation.getInformationId()));
        }
        return success(resultList);
    }}
        page.setTotal(resultList.size());
        if (pageSize>resultList.size()){
            page.setRecords(resultList);
        }
        else {
            List<List<NewsInformation>> lists = split8(resultList, pageSize);
            page.setRecords(lists.get(pageNum-1));
        }
        return success(page);
    }
    public static <T> List<List<T>> split8(List<T> list,int splitSize){
        // 每份个数 splitSize
        if( null == list || list.isEmpty() ){ return Collections.emptyList(); }
        // 列表元素数,总份数
        int size = list.size(), cnt = (size + splitSize - 1 ) / splitSize;
        return Stream
                .iterate(0,i -> i+1 )
                .limit(cnt)
                .parallel()
                .map(i -> list.parallelStream().skip( i * splitSize ).limit(splitSize).collect(Collectors.toList()))
                .filter(a -> !a.isEmpty())
                .collect(Collectors.toList());
    }
}
ycl-platform/src/main/java/com/ycl/controller/NewsDepartmentController.java
@@ -6,6 +6,7 @@
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.ycl.entity.NewsDepartment;
import com.ycl.service.NewsDepartmentService;
import io.swagger.annotations.Api;
@@ -42,6 +43,8 @@
    @GetMapping
    @ApiOperation(value = "查询所有数据")
    public R selectAll(Page<NewsDepartment> page, NewsDepartment newsDepartment) {
        page.setTotal(newsDepartmentService.count());
        PageHelper.startPage(new Long(page.getCurrent()).intValue(),new Long(page.getSize()).intValue());
        return success(this.newsDepartmentService.page(page, new QueryWrapper<>(newsDepartment)));
    }
ycl-platform/src/main/java/com/ycl/controller/NewsDutyController.java
@@ -6,6 +6,7 @@
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.ycl.entity.NewsDuty;
import com.ycl.service.NewsDutyService;
import io.swagger.annotations.Api;
@@ -42,6 +43,8 @@
    @GetMapping
    @ApiOperation(value = "查询所有数据")
    public R selectAll(Page<NewsDuty> page, NewsDuty newsDuty) {
        page.setTotal(newsDutyService.count());
        PageHelper.startPage(new Long(page.getCurrent()).intValue(),new Long(page.getSize()).intValue());
        return success(this.newsDutyService.page(page, new QueryWrapper<>(newsDuty)));
    }
ycl-platform/src/main/java/com/ycl/controller/NewsInformationController.java
@@ -68,8 +68,8 @@
     */
    @GetMapping("{id}")
    @ApiOperation(value = "按id查询数据")
    public R selectOne(@PathVariable Serializable id) {
        return success(this.newsInformationService.getById(id));
    public R selectOne(@PathVariable Integer id) {
        return success(this.newsInformationService.selectInformationById(id));
    }
    /**
@@ -114,25 +114,27 @@
    @ApiOperation(value = "修改数据")
    @Transactional
    public R update(@RequestBody NewsInformation newsInformation) {
        Integer informationId = newsInformation.getId();
        if (newsInformation.getIsSign()==0){
            newsInformationPoliceService.remove(new QueryWrapper<NewsInformationPolice>().eq("news_information_id",informationId));
            List<String> departmentIds = newsInformation.getDepartmentId();
            for (String departmentId:departmentIds){
                QueryWrapper<NewsPolice> wrapper = new QueryWrapper();
                wrapper.eq("news_department_id",departmentId);
                List<NewsPolice> list = policeService.list(wrapper);
                if (!list.isEmpty()){
                    for (NewsPolice newsPolice:list){
                        newsInformationPoliceService.save(NewsInformationPolice.builder().newsPoliceId(newsPolice.getId()).newsInformationId(informationId).isSign(0).build());
                    }
                }
            }
        }
        newsColumnInformationService.remove(new QueryWrapper<NewsColumnInformation>().eq("information_id",informationId));
        for (String columnId:newsInformation.getColumnId()){
            newsColumnInformationService.save(NewsColumnInformation.builder().columnId(Integer.parseInt(columnId)).informationId(informationId).build());
        }
//        Integer informationId = newsInformation.getId();
//        if (newsInformation.getIsSign()==0){
//            newsInformationPoliceService.remove(new QueryWrapper<NewsInformationPolice>().eq("news_information_id",informationId));
//            List<String> departmentIds = newsInformation.getDepartmentId();
//            for (String departmentId:departmentIds){
//                QueryWrapper<NewsPolice> wrapper = new QueryWrapper();
//                wrapper.eq("news_department_id",departmentId);
//                List<NewsPolice> list = policeService.list(wrapper);
//                if (!list.isEmpty()){
//                    for (NewsPolice newsPolice:list){
//                        newsInformationPoliceService.save(NewsInformationPolice.builder().newsPoliceId(newsPolice.getId()).newsInformationId(informationId).isSign(0).build());
//                    }
//                }
//            }
//        }
//        newsColumnInformationService.remove(new QueryWrapper<NewsColumnInformation>().eq("information_id",informationId));
//        for (String columnId:newsInformation.getColumnId()){
//            newsColumnInformationService.save(NewsColumnInformation.builder().columnId(Integer.parseInt(columnId)).informationId(informationId).build());
//        }
//        return success(this.newsInformationService.updateInformationById(newsInformation));
        return success(this.newsInformationService.updateInformationById(newsInformation));
    }
@@ -145,6 +147,12 @@
    @DeleteMapping
    @ApiOperation(value = "删除数据")
    public R delete(@RequestParam("idList") List<Long> idList) {
        if (idList==null||idList.size()==0){
            return failed("请选择一个刹车农户对象");
        }
        for (long id:idList){
            newsColumnInformationService.remove(new QueryWrapper<NewsColumnInformation>().eq("information_id",id));
        }
        return success(this.newsInformationService.removeByIds(idList));
    }
}
ycl-platform/src/main/java/com/ycl/dto/ColumnDto.java
New file
@@ -0,0 +1,19 @@
package com.ycl.dto;
import com.ycl.entity.NewsColumn;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class ColumnDto {
    //频道id
    @ApiModelProperty("频道id")
    private List<String> channelId;
    //栏目实体类
    @ApiModelProperty("栏目实体类")
    private NewsColumn newsColumn;
}
ycl-platform/src/main/java/com/ycl/entity/NewsAdmin.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
@@ -35,6 +36,7 @@
    private String note;
    //创建时间
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
    //帐号启用状态:0->禁用;1->启用
    @ApiModelProperty("帐号启用状态")
ycl-platform/src/main/java/com/ycl/entity/NewsChannel.java
@@ -30,17 +30,6 @@
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
    //栏目id
    @ApiModelProperty("栏目id")
    private List<String> columnId;
    public List<String> getColumnId() {
        return columnId;
    }
    public void setColumnId(List<String> columnId) {
        this.columnId = columnId;
    }
    public Integer getId() {
        return id;
ycl-platform/src/main/java/com/ycl/entity/NewsColumn.java
@@ -5,6 +5,7 @@
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.List;
/**
 * 栏目表(NewsColumn)表实体类
ycl-platform/src/main/java/com/ycl/entity/NewsDuty.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
@@ -25,9 +26,11 @@
    private String jobTitle;
    //创建时间
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
    //值班时间
    @ApiModelProperty("值班日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date dutyTime;
ycl-platform/src/main/java/com/ycl/mapper/NewsInformationDao.java
@@ -38,5 +38,7 @@
List<NewsInformation> selectAllInformation();
int updateInformationById(@Param("entity") NewsInformation entity);
}
ycl-platform/src/main/resources/application-dev.yml
@@ -1,5 +1,5 @@
server:
  port: 8082
  port: 8099
  tomcat:
    uri-encoding: UTF-8
  servlet:
@@ -53,6 +53,12 @@
    testOnReturn: false
    poolPreparedStatements: true
    maxOpenPreparedStatements: 20
  #配置pageHelper
  pageHelper:
    reasonable: "true"
    supportMethodsArguments: "true"
    returnPageInfo: check
    params: count=countSql
#e-mail:
#  sendHost: smtp.qq.com
#  username: 1723292425@qq.com
ycl-platform/src/main/resources/application.yml
@@ -73,4 +73,5 @@
      - /**/*.js
      - /**/*.css
      - /**/*.png
      - /newsAdmin/login
      - /**/*.ico
#      - /newsAdmin/login
ycl-platform/src/main/resources/mapper/NewsInformationDao.xml
@@ -45,7 +45,30 @@
    </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}
        update news_information
        <trim prefix="set" suffixOverrides=",">
            <if test="entity.title!=null and entity.title!=''">
                title=#{entity.title},
            </if>
            <if test="entity.content!=null and entity.content!=''">
                content=#{entity.content},
            </if>
            <if test="entity.publishTime!=null ">
                publish_time=#{entity.publishTime},
            </if>
            <if test="entity.isSign!=null and entity.isSign!=''">
                is_sign=#{entity.isSign},
            </if>
            <if test="entity.createTime!=null ">
                create_time=#{entity.createTime},
            </if>
            <if test="entity.sendTo!=null and entity.sendTo!=''">
                send_to=#{entity.sendTo},
            </if>
            <if test="entity.imageUrl!=null and entity.imageUrl!=''">
                image_url=#{entity.imageUrl},
            </if>
        </trim>
        where id=#{entity.id}
    </update>
</mapper>