Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
77db372b
Commit
77db372b
authored
Nov 10, 2020
by
mobh
Committed by
chenzg
Jul 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消息模板功能
parent
f5e0c9ce
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
121 additions
and
31 deletions
+121
-31
src/main/java/cn/timer/api/bean/admin/AdminMsgTemplate.java
+1
-4
src/main/java/cn/timer/api/controller/admin/AdminMsgTemplateController.java
+63
-9
src/main/java/cn/timer/api/dao/admin/AdminMsgTemplateMapper.java
+15
-2
src/main/java/cn/timer/api/dto/admin/AdminMsgTemplateDto.java
+0
-4
src/main/resources/mapping/admin/AdminMsgTemplateMapper.xml
+42
-12
No files found.
src/main/java/cn/timer/api/bean/admin/AdminMsgTemplate.java
View file @
77db372b
...
...
@@ -38,9 +38,6 @@ public class AdminMsgTemplate extends Model<AdminMsgTemplate> {
@ApiModelProperty
(
value
=
"id id"
,
example
=
"101"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"模板编号 "
,
example
=
"模板ID"
)
private
String
templateNum
;
@ApiModelProperty
(
value
=
"模板名称 "
,
example
=
"模板名称"
)
private
String
templateName
;
...
...
@@ -60,7 +57,7 @@ public class AdminMsgTemplate extends Model<AdminMsgTemplate> {
private
Integer
state
;
@ApiModelProperty
(
value
=
"生产时间 生产时间"
,
example
=
"101"
)
private
Integer
addtime
;
private
Long
addtime
;
@ApiModelProperty
(
value
=
"企业ID 企业ID"
,
example
=
"101"
)
private
Integer
orgCode
;
...
...
src/main/java/cn/timer/api/controller/admin/AdminMsgTemplateController.java
View file @
77db372b
package
cn
.
timer
.
api
.
controller
.
admin
;
import
cn.timer.api.bean.admin.AdminMsgTemplate
;
import
cn.timer.api.bean.yggl.YgglMainEmp
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.dao.admin.AdminMsgTemplateMapper
;
import
cn.timer.api.dto.admin.AdminMsgTemplateDto
;
import
cn.timer.api.dto.xcgl.FixedSalaryStaffDto
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.ResultUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.transaction.Transactional
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
@Api
(
tags
=
"消息模板管理"
)
@RestController
@Transactional
@RequestMapping
(
value
=
"/msg"
)
@RequestMapping
(
value
=
"/msg"
)
public
class
AdminMsgTemplateController
{
@Resource
...
...
@@ -30,9 +31,62 @@ public class AdminMsgTemplateController {
@PostMapping
(
"/listMsgTemplate"
)
@ApiOperation
(
value
=
"列出消息模板"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
listMsgTemplate
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AdminMsgTemplateDto
dto
)
{
dto
.
setOrgCode
(
userBean
.
getOrgCode
());
List
<
AdminMsgTemplate
>
list
=
msgTemplateMapper
.
listMsgTemplate
(
dto
);
public
Result
<
Object
>
listMsgTemplate
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AdminMsgTemplateDto
search
)
{
search
.
setOrgCode
(
userBean
.
getOrgCode
());
List
<
AdminMsgTemplate
>
list
=
msgTemplateMapper
.
listMsgTemplate
(
search
);
return
ResultUtil
.
data
(
list
);
}
@PostMapping
(
"/pageMsgTemplate"
)
@ApiOperation
(
value
=
"消息模板分页查询"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
pageMsgTemplate
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AdminMsgTemplateDto
search
)
{
search
.
setOrgCode
(
userBean
.
getOrgCode
());
Page
<
FixedSalaryStaffDto
>
page
=
new
Page
<
FixedSalaryStaffDto
>(
search
.
getCurrentPage
()
==
null
?
1
:
search
.
getCurrentPage
(),
search
.
getTotalPage
()
==
null
?
10
:
search
.
getTotalPage
());
long
total
=
msgTemplateMapper
.
pageMsgTemplateCount
(
search
);
List
<
AdminMsgTemplate
>
list
=
msgTemplateMapper
.
pageMsgTemplate
(
search
);
page
.
setTotal
(
total
);
return
ResultUtil
.
data
(
page
,
list
,
"消息模板分页查询"
);
}
@PostMapping
(
"/getMsgTemplate/{id}"
)
@ApiOperation
(
value
=
"根据ID获取消息模板"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
pageMsgTemplate
(
@CurrentUser
UserBean
userBean
,
@PathVariable
Integer
id
)
{
return
ResultUtil
.
data
(
msgTemplateMapper
.
selectById
(
id
));
}
@PostMapping
(
"/delMsgTemplate/{id}"
)
@ApiOperation
(
value
=
"根据ID删除消息模板"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
delMsgTemplate
(
@CurrentUser
UserBean
userBean
,
@PathVariable
Integer
id
)
{
msgTemplateMapper
.
deleteById
(
id
);
return
ResultUtil
.
success
(
"删除成功"
);
}
@PostMapping
(
"/editMsgTemplate"
)
@ApiOperation
(
value
=
"新增/编辑消息模板"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
editMsgTemplate
(
@CurrentUser
UserBean
userBean
,
@RequestBody
AdminMsgTemplate
temp
)
{
AdminMsgTemplate
exits
=
AdminMsgTemplate
.
builder
().
build
().
selectOne
(
new
LambdaQueryWrapper
<
AdminMsgTemplate
>().
eq
(
AdminMsgTemplate:
:
getOrgCode
,
userBean
.
getOrgCode
())
.
eq
(
AdminMsgTemplate:
:
getPlatformNum
,
temp
.
getPlatformNum
())
.
eq
(
AdminMsgTemplate:
:
getPlatformType
,
temp
.
getPlatformType
())
.
eq
(
AdminMsgTemplate:
:
getState
,
0
)
);
if
(
Objects
.
nonNull
(
exits
))
{
if
(
Objects
.
isNull
(
temp
.
getId
())
||
(
Objects
.
nonNull
(
temp
.
getId
())
&&
!
temp
.
getId
().
equals
(
exits
.
getId
())))
{
return
ResultUtil
.
error
(
"对应平台编号已经存在!"
);
}
}
temp
.
setOrgCode
(
userBean
.
getOrgCode
());
temp
.
setAddtime
(
new
Date
().
getTime
());
if
(
Objects
.
isNull
(
temp
.
getId
()))
{
msgTemplateMapper
.
insert
(
temp
);
}
else
{
msgTemplateMapper
.
updateById
(
temp
);
}
return
ResultUtil
.
success
(
"保存成功"
);
}
}
src/main/java/cn/timer/api/dao/admin/AdminMsgTemplateMapper.java
View file @
77db372b
...
...
@@ -20,8 +20,21 @@ import java.util.List;
public
interface
AdminMsgTemplateMapper
extends
BaseMapper
<
AdminMsgTemplate
>
{
/**
* 查询模板
* @param param
s
* @param param
* @return
*/
List
<
AdminMsgTemplate
>
listMsgTemplate
(
@Param
(
"params"
)
AdminMsgTemplateDto
params
);
List
<
AdminMsgTemplate
>
listMsgTemplate
(
@Param
(
"param"
)
AdminMsgTemplateDto
param
);
/**
* 分页查询总数
* @param param
* @return
*/
Long
pageMsgTemplateCount
(
@Param
(
"param"
)
AdminMsgTemplateDto
param
);
/**
* 分页查询
* @param param
* @return
*/
List
<
AdminMsgTemplate
>
pageMsgTemplate
(
@Param
(
"param"
)
AdminMsgTemplateDto
param
);
}
src/main/java/cn/timer/api/dto/admin/AdminMsgTemplateDto.java
View file @
77db372b
...
...
@@ -13,10 +13,6 @@ import java.io.Serializable;
@AllArgsConstructor
@NoArgsConstructor
public
class
AdminMsgTemplateDto
extends
Page
implements
Serializable
{
@ApiModelProperty
(
value
=
"模板编号 "
,
example
=
"模板ID"
)
private
String
templateNum
;
@ApiModelProperty
(
value
=
"模板名称 "
,
example
=
"模板名称"
)
private
String
templateName
;
...
...
src/main/resources/mapping/admin/AdminMsgTemplateMapper.xml
View file @
77db372b
...
...
@@ -5,7 +5,6 @@
<resultMap
id=
"BaseResultMap"
type=
"cn.timer.api.bean.admin.AdminMsgTemplate"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"template_num"
property=
"templateNum"
/>
<result
column=
"template_name"
property=
"templateName"
/>
<result
column=
"platform_num"
property=
"platformNum"
/>
<result
column=
"platform_type"
property=
"platformType"
/>
...
...
@@ -18,7 +17,6 @@
<sql
id=
"Base_Column_List"
>
id,
template_num,
template_name,
platform_num,
platform_type,
...
...
@@ -33,21 +31,52 @@
SELECT
<include
refid=
"Base_Column_List"
/>
FROM admin_msg_template temp
<where>
<if
test=
"param
s.templateName != null and params
.templateName !=''"
>
and temp.template_name like CONCAT('%',#{param
s
.templateName},'%')
<if
test=
"param
.templateName != null and param
.templateName !=''"
>
and temp.template_name like CONCAT('%',#{param.templateName},'%')
</if>
<if
test=
"param
s
.platformType != null"
>
and temp.platform_type = #{param
s
.platformType}
<if
test=
"param.platformType != null"
>
and temp.platform_type = #{param.platformType}
</if>
<if
test=
"param
s
.msgType != null"
>
and temp.msg_type = #{param
s
.msgType}
<if
test=
"param.msgType != null"
>
and temp.msg_type = #{param.msgType}
</if>
<if
test=
"param
s
.state != null"
>
and temp.state = #{param
s
.state}
<if
test=
"param.state != null"
>
and temp.state = #{param.state}
</if>
<if
test=
"param
s
.orgCode != null"
>
and temp.org_code = #{param
s
.orgCode}
<if
test=
"param.orgCode != null"
>
and temp.org_code = #{param.orgCode}
</if>
</where>
</select>
<!-- 分页查询 -->
<sql
id=
"pageMsgTemplateCondition"
>
<where>
<if
test=
"param.templateName != null and param.templateName !=''"
>
and temp.template_name like CONCAT('%',#{param.templateName},'%')
</if>
<if
test=
"param.platformType != null"
>
and temp.platform_type = #{param.platformType}
</if>
<if
test=
"param.msgType != null"
>
and temp.msg_type = #{param.msgType}
</if>
<if
test=
"param.state != null"
>
and temp.state = #{param.state}
</if>
<if
test=
"param.orgCode != null"
>
and temp.org_code = #{param.orgCode}
</if>
</where>
</sql>
<select
id=
"pageMsgTemplateCount"
resultType=
"java.lang.Long"
>
SELECT count(*) FROM admin_msg_template temp
<include
refid=
"pageMsgTemplateCondition"
/>
</select>
<select
id=
"pageMsgTemplate"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM admin_msg_template temp
<include
refid=
"pageMsgTemplateCondition"
/>
LIMIT #{param.offset}, #{param.totalPage}
</select>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment