Commit 9bbd0a67 authored by YazhouChen's avatar YazhouChen

添加了 新闻模块

parent e4f6b5b1
This diff is collapsed.
#Generated by Maven
#Thu Aug 19 16:25:20 CST 2021
#Thu Sep 09 12:44:17 CST 2021
version=2.0
groupId=io.geekidea.springbootplus
artifactId=admin
#Generated by Maven
#Thu Aug 19 16:25:47 CST 2021
#Thu Sep 09 12:45:04 CST 2021
version=2.0
groupId=io.geekidea.springbootplus
artifactId=bootstrap
io\geekidea\springbootplus\aop\LogAop.class
io\geekidea\springbootplus\config\SpringBootPlusWebMvcConfig.class
io\geekidea\springbootplus\config\ShiroConfig.class
io\geekidea\springbootplus\handler\GlobalExceptionHandler.class
io\geekidea\springbootplus\SpringBootPlusApplication.class
io\geekidea\springbootplus\config\SpringBootPlusConfig.class
io\geekidea\springbootplus\config\Swagger2Config.class
io\geekidea\springbootplus\config\MybatisPlusConfig.class
io\geekidea\springbootplus\config\SpringBootPlusCorsConfig.class
io\geekidea\springbootplus\config\JacksonConfig.class
io\geekidea\springbootplus\config\RestTemplateConfig.class
io\geekidea\springbootplus\config\Swagger2Config$ApiModelPropertyBuilderPlugin.class
io\geekidea\springbootplus\config\RedisTemplateConfig.class
io\geekidea\springbootplus\config\RedisCacheConfig.class
#Generated by Maven
#Thu Aug 19 16:25:24 CST 2021
#Thu Sep 09 12:44:24 CST 2021
version=2.0
groupId=io.geekidea.springbootplus
artifactId=config
io\geekidea\springbootplus\config\constant\DatePattern.class
io\geekidea\springbootplus\config\properties\ShiroProperties.class
io\geekidea\springbootplus\config\properties\ShiroPermissionProperties.class
io\geekidea\springbootplus\config\constant\CommonRedisKey.class
io\geekidea\springbootplus\config\properties\SpringBootPlusStaticProperties.class
io\geekidea\springbootplus\config\properties\SpringBootPlusInterceptorProperties$InterceptorConfig.class
io\geekidea\springbootplus\config\properties\SpringBootPlusAopProperties.class
io\geekidea\springbootplus\config\constant\CommonConstant.class
io\geekidea\springbootplus\config\properties\SpringBootPlusAopProperties$RequestIdType.class
io\geekidea\springbootplus\config\properties\DataPathProperties.class
io\geekidea\springbootplus\config\properties\SpringBootPlusFilterProperties.class
io\geekidea\springbootplus\config\constant\CacheKey.class
io\geekidea\springbootplus\config\properties\SwaggerProperties.class
io\geekidea\springbootplus\config\properties\SpringBootPlusAopProperties$AopConfig.class
io\geekidea\springbootplus\config\properties\SwaggerProperties$ParameterConfig.class
io\geekidea\springbootplus\config\properties\SpringBootPlusAopProperties$LogPrintType.class
io\geekidea\springbootplus\config\properties\SpringBootPlusProperties.class
io\geekidea\springbootplus\config\properties\CorsConfig.class
io\geekidea\springbootplus\config\properties\SpringBootPlusAopProperties$LogAopConfig.class
io\geekidea\springbootplus\config\properties\SpringBootPlusAopProperties$LoginLogConfig.class
io\geekidea\springbootplus\config\properties\SpringBootPlusAopProperties$OperationLogConfig.class
io\geekidea\springbootplus\config\properties\SpringBootPlusFilterProperties$FilterConfig.class
io\geekidea\springbootplus\config\properties\SpringBootPlusCorsProperties.class
io\geekidea\springbootplus\config\properties\JwtProperties.class
io\geekidea\springbootplus\config\properties\SpringBootPlusInterceptorProperties.class
#Generated by Maven
#Thu Aug 19 16:25:47 CST 2021
#Thu Sep 09 12:45:05 CST 2021
version=2.0
groupId=io.geekidea.springbootplus
artifactId=distribution
......@@ -6,7 +6,7 @@ import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2021-08-19T16:31:26+0800",
date = "2021-09-09T14:38:58+0800",
comments = "version: 1.3.1.Final, compiler: javac, environment: Java 1.8.0_131 (Oracle Corporation)"
)
public class LoginSysUserVoConvertImpl implements LoginSysUserVoConvert {
......
......@@ -6,7 +6,7 @@ import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2021-08-19T16:31:26+0800",
date = "2021-09-09T14:38:58+0800",
comments = "version: 1.3.1.Final, compiler: javac, environment: Java 1.8.0_131 (Oracle Corporation)"
)
public class ShiroMapstructConvertImpl implements ShiroMapstructConvert {
......
#Generated by Maven
#Thu Aug 19 16:25:32 CST 2021
#Thu Sep 09 12:44:39 CST 2021
version=2.0
groupId=io.geekidea.springbootplus
artifactId=framework
io\geekidea\springbootplus\framework\core\validator\PhoneValidator.class
io\geekidea\springbootplus\framework\util\SpringContextUtil.class
io\geekidea\springbootplus\framework\log\param\SysOperationLogPageParam.class
io\geekidea\springbootplus\framework\util\UploadUtil$DefaultUploadFileNameHandleImpl.class
io\geekidea\springbootplus\framework\common\service\BaseService.class
io\geekidea\springbootplus\framework\core\validator\groups\Update.class
io\geekidea\springbootplus\framework\util\PasswordUtil.class
io\geekidea\springbootplus\framework\common\bean\DeviceInfo.class
io\geekidea\springbootplus\framework\core\pagination\BasePageParam.class
io\geekidea\springbootplus\framework\core\validator\groups\Add.class
io\geekidea\springbootplus\framework\core\xss\XssFilter.class
io\geekidea\springbootplus\framework\shiro\jwt\JwtCredentialsMatcher.class
io\geekidea\springbootplus\framework\config\jackson\serializer\JacksonIntegerDeserializer.class
io\geekidea\springbootplus\framework\shiro\service\ShiroLoginService.class
io\geekidea\springbootplus\framework\core\pagination\Paging.class
io\geekidea\springbootplus\framework\shiro\service\impl\ShiroLoginServiceImpl.class
io\geekidea\springbootplus\framework\util\DownloadUtil$DefaultDownloadHandler.class
io\geekidea\springbootplus\framework\util\UploadUtil.class
io\geekidea\springbootplus\framework\common\exception\DaoException.class
io\geekidea\springbootplus\framework\util\ContentTypeUtil.class
io\geekidea\springbootplus\framework\util\IniUtil.class
io\geekidea\springbootplus\framework\ip\mapper\IpAddressMapper.class
io\geekidea\springbootplus\framework\log\entity\SysOperationLog.class
io\geekidea\springbootplus\framework\ip\service\IpAddressService.class
io\geekidea\springbootplus\framework\util\BaseEnumUtil.class
io\geekidea\springbootplus\framework\config\jackson\deserializer\JacksonDateDeserializer.class
io\geekidea\springbootplus\framework\shiro\cache\LoginRedisService.class
io\geekidea\springbootplus\framework\common\api\ApiResult.class
io\geekidea\springbootplus\framework\common\exception\SpringBootPlusConfigException.class
io\geekidea\springbootplus\framework\config\converter\StringToIntegerConverter.class
io\geekidea\springbootplus\framework\util\HttpServletResponseUtil.class
io\geekidea\springbootplus\framework\shiro\service\LoginUsername.class
io\geekidea\springbootplus\framework\core\filter\RequestDetailFilter.class
io\geekidea\springbootplus\framework\common\entity\BaseEntity.class
io\geekidea\springbootplus\framework\core\pagination\OrderMapping.class
io\geekidea\springbootplus\framework\shiro\convert\ShiroMapstructConvert.class
io\geekidea\springbootplus\framework\config\converter\StringToDoubleConverter.class
io\geekidea\springbootplus\framework\core\validator\constraints\Phone.class
io\geekidea\springbootplus\framework\util\DownloadUtil$DownloadHandler.class
io\geekidea\springbootplus\framework\shiro\vo\SysPermission.class
io\geekidea\springbootplus\framework\util\ClientInfoUtil.class
io\geekidea\springbootplus\framework\common\exception\SpringBootPlusException.class
io\geekidea\springbootplus\framework\log\bean\RequestInfo.class
io\geekidea\springbootplus\framework\log\param\SysLoginLogPageParam.class
io\geekidea\springbootplus\framework\common\api\ApiResult$ApiResultBuilder.class
io\geekidea\springbootplus\framework\log\annotation\OperationLog.class
io\geekidea\springbootplus\framework\config\converter\StringToIntegerUtil.class
io\geekidea\springbootplus\framework\log\service\impl\SysOperationLogServiceImpl.class
io\geekidea\springbootplus\framework\log\annotation\Module.class
io\geekidea\springbootplus\framework\shiro\jwt\JwtFilter.class
io\geekidea\springbootplus\framework\util\PhoneUtil.class
io\geekidea\springbootplus\framework\common\service\impl\BaseServiceImpl.class
io\geekidea\springbootplus\framework\util\HttpServletRequestUtil.class
io\geekidea\springbootplus\framework\core\pagination\BasePageOrderParam.class
io\geekidea\springbootplus\framework\shiro\util\JwtTokenUtil.class
io\geekidea\springbootplus\framework\core\bean\RequestDetail.class
io\geekidea\springbootplus\framework\log\mapper\SysOperationLogMapper.class
io\geekidea\springbootplus\framework\util\DateUtil.class
io\geekidea\springbootplus\framework\common\param\IdParam.class
io\geekidea\springbootplus\framework\core\validator\IdCardValidator.class
io\geekidea\springbootplus\framework\util\UUIDUtil.class
io\geekidea\springbootplus\framework\shiro\service\LoginToken.class
io\geekidea\springbootplus\framework\config\jackson\serializer\JacksonDateSerializer.class
io\geekidea\springbootplus\framework\common\enums\BaseEnum.class
io\geekidea\springbootplus\framework\core\pagination\PageInfo.class
io\geekidea\springbootplus\framework\util\PrintApplicationInfo.class
io\geekidea\springbootplus\framework\ip\service\impl\IpAddressServiceImpl.class
io\geekidea\springbootplus\framework\log\service\impl\SysLoginLogServiceImpl.class
io\geekidea\springbootplus\framework\core\xss\XssJacksonSerializer.class
io\geekidea\springbootplus\framework\util\UploadUtil$UploadFileNameHandle.class
io\geekidea\springbootplus\framework\log\aop\BaseLogAop.class
io\geekidea\springbootplus\framework\log\bean\OperationLogInfo.class
io\geekidea\springbootplus\framework\log\enums\OperationLogType.class
io\geekidea\springbootplus\framework\util\DownloadUtil.class
io\geekidea\springbootplus\framework\util\IpUtil.class
io\geekidea\springbootplus\framework\config\converter\StringToDoubleUtil.class
io\geekidea\springbootplus\framework\shiro\vo\LoginSysUserVo.class
io\geekidea\springbootplus\framework\util\BrowserUtil.class
io\geekidea\springbootplus\framework\log\service\SysOperationLogService.class
io\geekidea\springbootplus\framework\common\exception\BusinessException.class
io\geekidea\springbootplus\framework\core\validator\constraints\IdCard.class
io\geekidea\springbootplus\framework\shiro\util\JwtUtil.class
io\geekidea\springbootplus\framework\shiro\util\SaltUtil.class
io\geekidea\springbootplus\framework\util\TokenUtil.class
io\geekidea\springbootplus\framework\common\vo\EnumVo.class
io\geekidea\springbootplus\framework\shiro\convert\ShiroMapstructConvertImpl.class
io\geekidea\springbootplus\framework\shiro\jwt\JwtToken.class
io\geekidea\springbootplus\framework\util\RedisCacheUtil.class
io\geekidea\springbootplus\framework\core\util\RequestDetailThreadLocal.class
io\geekidea\springbootplus\framework\shiro\vo\Members.class
io\geekidea\springbootplus\framework\ip\entity\IpAddress.class
io\geekidea\springbootplus\framework\util\PropertyColumnUtil.class
io\geekidea\springbootplus\framework\config\jackson\deserializer\JacksonDoubleDeserializer.class
io\geekidea\springbootplus\framework\config\jackson\serializer\JacksonLocalDateTimeSerializer.class
io\geekidea\springbootplus\framework\shiro\vo\Members$FieldEnum.class
io\geekidea\springbootplus\framework\shiro\cache\impl\LoginRedisServiceImpl.class
io\geekidea\springbootplus\framework\log\annotation\OperationLogIgnore.class
io\geekidea\springbootplus\framework\shiro\convert\LoginSysUserVoConvertImpl.class
io\geekidea\springbootplus\framework\util\LambdaColumn.class
io\geekidea\springbootplus\framework\shiro\vo\JwtTokenRedisVo.class
io\geekidea\springbootplus\framework\shiro\jwt\JwtRealm.class
io\geekidea\springbootplus\framework\common\api\ApiCode.class
io\geekidea\springbootplus\framework\core\validator\constraints\EnumType.class
io\geekidea\springbootplus\framework\util\VerificationCode.class
io\geekidea\springbootplus\framework\util\AnsiUtil.class
io\geekidea\springbootplus\framework\shiro\convert\LoginSysUserVoConvert.class
io\geekidea\springbootplus\framework\log\entity\SysLoginLog.class
io\geekidea\springbootplus\framework\log\mapper\SysLoginLogMapper.class
io\geekidea\springbootplus\framework\config\converter\ConverterConfig.class
io\geekidea\springbootplus\framework\core\xss\XssHttpServletRequestWrapper.class
io\geekidea\springbootplus\framework\common\exception\GlobalErrorController.class
io\geekidea\springbootplus\framework\shiro\vo\LoginSysUserRedisVo.class
io\geekidea\springbootplus\framework\shiro\vo\SysPermissionTreeVo.class
io\geekidea\springbootplus\framework\util\MapUtil.class
io\geekidea\springbootplus\framework\core\validator\EnumTypeValidator.class
io\geekidea\springbootplus\framework\config\converter\StringToDateConverter.class
io\geekidea\springbootplus\framework\log\service\SysLoginLogService.class
io\geekidea\springbootplus\framework\common\bean\ClientInfo.class
io\geekidea\springbootplus\framework\common\controller\BaseController.class
io\geekidea\springbootplus\framework\core\xss\XssJacksonDeserializer.class
io\geekidea\springbootplus\framework\util\LoginUtil.class
io\geekidea\springbootplus\framework\config\converter\StringToDateUtil.class
io\geekidea\springbootplus\framework\config\jackson\deserializer\JacksonLocalDateTimeDeserializer.class
io\geekidea\springbootplus\framework\core\interceptor\PermissionInterceptor.class
io\geekidea\springbootplus\framework\util\Jackson.class
io\geekidea\springbootplus\framework\shiro\exception\ShiroConfigException.class
......@@ -49,7 +49,7 @@ public class SpringBootPlusGenerator {
.setFileOverride(true);
// 设置表信息
generatorProperties.addTable("manage_way","ID");
generatorProperties.addTable("news","ID");
// 数据源配置
generatorProperties.getDataSourceConfig()
......
#Generated by Maven
#Thu Aug 19 16:25:50 CST 2021
#Thu Sep 09 12:45:10 CST 2021
version=2.0
groupId=io.geekidea.springbootplus
artifactId=generator
io\geekidea\springbootplus\generator\CodeGenerator$4.class
io\geekidea\springbootplus\generator\exception\GeneratorException.class
io\geekidea\springbootplus\generator\CodeGenerator$2.class
io\geekidea\springbootplus\generator\config\GeneratorStrategy.class
io\geekidea\springbootplus\generator\config\TableConfig.class
io\geekidea\springbootplus\generator\config\GeneratorConfig.class
io\geekidea\springbootplus\generator\properties\GeneratorProperties.class
io\geekidea\springbootplus\generator\SpringBootPlusGenerator.class
io\geekidea\springbootplus\generator\CodeGenerator.class
io\geekidea\springbootplus\generator\config\query\SpringBootPlusMySqlQuery.class
io\geekidea\springbootplus\generator\CodeGenerator$3.class
io\geekidea\springbootplus\generator\config\ProjectConfig.class
io\geekidea\springbootplus\generator\constant\GeneratorConstant.class
io\geekidea\springbootplus\generator\config\query\SpringBootPlusSqlServerQuery.class
io\geekidea\springbootplus\generator\CodeGenerator$1.class
io\geekidea\springbootplus\generator\config\MybatisPlusGeneratorConfig.class
io\geekidea\springbootplus\generator\test\GeneratorTestApplication.class
io\geekidea\springbootplus\generator\test\GeneratorPropertiesTest.class
package com.hongxinhui.controller;
import com.hongxinhui.entity.ManageWay;
import com.hongxinhui.entity.News;
import com.hongxinhui.service.NewsService;
import lombok.extern.slf4j.Slf4j;
import com.hongxinhui.param.NewsPageParam;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.common.param.IdParam;
import io.geekidea.springbootplus.framework.log.annotation.Module;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
import io.geekidea.springbootplus.framework.core.validator.groups.Add;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import org.springframework.validation.annotation.Validated;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 新闻表 控制器
*
* @author cyz
* @since 2021-09-09
*/
@Slf4j
@RestController
@RequestMapping("/news")
@Module("${cfg.module}")
@Api(value = "新闻表API", tags = {"新闻表"})
public class NewsController extends BaseController {
@Autowired
private NewsService newsService;
/**
* 添加新闻表
*/
@PostMapping("/add")
@OperationLog(name = "添加新闻表", type = OperationLogType.ADD)
@ApiOperation(value = "添加新闻表", response = ApiResult.class)
public ApiResult<Boolean> addNews(@Validated(Add.class) @RequestBody News news) throws Exception {
boolean flag = newsService.saveNews(news);
return ApiResult.result(flag);
}
/**
* 修改新闻表
*/
@PostMapping("/update")
@OperationLog(name = "修改新闻表", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改新闻表", response = ApiResult.class)
public ApiResult<Boolean> updateNews(@Validated(Update.class) @RequestBody News news) throws Exception {
boolean flag = newsService.updateNews(news);
return ApiResult.result(flag);
}
/**
* 删除新闻表
*/
@PostMapping("/delete/{id}")
@OperationLog(name = "删除新闻表", type = OperationLogType.DELETE)
@ApiOperation(value = "删除新闻表", response = ApiResult.class)
public ApiResult<Boolean> deleteNews(@PathVariable("id") Long id) throws Exception {
boolean flag = newsService.deleteNews(id);
return ApiResult.result(flag);
}
/**
* 获取新闻表详情
*/
@GetMapping("/info/{id}")
@OperationLog(name = "新闻表详情", type = OperationLogType.INFO)
@ApiOperation(value = "新闻表详情", response = News.class)
public ApiResult<News> getNews(@PathVariable("id") Long id) throws Exception {
News news = newsService.getByIdOne(id);
return ApiResult.ok(news);
}
/**
* 新闻表分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "新闻表分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "新闻表分页列表", response = News.class)
public ApiResult<Paging<News>> getNewsPageList(@Validated @RequestBody NewsPageParam newsPageParam) throws Exception {
Paging<News> paging = newsService.getNewsPageList(newsPageParam);
return ApiResult.ok(paging);
}
@PostMapping("/updateStatus")
@OperationLog(name = "发布新闻", type = OperationLogType.UPDATE)
@ApiOperation(value = "发布新闻", response = ApiResult.class)
public ApiResult<Boolean> updateStatus(@RequestBody News news) throws Exception {
boolean flag = newsService.updateStatus(news);
return ApiResult.result(flag);
}
@GetMapping("/updateReadCount/{id}")
@OperationLog(name = "修改阅读数量", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改阅读数量", response = ApiResult.class)
public ApiResult<Boolean> updateReadCount(@PathVariable("id") Long id) throws Exception {
boolean flag = newsService.updateReadCount(id);
return ApiResult.result(flag);
}
}
package com.hongxinhui.entity;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;
import io.geekidea.springbootplus.framework.common.enums.BaseEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
/**
* 新闻表
*
* @author cyz
* @since 2021-09-09
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "News对象")
public class News extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "id不能为空", groups = {Update.class})
@TableId(value = "ID", type = IdType.AUTO)
private Long id;
@ApiModelProperty("新闻标题")
private String title;
@ApiModelProperty("新闻的logo,传附件ID")
private String logopic;
@TableField(exist = false)
@ApiModelProperty("新闻的logo路径")
private String logpath;
@ApiModelProperty("新闻类型id 1行业新闻 2公司新闻")
@TableField("typeId")
private Integer typeId;
@ApiModelProperty("新闻内容")
private String content;
@ApiModelProperty("新闻状态1草稿2已发布")
private Integer status;
@ApiModelProperty("阅读数量")
private Integer readcount;
@ApiModelProperty("发布时间")
@TableField("releaseTime")
private Date releaseTime;
@ApiModelProperty("创建时间")
@TableField("createTime")
private Date createTime;
@ApiModelProperty("创建人")
@TableField("createUser")
private Integer createUser;
@ApiModelProperty("创建人名字")
@TableField(exist = false)
private String createUserstr;
@ApiModelProperty("1正常0删除")
@TableLogic
private Integer enable;
public enum FieldEnum implements BaseEnum {
title("title", "新闻标题"),
logopic("logopic", "新闻的logo,传附件ID"),
typeId("typeId", "新闻类型id 1行业新闻 2公司新闻"),
content("content", "新闻内容"),
status("status", "新闻状态1草稿2已发布"),
readcount("readcount", "阅读数量"),
releaseTime("releaseTime", "发布时间"),
createTime("createTime", "创建时间"),
createUser("createUser", "创建人"),
enable("enable", "1正常0删除"),
id("id", "编号");
/**
* name
*/
@Getter
private final String name;
/**
* desc
*/
@Getter
private final String desc;
FieldEnum(String name, String desc) {
this.name = name;
this.desc = desc;
}
@Override
public Integer getCode() {
return null;
}
}
}
package com.hongxinhui.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hongxinhui.entity.News;
import com.hongxinhui.param.NewsPageParam;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.io.Serializable;
/**
* 新闻表 Mapper 接口
*
* @author cyz
* @since 2021-09-09
*/
@Repository
public interface NewsMapper extends BaseMapper<News> {
}
package com.hongxinhui.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam;
import java.util.Date;
/**
* <pre>
* 新闻表 分页参数对象
* </pre>
*
* @author cyz
* @date 2021-09-09
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "新闻表分页参数")
public class NewsPageParam extends BasePageOrderParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty("新闻标题")
private String title;
@ApiModelProperty("新闻类型-1行业2公司")
private Integer type;
@ApiModelProperty("新闻状态-1全部1草稿2已发布")
private Integer status;
@ApiModelProperty("开始时间")
private Date beginTime;
@ApiModelProperty("结束时间")
private Date endTime;
}
package com.hongxinhui.service;
import com.hongxinhui.entity.News;
import com.hongxinhui.param.NewsPageParam;
import io.geekidea.springbootplus.framework.common.service.BaseService;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
/**
* 新闻表 服务类
*
* @author cyz
* @since 2021-09-09
*/
public interface NewsService extends BaseService<News> {
/**
* 保存
*
* @param news
* @return
* @throws Exception
*/
boolean saveNews(News news) throws Exception;
/**
* 修改
*
* @param news
* @return
* @throws Exception
*/
boolean updateNews(News news) throws Exception;
/**
* 删除
*
* @param id
* @return
* @throws Exception
*/
boolean deleteNews(Long id) throws Exception;
/**
* 获取分页对象
*
* @param newsQueryParam
* @return
* @throws Exception
*/
Paging<News> getNewsPageList(NewsPageParam newsPageParam) throws Exception;
boolean updateStatus(News news);
boolean updateReadCount(Long id);
News getByIdOne(Long id);
}
package com.hongxinhui.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hongxinhui.entity.ManageWay;
import com.hongxinhui.entity.News;
import com.hongxinhui.entity.Superadmindb;
import com.hongxinhui.entity.Surveyfile;
import com.hongxinhui.mapper.NewsMapper;
import com.hongxinhui.mapper.SuperadmindbMapper;
import com.hongxinhui.mapper.SurveyfileMapper;
import com.hongxinhui.service.NewsService;
import com.hongxinhui.param.NewsPageParam;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hongxinhui.utils.StringUtils;
import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.core.pagination.PageInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.geekidea.springbootplus.framework.util.LoginUtil;
import org.apache.commons.text.StringEscapeUtils;
import org.springframework.transaction.annotation.Transactional;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
/**
* 新闻表 服务实现类
*
* @author cyz
* @since 2021-09-09
*/
@Slf4j
@Service
public class NewsServiceImpl extends BaseServiceImpl<NewsMapper, News> implements NewsService {
@Autowired
private NewsMapper newsMapper;
@Autowired
private SurveyfileMapper surveyfileMapper;
@Autowired
private SuperadmindbMapper superadmindbMapper;
@Transactional(rollbackFor = Exception.class)
@Override
public boolean saveNews(News news) throws Exception {
news.setContent(StringEscapeUtils.unescapeHtml4( news.getContent() ));//转义html
if(news.getStatus()==2){
news.setReleaseTime(new Date());
}
Superadmindb user = (Superadmindb) LoginUtil.getSysUser();
if(user!=null){
news.setCreateUser(user.getId().intValue());
}else{
// return false;
news.setCreateUser(0);
}
return newsMapper.insert(news)>0;
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean updateNews(News news) throws Exception {
return super.updateById(news);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean deleteNews(Long id) throws Exception {
return super.removeById(id);
}
@Override
public Paging<News> getNewsPageList(NewsPageParam newsPageParam) throws Exception {
Page<News> page = new PageInfo<>(newsPageParam, OrderItem.desc(getLambdaColumn(News::getCreateTime)));
QueryWrapper<News> wrapper = new QueryWrapper<>();
if(newsPageParam.getType()!=null&&newsPageParam.getType()!=0){
wrapper.eq("typeId",newsPageParam.getType());
}
if(newsPageParam.getStatus()!=null&&newsPageParam.getStatus()!=-1){
wrapper.eq("status",newsPageParam.getStatus());
}
if(!StringUtils.isEmpty(newsPageParam.getTitle())){
wrapper.like("title",newsPageParam.getTitle());
}
if(newsPageParam.getBeginTime()!=null){
wrapper.ge("releaseTime",newsPageParam.getBeginTime());
}
if(newsPageParam.getEndTime()!=null){
wrapper.le("releaseTime",newsPageParam.getEndTime());
}
IPage<News> iPage = newsMapper.selectPage(page, wrapper);
for (News news:iPage.getRecords()) {
String logopic = news.getLogopic();
if(!StringUtils.isEmpty(logopic)){
Integer fileid = Integer.valueOf(logopic);
Surveyfile surveyfile = surveyfileMapper.selectById(fileid);
if(surveyfile!=null){
news.setLogpath(surveyfile.getFilePath());
}
}
Integer createUser = news.getCreateUser();
if(createUser!=null){
news.setCreateUserstr(superadmindbMapper.selectById(createUser).getNickname());
}
news.setContent(StringEscapeUtils.unescapeHtml4(news.getContent()));
}
return new Paging<News>(iPage);
}
@Override
public boolean updateStatus(News news) {
news.setStatus(2);
news.setReleaseTime(new Date());
int count = newsMapper.updateById(news);
return count>0;
}
@Override
public boolean updateReadCount(Long id) {
News news = newsMapper.selectById(id);
news.setReadcount(news.getReadcount()+1) ;
int count = newsMapper.updateById(news);
return count>0;
}
@Override
public News getByIdOne(Long id) {
News news = newsMapper.selectById(id);
String logopic = news.getLogopic();
if(!StringUtils.isEmpty(logopic)){
Integer fileid = Integer.valueOf(logopic);
Surveyfile surveyfile = surveyfileMapper.selectById(fileid);
if(surveyfile!=null){
news.setLogpath(surveyfile.getFilePath());
}
}
Integer createUser = news.getCreateUser();
if(createUser!=null){
news.setCreateUserstr(superadmindbMapper.selectById(createUser).getNickname());
}
news.setContent(StringEscapeUtils.unescapeHtml4(news.getContent()));
return news;
}
}
<?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.hongxinhui.mapper.NewsMapper">
</mapper>
#Generated by Maven
#Thu Aug 19 16:25:41 CST 2021
#Thu Sep 09 12:44:54 CST 2021
version=2.0
groupId=io.geekidea.springbootplus
artifactId=example
com\hongxinhui\entity\Superadmindb.class
com\hongxinhui\entity\Survey.class
com\hongxinhui\utils\StringUtils.class
com\hongxinhui\param\EnterpriseMembers.class
com\hongxinhui\entity\Surveyfile$FieldEnum.class
com\hongxinhui\vo\SysDepartmentQueryVo.class
com\hongxinhui\controller\MembersController.class
com\hongxinhui\param\ManageWayPageParam.class
com\hongxinhui\utils\wx\msg\MusicMessage$Music.class
com\hongxinhui\utils\wx\msg\VoiceMessage.class
com\hongxinhui\utils\DownloadHelper.class
com\hongxinhui\service\impl\SurveyfileServiceImpl.class
com\hongxinhui\param\EnterpriseMembersUpdate.class
com\hongxinhui\utils\wx\aes\WXBizMsgCrypt.class
com\hongxinhui\vo\SubjectinformationQueryVo.class
com\hongxinhui\utils\wx\aes\XMLParse.class
com\hongxinhui\service\WxService.class
com\hongxinhui\utils\ZipUtils.class
com\hongxinhui\controller\NoticetypeController.class
com\hongxinhui\utils\wx\msg\TextMessage.class
com\hongxinhui\service\impl\NoticeServiceImpl.class
com\hongxinhui\utils\CheckUtil.class
com\hongxinhui\utils\wx\aes\SHA1.class
com\hongxinhui\mapper\SurveyfileMapper.class
com\hongxinhui\utils\ListUtils.class
com\hongxinhui\service\impl\WxServiceImpl.class
com\hongxinhui\utils\wx\msg\MusicMessage.class
com\hongxinhui\vo\TCaseReportVO.class
com\hongxinhui\param\SurveyPageParam.class
com\hongxinhui\vo\SysUserQueryVo.class
com\hongxinhui\mapper\NoticetypeMapper.class
com\hongxinhui\service\impl\SurveyServiceImpl.class
com\hongxinhui\param\SurveyfilePageParam.class
com\hongxinhui\param\PersonalMembersUpdate.class
com\hongxinhui\entity\Members$FieldEnum.class
com\hongxinhui\param\EnterpriseMembersPage.class
com\hongxinhui\param\NoticeAdd.class
com\hongxinhui\entity\Surveyfile.class
com\hongxinhui\service\SuperadmindbService.class
com\hongxinhui\utils\SendMail.class
com\hongxinhui\utils\wx\WXSecurityUtils.class
com\hongxinhui\controller\NoticeController.class
com\hongxinhui\service\NoticeService.class
com\hongxinhui\entity\Survey$FieldEnum.class
com\hongxinhui\param\PersonalMembersPage.class
com\hongxinhui\utils\wx\MessageManager.class
com\hongxinhui\controller\MultithreadScheduleTask.class
com\hongxinhui\param\NoticetypePageParam.class
com\hongxinhui\utils\wx\msg\NewsMessage.class
com\hongxinhui\enums\EntityEnum.class
com\hongxinhui\controller\WxController.class
com\hongxinhui\utils\wx\StringUtils.class
com\hongxinhui\utils\wx\msg\BaseMessage.class
com\hongxinhui\mapper\SuperadmindbMapper.class
com\hongxinhui\param\MembersPageParam.class
com\hongxinhui\utils\wx\aes\ByteGroup.class
com\hongxinhui\controller\SurveyfileController.class
com\hongxinhui\utils\wx\SignatureUtil.class
com\hongxinhui\utils\wx\DateUtils.class
com\hongxinhui\entity\Noticetype.class
com\hongxinhui\param\HomeInfo.class
com\hongxinhui\service\SurveyfileService.class
com\hongxinhui\enums\MenuLevelEnum.class
com\hongxinhui\vo\TSubmitRulesVO.class
com\hongxinhui\entity\Notice.class
com\hongxinhui\utils\wx\aes\AesException.class
com\hongxinhui\param\SurveyAdd.class
com\hongxinhui\param\NoticePageParam.class
com\hongxinhui\utils\CapitalizationUtils.class
com\hongxinhui\utils\wx\msg\EventMessage.class
com\hongxinhui\controller\ManageWayController.class
com\hongxinhui\entity\Superadmindb$FieldEnum.class
com\hongxinhui\utils\wx\WXMessageUtils.class
com\hongxinhui\vo\ProjectQueryVo.class
com\hongxinhui\service\ManageWayService.class
com\hongxinhui\param\SuperadmindbPageParam.class
com\hongxinhui\utils\wx\msg\NewsMessage$Item.class
com\hongxinhui\service\impl\NoticetypeServiceImpl.class
com\hongxinhui\utils\wx\msg\RespMessage.class
com\hongxinhui\param\PersonalMembers.class
com\hongxinhui\vo\countFiveYearsEntity.class
com\hongxinhui\vo\TFirsthandDataPageList.class
com\hongxinhui\mapper\NoticeMapper.class
com\hongxinhui\utils\SendMail$1.class
com\hongxinhui\vo\SubjectsInfoStatisticsDashboard.class
com\hongxinhui\mapper\MembersMapper.class
com\hongxinhui\utils\wx\msg\VideoMessage.class
com\hongxinhui\utils\wx\WXConfigInfo.class
com\hongxinhui\utils\ListUtils$2.class
com\hongxinhui\entity\Notice$FieldEnum.class
com\hongxinhui\entity\ManageWay$FieldEnum.class
com\hongxinhui\utils\IpUtils.class
com\hongxinhui\utils\wx\msg\ImageMessage.class
com\hongxinhui\vo\TFolderManagementTreeVo.class
com\hongxinhui\entity\ManageWay.class
com\hongxinhui\mapper\ManageWayMapper.class
com\hongxinhui\utils\wx\DateUtils$ISimpleDateFormat.class
com\hongxinhui\utils\ExcelUtils.class
com\hongxinhui\utils\wx\aes\PKCS7Encoder.class
com\hongxinhui\service\impl\ManageWayServiceImpl.class
com\hongxinhui\utils\wx\msg\LinkMessage.class
com\hongxinhui\utils\wx\msg\LocationMessage.class
com\hongxinhui\param\SuperadmindbAdd.class
com\hongxinhui\param\NoticetypeUpdate.class
com\hongxinhui\param\EnterPageParam.class
com\hongxinhui\controller\SurveyController.class
com\hongxinhui\utils\wx\AccessTokenCommon.class
com\hongxinhui\service\impl\SuperadmindbServiceImpl.class
com\hongxinhui\utils\VerifyCodeUtils.class
com\hongxinhui\utils\IdCardUtil.class
com\hongxinhui\service\MembersService.class
com\hongxinhui\mapper\SurveyMapper.class
com\hongxinhui\utils\ListUtils$1.class
com\hongxinhui\enums\StateEnum.class
com\hongxinhui\controller\UploadController.class
com\hongxinhui\vo\sysName.class
com\hongxinhui\utils\FileUtils.class
com\hongxinhui\controller\WeChartAuthorizedController.class
com\hongxinhui\utils\DateUtils.class
com\hongxinhui\entity\Members.class
com\hongxinhui\utils\wx\msg\MediaMessage.class
com\hongxinhui\controller\SuperadmindbController.class
com\hongxinhui\utils\EntityUtil.class
com\hongxinhui\service\impl\MembersServiceImpl.class
com\hongxinhui\service\NoticetypeService.class
com\hongxinhui\service\SurveyService.class
......@@ -5,6 +5,7 @@ E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\vo\countFiveYearsE
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\controller\NoticeController.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\service\impl\SuperadmindbServiceImpl.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\utils\wx\msg\RespMessage.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\param\NewsPageParam.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\service\SurveyfileService.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\utils\wx\AccessTokenCommon.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\vo\TFirsthandDataPageList.java
......@@ -16,6 +17,7 @@ E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\mapper\SurveyMappe
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\service\NoticetypeService.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\utils\FileUtils.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\service\impl\NoticetypeServiceImpl.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\entity\News.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\service\NoticeService.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\vo\TFolderManagementTreeVo.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\controller\WeChartAuthorizedController.java
......@@ -24,6 +26,7 @@ E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\entity\Notice.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\entity\Surveyfile.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\param\PersonalMembersPage.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\service\impl\WxServiceImpl.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\service\NewsService.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\utils\wx\msg\LocationMessage.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\utils\wx\msg\VideoMessage.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\controller\UploadController.java
......@@ -54,6 +57,7 @@ E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\utils\wx\aes\SHA1.
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\controller\ManageWayController.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\controller\SurveyfileController.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\mapper\NoticetypeMapper.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\mapper\NewsMapper.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\param\NoticeAdd.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\param\EnterPageParam.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\controller\MultithreadScheduleTask.java
......@@ -75,6 +79,7 @@ E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\utils\wx\msg\Image
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\controller\SurveyController.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\utils\wx\aes\XMLParse.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\utils\wx\aes\WXBizMsgCrypt.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\controller\NewsController.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\utils\wx\StringUtils.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\utils\ListUtils.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\utils\wx\DateUtils.java
......@@ -84,6 +89,7 @@ E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\vo\Subjectinformat
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\controller\SuperadmindbController.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\param\NoticetypePageParam.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\vo\SubjectsInfoStatisticsDashboard.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\service\impl\NewsServiceImpl.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\utils\IpUtils.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\mapper\NoticeMapper.java
E:\changfa\hongxinhui\hongxinhui\src\main\java\com\hongxinhui\mapper\ManageWayMapper.java
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
#Generated by Maven
#Thu Aug 19 16:25:51 CST 2021
#Thu Sep 09 12:45:12 CST 2021
version=2.0
groupId=io.geekidea.springbootplus
artifactId=scheduled
#Generated by Maven
#Thu Aug 19 16:25:43 CST 2021
#Thu Sep 09 12:44:57 CST 2021
version=2.0
groupId=io.geekidea.springbootplus
artifactId=system
io\geekidea\springbootplus\system\interceptor\ResourceInterceptor.class
io\geekidea\springbootplus\system\enums\EntityEnum.class
io\geekidea\springbootplus\system\exception\SysLoginException.class
io\geekidea\springbootplus\system\interceptor\UploadInterceptor.class
io\geekidea\springbootplus\system\enums\StateEnum.class
io\geekidea\springbootplus\system\exception\VerificationCodeException.class
io\geekidea\springbootplus\system\enums\MenuLevelEnum.class
io\geekidea\springbootplus\system\interceptor\DownloadInterceptor.class
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment