Compare commits
3 Commits
master
...
server_202
Author | SHA1 | Date |
---|---|---|
|
19690e9e6f | |
|
094c62be8d | |
|
a3290a8b5b |
7
pom.xml
7
pom.xml
|
@ -207,6 +207,13 @@
|
||||||
<version>${zhilian.version}</version>
|
<version>${zhilian.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 一组3.23-3.24测试mybatis-plus模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.zhilian</groupId>
|
||||||
|
<artifactId>zhilian-mybatis-plus</artifactId>
|
||||||
|
<version>${zhilian.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<module>zhilian-gen</module>
|
<module>zhilian-gen</module>
|
||||||
<module>zhilian-job</module>
|
<module>zhilian-job</module>
|
||||||
<module>zhilian-file</module>
|
<module>zhilian-file</module>
|
||||||
|
<module>zhilian-mybatis-plus</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>zhilian-modules</artifactId>
|
<artifactId>zhilian-modules</artifactId>
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -0,0 +1,107 @@
|
||||||
|
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.zhilian</groupId>
|
||||||
|
<artifactId>zhilian-modules</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>zhilian-mybatis-plus</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
zhilian-modules-file文件服务
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos Config -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Sentinel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot Actuator -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- FastDFS -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.tobato</groupId>
|
||||||
|
<artifactId>fastdfs-client</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Minio -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.minio</groupId>
|
||||||
|
<artifactId>minio</artifactId>
|
||||||
|
<version>${minio.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- zhilian Common Swagger -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.zhilian</groupId>
|
||||||
|
<artifactId>zhilian-common-swagger</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- zhilian Common System-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.zhilian</groupId>
|
||||||
|
<artifactId>zhilian-common-system</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.zhilian</groupId>
|
||||||
|
<artifactId>zhilian-common-log</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<!-- 加入maven deploy插件,当在deploy时,忽略些model-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.zhilian.mybatisplus;
|
||||||
|
|
||||||
|
import com.zhilian.common.security.annotation.EnableMyFeignClients;
|
||||||
|
import com.zhilian.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@EnableCustomSwagger2
|
||||||
|
@EnableMyFeignClients
|
||||||
|
@MapperScan("com.zhilian.mybatisplus.mapper")
|
||||||
|
@SpringBootApplication
|
||||||
|
public class ZhiLianMybatisPlusApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(ZhiLianMybatisPlusApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.zhilian.mybatisplus.controller;
|
||||||
|
|
||||||
|
import com.zhilian.common.core.domain.Result;
|
||||||
|
import com.zhilian.common.log.annotation.Log;
|
||||||
|
import com.zhilian.common.log.enums.BusinessType;
|
||||||
|
import com.zhilian.mybatisplus.domain.Content;
|
||||||
|
import com.zhilian.mybatisplus.domain.resp.ContentResp;
|
||||||
|
import com.zhilian.mybatisplus.service.ContentServer;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/content")
|
||||||
|
public class ContentController {
|
||||||
|
@Autowired
|
||||||
|
private ContentServer contentServer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取新闻列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<List<ContentResp>> searchContentList(){
|
||||||
|
List<ContentResp> list =contentServer.searchContentList();
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新闻添加
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log(title = "新闻添加",businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/addNews")
|
||||||
|
public Result addNews(@RequestBody Content content){
|
||||||
|
contentServer.addNews(content);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新闻添加
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log(title = "新闻删除",businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping("/delNews/{id}")
|
||||||
|
public Result delNews(@PathVariable Integer id){
|
||||||
|
contentServer.delNews(id);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.zhilian.mybatisplus.controller;
|
||||||
|
|
||||||
|
import com.zhilian.common.core.domain.Result;
|
||||||
|
import com.zhilian.common.log.enums.BusinessType;
|
||||||
|
import com.zhilian.mybatisplus.domain.NewsType;
|
||||||
|
import com.zhilian.mybatisplus.service.NewsTypeService;
|
||||||
|
import com.zhilian.common.log.annotation.Log;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/newsType")
|
||||||
|
public class NewsTypeController {
|
||||||
|
@Autowired
|
||||||
|
private NewsTypeService newsTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取新闻类型字典
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<List<NewsType>> searchNewsTypes(){
|
||||||
|
List<NewsType> list =newsTypeService.searchNewsTypes();
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新闻类型字典添加
|
||||||
|
* @param newsType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log(title = "新闻类型字典添加",businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/addNewsTypes")
|
||||||
|
public Result addNewsTypes(@RequestBody NewsType newsType){
|
||||||
|
newsTypeService.addNewsTypes(newsType);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新闻类型字典删除
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log(title = "新闻类型字典删除",businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping("/delNewsTypes/{id}")
|
||||||
|
public Result delNewsTypes(@PathVariable Integer id){
|
||||||
|
newsTypeService.delNewsTypes(id);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.zhilian.mybatisplus.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class Content {
|
||||||
|
private Integer id;
|
||||||
|
private Integer typeId;
|
||||||
|
private Date createTime;
|
||||||
|
private String pic;
|
||||||
|
private String details;
|
||||||
|
private Integer isDelete;
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.zhilian.mybatisplus.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class NewsType {
|
||||||
|
/**
|
||||||
|
* 新闻属性id
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新闻属性名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*1展示 0不展示
|
||||||
|
*/
|
||||||
|
private Integer isDelete;
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.zhilian.mybatisplus.domain.resp;
|
||||||
|
|
||||||
|
import com.zhilian.mybatisplus.domain.Content;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ContentResp extends Content {
|
||||||
|
/**
|
||||||
|
* 新闻字典名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.zhilian.mybatisplus.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.zhilian.mybatisplus.domain.Content;
|
||||||
|
import com.zhilian.mybatisplus.domain.resp.ContentResp;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ContentMapper extends BaseMapper<ContentResp> {
|
||||||
|
List<ContentResp> searchContentList();
|
||||||
|
|
||||||
|
void addNews(Content content);
|
||||||
|
|
||||||
|
void delNews(@Param("id") Integer id);
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.zhilian.mybatisplus.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.zhilian.mybatisplus.domain.NewsType;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface NewsTypeMapper extends BaseMapper<NewsType> {
|
||||||
|
List<NewsType> searchNewsTypes();
|
||||||
|
|
||||||
|
void addNewsTypes(NewsType newsType);
|
||||||
|
|
||||||
|
void delNewsTypes(@Param("id") Integer id);
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.zhilian.mybatisplus.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.zhilian.mybatisplus.domain.Content;
|
||||||
|
import com.zhilian.mybatisplus.domain.resp.ContentResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ContentServer extends IService<ContentResp> {
|
||||||
|
List<ContentResp> searchContentList();
|
||||||
|
|
||||||
|
void addNews(Content content);
|
||||||
|
|
||||||
|
void delNews(Integer id);
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.zhilian.mybatisplus.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.zhilian.mybatisplus.domain.NewsType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface NewsTypeService extends IService<NewsType> {
|
||||||
|
/**
|
||||||
|
* 查询所有新闻类型字典
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<NewsType> searchNewsTypes();
|
||||||
|
|
||||||
|
void addNewsTypes(NewsType newsType);
|
||||||
|
|
||||||
|
void delNewsTypes(Integer id);
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.zhilian.mybatisplus.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.zhilian.mybatisplus.domain.Content;
|
||||||
|
import com.zhilian.mybatisplus.domain.resp.ContentResp;
|
||||||
|
import com.zhilian.mybatisplus.mapper.ContentMapper;
|
||||||
|
import com.zhilian.mybatisplus.service.ContentServer;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
@Service
|
||||||
|
public class ContentServerImpl extends ServiceImpl<ContentMapper, ContentResp> implements ContentServer {
|
||||||
|
@Autowired
|
||||||
|
private ContentMapper contentMapper;
|
||||||
|
@Override
|
||||||
|
public List<ContentResp> searchContentList() {
|
||||||
|
return contentMapper.searchContentList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addNews(Content content) {
|
||||||
|
contentMapper.addNews(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delNews(Integer id) {
|
||||||
|
contentMapper.delNews(id);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.zhilian.mybatisplus.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.zhilian.mybatisplus.domain.NewsType;
|
||||||
|
import com.zhilian.mybatisplus.mapper.NewsTypeMapper;
|
||||||
|
import com.zhilian.mybatisplus.service.NewsTypeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class NewsTypeServiceImpl extends ServiceImpl<NewsTypeMapper, NewsType> implements NewsTypeService {
|
||||||
|
@Autowired
|
||||||
|
private NewsTypeMapper newsTypeMapper;
|
||||||
|
@Override
|
||||||
|
public List<NewsType> searchNewsTypes() {
|
||||||
|
return newsTypeMapper.searchNewsTypes();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addNewsTypes(NewsType newsType) {
|
||||||
|
newsTypeMapper.addNewsTypes(newsType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delNewsTypes(Integer id) {
|
||||||
|
newsTypeMapper.delNewsTypes(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Spring Boot Version: ${spring-boot.version}
|
||||||
|
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,27 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9202
|
||||||
|
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: zhilian-mybatisplus
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/zhilian-mybatis-plus" />
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.zhilian" level="info" />
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn" />
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="console" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info" />
|
||||||
|
<appender-ref ref="file_error" />
|
||||||
|
</root>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.zhilian.mybatisplus.mapper.ContentMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.zhilian.mybatisplus.domain.resp.ContentResp" id="contentResult">
|
||||||
|
<id property="id" column="id"/>
|
||||||
|
<result property="name" column="name"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="pic" column="pic"/>
|
||||||
|
<result property="details" column="details"/>
|
||||||
|
</resultMap>
|
||||||
|
<sql id="contentList">
|
||||||
|
SELECT c.id,
|
||||||
|
t.name,
|
||||||
|
c.create_time,
|
||||||
|
c.pic,
|
||||||
|
c.details
|
||||||
|
from t_content c LEFT JOIN t_news_type t on c.type_id=t.id WHERE c.is_delete=1
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 添加新闻 -->
|
||||||
|
<insert id="addNews">
|
||||||
|
INSERT INTO `zhilian-cloud`.`t_content`
|
||||||
|
(`id`, `type_id`, `create_time`, `pic`, `details`, `is_delete`)
|
||||||
|
VALUES
|
||||||
|
(#{id}, #{typeId},DATE_ADD(NOW(), INTERVAL 8 HOUR), NULL, #{details}, 1);
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- 删除新闻 -->
|
||||||
|
<delete id="delNews">
|
||||||
|
update t_content set is_delete=0 where id=#{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<!-- 查询新闻列表 -->
|
||||||
|
<select id="searchContentList" resultType="com.zhilian.mybatisplus.domain.resp.ContentResp" resultMap="contentResult">
|
||||||
|
<include refid="contentList"/>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.zhilian.mybatisplus.mapper.NewsTypeMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.zhilian.mybatisplus.domain.NewsType" id="NewsTypeResult">
|
||||||
|
<id property="id" column="id"/>
|
||||||
|
<result property="name" column="name"/>
|
||||||
|
</resultMap>
|
||||||
|
<sql id="newsTypeList">
|
||||||
|
select id ,name from t_news_type where is_delete =1
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 新增 -->
|
||||||
|
<insert id="addNewsTypes">
|
||||||
|
INSERT INTO `zhilian-cloud`.`t_news_type` (`id`, `name`,`is_delete`) VALUES (0, #{name},1);
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- 删除 -->
|
||||||
|
<delete id="delNewsTypes">
|
||||||
|
update t_news_type set is_delete = 0 where id = #{id};
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<!-- 查询 -->
|
||||||
|
<select id="searchNewsTypes" resultType="com.zhilian.mybatisplus.domain.NewsType" resultMap="NewsTypeResult">
|
||||||
|
<include refid="newsTypeList"/>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
Loading…
Reference in New Issue