Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-cloud-account
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.account
pica-cloud-account
提交
dadaece9
提交
dadaece9
编写于
3月 03, 2022
作者:
wenhao.qin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
saas平台修改
上级
eb388916
流水线
#42897
已取消 于阶段
变更
17
流水线
1
显示空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
434 行增加
和
134 行删除
+434
-134
HospitalSaasRoleController.java
...account/server/controller/HospitalSaasRoleController.java
+7
-5
HospitalSaasUserController.java
...account/server/controller/HospitalSaasUserController.java
+15
-5
AccountMapper.java
...ca/cloud/account/account/server/mapper/AccountMapper.java
+7
-1
PermissionDoctorRoleMapper.java
...unt/account/server/mapper/PermissionDoctorRoleMapper.java
+2
-1
PermissionRoleMapper.java
...d/account/account/server/mapper/PermissionRoleMapper.java
+1
-1
HospitalRoleDetailReq.java
...oud/account/account/server/req/HospitalRoleDetailReq.java
+2
-0
HospitalSaasUserReq.java
...cloud/account/account/server/req/HospitalSaasUserReq.java
+14
-4
HospitalRoleDetailDto.java
...ud/account/account/server/resp/HospitalRoleDetailDto.java
+17
-0
HospitalRoleDto.java
...ca/cloud/account/account/server/resp/HospitalRoleDto.java
+2
-2
HospitalSaasUserEditResp.java
...account/account/server/resp/HospitalSaasUserEditResp.java
+30
-0
HospitalSaasRoleService.java
...count/account/server/service/HospitalSaasRoleService.java
+3
-2
HospitalSaasUserService.java
...count/account/server/service/HospitalSaasUserService.java
+6
-2
HospitalSaasRoleServiceImpl.java
...ount/server/service/impl/HospitalSaasRoleServiceImpl.java
+13
-32
HospitalSaasUserServiceImpl.java
...ount/server/service/impl/HospitalSaasUserServiceImpl.java
+76
-33
AccountMapper.xml
server/src/main/resources/mybatis/AccountMapper.xml
+225
-39
PermissionDoctorRoleMapper.xml
...src/main/resources/mybatis/PermissionDoctorRoleMapper.xml
+5
-2
PermissionRoleMapper.xml
server/src/main/resources/mybatis/PermissionRoleMapper.xml
+9
-5
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/controller/HospitalSaasRoleController.java
浏览文件 @
dadaece9
...
...
@@ -3,7 +3,7 @@ package com.pica.cloud.account.account.server.controller;
import
com.pica.cloud.account.account.server.req.HospitalRoleDetailReq
;
import
com.pica.cloud.account.account.server.req.HospitalRoleListReq
;
import
com.pica.cloud.account.account.server.resp.HospitalRoleDto
;
import
com.pica.cloud.account.account.server.resp.HospitalRoleD
etailD
to
;
import
com.pica.cloud.account.account.server.resp.HospitalRoleResp
;
import
com.pica.cloud.account.account.server.service.HospitalSaasRoleService
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
...
...
@@ -12,6 +12,7 @@ import com.pica.cloud.foundation.utils.entity.PicaUser;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
/**
...
...
@@ -27,7 +28,7 @@ public class HospitalSaasRoleController extends AccountBaseController {
@ApiOperation
(
"机构saas角色-新增或更新"
)
@PostMapping
(
value
=
"/hospital/role/insertAndModify"
)
@EnabledLoginValidate
public
PicaResponse
<
Integer
>
insertAndModify
(
@RequestBody
HospitalRoleDetailReq
req
)
{
public
PicaResponse
<
Integer
>
insertAndModify
(
@
Validated
@
RequestBody
HospitalRoleDetailReq
req
)
{
PicaUser
user
=
fetchPicaUser
();
return
PicaResponse
.
toResponse
(
hospitalSaasRoleService
.
insertAndModify
(
req
,
user
));
}
...
...
@@ -36,7 +37,8 @@ public class HospitalSaasRoleController extends AccountBaseController {
@DeleteMapping
(
value
=
"/hospital/role/delete/{id}"
)
@EnabledLoginValidate
public
PicaResponse
<
Integer
>
delete
(
@PathVariable
(
"id"
)
Long
id
)
{
return
PicaResponse
.
toResponse
(
hospitalSaasRoleService
.
delete
(
id
));
PicaUser
user
=
fetchPicaUser
();
return
PicaResponse
.
toResponse
(
hospitalSaasRoleService
.
delete
(
id
,
user
));
}
@ApiOperation
(
"机构saas平台角色列表"
)
...
...
@@ -48,10 +50,10 @@ public class HospitalSaasRoleController extends AccountBaseController {
}
@ApiOperation
(
"机构saas角色-角色"
)
@ApiOperation
(
"机构saas角色-角色
详情
"
)
@GetMapping
(
value
=
"/hospital/role/getRoleDetail/{id}"
)
@EnabledLoginValidate
public
PicaResponse
<
HospitalRoleDto
>
getRoleDetail
(
@PathVariable
(
"id"
)
Long
id
)
{
public
PicaResponse
<
HospitalRoleD
etailD
to
>
getRoleDetail
(
@PathVariable
(
"id"
)
Long
id
)
{
return
PicaResponse
.
toResponse
(
hospitalSaasRoleService
.
getRoleDetail
(
id
));
}
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/controller/HospitalSaasUserController.java
浏览文件 @
dadaece9
...
...
@@ -5,6 +5,7 @@ import com.pica.cloud.account.account.server.req.HospitalSaasUserListReq;
import
com.pica.cloud.account.account.server.req.HospitalSaasUserReq
;
import
com.pica.cloud.account.account.server.resp.HospitalRoleResp
;
import
com.pica.cloud.account.account.server.resp.HospitalSaasUserDetailResp
;
import
com.pica.cloud.account.account.server.resp.HospitalSaasUserEditResp
;
import
com.pica.cloud.account.account.server.resp.HospitalSaasUserResp
;
import
com.pica.cloud.account.account.server.service.HospitalSaasRoleService
;
import
com.pica.cloud.account.account.server.service.HospitalSaasUserService
;
...
...
@@ -31,15 +32,17 @@ public class HospitalSaasUserController extends AccountBaseController {
@ApiOperation
(
"机构saas平台人员注册 0失败 1成功"
)
@PostMapping
(
value
=
"/hospital/register"
)
@EnabledLoginValidate
public
PicaResponse
<
Integer
>
register
(
@RequestBody
HospitalSaasUserReq
req
)
{
return
PicaResponse
.
toResponse
(
hospitalSaasUserService
.
register
(
req
,
super
.
getProductType
(),
super
.
getSourceType
(),
getPicaUser
()));
public
PicaResponse
<
Integer
>
register
(
@RequestBody
HospitalSaasUserReq
req
,
@RequestHeader
(
"token"
)
String
token
)
{
Long
doctorId
=
super
.
getDoctorIdByToken
();
return
PicaResponse
.
toResponse
(
hospitalSaasUserService
.
register
(
req
,
doctorId
));
}
@ApiOperation
(
"机构saas平台人员更新 0失败 1成功"
)
@PostMapping
(
value
=
"/hospital/upsert"
)
@EnabledLoginValidate
public
PicaResponse
<
Integer
>
upsert
(
@RequestBody
HospitalSaasUserReq
req
)
{
return
PicaResponse
.
toResponse
(
hospitalSaasUserService
.
upsert
(
req
,
getPicaUser
()));
Long
doctorId
=
super
.
getDoctorIdByToken
();
return
PicaResponse
.
toResponse
(
hospitalSaasUserService
.
upsert
(
req
,
doctorId
));
}
@ApiOperation
(
"机构saas平台人员列表查询"
)
...
...
@@ -49,14 +52,21 @@ public class HospitalSaasUserController extends AccountBaseController {
return
PicaResponse
.
toResponse
(
hospitalSaasUserService
.
listByPage
(
req
));
}
@ApiOperation
(
"机构saas平台人员详情查询"
)
@GetMapping
(
value
=
"/hospital/edit/{id}"
)
@EnabledLoginValidate
public
PicaResponse
<
HospitalSaasUserEditResp
>
edit
(
@PathVariable
(
"id"
)
Long
id
)
{
return
PicaResponse
.
toResponse
(
hospitalSaasUserService
.
edit
(
id
));
}
@ApiOperation
(
"机构saas平台人员删除 0失败 1成功"
)
@
Delete
Mapping
(
value
=
"/hospital/delete"
)
@
Get
Mapping
(
value
=
"/hospital/delete"
)
@EnabledLoginValidate
public
PicaResponse
<
Integer
>
delete
(
@RequestParam
(
"id"
)
Long
id
)
{
return
PicaResponse
.
toResponse
(
hospitalSaasUserService
.
delete
(
id
));
}
@ApiOperation
(
"机构saas平台人员
账户
"
)
@ApiOperation
(
"机构saas平台人员
详情
"
)
@GetMapping
(
value
=
"/hospital/userDetail"
)
@EnabledLoginValidate
public
PicaResponse
<
HospitalSaasUserDetailResp
>
userDetail
(
@RequestHeader
(
"token"
)
String
token
)
{
...
...
server/src/main/java/com/pica/cloud/account/account/server/mapper/AccountMapper.java
浏览文件 @
dadaece9
...
...
@@ -2,6 +2,7 @@ package com.pica.cloud.account.account.server.mapper;
import
com.pica.cloud.account.account.server.entity.Account
;
import
com.pica.cloud.account.account.server.resp.HospitalSaasUserDto
;
import
com.pica.cloud.account.account.server.resp.HospitalSaasUserEditResp
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -23,6 +24,8 @@ public interface AccountMapper {
//新增账号
void
insertSelective
(
Account
account
);
Long
insertSelectiveV2
(
Account
account
);
//更新账号
int
updateByIdSelective
(
Account
account
);
...
...
@@ -36,7 +39,10 @@ public interface AccountMapper {
List
<
Map
<
String
,
Object
>>
getHospitalInfoByPage
(
@Param
(
"id"
)
Long
id
,
@Param
(
"offset"
)
int
offset
,
@Param
(
"size"
)
int
size
);
Integer
listCountByPage
(
Map
<
String
,
Object
>
map
);
Integer
listCountByPage
(
Map
<
String
,
Object
>
map
);
List
<
HospitalSaasUserDto
>
listByPage
(
Map
<
String
,
Object
>
map
);
HospitalSaasUserEditResp
selectUserRoleById
(
Long
id
);
}
server/src/main/java/com/pica/cloud/account/account/server/mapper/PermissionDoctorRoleMapper.java
浏览文件 @
dadaece9
...
...
@@ -4,6 +4,7 @@ package com.pica.cloud.account.account.server.mapper;
import
com.pica.cloud.account.account.server.entity.PermissionDoctorRole
;
import
java.util.List
;
import
java.util.Map
;
public
interface
PermissionDoctorRoleMapper
{
...
...
@@ -31,5 +32,5 @@ public interface PermissionDoctorRoleMapper {
List
<
PermissionDoctorRole
>
selectByRoleId
(
Long
id
);
int
upsertDefaultRole
(
Long
id
);
int
upsertDefaultRole
(
Map
<
String
,
Object
>
map
);
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/mapper/PermissionRoleMapper.java
浏览文件 @
dadaece9
...
...
@@ -26,7 +26,7 @@ public interface PermissionRoleMapper {
int
listCountByPage
(
Map
<
String
,
Object
>
map
);
int
deleteById
(
Long
id
);
int
deleteById
(
Map
<
String
,
Object
>
map
);
List
<
RoleDto
>
querySaasRoles
();
...
...
server/src/main/java/com/pica/cloud/account/account/server/req/HospitalRoleDetailReq.java
浏览文件 @
dadaece9
...
...
@@ -4,6 +4,7 @@ package com.pica.cloud.account.account.server.req;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.NotBlank
;
/**
* @Author qinwh
...
...
@@ -15,6 +16,7 @@ public class HospitalRoleDetailReq {
@ApiModelProperty
(
"角色id"
)
private
Long
id
;
@ApiModelProperty
(
"角色name"
)
@NotBlank
(
message
=
"角色名称不能为空"
)
private
String
name
;
@ApiModelProperty
(
"角色描述"
)
private
String
remark
;
...
...
server/src/main/java/com/pica/cloud/account/account/server/req/HospitalSaasUserReq.java
浏览文件 @
dadaece9
...
...
@@ -44,6 +44,11 @@ public class HospitalSaasUserReq {
@ApiModelProperty
(
"角色id"
)
private
Long
roleId
;
@ApiModelProperty
(
"产品类型"
)
private
Integer
productType
;
@ApiModelProperty
(
"资源类型"
)
private
Integer
sourceType
;
public
void
checkInsertParams
()
{
if
(
StringUtils
.
isBlank
(
this
.
mobile
))
{
...
...
@@ -55,15 +60,20 @@ public class HospitalSaasUserReq {
if
(
StringUtils
.
isBlank
(
this
.
password
))
{
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_NOT_EMPTY
.
getCode
(),
"密码不能为空"
);
}
if
(
null
==
this
.
roleId
)
{
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_NOT_EMPTY
.
getCode
(),
"角色id不能为空"
);
}
//
if (null == this.roleId) {
//
throw new PicaWarnException(AccountExceptionEnum.PICA_NOT_EMPTY.getCode(), "角色id不能为空");
//
}
if
(
this
.
name
.
length
()
>
16
)
{
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_NOT_EMPTY
.
getCode
(),
"姓名长度必须≤16字符!"
);
}
if
(!
ValidateUtils
.
isMobile
(
this
.
mobile
))
{
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_NOT_EMPTY
.
getCode
(),
"手机号格式不正确!"
);
}
if
(
null
==
this
.
productType
)
{
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_NOT_EMPTY
.
getCode
(),
"产品类型不能为空!"
);
}
if
(
null
==
this
.
sourceType
)
{
throw
new
PicaWarnException
(
AccountExceptionEnum
.
PICA_NOT_EMPTY
.
getCode
(),
"资源类型不能为空!"
);
}
}
}
server/src/main/java/com/pica/cloud/account/account/server/resp/HospitalRoleDetailDto.java
0 → 100644
浏览文件 @
dadaece9
// Copyright 2016-2101 Pica.
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
resp
;
import
lombok.Data
;
/**
* @Author Pica
* @Date 2022/3/3 14:36
*/
@Data
public
class
HospitalRoleDetailDto
{
private
String
roleName
;
private
Long
roleId
;
private
String
remark
;
}
server/src/main/java/com/pica/cloud/account/account/server/resp/HospitalRoleDto.java
浏览文件 @
dadaece9
...
...
@@ -16,9 +16,9 @@ public class HospitalRoleDto {
private
String
remark
;
private
String
createName
;
private
String
createId
;
private
Long
createTime
;
}
server/src/main/java/com/pica/cloud/account/account/server/resp/HospitalSaasUserEditResp.java
0 → 100644
浏览文件 @
dadaece9
// Copyright 2016-2101 Pica.
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
resp
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @Author Pica
* @Date 2022/3/3 17:58
*/
@Data
public
class
HospitalSaasUserEditResp
{
@ApiModelProperty
(
"id"
)
private
Long
id
;
@ApiModelProperty
(
"姓名"
)
private
String
name
;
@ApiModelProperty
(
"手机号"
)
private
String
mobile
;
@ApiModelProperty
(
"备注"
)
private
String
comment
;
@ApiModelProperty
(
"角色id"
)
private
Integer
roleId
;
@ApiModelProperty
(
"角色名称"
)
private
String
roleName
;
@ApiModelProperty
(
"密码"
)
private
String
password
;
@ApiModelProperty
(
"密码是否可修改 1 不可修改 2 可修改"
)
private
Integer
pwdFlag
;
}
server/src/main/java/com/pica/cloud/account/account/server/service/HospitalSaasRoleService.java
浏览文件 @
dadaece9
...
...
@@ -3,6 +3,7 @@ package com.pica.cloud.account.account.server.service;
import
com.pica.cloud.account.account.server.req.HospitalRoleDetailReq
;
import
com.pica.cloud.account.account.server.req.HospitalRoleListReq
;
import
com.pica.cloud.account.account.server.resp.HospitalRoleDetailDto
;
import
com.pica.cloud.account.account.server.resp.HospitalRoleDto
;
import
com.pica.cloud.account.account.server.resp.HospitalRoleResp
;
import
com.pica.cloud.account.account.server.resp.HospitalSaasRoleResp
;
...
...
@@ -20,10 +21,10 @@ public interface HospitalSaasRoleService {
HospitalRoleResp
listByPage
(
HospitalRoleListReq
req
);
int
delete
(
Long
id
);
int
delete
(
Long
id
,
PicaUser
user
);
HospitalSaasRoleResp
querySaasRoles
();
HospitalRoleDto
getRoleDetail
(
Long
id
);
HospitalRoleD
etailD
to
getRoleDetail
(
Long
id
);
}
server/src/main/java/com/pica/cloud/account/account/server/service/HospitalSaasUserService.java
浏览文件 @
dadaece9
...
...
@@ -6,6 +6,7 @@ import com.pica.cloud.account.account.server.req.BaseRequest;
import
com.pica.cloud.account.account.server.req.HospitalSaasUserListReq
;
import
com.pica.cloud.account.account.server.req.HospitalSaasUserReq
;
import
com.pica.cloud.account.account.server.resp.HospitalSaasUserDetailResp
;
import
com.pica.cloud.account.account.server.resp.HospitalSaasUserEditResp
;
import
com.pica.cloud.account.account.server.resp.HospitalSaasUserResp
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.utils.entity.PicaUser
;
...
...
@@ -18,13 +19,16 @@ import java.util.List;
*/
public
interface
HospitalSaasUserService
{
int
register
(
HospitalSaasUserReq
baseRequest
,
Integer
productType
,
Integer
sourceType
,
PicaUser
user
);
int
register
(
HospitalSaasUserReq
baseRequest
,
Long
doctorId
);
HospitalSaasUserResp
listByPage
(
HospitalSaasUserListReq
req
);
int
upsert
(
HospitalSaasUserReq
req
,
PicaUser
user
);
int
upsert
(
HospitalSaasUserReq
req
,
Long
doctorId
);
int
delete
(
Long
id
);
HospitalSaasUserDetailResp
userDetail
(
PicaUser
user
);
HospitalSaasUserEditResp
edit
(
Long
id
);
}
server/src/main/java/com/pica/cloud/account/account/server/service/impl/HospitalSaasRoleServiceImpl.java
浏览文件 @
dadaece9
...
...
@@ -7,10 +7,7 @@ import com.pica.cloud.account.account.server.mapper.PermissionDoctorRoleMapper;
import
com.pica.cloud.account.account.server.mapper.PermissionRoleMapper
;
import
com.pica.cloud.account.account.server.req.HospitalRoleDetailReq
;
import
com.pica.cloud.account.account.server.req.HospitalRoleListReq
;
import
com.pica.cloud.account.account.server.resp.HospitalRoleDto
;
import
com.pica.cloud.account.account.server.resp.HospitalRoleResp
;
import
com.pica.cloud.account.account.server.resp.HospitalSaasRoleResp
;
import
com.pica.cloud.account.account.server.resp.RoleDto
;
import
com.pica.cloud.account.account.server.resp.*
;
import
com.pica.cloud.account.account.server.service.HospitalSaasRoleService
;
import
com.pica.cloud.foundation.entity.PicaWarnException
;
import
com.pica.cloud.foundation.utils.entity.PicaUser
;
...
...
@@ -61,31 +58,13 @@ public class HospitalSaasRoleServiceImpl implements HospitalSaasRoleService {
role
.
setModifiedTime
(
new
Date
());
num
=
permissionRoleMapper
.
insertSelective
(
role
);
}
// PermissionRole role = permissionRoleMapper.selectByPrimaryKey(req.getId());
// //新增
// if (Objects.isNull(role)) {
// //新增
// role = new PermissionRole();
// BeanUtils.copyProperties(req, role);
// CommonUtils.setCommonParam(role, user.getId(), Calendar.getInstance().getTime());
// permissionRoleMapper.insert(role);
// } else {
// //更新
// // todo roleCode 字段格式定义
// role.setRoleName(req.getName());
// // todo 描述信息 需新增字段
// permissionRoleMapper.updateByPrimaryKeySelective(role);
// }
return
num
;
}
@Override
public
HospitalRoleResp
listByPage
(
HospitalRoleListReq
req
)
{
ArrayList
<
Object
>
list
=
new
ArrayList
<>(
3
);
list
.
add
(
1
);
list
.
add
(
2
);
//todo 过滤当前人员的角色信息
//list.add();
Arrays
.
asList
(
1
,
2
,
3
);
Map
<
String
,
Object
>
map
=
new
HashMap
(
4
);
map
.
put
(
"list"
,
list
);
map
.
put
(
"name"
,
req
.
getName
());
...
...
@@ -101,10 +80,13 @@ public class HospitalSaasRoleServiceImpl implements HospitalSaasRoleService {
@Override
@Transactional
public
int
delete
(
Long
id
)
{
permissionRoleMapper
.
deleteById
(
id
);
//把这个角色下的人员信息 调整为默认角色 todo 需写死一个默认角色的id
permissionDoctorRoleMapper
.
upsertDefaultRole
(
id
);
public
int
delete
(
Long
id
,
PicaUser
user
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
3
);
map
.
put
(
"id"
,
id
);
map
.
put
(
"modifiedId"
,
user
.
getId
());
map
.
put
(
"modifiedTime"
,
new
Date
());
permissionRoleMapper
.
deleteById
(
map
);
permissionDoctorRoleMapper
.
upsertDefaultRole
(
map
);
return
1
;
}
...
...
@@ -115,11 +97,10 @@ public class HospitalSaasRoleServiceImpl implements HospitalSaasRoleService {
}
@Override
public
HospitalRoleDto
getRoleDetail
(
Long
id
)
{
HospitalRoleDto
roleDto
=
new
HospitalRoleDto
();
public
HospitalRoleDetailDto
getRoleDetail
(
Long
id
)
{
PermissionRole
permissionRole
=
permissionRoleMapper
.
selectByPrimaryKey
(
id
);
BeanUtils
.
copyProperties
(
permissionRole
,
roleDto
);
roleDto
.
setRoleId
(
permissionRole
.
getId
()
);
return
roleD
to
;
HospitalRoleDetailDto
dto
=
new
HospitalRoleDetailDto
(
);
BeanUtils
.
copyProperties
(
permissionRole
,
dto
);
return
d
to
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/service/impl/HospitalSaasUserServiceImpl.java
浏览文件 @
dadaece9
...
...
@@ -12,6 +12,8 @@ import com.pica.cloud.account.account.server.mapper.*;
import
com.pica.cloud.account.account.server.req.HospitalSaasUserListReq
;
import
com.pica.cloud.account.account.server.req.HospitalSaasUserReq
;
import
com.pica.cloud.account.account.server.resp.HospitalSaasUserDetailResp
;
import
com.pica.cloud.account.account.server.resp.HospitalSaasUserDto
;
import
com.pica.cloud.account.account.server.resp.HospitalSaasUserEditResp
;
import
com.pica.cloud.account.account.server.resp.HospitalSaasUserResp
;
import
com.pica.cloud.account.account.server.service.HospitalSaasUserService
;
import
com.pica.cloud.account.account.server.util.AESUtil
;
...
...
@@ -23,11 +25,15 @@ import com.pica.cloud.foundation.entity.PicaException;
import
com.pica.cloud.foundation.entity.PicaResultCode
;
import
com.pica.cloud.foundation.redis.ICacheClient
;
import
com.pica.cloud.foundation.utils.entity.PicaUser
;
import
com.pica.cloud.foundation.utils.utils.MD5Util
;
import
com.pica.cloud.foundation.utils.utils.date.D
;
import
com.pica.cloud.trade.store.client.StoreCertifyServiceClient
;
import
com.pica.cloud.trade.store.resp.certify.StoreCertifyStatus
;
import
org.apache.commons.codec.digest.Md5Crypt
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -50,8 +56,6 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
@Autowired
private
AccountMapper
accountMapper
;
@Autowired
private
AccountLogUtils
picaLogUtils
;
@Autowired
private
PUserRoleMapper
pUserRoleMapper
;
@Autowired
private
AgreementLogEntityMapper
agreementLogEntityMapper
;
...
...
@@ -68,11 +72,8 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
@Override
@Transactional
public
int
register
(
HospitalSaasUserReq
req
,
Integer
productType
,
Integer
sourceType
,
PicaUser
user
)
{
public
int
register
(
HospitalSaasUserReq
req
,
Long
doctorId
)
{
req
.
checkInsertParams
();
if
(
Objects
.
isNull
(
productType
)
||
Objects
.
isNull
(
sourceType
))
{
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
PicaResultCode
.
PARAM_IS_INVALID
.
message
());
}
//得到手机号
String
mobile
=
req
.
getMobile
();
//幂等校验
...
...
@@ -84,48 +85,52 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
String
mobileEncrypt
=
AESUtil
.
encryptV0
(
mobile
);
AccountInfoEntity
accountInfoEntity
=
accountInfoDetailMapper
.
selectByMobile
(
mobileEncrypt
);
Account
byMobilePhone
=
accountMapper
.
getByMobilePhone
(
mobileEncrypt
);
//新用户 走注册逻辑
//密码已经存在的处理逻辑
if
(
Objects
.
nonNull
(
accountInfoEntity
)
&&
StringUtils
.
isNotBlank
(
accountInfoEntity
.
getPassword
()))
{
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"密码已经存在,不可进行编辑"
);
}
//用户不存在的处理逻辑
if
(
accountInfoEntity
==
null
)
{
redisClient
.
expire
(
nxKey
,
30
);
Date
currentTime
=
Calendar
.
getInstance
().
getTime
();
String
password
=
req
.
getPassword
();
AccountInfoEntity
accountInfo
=
buildAccountInfo
(
mobileEncrypt
,
currentTime
,
productType
,
sourceType
,
password
);
String
md5Pwd
=
MD5Util
.
MD5
(
password
);
AccountInfoEntity
accountInfo
=
buildAccountInfo
(
mobileEncrypt
,
currentTime
,
req
.
getProductType
(),
req
.
getSourceType
(),
md5Pwd
);
accountInfoDetailMapper
.
insertSelective
(
accountInfo
);
Integer
acctId
=
accountInfo
.
getId
();
accountInfoDetailMapper
.
updateCreateInfo
(
acctId
);
Account
account
=
buildDoctorMsg
(
req
,
mobileEncrypt
,
currentTime
,
sourceType
,
password
,
acctId
);
accountMapper
.
insertSelective
(
account
);
Account
account
=
buildDoctorMsg
(
req
,
mobileEncrypt
,
currentTime
,
req
.
getSourceType
()
,
password
,
acctId
);
Long
id
=
accountMapper
.
insertSelectiveV2
(
account
);
Long
userId
=
account
.
getId
();
LogLoginEntity
entity
=
AccountLogEntityUtils
.
getLogLoginEntity
(
acctId
,
productType
,
productType
,
AccountTypeEnum
.
LOGIN_REGISTER
.
getCode
(),
null
,
AccountTypeEnum
.
LOGIN_STATUS_SUCCESS
.
getCode
(),
AccountTypeEnum
.
LOG_TYPE_LOGIN
.
getCode
(),
null
,
1
,
null
);
picaLogUtils
.
info
(
entity
);
processAgreement
(
userId
);
insertAppRole
(
userId
,
req
,
user
);
insertSaasRole
(
req
,
user
);
insertAppRole
(
userId
);
insertSaasRole
(
req
,
id
,
userId
);
redisClient
.
del
(
nxKey
);
return
1
;
}
else
{
logger
.
info
(
"register-account is exists"
);
throw
new
AccountException
(
AccountExceptionEnum
.
PICA_ALREADY_REGISTER
);
// byMobilePhone.setComment(req.getComment());
// byMobilePhone.setPassword(req.getPassword());
// accountMapper.updateByIdSelective(byMobilePhone);
// //更新角色信息 逻辑删除
// doctorRoleMapper.deleteByDoctorId(req.getId());
// //插入新的角色关系
// insertSaasRole(req, user);
}
//用户存在,但密码不存在的处理逻辑
if
(
Objects
.
nonNull
(
accountInfoEntity
)
&&
StringUtils
.
isBlank
(
accountInfoEntity
.
getPassword
()))
{
byMobilePhone
.
setPassword
(
req
.
getPassword
());
byMobilePhone
.
setComment
(
req
.
getComment
());
accountMapper
.
updateByIdSelective
(
byMobilePhone
);
if
(!
Objects
.
equals
(
req
.
getRoleId
(),
-
1
))
{
insertSaasRole
(
req
,
byMobilePhone
.
getId
(),
doctorId
);
}
}
}
return
1
;
}
private
void
insertSaasRole
(
HospitalSaasUserReq
req
,
PicaUser
user
)
{
private
void
insertSaasRole
(
HospitalSaasUserReq
req
,
Long
doctorId
,
Long
userId
)
{
PermissionDoctorRole
doctorRole
=
new
PermissionDoctorRole
();
doctorRole
.
setDoctorId
(
req
.
getId
()
);
doctorRole
.
setDoctorId
(
doctorId
);
doctorRole
.
setHospitalId
(
req
.
getHospitalId
().
longValue
());
doctorRole
.
setRoleId
(
req
.
getRoleId
());
doctorRole
.
setDeleteFlag
(
1
);
doctorRole
.
setRoleId
(
req
.
getRoleId
());
CommonUtils
.
setCommonParam
(
doctorRole
,
user
.
getId
(),
Calendar
.
getInstance
().
getTime
());
doctorRole
.
setCreatedId
(
userId
);
doctorRole
.
setCreatedTime
(
new
Date
());
doctorRole
.
setModifiedId
(
userId
);
doctorRole
.
setModifiedTime
(
new
Date
());
doctorRoleMapper
.
insert
(
doctorRole
);
}
...
...
@@ -164,11 +169,20 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
}
map
.
put
(
"pageNo"
,
(
req
.
getPageNo
()
-
1
)
*
req
.
getPageSize
());
map
.
put
(
"pageSize"
,
req
.
getPageSize
());
return
new
HospitalSaasUserResp
(
accountMapper
.
listByPage
(
map
),
count
);
List
<
HospitalSaasUserDto
>
lists
=
accountMapper
.
listByPage
(
map
);
//手机号 解密脱敏
lists
.
stream
().
forEach
(
t
->
{
String
phone
=
EncryptUtils
.
decryptContent
(
t
.
getMobile
(),
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
,
EncryptConstants
.
ENCRYPT_DECRYPT_KEY
);
String
mixMobile
=
mixMobile
(
phone
);
t
.
setMobile
(
mixMobile
);
});
return
new
HospitalSaasUserResp
(
lists
,
count
);
}
@Override
public
int
upsert
(
HospitalSaasUserReq
req
,
PicaUser
user
)
{
public
int
upsert
(
HospitalSaasUserReq
req
,
Long
doctorId
)
{
//走更新的逻辑,只可以更新角色和备注
String
mobileEncrypt
=
AESUtil
.
encryptV0
(
req
.
getMobile
());
Account
account
=
accountMapper
.
getByMobilePhone
(
mobileEncrypt
);
...
...
@@ -177,9 +191,8 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
account
.
setComment
(
req
.
getComment
());
accountMapper
.
updateByIdSelective
(
account
);
}
//更新角色信息 逻辑删除
doctorRoleMapper
.
deleteByDoctorId
(
req
.
getId
());
insertSaasRole
(
req
,
user
);
insertSaasRole
(
req
,
req
.
getId
(),
doctorId
);
return
1
;
}
...
...
@@ -241,8 +254,27 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
return
resp
;
}
@Override
public
HospitalSaasUserEditResp
edit
(
Long
id
)
{
HospitalSaasUserEditResp
resp
=
accountMapper
.
selectUserRoleById
(
id
);
if
(
null
==
resp
)
{
return
new
HospitalSaasUserEditResp
();
}
//手机号 解密脱敏
if
(
StringUtils
.
isNotBlank
(
resp
.
getPassword
()))
{
String
phone
=
EncryptUtils
.
decryptContent
(
resp
.
getMobile
(),
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
,
EncryptConstants
.
ENCRYPT_DECRYPT_KEY
);
resp
.
setMobile
(
phone
);
}
if
(
StringUtils
.
isNotBlank
(
resp
.
getPassword
()))
{
resp
.
setPwdFlag
(
1
);
}
else
{
resp
.
setPwdFlag
(
2
);
}
return
resp
;
}
//处理app端 用户-角色关系
private
void
insertAppRole
(
Long
userId
,
HospitalSaasUserReq
req
,
PicaUser
user
)
{
private
void
insertAppRole
(
Long
userId
)
{
ExecutorServiceUtils
.
getExecutor
().
submit
(
new
Runnable
()
{
@Override
public
void
run
()
{
...
...
@@ -305,4 +337,15 @@ public class HospitalSaasUserServiceImpl implements HospitalSaasUserService {
account
.
setRegisterSource
(
sourceType
);
return
account
;
}
private
static
String
mixMobile
(
String
mobile
)
{
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isBlank
(
mobile
))
{
return
mobile
;
}
if
(
mobile
.
length
()
==
11
)
{
return
(
new
StringBuilder
()).
append
(
mobile
.
substring
(
0
,
3
)).
append
(
"****"
).
append
(
mobile
.
substring
(
7
)).
toString
();
}
return
(
new
StringBuilder
()).
append
(
mobile
.
substring
(
0
,
1
)).
append
(
"***"
).
append
(
mobile
.
substring
(
mobile
.
length
())).
toString
();
}
}
server/src/main/resources/mybatis/AccountMapper.xml
浏览文件 @
dadaece9
...
...
@@ -3,37 +3,37 @@
<mapper
namespace=
"com.pica.cloud.account.account.server.mapper.AccountMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pica.cloud.account.account.server.entity.Account"
>
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"sex"
jdbcType=
"INTEGER"
property=
"sex"
/>
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"mobile_phone"
jdbcType=
"VARCHAR"
property=
"mobilePhone"
/>
<result
column=
"acct_id"
jdbcType=
"INTEGER"
property=
"acctId"
/>
<result
column=
"status"
jdbcType=
"INTEGER"
property=
"status"
/>
<result
column=
"certify_status"
jdbcType=
"INTEGER"
property=
"certifyStatus"
/>
<result
column=
"nation"
jdbcType=
"VARCHAR"
property=
"nation"
/>
<result
column=
"avatar_image_url"
jdbcType=
"VARCHAR"
property=
"avatarImageUrl"
/>
<result
column=
"email"
jdbcType=
"VARCHAR"
property=
"email"
/>
<result
column=
"qrcode"
jdbcType=
"VARCHAR"
property=
"qrcode"
/>
<result
column=
"nickname"
jdbcType=
"VARCHAR"
property=
"nickname"
/>
<result
column=
"personal_sign"
jdbcType=
"VARCHAR"
property=
"personalSign"
/>
<result
column=
"delete_flag"
jdbcType=
"INTEGER"
property=
"deleteFlag"
/>
<result
column=
"creat_id"
jdbcType=
"INTEGER"
property=
"creatId"
/>
<result
column=
"creat_time"
jdbcType=
"TIMESTAMP"
property=
"creatTime"
/>
<result
column=
"modify_id"
jdbcType=
"INTEGER"
property=
"modifyId"
/>
<result
column=
"modify_time"
jdbcType=
"TIMESTAMP"
property=
"modifyTime"
/>
<result
column=
"password"
jdbcType=
"VARCHAR"
property=
"password"
/>
<result
column=
"info"
jdbcType=
"VARCHAR"
property=
"info"
/>
<result
column=
"entire_flag"
jdbcType=
"INTEGER"
property=
"entireFlag"
/>
<result
column=
"reg_time"
jdbcType=
"DATE"
property=
"regTime"
/>
<result
column=
"last_login_time"
jdbcType=
"TIMESTAMP"
property=
"lastLoginTime"
/>
<result
column=
"unionid"
jdbcType=
"VARCHAR"
property=
"unionid"
/>
<result
column=
"register_source"
jdbcType=
"INTEGER"
property=
"registerSource"
/>
<result
column=
"comment"
jdbcType=
"VARCHAR"
property=
"comment"
/>
<result
column=
"register_type"
jdbcType=
"INTEGER"
property=
"registerType"
/>
<result
column=
"first_login_time"
jdbcType=
"TIMESTAMP"
property=
"firstLoginTime"
/>
<result
column=
"card"
jdbcType=
"VARCHAR"
property=
"card"
/>
<result
column=
"birthday"
jdbcType=
"DATE"
property=
"birthday"
/>
<result
column=
"hospital_id"
jdbcType=
"INTEGER"
property=
"hospitalId"
/>
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"sex"
jdbcType=
"INTEGER"
property=
"sex"
/>
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"mobile_phone"
jdbcType=
"VARCHAR"
property=
"mobilePhone"
/>
<result
column=
"acct_id"
jdbcType=
"INTEGER"
property=
"acctId"
/>
<result
column=
"status"
jdbcType=
"INTEGER"
property=
"status"
/>
<result
column=
"certify_status"
jdbcType=
"INTEGER"
property=
"certifyStatus"
/>
<result
column=
"nation"
jdbcType=
"VARCHAR"
property=
"nation"
/>
<result
column=
"avatar_image_url"
jdbcType=
"VARCHAR"
property=
"avatarImageUrl"
/>
<result
column=
"email"
jdbcType=
"VARCHAR"
property=
"email"
/>
<result
column=
"qrcode"
jdbcType=
"VARCHAR"
property=
"qrcode"
/>
<result
column=
"nickname"
jdbcType=
"VARCHAR"
property=
"nickname"
/>
<result
column=
"personal_sign"
jdbcType=
"VARCHAR"
property=
"personalSign"
/>
<result
column=
"delete_flag"
jdbcType=
"INTEGER"
property=
"deleteFlag"
/>
<result
column=
"creat_id"
jdbcType=
"INTEGER"
property=
"creatId"
/>
<result
column=
"creat_time"
jdbcType=
"TIMESTAMP"
property=
"creatTime"
/>
<result
column=
"modify_id"
jdbcType=
"INTEGER"
property=
"modifyId"
/>
<result
column=
"modify_time"
jdbcType=
"TIMESTAMP"
property=
"modifyTime"
/>
<result
column=
"password"
jdbcType=
"VARCHAR"
property=
"password"
/>
<result
column=
"info"
jdbcType=
"VARCHAR"
property=
"info"
/>
<result
column=
"entire_flag"
jdbcType=
"INTEGER"
property=
"entireFlag"
/>
<result
column=
"reg_time"
jdbcType=
"DATE"
property=
"regTime"
/>
<result
column=
"last_login_time"
jdbcType=
"TIMESTAMP"
property=
"lastLoginTime"
/>
<result
column=
"unionid"
jdbcType=
"VARCHAR"
property=
"unionid"
/>
<result
column=
"register_source"
jdbcType=
"INTEGER"
property=
"registerSource"
/>
<result
column=
"comment"
jdbcType=
"VARCHAR"
property=
"comment"
/>
<result
column=
"register_type"
jdbcType=
"INTEGER"
property=
"registerType"
/>
<result
column=
"first_login_time"
jdbcType=
"TIMESTAMP"
property=
"firstLoginTime"
/>
<result
column=
"card"
jdbcType=
"VARCHAR"
property=
"card"
/>
<result
column=
"birthday"
jdbcType=
"DATE"
property=
"birthday"
/>
<result
column=
"hospital_id"
jdbcType=
"INTEGER"
property=
"hospitalId"
/>
<result
column=
"hospital"
jdbcType=
"VARCHAR"
property=
"hospital"
/>
</resultMap>
...
...
@@ -45,12 +45,13 @@
<select
id=
"selectById"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
from p_doctor
where id = #{id,jdbcType=INTEGER}
</select>
<insert
id=
"insertSelective"
parameterType=
"com.pica.cloud.account.account.server.entity.Account"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"insertSelective"
parameterType=
"com.pica.cloud.account.account.server.entity.Account"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into p_doctor
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"sex != null"
>
...
...
@@ -213,7 +214,176 @@
</if>
</trim>
</insert>
<insert
id=
"insertSelectiveV2"
parameterType=
"com.pica.cloud.account.account.server.entity.Account"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into p_doctor
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"sex != null"
>
sex,
</if>
<if
test=
"name != null"
>
name,
</if>
<if
test=
"mobilePhone != null"
>
mobile_phone,
</if>
<if
test=
"avatarImageUrl != null"
>
avatar_image_url,
</if>
<if
test=
"acctId != null"
>
acct_id,
</if>
<if
test=
"email != null"
>
email,
</if>
<if
test=
"qrcode != null"
>
qrcode,
</if>
<if
test=
"nickname != null"
>
nickname,
</if>
<if
test=
"personalSign != null"
>
personal_sign,
</if>
<if
test=
"deleteFlag != null"
>
delete_flag,
</if>
<if
test=
"creatId != null"
>
creat_id,
</if>
<if
test=
"creatTime != null"
>
creat_time,
</if>
<if
test=
"modifyId != null"
>
modify_id,
</if>
<if
test=
"modifyTime != null"
>
modify_time,
</if>
<if
test=
"password != null"
>
password,
</if>
<if
test=
"info != null"
>
info,
</if>
<if
test=
"entireFlag != null"
>
entire_flag,
</if>
<if
test=
"regTime != null"
>
reg_time,
</if>
<if
test=
"lastLoginTime != null"
>
last_login_time,
</if>
<if
test=
"unionid != null"
>
unionid,
</if>
<if
test=
"registerSource != null"
>
register_source,
</if>
<if
test=
"comment != null"
>
comment,
</if>
<if
test=
"registerType != null"
>
register_type,
</if>
<if
test=
"firstLoginTime != null"
>
first_login_time,
</if>
<if
test=
"card != null"
>
card,
</if>
<if
test=
"birthday != null"
>
birthday,
</if>
<if
test=
"hospitalId != null"
>
hospital_id,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"sex != null"
>
#{sex,jdbcType=INTEGER},
</if>
<if
test=
"name != null"
>
#{name,jdbcType=VARCHAR},
</if>
<if
test=
"mobilePhone != null"
>
#{mobilePhone,jdbcType=VARCHAR},
</if>
<if
test=
"avatarImageUrl != null"
>
#{avatarImageUrl,jdbcType=VARCHAR},
</if>
<if
test=
"acctId != null"
>
#{acctId,jdbcType=INTEGER},
</if>
<if
test=
"email != null"
>
#{email,jdbcType=VARCHAR},
</if>
<if
test=
"qrcode != null"
>
#{qrcode,jdbcType=VARCHAR},
</if>
<if
test=
"nickname != null"
>
#{nickname,jdbcType=VARCHAR},
</if>
<if
test=
"personalSign != null"
>
#{personalSign,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
#{deleteFlag,jdbcType=INTEGER},
</if>
<if
test=
"creatId != null"
>
#{creatId,jdbcType=INTEGER},
</if>
<if
test=
"creatTime != null"
>
#{creatTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"modifyId != null"
>
#{modifyId,jdbcType=INTEGER},
</if>
<if
test=
"modifyTime != null"
>
#{modifyTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"password != null"
>
#{password,jdbcType=VARCHAR},
</if>
<if
test=
"info != null"
>
#{info,jdbcType=VARCHAR},
</if>
<if
test=
"entireFlag != null"
>
#{entireFlag,jdbcType=INTEGER},
</if>
<if
test=
"regTime != null"
>
#{regTime,jdbcType=DATE},
</if>
<if
test=
"lastLoginTime != null"
>
#{lastLoginTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"unionid != null"
>
#{unionid,jdbcType=VARCHAR},
</if>
<if
test=
"registerSource != null"
>
#{registerSource,jdbcType=INTEGER},
</if>
<if
test=
"comment != null"
>
#{comment,jdbcType=VARCHAR},
</if>
<if
test=
"registerType != null"
>
#{registerType,jdbcType=INTEGER},
</if>
<if
test=
"firstLoginTime != null"
>
#{firstLoginTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"card != null"
>
#{card,jdbcType=VARCHAR},
</if>
<if
test=
"birthday != null"
>
#{birthday,jdbcType=DATE},
</if>
<if
test=
"hospitalId != null"
>
#{hospitalId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update
id=
"updateByIdSelective"
parameterType=
"com.pica.cloud.account.account.server.entity.Account"
>
update p_doctor
<set>
...
...
@@ -310,14 +480,14 @@
<select
id=
"getByMobilePhone"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
from p_doctor
where mobile_phone = #{mobilePhone} and delete_flag = 1 limit 1
</select>
<select
id=
"getByUnionid"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
from p_doctor
where unionid = #{unionid} and delete_flag = 1
limit 1
...
...
@@ -325,7 +495,7 @@
<select
id=
"getByCard"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
from p_doctor
where card = #{card} and delete_flag = 1
limit 1
...
...
@@ -345,10 +515,10 @@
</select>
<sql
id=
"select_list_page"
>
p.delete_flag=1 AND p.hospital_id=#{hospitalId}
<if
test=
"mobile != null"
>
<if
test=
"mobile != null
and mobile != ''
"
>
and p.mobile_phone = #{mobile}
</if>
<if
test=
"name != null"
>
<if
test=
"name != null
and name != ''
"
>
and p.name = #{name}
</if>
...
...
@@ -363,6 +533,7 @@
</select>
<select
id=
"listByPage"
resultType=
"com.pica.cloud.account.account.server.resp.HospitalSaasUserDto"
>
select
p.id as id,
p.name as name,
p.hospital_id as hospitalId,
p.mobile_phone as mobile,
...
...
@@ -378,4 +549,19 @@
ORDER BY p.reg_time DESC
limit #{pageNo},#{pageSize}
</select>
<select
id=
"selectUserRoleById"
resultType=
"com.pica.cloud.account.account.server.resp.HospitalSaasUserEditResp"
>
select p.id as id,
p.name as name,
p.hospital_id as hospitalId,
p.mobile_phone as mobile,
p.comment as comment,
pr.id as roleId,
pr.role_name as roleName
from p_doctor as p
left join permission_doctor_role as pdr ON p.id = pdr.doctor_id and p.hospital_id = pdr.hospital_id and pdr.delete_flag = 1
left join permission_role as pr ON pdr.role_id = pr.id and pr.delete_flag = 1
where p.id = #{id, jdbcType=INTEGER}
limit 1
</select>
</mapper>
server/src/main/resources/mybatis/PermissionDoctorRoleMapper.xml
浏览文件 @
dadaece9
...
...
@@ -48,7 +48,7 @@
and modified_time
<
DATE_FORMAT(NOW(), '%Y-%m-%d %H:00:00')
</insert>
<insert
id=
"insert"
parameterType=
"com.pica.cloud.account.account.server.entity.PermissionDoctorRole"
>
<insert
id=
"insert"
parameterType=
"com.pica.cloud.account.account.server.entity.PermissionDoctorRole"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into permission_doctor_role (id, doctor_id, hospital_id,
role_id, delete_flag, created_id,
created_time, modified_id, modified_time)
...
...
@@ -170,7 +170,10 @@
<update
id=
"upsertDefaultRole"
parameterType=
"java.lang.Integer"
>
update permission_doctor_role
set role_id = 2
set delete_flag = 2,
# role_id = 4,
modified_id = #{modifiedId,jdbcType=BIGINT},
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
where role_id = #{id,jdbcType=BIGINT}
and delete_flag = 1
</update>
...
...
server/src/main/resources/mybatis/PermissionRoleMapper.xml
浏览文件 @
dadaece9
...
...
@@ -167,24 +167,28 @@
pr.created_time as createTime,
pr.role_name as roleName,
pr.id as roleId,
pr.remark as remark
from permission_role as pr
pr.remark as remark,
pr.created_id as createId,
pd.name as name
from permission_role as pr join p_doctor as pd on pr.created_id=pd.id
where pr.delete_flag = 1
<include
refid=
"list_by_page"
></include>
ORDER BY pr.created_time ASC
Limit #{pageNo},#{pageSize}
</select>
<select
id=
"querySaasRoles"
resultType=
"com.pica.cloud.account.account.server.resp.RoleDto"
>
select p.id as id, p.role_name as name
from permission_role as p
# todo id暂不确定
where p.id not in (1, 2, 3)
where p.id not in (1, 2)
</select>
<update
id=
"deleteById"
>
update permission_role
set delete_flag = 2
set delete_flag = 2,
modified_id = #{modifiedId,jdbcType=BIGINT},
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录