Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
ims
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
ims
Commits
e1b173e8
提交
e1b173e8
authored
6月 19, 2023
作者:
panda
提交者:
余乾开
7月 01, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
行业新闻相关接口
上级
fe1ca2cc
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
367 行增加
和
53 行删除
+367
-53
IndustryNewsQO.java
...c/main/java/com/mmc/csf/infomation/qo/IndustryNewsQO.java
+46
-0
IndustryNewsDTO.java
.../main/java/com/mmc/csf/infomation/vo/IndustryNewsDTO.java
+40
-0
IndustryNewsVO.java
...c/main/java/com/mmc/csf/infomation/vo/IndustryNewsVO.java
+22
-13
TenderApplyVO.java
...rc/main/java/com/mmc/csf/infomation/vo/TenderApplyVO.java
+1
-1
ResultEnum.java
...src/main/java/com/mmc/csf/common/util/web/ResultEnum.java
+4
-1
IndustryNewsController.java
...om/mmc/csf/release/controller/IndustryNewsController.java
+34
-11
TenderController.java
...java/com/mmc/csf/release/controller/TenderController.java
+9
-9
IndustryNewsDao.java
...rc/main/java/com/mmc/csf/release/dao/IndustryNewsDao.java
+12
-0
IndustryNewsDO.java
.../main/java/com/mmc/csf/release/entity/IndustryNewsDO.java
+26
-11
IndustryNewsService.java
...java/com/mmc/csf/release/service/IndustryNewsService.java
+19
-1
IndustryNewsServiceImpl.java
...mmc/csf/release/service/impl/IndustryNewsServiceImpl.java
+43
-3
IndustryNewsDao.xml
...ervice/src/main/resources/mapper/news/IndustryNewsDao.xml
+111
-3
没有找到文件。
csf-common/csf-common-model/src/main/java/com/mmc/csf/infomation/qo/IndustryNewsQO.java
0 → 100644
浏览文件 @
e1b173e8
package
com
.
mmc
.
csf
.
infomation
.
qo
;
import
com.mmc.csf.release.model.group.Page
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.Date
;
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
IndustryNewsQO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
46151544725013257L
;
@ApiModelProperty
(
value
=
"新闻标题"
,
example
=
"新闻标题"
)
private
String
newsTitle
;
@ApiModelProperty
(
value
=
"开始时间"
)
private
Date
startTime
;
@ApiModelProperty
(
value
=
"结束时间"
)
private
Date
endTime
;
@ApiModelProperty
(
value
=
"页码"
,
required
=
true
)
@NotNull
(
message
=
"页码不能为空"
,
groups
=
Page
.
class
)
@Min
(
value
=
1
,
groups
=
Page
.
class
)
private
Integer
pageNo
;
@ApiModelProperty
(
value
=
"每页显示数"
,
required
=
true
)
@NotNull
(
message
=
"每页显示数不能为空"
,
groups
=
Page
.
class
)
@Min
(
value
=
1
,
groups
=
Page
.
class
)
private
Integer
pageSize
;
public
void
buildCurrentPage
()
{
this
.
pageNo
=
(
pageNo
-
1
)
*
pageSize
;
}
}
csf-common/csf-common-model/src/main/java/com/mmc/csf/infomation/vo/IndustryNewsDTO.java
0 → 100644
浏览文件 @
e1b173e8
package
com
.
mmc
.
csf
.
infomation
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @author: zj
* @Date: 2023/5/19 11:23
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public
class
IndustryNewsDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
8479619142765659138L
;
@ApiModelProperty
(
value
=
"id"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"新闻标题"
)
private
String
newsTitle
;
@ApiModelProperty
(
value
=
"作者"
)
private
String
newsAuthor
;
@ApiModelProperty
(
value
=
"发布者id"
)
private
Integer
userAccountId
;
@ApiModelProperty
(
value
=
"封面图"
)
private
String
surfaceImg
;
@ApiModelProperty
(
value
=
"新闻内容"
)
private
String
newsContents
;
@ApiModelProperty
(
value
=
"来源"
)
private
String
origin
;
@ApiModelProperty
(
value
=
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
value
=
"最新修改时间"
)
private
Date
updateTime
;
}
csf-common/csf-common-model/src/main/java/com/mmc/csf/infomation/vo/IndustryNewsVO.java
浏览文件 @
e1b173e8
package
com
.
mmc
.
csf
.
infomation
.
vo
;
import
com.mmc.csf.release.model.group.Create
;
import
com.mmc.csf.release.model.group.Others
;
import
com.mmc.csf.release.model.group.Update
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @author: zj
* @Date: 2023/5/19 11:23
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public
class
IndustryNewsVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
8479619142765659138L
;
@ApiModelProperty
(
value
=
"id"
)
@NotNull
(
message
=
"修改id不能为空"
,
groups
=
{
Update
.
class
})
private
Integer
id
;
@ApiModelProperty
(
value
=
"新闻标题"
)
@ApiModelProperty
(
value
=
"新闻标题"
,
example
=
"新闻标题"
)
@NotBlank
(
message
=
"文章标题不能为空"
,
groups
=
{
Create
.
class
,
Update
.
class
})
private
String
newsTitle
;
@ApiModelProperty
(
value
=
"作者"
)
@ApiModelProperty
(
value
=
"作者"
,
example
=
"作者"
)
@NotBlank
(
message
=
"作者不能为空"
,
groups
=
{
Create
.
class
,
Update
.
class
})
private
String
newsAuthor
;
@ApiModelProperty
(
value
=
"发布者id"
)
@ApiModelProperty
(
value
=
"创建人"
,
hidden
=
true
)
private
Integer
userAccountId
;
@ApiModelProperty
(
value
=
"封面图"
)
@NotBlank
(
message
=
"封面图不能为空"
,
groups
=
{
Create
.
class
,
Update
.
class
})
private
String
surfaceImg
;
@ApiModelProperty
(
value
=
"新闻内容"
)
private
String
newsContents
;
@ApiModelProperty
(
value
=
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
value
=
"最新修改时间"
)
private
Date
updateTime
;
@ApiModelProperty
(
value
=
"来源"
,
example
=
"来源"
)
private
String
origin
;
}
csf-common/csf-common-model/src/main/java/com/mmc/csf/infomation/vo/TenderApplyVO.java
浏览文件 @
e1b173e8
...
...
@@ -21,7 +21,7 @@ public class TenderApplyVO implements Serializable {
@ApiModelProperty
(
value
=
"招标id"
)
@NotNull
(
message
=
"招标id不能为空"
,
groups
=
{
Create
.
class
})
private
Integer
tenderNewsId
;
@ApiModelProperty
(
value
=
"用户id"
)
@ApiModelProperty
(
value
=
"用户id"
,
hidden
=
true
)
//@NotNull(message = "用户id不能为空", groups = {Create.class})
private
Integer
userAccountId
;
@ApiModelProperty
(
value
=
"招标详情id"
)
...
...
csf-common/csf-common-util/src/main/java/com/mmc/csf/common/util/web/ResultEnum.java
浏览文件 @
e1b173e8
...
...
@@ -396,7 +396,10 @@ public enum ResultEnum implements BaseErrorInfoInterface {
HELP_FAIL_ERROR
(
"2009"
,
"不能给自己助力哦!"
),
ALREADY_BINDING_ERROR
(
"2010"
,
"优惠券已被绑定"
),
ALREADY_DIVIDE_ERROR
(
"2011"
,
"订单已分成"
),
DIVIDE_OBJ_NOT_EXIST
(
"2012"
,
"先点击确认添加分成对象"
);
DIVIDE_OBJ_NOT_EXIST
(
"2012"
,
"先点击确认添加分成对象"
),
// 新闻行业
INDUSTRY_NEWS_TITLE_EXISTS
(
"40200"
,
"文章标题存在"
);
/**
* 错误码
*
...
...
release-service/src/main/java/com/mmc/csf/release/controller/IndustryNewsController.java
浏览文件 @
e1b173e8
...
...
@@ -2,9 +2,12 @@ package com.mmc.csf.release.controller;
import
com.mmc.csf.common.util.web.ResultBody
;
import
com.mmc.csf.infomation.qo.IndustryCaseQO
;
import
com.mmc.csf.infomation.vo.IndustryCaseVO
;
import
com.mmc.csf.infomation.qo.IndustryNewsQO
;
import
com.mmc.csf.infomation.vo.IndustryNewsDTO
;
import
com.mmc.csf.infomation.vo.IndustryNewsVO
;
import
com.mmc.csf.release.model.group.Create
;
import
com.mmc.csf.release.model.group.Page
;
import
com.mmc.csf.release.model.group.Update
;
import
com.mmc.csf.release.service.IndustryNewsService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -13,31 +16,51 @@ import io.swagger.annotations.ApiResponses;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
/**
* @author: zj
* @Date: 2023/5/19 10:42
*/
@Api
(
tags
=
{
"行业新闻
相关
"
})
@Api
(
tags
=
{
"行业新闻
-相关接口
"
})
@RestController
@RequestMapping
(
"/industry-news/"
)
public
class
IndustryNewsController
{
public
class
IndustryNewsController
extends
BaseController
{
@Autowired
private
IndustryNewsService
industryNewsService
;
@ApiOperation
(
value
=
"新闻列表"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
IndustryNewsVO
.
class
)
})
@PostMapping
(
"listNewsPage"
)
public
ResultBody
listNewsPage
(
@Validated
(
value
=
{
Page
.
class
})
@RequestBody
IndustryCaseQO
industryCaseQO
,
HttpServletRequest
request
){
return
industryNewsService
.
listNewsPage
(
industryCaseQO
,
request
);
@ApiOperation
(
value
=
"添加-行业新闻"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)
})
@PostMapping
(
"insertIndustryNews"
)
public
ResultBody
insertIndustryNews
(
@RequestBody
@Validated
(
Create
.
class
)
IndustryNewsVO
industryNewsVO
,
HttpServletRequest
request
){
return
industryNewsService
.
insertIndustryNews
(
industryNewsVO
,
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
());
}
@ApiOperation
(
value
=
"修改-行业新闻"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)
})
@PostMapping
(
"upDateIndustryNews"
)
public
ResultBody
upDateIndustryNews
(
@RequestBody
@Validated
(
Update
.
class
)
IndustryNewsVO
industryNewsVO
,
HttpServletRequest
request
){
return
industryNewsService
.
upDateIndustryNews
(
industryNewsVO
,
this
.
getUserLoginInfoFromRedis
(
request
).
getUserAccountId
());
}
@ApiOperation
(
value
=
"新闻详情"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
IndustryNews
V
O
.
class
)
})
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
IndustryNews
DT
O
.
class
)
})
@GetMapping
(
"details"
)
public
ResultBody
details
(
@RequestParam
Integer
id
){
public
ResultBody
<
IndustryNewsDTO
>
details
(
@RequestParam
Integer
id
){
return
industryNewsService
.
details
(
id
);
}
@ApiOperation
(
value
=
"后台-新闻列表"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
IndustryNewsDTO
.
class
)
})
@PostMapping
(
"backgroundListNewsPage"
)
public
ResultBody
<
IndustryNewsDTO
>
backgroundListNewsPage
(
@Validated
(
value
=
{
Page
.
class
})
@RequestBody
IndustryNewsQO
industryNewsQO
,
HttpServletRequest
request
){
return
industryNewsService
.
backgroundListNewsPage
(
industryNewsQO
,
request
);
}
@ApiOperation
(
value
=
"web端-新闻列表"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
IndustryNewsDTO
.
class
)
})
@PostMapping
(
"listNewsPage"
)
public
ResultBody
<
IndustryNewsDTO
>
listNewsPage
(
@Validated
(
value
=
{
Page
.
class
})
@RequestBody
IndustryCaseQO
industryCaseQO
,
HttpServletRequest
request
){
return
industryNewsService
.
listNewsPage
(
industryCaseQO
,
request
);
}
}
release-service/src/main/java/com/mmc/csf/release/controller/TenderController.java
浏览文件 @
e1b173e8
...
...
@@ -101,12 +101,11 @@ public class TenderController extends BaseController{
return
tenderService
.
listTenderApply
(
tenderApplyQO
);
}
@ApiOperation
(
value
=
"
app往期招标快讯详情列表-分页
"
)
@ApiOperation
(
value
=
"
web端-招投标列表
"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
AppTenderInfoDTO
.
class
)})
@GetMapping
(
value
=
"info/app"
)
public
ResultBody
listTenderInfoApp
(
@RequestParam
Integer
pageNo
,
@RequestParam
Integer
pageSize
,
@RequestParam
Integer
tenderNewsId
,
@RequestParam
(
required
=
false
)
Integer
userAccountId
){
return
tenderService
.
listTenderInfoApp
(
pageNo
,
pageSize
,
tenderNewsId
,
userAccountId
);
@PostMapping
(
value
=
"listNewTenderInfo"
)
public
ResultBody
listNewTenderInfo
(
@Validated
(
value
=
{
Page
.
class
})
@RequestBody
IndustryCaseQO
industryCaseQO
,
HttpServletRequest
request
){
return
tenderService
.
listNewTenderInfo
(
industryCaseQO
,
this
.
getUserLoginInfoFromRedis
(
request
),
request
);
}
@ApiOperation
(
value
=
"app最新招标快讯详情列表-分页"
)
...
...
@@ -117,10 +116,11 @@ public class TenderController extends BaseController{
return
tenderService
.
listTenderInfoAppLatest
(
pageNo
,
pageSize
,
userAccountId
);
}
@ApiOperation
(
value
=
"
招投标列表"
)
@ApiOperation
(
value
=
"
app往期招标快讯详情列表-分页"
,
hidden
=
true
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
AppTenderInfoDTO
.
class
)})
@PostMapping
(
value
=
"listNewTenderInfo"
)
public
ResultBody
listNewTenderInfo
(
@Validated
(
value
=
{
Page
.
class
})
@RequestBody
IndustryCaseQO
industryCaseQO
,
HttpServletRequest
request
){
return
tenderService
.
listNewTenderInfo
(
industryCaseQO
,
this
.
getUserLoginInfoFromRedis
(
request
),
request
);
@GetMapping
(
value
=
"info/app"
)
public
ResultBody
listTenderInfoApp
(
@RequestParam
Integer
pageNo
,
@RequestParam
Integer
pageSize
,
@RequestParam
Integer
tenderNewsId
,
@RequestParam
(
required
=
false
)
Integer
userAccountId
){
return
tenderService
.
listTenderInfoApp
(
pageNo
,
pageSize
,
tenderNewsId
,
userAccountId
);
}
}
release-service/src/main/java/com/mmc/csf/release/dao/IndustryNewsDao.java
浏览文件 @
e1b173e8
package
com
.
mmc
.
csf
.
release
.
dao
;
import
com.mmc.csf.infomation.qo.IndustryCaseQO
;
import
com.mmc.csf.infomation.qo.IndustryNewsQO
;
import
com.mmc.csf.infomation.vo.IndustryNewsVO
;
import
com.mmc.csf.release.entity.IndustryNewsDO
;
import
org.apache.ibatis.annotations.Mapper
;
...
...
@@ -32,4 +34,14 @@ public interface IndustryNewsDao {
* @return
*/
IndustryNewsDO
details
(
Integer
id
);
Integer
count
(
IndustryNewsDO
industryNewsDO
);
Integer
insert
(
IndustryNewsDO
industryNewsDO
);
Integer
update
(
IndustryNewsDO
industryNewsDO
);
Integer
countPage
(
IndustryNewsQO
industryNewsQO
);
List
<
IndustryNewsDO
>
backgroundListNewsPage
(
IndustryNewsQO
industryNewsQO
);
}
release-service/src/main/java/com/mmc/csf/release/entity/IndustryNewsDO.java
浏览文件 @
e1b173e8
package
com
.
mmc
.
csf
.
release
.
entity
;
import
com.mmc.csf.infomation.vo.IndustryNewsVO
;
import
com.mmc.csf.infomation.vo.IndustryNewsDTO
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
...
...
@@ -15,6 +17,7 @@ import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public
class
IndustryNewsDO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
3296973167970903480L
;
private
Integer
id
;
...
...
@@ -25,18 +28,30 @@ public class IndustryNewsDO implements Serializable {
private
String
newsContents
;
private
Date
createTime
;
private
Date
updateTime
;
@ApiModelProperty
(
value
=
"来源"
)
private
String
origin
;
public
IndustryNews
VO
buildIndustryNewsV
O
(){
return
IndustryNews
V
O
.
builder
().
id
(
id
).
newsTitle
(
newsTitle
).
newsAuthor
(
newsAuthor
).
userAccountId
(
userAccountId
).
surfaceImg
(
surfaceImg
).
newsContents
(
newsContents
).
createTime
(
createTime
).
updateTime
(
updateTime
).
build
();
public
IndustryNews
DTO
buildIndustryNewsDT
O
(){
return
IndustryNews
DT
O
.
builder
().
id
(
id
).
newsTitle
(
newsTitle
).
newsAuthor
(
newsAuthor
).
userAccountId
(
userAccountId
).
surfaceImg
(
surfaceImg
).
newsContents
(
newsContents
).
createTime
(
createTime
).
updateTime
(
updateTime
).
origin
(
origin
).
build
();
}
public
IndustryNewsDO
(
IndustryNewsVO
industryNewsVO
){
this
.
id
=
industryNewsVO
.
getId
();
this
.
newsTitle
=
industryNewsVO
.
getNewsTitle
();
this
.
newsAuthor
=
industryNewsVO
.
getNewsAuthor
();
this
.
userAccountId
=
industryNewsVO
.
getUserAccountId
();
this
.
surfaceImg
=
industryNewsVO
.
getSurfaceImg
();
this
.
newsContents
=
industryNewsVO
.
getNewsContents
();
public
IndustryNewsDO
(
IndustryNewsDTO
industryNewsDTO
){
this
.
id
=
industryNewsDTO
.
getId
();
this
.
newsTitle
=
industryNewsDTO
.
getNewsTitle
();
this
.
newsAuthor
=
industryNewsDTO
.
getNewsAuthor
();
this
.
userAccountId
=
industryNewsDTO
.
getUserAccountId
();
this
.
surfaceImg
=
industryNewsDTO
.
getSurfaceImg
();
this
.
newsContents
=
industryNewsDTO
.
getNewsContents
();
}
public
IndustryNewsDO
(
Integer
id
,
String
newsTitle
,
String
newsAuthor
,
Integer
userAccountId
,
String
surfaceImg
,
String
newsContents
,
String
origin
)
{
this
.
id
=
id
;
this
.
newsTitle
=
newsTitle
;
this
.
newsAuthor
=
newsAuthor
;
this
.
userAccountId
=
userAccountId
;
this
.
surfaceImg
=
surfaceImg
;
this
.
newsContents
=
newsContents
;
this
.
origin
=
origin
;
}
}
release-service/src/main/java/com/mmc/csf/release/service/IndustryNewsService.java
浏览文件 @
e1b173e8
...
...
@@ -2,6 +2,9 @@ package com.mmc.csf.release.service;
import
com.mmc.csf.common.util.web.ResultBody
;
import
com.mmc.csf.infomation.qo.IndustryCaseQO
;
import
com.mmc.csf.infomation.qo.IndustryNewsQO
;
import
com.mmc.csf.infomation.vo.IndustryNewsDTO
;
import
com.mmc.csf.infomation.vo.IndustryNewsVO
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -11,7 +14,7 @@ import javax.servlet.http.HttpServletRequest;
*/
public
interface
IndustryNewsService
{
/**
* 新闻列表
* 新闻列表
-web
* @param industryCaseQO
* @param request
* @return
...
...
@@ -24,4 +27,19 @@ public interface IndustryNewsService {
* @return
*/
ResultBody
details
(
Integer
id
);
/**
* 新闻插入
*/
ResultBody
insertIndustryNews
(
IndustryNewsVO
industryNewsVO
,
Integer
userAccountId
);
/**
* 新闻编辑
*/
ResultBody
upDateIndustryNews
(
IndustryNewsVO
industryNewsVO
,
Integer
userAccountId
);
/**
* 新闻列表-后台
*/
ResultBody
<
IndustryNewsDTO
>
backgroundListNewsPage
(
IndustryNewsQO
industryNewsQO
,
HttpServletRequest
request
);
}
release-service/src/main/java/com/mmc/csf/release/service/impl/IndustryNewsServiceImpl.java
浏览文件 @
e1b173e8
...
...
@@ -2,7 +2,10 @@ package com.mmc.csf.release.service.impl;
import
com.mmc.csf.common.util.page.PageResult
;
import
com.mmc.csf.common.util.web.ResultBody
;
import
com.mmc.csf.common.util.web.ResultEnum
;
import
com.mmc.csf.infomation.qo.IndustryCaseQO
;
import
com.mmc.csf.infomation.qo.IndustryNewsQO
;
import
com.mmc.csf.infomation.vo.IndustryNewsDTO
;
import
com.mmc.csf.infomation.vo.IndustryNewsVO
;
import
com.mmc.csf.release.constant.TokenConstant
;
import
com.mmc.csf.release.dao.IndustryNewsDao
;
...
...
@@ -42,16 +45,53 @@ public class IndustryNewsServiceImpl implements IndustryNewsService {
Integer
pageNo
=
industryCaseQO
.
getPageNo
();
industryCaseQO
.
buildCurrentPage
();
List
<
IndustryNewsDO
>
industryNewsDOList
=
industryNewsDao
.
listNewsPage
(
industryCaseQO
);
List
<
IndustryNews
VO
>
industryNewsVOS
=
industryNewsDOList
.
stream
().
map
(
IndustryNewsDO:
:
buildIndustryNewsV
O
).
collect
(
Collectors
.
toList
());
return
ResultBody
.
success
(
PageResult
.
buildPage
(
pageNo
,
industryCaseQO
.
getPageSize
(),
count
,
industryNews
V
OS
));
List
<
IndustryNews
DTO
>
industryNewsDTOS
=
industryNewsDOList
.
stream
().
map
(
IndustryNewsDO:
:
buildIndustryNewsDT
O
).
collect
(
Collectors
.
toList
());
return
ResultBody
.
success
(
PageResult
.
buildPage
(
pageNo
,
industryCaseQO
.
getPageSize
(),
count
,
industryNews
DT
OS
));
}
@Override
public
ResultBody
details
(
Integer
id
)
{
IndustryNewsDO
industryNewsDO
=
industryNewsDao
.
details
(
id
);
if
(
industryNewsDO
!=
null
)
{
return
ResultBody
.
success
(
industryNewsDO
.
buildIndustryNews
V
O
());
return
ResultBody
.
success
(
industryNewsDO
.
buildIndustryNews
DT
O
());
}
return
ResultBody
.
success
();
}
@Override
public
ResultBody
insertIndustryNews
(
IndustryNewsVO
param
,
Integer
userAccountId
)
{
IndustryNewsDO
industryNewsDO
=
IndustryNewsDO
.
builder
().
newsTitle
(
param
.
getNewsTitle
()).
build
();
Integer
count
=
industryNewsDao
.
count
(
industryNewsDO
);
if
(
count
>
0
){
return
ResultBody
.
error
(
ResultEnum
.
INDUSTRY_NEWS_TITLE_EXISTS
);
}
industryNewsDO
=
new
IndustryNewsDO
(
param
.
getId
(),
param
.
getNewsTitle
(),
param
.
getNewsAuthor
(),
userAccountId
,
param
.
getSurfaceImg
(),
param
.
getNewsContents
(),
param
.
getOrigin
());
industryNewsDao
.
insert
(
industryNewsDO
);
return
ResultBody
.
success
();
}
@Override
public
ResultBody
upDateIndustryNews
(
IndustryNewsVO
param
,
Integer
userAccountId
)
{
IndustryNewsDO
industryNewsDO
=
IndustryNewsDO
.
builder
().
newsTitle
(
param
.
getNewsTitle
()).
build
();
Integer
count
=
industryNewsDao
.
count
(
industryNewsDO
);
if
(
count
>
0
){
return
ResultBody
.
error
(
ResultEnum
.
INDUSTRY_NEWS_TITLE_EXISTS
);
}
industryNewsDO
=
new
IndustryNewsDO
(
param
.
getId
(),
param
.
getNewsTitle
(),
param
.
getNewsAuthor
(),
userAccountId
,
param
.
getSurfaceImg
(),
param
.
getNewsContents
(),
param
.
getOrigin
());
industryNewsDao
.
update
(
industryNewsDO
);
return
ResultBody
.
success
();
}
@Override
public
ResultBody
<
IndustryNewsDTO
>
backgroundListNewsPage
(
IndustryNewsQO
industryNewsQO
,
HttpServletRequest
request
)
{
Integer
count
=
industryNewsDao
.
countPage
(
industryNewsQO
);
if
(
count
==
0
)
{
return
ResultBody
.
success
(
PageResult
.
buildPage
(
industryNewsQO
.
getPageNo
(),
industryNewsQO
.
getPageSize
(),
count
));
}
Integer
pageNo
=
industryNewsQO
.
getPageNo
();
industryNewsQO
.
buildCurrentPage
();
List
<
IndustryNewsDO
>
industryNewsDOList
=
industryNewsDao
.
backgroundListNewsPage
(
industryNewsQO
);
List
<
IndustryNewsDTO
>
industryNewsDTOS
=
industryNewsDOList
.
stream
().
map
(
IndustryNewsDO:
:
buildIndustryNewsDTO
).
collect
(
Collectors
.
toList
());
return
ResultBody
.
success
(
PageResult
.
buildPage
(
pageNo
,
industryNewsQO
.
getPageSize
(),
count
,
industryNewsDTOS
));
}
}
release-service/src/main/resources/mapper/news/IndustryNewsDao.xml
浏览文件 @
e1b173e8
...
...
@@ -3,7 +3,8 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.mmc.csf.release.dao.IndustryNewsDao"
>
<select
id=
"countListNewsPage"
resultType=
"java.lang.Integer"
parameterType=
"com.mmc.csf.infomation.qo.IndustryCaseQO"
>
<select
id=
"countListNewsPage"
resultType=
"java.lang.Integer"
parameterType=
"com.mmc.csf.infomation.qo.IndustryCaseQO"
>
select count(*) from industry_news
where is_deleted = 0
<if
test=
" userIds != null "
>
...
...
@@ -17,13 +18,15 @@
</if>
</select>
<select
id=
"listNewsPage"
resultType=
"com.mmc.csf.release.entity.IndustryNewsDO"
parameterType=
"com.mmc.csf.infomation.qo.IndustryCaseQO"
>
<select
id=
"listNewsPage"
resultType=
"com.mmc.csf.release.entity.IndustryNewsDO"
parameterType=
"com.mmc.csf.infomation.qo.IndustryCaseQO"
>
select id,
news_title,
news_author,
user_account_id,
surface_img,
news_contents,
origin,
create_time,
update_time
from industry_news
...
...
@@ -43,14 +46,118 @@
<select
id=
"details"
resultType=
"com.mmc.csf.release.entity.IndustryNewsDO"
>
select id,
news_title,
news_author,
user_account_id,
surface_img,
news_contents,
origin,
create_time,
update_time
from industry_news
where is_deleted = 0
and id = #{id}
</select>
<select
id=
"count"
resultType=
"java.lang.Integer"
parameterType=
"com.mmc.csf.release.entity.IndustryNewsDO"
>
select count(*)
from industry_news
<where>
is_deleted = 0
<if
test=
"newsTitle != null and newsTitle != ''"
>
and news_title = #{newsTitle}
</if>
<if
test=
"newsAuthor != null and newsAuthor != ''"
>
and news_author = #{newsAuthor}
</if>
<if
test=
"userAccountId != null"
>
and user_account_id = #{userAccountId}
</if>
<if
test=
"surfaceImg != null and surfaceImg != ''"
>
and surface_img = #{surfaceImg}
</if>
<if
test=
"newsContents != null and newsContents != ''"
>
and news_contents = #{newsContents}
</if>
<if
test=
"origin != null and origin != ''"
>
and origin = #{origin}
</if>
</where>
</select>
<insert
id=
"insert"
parameterType=
"com.mmc.csf.release.entity.IndustryNewsDO"
useGeneratedKeys=
"true"
keyColumn=
"id"
>
insert into industry_news(news_title, news_author, user_account_id, surface_img, news_contents, origin,
create_time)
values (#{newsTitle}, #{newsAuthor}, #{userAccountId}, #{surfaceImg}, #{newsContents}, #{origin}, now())
</insert>
<update
id=
"update"
parameterType=
"com.mmc.csf.release.entity.IndustryNewsDO"
>
update industry_news
<set>
<if
test=
"newsTitle != null and newsTitle != ''"
>
news_title = #{newsTitle},
</if>
<if
test=
"newsAuthor != null and newsAuthor != ''"
>
news_author = #{newsAuthor},
</if>
<if
test=
"userAccountId != null"
>
user_account_id = #{userAccountId},
</if>
<if
test=
"surfaceImg != null and surfaceImg != ''"
>
surface_img = #{surfaceImg},
</if>
<if
test=
"newsContents != null"
>
news_contents = #{newsContents},
</if>
<if
test=
"origin != null and origin != ''"
>
origin = #{origin},
</if>
</set>
where is_deleted = 0 and id = #{id}
</update>
<select
id=
"countPage"
parameterType=
"com.mmc.csf.infomation.qo.IndustryNewsQO"
resultType=
"java.lang.Integer"
>
select count(*)
from industry_news
<where>
is_deleted = 0
<if
test=
"newsTitle != null and newsTitle != ''"
>
and news_title like concat('%',#{newsTitle},'%')
</if>
<if
test=
"startTime != null"
>
and create_time
>
= #{startTime}
</if>
<if
test=
"endTime != null"
>
and create_time
<
= #{endTime}
</if>
</where>
</select>
<select
id=
"backgroundListNewsPage"
parameterType=
"com.mmc.csf.infomation.qo.IndustryNewsQO"
resultType=
"com.mmc.csf.release.entity.IndustryNewsDO"
>
select id,
news_title,
news_author,
user_account_id,
surface_img,
news_contents,
origin,
create_time,
update_time
from industry_news
where is_deleted = 0 and id = #{id}
<where>
is_deleted = 0
<if
test=
"newsTitle != null and newsTitle != ''"
>
and news_title like concat('%',#{newsTitle},'%')
</if>
<if
test=
"startTime != null"
>
and create_time
>
= #{startTime}
</if>
<if
test=
"endTime != null"
>
and create_time
<
= #{endTime}
</if>
</where>
order by create_time desc
limit #{pageNo}, #{pageSize}
</select>
</mapper>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论