Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gogirl-miniapp-backend
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huluobin
gogirl-miniapp-backend
Commits
c2131284
Commit
c2131284
authored
Mar 06, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
美甲师登陆流程修改 线程变量保存登陆Seesion
parent
8f507877
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
136 additions
and
20 deletions
+136
-20
Message.java
src/main/java/com/gogirl/domain/xcx/Message.java
+10
-3
MessageMapper.java
...a/com/gogirl/infrastructure/mapper/xcx/MessageMapper.java
+16
-3
TechnicianMessageController.java
...om/gogirl/interfaces/xcx/TechnicianMessageController.java
+79
-0
MessageMapper.xml
src/main/resources/mapper/xcx/MessageMapper.xml
+31
-14
No files found.
src/main/java/com/gogirl/domain/xcx/Message.java
View file @
c2131284
package
com
.
gogirl
.
domain
.
xcx
;
package
com
.
gogirl
.
domain
.
xcx
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.gogirl.domain.store.oa.TakeLeaveEvent
;
import
com.gogirl.domain.store.oa.TakeLeaveEvent
;
...
@@ -21,23 +22,29 @@ public class Message {
...
@@ -21,23 +22,29 @@ public class Message {
@ApiModelProperty
(
"美甲师id"
)
@ApiModelProperty
(
"美甲师id"
)
private
Integer
technicianId
;
private
Integer
technicianId
;
@ApiModelProperty
(
"
1.新预约消息
"
)
@ApiModelProperty
(
"
消息分类 1.请假审核 2.排班提醒 3请假申请 4采购信息 5-培训课程 6-假期调整
"
)
private
Integer
type
;
private
Integer
type
;
@ApiModelProperty
(
"消息时间"
)
@ApiModelProperty
(
"消息时间"
)
private
Date
time
;
private
Date
time
;
@ApiModelProperty
(
"0-未读 1-已读"
)
@ApiModelProperty
(
"0-未读 1-已读"
)
private
Boolean
isRead
;
private
Integer
isRead
;
@ApiModelProperty
(
"标题"
)
@ApiModelProperty
(
"标题"
)
private
String
title
;
private
String
title
;
@ApiModelProperty
(
"消息"
)
@ApiModelProperty
(
"消息"
)
private
String
message
;
private
String
content
;
private
String
paramJson
;
private
String
paramJson
;
private
Integer
tab
;
@TableField
(
exist
=
false
)
private
Integer
unread
;
@TableField
(
exist
=
false
)
private
TakeLeaveEvent
takeLeaveEvent
;
private
TakeLeaveEvent
takeLeaveEvent
;
}
}
src/main/java/com/gogirl/infrastructure/mapper/xcx/MessageMapper.java
View file @
c2131284
package
com
.
gogirl
.
infrastructure
.
mapper
.
xcx
;
package
com
.
gogirl
.
infrastructure
.
mapper
.
xcx
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.gogirl.domain.xcx.Message
;
import
com.gogirl.domain.xcx.Message
;
import
org.apache.ibatis.annotations.
Mapper
;
import
org.apache.ibatis.annotations.
Param
;
import
java.util.List
;
import
java.util.List
;
public
interface
MessageMapper
{
public
interface
MessageMapper
extends
BaseMapper
<
Message
>
{
List
<
Message
>
selectMyMessage
(
Integer
customerId
);
/**
* 美甲师获取我的消息
*
* @param id
* @param technicianId 美甲师id
* @return 消息列表
*/
IPage
<
Message
>
selectMyMessage
(
@Param
(
"page"
)
IPage
page
,
@Param
(
"technicianId"
)
Integer
technicianId
,
@Param
(
"type"
)
Integer
type
,
@Param
(
"tab"
)
Integer
tab
);
List
<
Message
>
myMessageManage
(
@Param
(
"technicianId"
)
Integer
technicianId
,
@Param
(
"tab"
)
Integer
tab
);
Integer
selectUnReadCount
(
@Param
(
"technicianId"
)
Integer
technicianId
,
@Param
(
"type"
)
Integer
type
);
}
}
src/main/java/com/gogirl/interfaces/xcx/TechnicianMessageController.java
0 → 100644
View file @
c2131284
package
com
.
gogirl
.
interfaces
.
xcx
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.gogirl.application.xcx.GogirlTokenService
;
import
com.gogirl.domain.store.oa.TakeLeaveEvent
;
import
com.gogirl.domain.store.store.StoreTechnician
;
import
com.gogirl.domain.xcx.GogirlToken
;
import
com.gogirl.domain.xcx.Message
;
import
com.gogirl.infrastructure.common.base.JsonResult
;
import
com.gogirl.infrastructure.common.util.JsonUtilByFsJson
;
import
com.gogirl.infrastructure.mapper.xcx.MessageMapper
;
import
com.gogirl.infrastructure.util.SessionUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/message"
)
@Api
(
tags
=
{
"10.美甲师消息和用户登入登出记录"
},
value
=
"美甲师消息和用户登入登出记录"
)
@AllArgsConstructor
@Slf4j
public
class
TechnicianMessageController
{
private
final
MessageMapper
messageMapper
;
private
final
GogirlTokenService
gogirlTokenService
;
@ApiOperation
(
value
=
"获取我的消息"
)
@PostMapping
(
value
=
"/technician/message/selectMyMessage"
)
public
JsonResult
<
Page
<
Message
>>
selectMyMessage
(
@RequestHeader
String
token
,
Integer
pageSize
,
Integer
pageNum
,
Integer
type
,
Integer
tab
)
{
GogirlToken
gogirlToken
=
gogirlTokenService
.
getByToken
(
token
);
IPage
<
Message
>
page
=
new
Page
<>(
pageNum
,
pageSize
);
StoreTechnician
storeTechnician
=
SessionUtils
.
getStoreTechnician
();
page
=
messageMapper
.
selectMyMessage
(
page
,
storeTechnician
.
getId
(),
type
,
tab
);
page
.
getRecords
().
forEach
(
val
->
{
if
(
val
.
getType
()
==
1
||
val
.
getType
()
==
3
)
val
.
setTakeLeaveEvent
(
JsonUtilByFsJson
.
jsonToBean
(
val
.
getParamJson
(),
TakeLeaveEvent
.
class
));
});
return
JsonResult
.
success
((
Page
<
Message
>)
page
);
}
@ApiOperation
(
value
=
"我的消息管理"
)
@PostMapping
(
value
=
"/technician/message/myMessageManage"
)
public
JsonResult
<
List
<
Message
>>
myMessageManage
(
@RequestHeader
String
token
,
Integer
pageSize
,
Integer
pageNum
,
Integer
tab
)
{
StoreTechnician
storeTechnician
=
SessionUtils
.
getStoreTechnician
();
List
<
Message
>
list
=
messageMapper
.
myMessageManage
(
storeTechnician
.
getId
(),
tab
);
list
.
forEach
(
message
->
{
Integer
unread
=
messageMapper
.
selectUnReadCount
(
message
.
getTechnicianId
(),
message
.
getType
());
message
.
setUnread
(
unread
);
});
return
JsonResult
.
success
(
list
);
}
@ApiOperation
(
value
=
"阅读消息"
)
@GetMapping
(
value
=
"/technician/message/readMessage"
)
public
JsonResult
<
Void
>
readMessage
(
@RequestParam
Integer
id
)
{
Message
message
=
messageMapper
.
selectById
(
id
);
message
.
setIsRead
(
1
);
messageMapper
.
updateById
(
message
);
return
JsonResult
.
success
();
}
}
src/main/resources/mapper/xcx/MessageMapper.xml
View file @
c2131284
<?xml version="1.0" encoding="UTF-8" ?>
<?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" >
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.gogirl.infrastructure.mapper.xcx.MessageMapper"
>
<mapper
namespace=
"com.gogirl.infrastructure.mapper.xcx.MessageMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.gogirl.domain.xcx.Message"
>
<select
id=
"selectMyMessage"
resultType=
"com.gogirl.domain.xcx.Message"
parameterType=
"java.lang.Integer"
>
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"technician_id"
property=
"technicianId"
jdbcType=
"INTEGER"
/>
<result
column=
"type"
property=
"type"
jdbcType=
"INTEGER"
/>
<result
column=
"time"
property=
"time"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"is_read"
property=
"isRead"
jdbcType=
"BIT"
/>
<result
column=
"title"
property=
"title"
jdbcType=
"VARCHAR"
/>
<result
column=
"message"
property=
"message"
jdbcType=
"VARCHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, technician_id, type, time, is_read, title, message
</sql>
<select
id=
"selectMyMessage"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
select
<include
refid=
"Base_Column_List"
/>
*
from message
from message
where technician_id = #{technicianId,jdbcType=INTEGER}
where technician_id = #{technicianId,jdbcType=INTEGER}
<if
test=
"type != null"
>
and type =#{type}
</if>
<if
test=
"tab != null"
>
and tab =#{tab}
</if>
order by time desc
</select>
</select>
<select
id=
"myMessageManage"
resultType=
"com.gogirl.domain.xcx.Message"
>
SELECT *
from (SELECT *
FROM message
where true
<if
test=
"tab != null"
>
and tab =#{tab}
</if>
and technician_id =#{technicianId}
ORDER BY time DESC) t
GROUP BY t.type
</select>
<select
id=
"selectUnReadCount"
resultType=
"java.lang.Integer"
>
select count(id)
from message
where technician_id = #{technicianId}
and type = #{type}
and is_read = 0
</select>
</mapper>
</mapper>
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