Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-data-cloud
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
base_platform_enterprise
gic-data-cloud
Commits
bd92e5a6
Commit
bd92e5a6
authored
Jul 09, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据权限集接口
parent
e0a47e6c
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
1088 additions
and
5 deletions
+1088
-5
DataAuthDTO.java
...loud-api/src/main/java/com/gic/cloud/dto/DataAuthDTO.java
+162
-0
DataAuthApiService.java
...c/main/java/com/gic/cloud/service/DataAuthApiService.java
+22
-0
TabSysDataAuthMapper.java
...n/java/com/gic/cloud/dao/mapper/TabSysDataAuthMapper.java
+66
-0
TabSysUserMapper.java
.../main/java/com/gic/cloud/dao/mapper/TabSysUserMapper.java
+5
-1
TabSysDataAuth.java
...ce/src/main/java/com/gic/cloud/entity/TabSysDataAuth.java
+149
-0
DataAuthService.java
.../src/main/java/com/gic/cloud/service/DataAuthService.java
+24
-0
UserService.java
...vice/src/main/java/com/gic/cloud/service/UserService.java
+2
-0
DataAuthServiceImpl.java
.../java/com/gic/cloud/service/impl/DataAuthServiceImpl.java
+73
-0
UserServiceImpl.java
...main/java/com/gic/cloud/service/impl/UserServiceImpl.java
+5
-0
DataAuthApiServiceImpl.java
.../gic/cloud/service/outer/impl/DataAuthApiServiceImpl.java
+119
-0
dubbo-gic-data-cloud-service.xml
...rvice/src/main/resources/dubbo-gic-data-cloud-service.xml
+1
-0
TabSysDataAuthMapper.xml
...ervice/src/main/resources/mapper/TabSysDataAuthMapper.xml
+183
-0
TabSysUserMapper.xml
...ud-service/src/main/resources/mapper/TabSysUserMapper.xml
+15
-0
DataAuthController.java
...java/com/gic/cloud/web/controller/DataAuthController.java
+53
-0
UserController.java
...ain/java/com/gic/cloud/web/controller/UserController.java
+9
-4
DataAuthDetailVO.java
.../src/main/java/com/gic/cloud/web/vo/DataAuthDetailVO.java
+115
-0
DataAuthListVO.java
...eb/src/main/java/com/gic/cloud/web/vo/DataAuthListVO.java
+35
-0
DataAuthVO.java
...ud-web/src/main/java/com/gic/cloud/web/vo/DataAuthVO.java
+49
-0
dubbo-gic-data-cloud-web.xml
...cloud-web/src/main/resources/dubbo-gic-data-cloud-web.xml
+1
-0
No files found.
gic-data-cloud-api/src/main/java/com/gic/cloud/dto/DataAuthDTO.java
0 → 100644
View file @
bd92e5a6
package
com
.
gic
.
cloud
.
dto
;
import
java.io.Serializable
;
import
java.util.Date
;
public
class
DataAuthDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
2015311334509633014L
;
/**
* ID
*/
private
Integer
dataAuthId
;
/**
* 名称
*/
private
String
dataAuthName
;
/**
*
*/
private
Integer
enterpriseId
;
/**
* 线上业绩权限,json数组,[{"channel":1,"storeContent":[1]}]
*/
private
String
onlinePerformance
;
/**
* 门店资源,门店选择器ID
*/
private
Integer
storeWidgetId
;
/**
* 会员卡权限,_23232_23232_,可以多选,下划线隔开
*/
private
String
memberCardAuth
;
/**
* 商品域权限,_23232_23232_,可以多选,下划线隔开
*/
private
String
goodsAreaAuth
;
/**
* 1:有效 0:无效
*/
private
Integer
status
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
/**
* 授权人数
*/
private
Integer
memberCount
;
public
Integer
getDataAuthId
()
{
return
dataAuthId
;
}
public
DataAuthDTO
setDataAuthId
(
Integer
dataAuthId
)
{
this
.
dataAuthId
=
dataAuthId
;
return
this
;
}
public
String
getDataAuthName
()
{
return
dataAuthName
;
}
public
DataAuthDTO
setDataAuthName
(
String
dataAuthName
)
{
this
.
dataAuthName
=
dataAuthName
;
return
this
;
}
public
Integer
getEnterpriseId
()
{
return
enterpriseId
;
}
public
DataAuthDTO
setEnterpriseId
(
Integer
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
return
this
;
}
public
String
getOnlinePerformance
()
{
return
onlinePerformance
;
}
public
DataAuthDTO
setOnlinePerformance
(
String
onlinePerformance
)
{
this
.
onlinePerformance
=
onlinePerformance
;
return
this
;
}
public
Integer
getStoreWidgetId
()
{
return
storeWidgetId
;
}
public
DataAuthDTO
setStoreWidgetId
(
Integer
storeWidgetId
)
{
this
.
storeWidgetId
=
storeWidgetId
;
return
this
;
}
public
String
getMemberCardAuth
()
{
return
memberCardAuth
;
}
public
DataAuthDTO
setMemberCardAuth
(
String
memberCardAuth
)
{
this
.
memberCardAuth
=
memberCardAuth
;
return
this
;
}
public
String
getGoodsAreaAuth
()
{
return
goodsAreaAuth
;
}
public
DataAuthDTO
setGoodsAreaAuth
(
String
goodsAreaAuth
)
{
this
.
goodsAreaAuth
=
goodsAreaAuth
;
return
this
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
DataAuthDTO
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
return
this
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
DataAuthDTO
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
return
this
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
DataAuthDTO
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
return
this
;
}
public
Integer
getMemberCount
()
{
return
memberCount
;
}
public
DataAuthDTO
setMemberCount
(
Integer
memberCount
)
{
this
.
memberCount
=
memberCount
;
return
this
;
}
}
gic-data-cloud-api/src/main/java/com/gic/cloud/service/DataAuthApiService.java
0 → 100644
View file @
bd92e5a6
package
com
.
gic
.
cloud
.
service
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.cloud.dto.DataAuthDTO
;
import
java.util.List
;
public
interface
DataAuthApiService
{
ServiceResponse
<
Integer
>
saveDataAuth
(
DataAuthDTO
dto
);
ServiceResponse
<
Void
>
editDataAuth
(
DataAuthDTO
dto
);
ServiceResponse
<
DataAuthDTO
>
getDataAuth
(
Integer
dataAuthId
);
ServiceResponse
<
Void
>
deleteDataAuth
(
Integer
dataAuthId
);
ServiceResponse
<
Page
<
DataAuthDTO
>>
pageDataAuth
(
Integer
enterpriseId
,
String
dataAuthName
,
Integer
currentPage
,
Integer
pageSize
);
ServiceResponse
<
List
<
DataAuthDTO
>>
listDataAuth
(
Integer
enterpriseId
,
String
dataAuthName
);
}
gic-data-cloud-service/src/main/java/com/gic/cloud/dao/mapper/TabSysDataAuthMapper.java
0 → 100644
View file @
bd92e5a6
package
com
.
gic
.
cloud
.
dao
.
mapper
;
import
com.gic.cloud.entity.TabSysDataAuth
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
TabSysDataAuthMapper
{
/**
* 根据主键删除
*
* @param dataAuthId 主键
* @return 更新条目数
*/
int
deleteByPrimaryKey
(
Integer
dataAuthId
);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
insert
(
TabSysDataAuth
record
);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
insertSelective
(
TabSysDataAuth
record
);
/**
* 根据主键查询
*
* @param dataAuthId 主键
* @return 实体对象
*/
TabSysDataAuth
selectByPrimaryKey
(
Integer
dataAuthId
);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
updateByPrimaryKeySelective
(
TabSysDataAuth
record
);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
updateByPrimaryKey
(
TabSysDataAuth
record
);
int
countByDataAuthName
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
,
@Param
(
"dataAuthId"
)
Integer
dataAuthId
,
@Param
(
"dataAuthName"
)
String
dataAuthName
);
int
deleteDataAuth
(
@Param
(
"dataAuthId"
)
Integer
dataAuthId
);
List
<
TabSysDataAuth
>
listDataAuth
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
,
@Param
(
"dataAuthName"
)
String
dataAuthName
);
}
\ No newline at end of file
gic-data-cloud-service/src/main/java/com/gic/cloud/dao/mapper/TabSysUserMapper.java
View file @
bd92e5a6
...
...
@@ -73,6 +73,9 @@ public interface TabSysUserMapper {
List
<
TabSysUser
>
listUserByPhone
(
@Param
(
"nationCode"
)
String
nationCode
,
@Param
(
"phone"
)
String
phone
);
List
<
UserDTO
>
countGroupByFunctionAuthId
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
,
List
<
UserDTO
>
countGroupByFunctionAuthId
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
,
@Param
(
"functionIdList"
)
List
<
Integer
>
functionIdList
);
List
<
UserDTO
>
countGroupByDataAuthId
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
,
@Param
(
"dataAuthIdList"
)
List
<
Integer
>
dataAuthIdList
);
}
\ No newline at end of file
gic-data-cloud-service/src/main/java/com/gic/cloud/entity/TabSysDataAuth.java
0 → 100644
View file @
bd92e5a6
package
com
.
gic
.
cloud
.
entity
;
import
java.util.Date
;
/**
* tab_sys_data_auth
*/
public
class
TabSysDataAuth
{
/**
* ID
*/
private
Integer
dataAuthId
;
/**
* 名称
*/
private
String
dataAuthName
;
/**
*
*/
private
Integer
enterpriseId
;
/**
* 线上业绩权限,json数组,[{"channel":1,"storeContent":[1]}]
*/
private
String
onlinePerformance
;
/**
* 门店资源,门店选择器ID
*/
private
Integer
storeWidgetId
;
/**
* 会员卡权限,_23232_23232_,可以多选,下划线隔开
*/
private
String
memberCardAuth
;
/**
* 商品域权限,_23232_23232_,可以多选,下划线隔开
*/
private
String
goodsAreaAuth
;
/**
* 1:有效 0:无效
*/
private
Integer
status
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
public
Integer
getDataAuthId
()
{
return
dataAuthId
;
}
public
TabSysDataAuth
setDataAuthId
(
Integer
dataAuthId
)
{
this
.
dataAuthId
=
dataAuthId
;
return
this
;
}
public
String
getDataAuthName
()
{
return
dataAuthName
;
}
public
TabSysDataAuth
setDataAuthName
(
String
dataAuthName
)
{
this
.
dataAuthName
=
dataAuthName
;
return
this
;
}
public
Integer
getEnterpriseId
()
{
return
enterpriseId
;
}
public
TabSysDataAuth
setEnterpriseId
(
Integer
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
return
this
;
}
public
String
getOnlinePerformance
()
{
return
onlinePerformance
;
}
public
TabSysDataAuth
setOnlinePerformance
(
String
onlinePerformance
)
{
this
.
onlinePerformance
=
onlinePerformance
;
return
this
;
}
public
Integer
getStoreWidgetId
()
{
return
storeWidgetId
;
}
public
TabSysDataAuth
setStoreWidgetId
(
Integer
storeWidgetId
)
{
this
.
storeWidgetId
=
storeWidgetId
;
return
this
;
}
public
String
getMemberCardAuth
()
{
return
memberCardAuth
;
}
public
TabSysDataAuth
setMemberCardAuth
(
String
memberCardAuth
)
{
this
.
memberCardAuth
=
memberCardAuth
;
return
this
;
}
public
String
getGoodsAreaAuth
()
{
return
goodsAreaAuth
;
}
public
TabSysDataAuth
setGoodsAreaAuth
(
String
goodsAreaAuth
)
{
this
.
goodsAreaAuth
=
goodsAreaAuth
;
return
this
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
TabSysDataAuth
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
return
this
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
TabSysDataAuth
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
return
this
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
TabSysDataAuth
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
return
this
;
}
}
\ No newline at end of file
gic-data-cloud-service/src/main/java/com/gic/cloud/service/DataAuthService.java
0 → 100644
View file @
bd92e5a6
package
com
.
gic
.
cloud
.
service
;
import
com.gic.cloud.dto.DataAuthDTO
;
import
com.gic.cloud.entity.TabSysDataAuth
;
import
com.github.pagehelper.Page
;
import
java.util.List
;
public
interface
DataAuthService
{
Integer
saveDataAuth
(
DataAuthDTO
dto
);
void
editDataAuth
(
DataAuthDTO
dto
);
TabSysDataAuth
getDataAuth
(
Integer
dataAuthId
);
boolean
isRepeatDataAuthName
(
Integer
enterpriseId
,
Integer
dataAuthId
,
String
dataAuthName
);
int
deleteDataAuth
(
Integer
dataAuthId
);
Page
<
TabSysDataAuth
>
pageDataAuth
(
Integer
enterpriseId
,
String
dataAuthName
,
Integer
currentPage
,
Integer
pageSize
);
List
<
TabSysDataAuth
>
listDataAuth
(
Integer
enterpriseId
,
String
dataAuthName
);
}
gic-data-cloud-service/src/main/java/com/gic/cloud/service/UserService.java
View file @
bd92e5a6
...
...
@@ -38,4 +38,6 @@ public interface UserService {
List
<
TabSysUser
>
listUserByPhone
(
String
nationCode
,
String
phone
);
List
<
UserDTO
>
countGroupByFunctionAuthId
(
Integer
enterpriseId
,
List
<
Integer
>
functionIdList
);
List
<
UserDTO
>
countGroupByDataAuthId
(
Integer
enterpriseId
,
List
<
Integer
>
dataAuthIdList
);
}
gic-data-cloud-service/src/main/java/com/gic/cloud/service/impl/DataAuthServiceImpl.java
0 → 100644
View file @
bd92e5a6
package
com
.
gic
.
cloud
.
service
.
impl
;
import
com.gic.cloud.dao.mapper.TabSysDataAuthMapper
;
import
com.gic.cloud.dto.DataAuthDTO
;
import
com.gic.cloud.entity.TabSysDataAuth
;
import
com.gic.cloud.service.DataAuthService
;
import
com.gic.commons.util.EntityUtil
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
@Service
(
"dataAuthService"
)
public
class
DataAuthServiceImpl
implements
DataAuthService
{
@Autowired
private
TabSysDataAuthMapper
tabSysDataAuthMapper
;
@Override
public
Integer
saveDataAuth
(
DataAuthDTO
dto
)
{
TabSysDataAuth
record
=
EntityUtil
.
changeEntityNew
(
TabSysDataAuth
.
class
,
dto
);
Date
now
=
new
Date
();
record
.
setUpdateTime
(
now
);
record
.
setCreateTime
(
now
);
record
.
setStatus
(
1
);
tabSysDataAuthMapper
.
insert
(
record
);
return
record
.
getDataAuthId
();
}
@Override
public
void
editDataAuth
(
DataAuthDTO
dto
)
{
TabSysDataAuth
record
=
EntityUtil
.
changeEntityNew
(
TabSysDataAuth
.
class
,
dto
);
record
.
setUpdateTime
(
new
Date
());
tabSysDataAuthMapper
.
updateByPrimaryKeySelective
(
record
);
}
@Override
public
TabSysDataAuth
getDataAuth
(
Integer
dataAuthId
)
{
return
tabSysDataAuthMapper
.
selectByPrimaryKey
(
dataAuthId
);
}
@Override
public
boolean
isRepeatDataAuthName
(
Integer
enterpriseId
,
Integer
dataAuthId
,
String
dataAuthName
)
{
if
(
tabSysDataAuthMapper
.
countByDataAuthName
(
enterpriseId
,
dataAuthId
,
dataAuthName
)
>
0
)
{
return
true
;
}
return
false
;
}
@Override
public
int
deleteDataAuth
(
Integer
dataAuthId
)
{
return
tabSysDataAuthMapper
.
deleteDataAuth
(
dataAuthId
);
}
@Override
public
Page
<
TabSysDataAuth
>
pageDataAuth
(
Integer
enterpriseId
,
String
dataAuthName
,
Integer
currentPage
,
Integer
pageSize
)
{
if
(
currentPage
==
null
)
{
currentPage
=
1
;
}
if
(
pageSize
==
null
)
{
pageSize
=
20
;
}
PageHelper
.
startPage
(
currentPage
,
pageSize
);
return
(
Page
<
TabSysDataAuth
>)
tabSysDataAuthMapper
.
listDataAuth
(
enterpriseId
,
dataAuthName
);
}
@Override
public
List
<
TabSysDataAuth
>
listDataAuth
(
Integer
enterpriseId
,
String
dataAuthName
)
{
return
tabSysDataAuthMapper
.
listDataAuth
(
enterpriseId
,
dataAuthName
);
}
}
gic-data-cloud-service/src/main/java/com/gic/cloud/service/impl/UserServiceImpl.java
View file @
bd92e5a6
...
...
@@ -89,4 +89,9 @@ public class UserServiceImpl implements UserService{
public
List
<
UserDTO
>
countGroupByFunctionAuthId
(
Integer
enterpriseId
,
List
<
Integer
>
functionIdList
)
{
return
tabSysUserMapper
.
countGroupByFunctionAuthId
(
enterpriseId
,
functionIdList
);
}
@Override
public
List
<
UserDTO
>
countGroupByDataAuthId
(
Integer
enterpriseId
,
List
<
Integer
>
dataAuthIdList
)
{
return
tabSysUserMapper
.
countGroupByDataAuthId
(
enterpriseId
,
dataAuthIdList
);
}
}
gic-data-cloud-service/src/main/java/com/gic/cloud/service/outer/impl/DataAuthApiServiceImpl.java
0 → 100644
View file @
bd92e5a6
package
com
.
gic
.
cloud
.
service
.
outer
.
impl
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.cloud.dto.DataAuthDTO
;
import
com.gic.cloud.dto.UserDTO
;
import
com.gic.cloud.entity.TabSysDataAuth
;
import
com.gic.cloud.service.DataAuthApiService
;
import
com.gic.cloud.service.DataAuthService
;
import
com.gic.cloud.service.UserService
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.enterprise.error.ErrorCode
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
@Service
(
"dataAuthApiService"
)
public
class
DataAuthApiServiceImpl
implements
DataAuthApiService
{
private
static
Logger
LOGGER
=
LogManager
.
getLogger
(
DataAuthApiServiceImpl
.
class
);
@Autowired
private
DataAuthService
dataAuthService
;
@Autowired
private
UserService
userService
;
@Override
public
ServiceResponse
<
Integer
>
saveDataAuth
(
DataAuthDTO
dto
)
{
ServiceResponse
validParamResult
=
validParam
(
dto
);
if
(!
validParamResult
.
isSuccess
())
{
return
ServiceResponse
.
failure
(
validParamResult
.
getCode
(),
validParamResult
.
getMessage
());
}
return
ServiceResponse
.
success
(
dataAuthService
.
saveDataAuth
(
dto
));
}
@Override
public
ServiceResponse
<
Void
>
editDataAuth
(
DataAuthDTO
dto
)
{
ServiceResponse
validParamResult
=
validParam
(
dto
);
if
(!
validParamResult
.
isSuccess
())
{
return
ServiceResponse
.
failure
(
validParamResult
.
getCode
(),
validParamResult
.
getMessage
());
}
dataAuthService
.
editDataAuth
(
dto
);
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
DataAuthDTO
>
getDataAuth
(
Integer
dataAuthId
)
{
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityNew
(
DataAuthDTO
.
class
,
dataAuthService
.
getDataAuth
(
dataAuthId
)));
}
@Override
public
ServiceResponse
<
Void
>
deleteDataAuth
(
Integer
dataAuthId
)
{
dataAuthService
.
deleteDataAuth
(
dataAuthId
);
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
Page
<
DataAuthDTO
>>
pageDataAuth
(
Integer
enterpriseId
,
String
dataAuthName
,
Integer
currentPage
,
Integer
pageSize
)
{
com
.
github
.
pagehelper
.
Page
page
=
dataAuthService
.
pageDataAuth
(
enterpriseId
,
dataAuthName
,
currentPage
,
pageSize
);
Page
<
DataAuthDTO
>
resultPage
=
PageHelperUtils
.
changePageHelperToCurrentPage
(
page
,
DataAuthDTO
.
class
);
if
(
resultPage
!=
null
)
{
List
<
DataAuthDTO
>
dataAuthList
=
resultPage
.
getResult
();
//查询授权人数
if
(
CollectionUtils
.
isNotEmpty
(
dataAuthList
))
{
List
<
UserDTO
>
userList
=
userService
.
countGroupByDataAuthId
(
enterpriseId
,
dataAuthList
.
stream
().
map
(
e
->
e
.
getDataAuthId
()).
collect
(
Collectors
.
toList
()));
if
(
CollectionUtils
.
isNotEmpty
(
userList
))
{
Map
<
String
,
Integer
>
map
=
userList
.
stream
()
.
collect
(
Collectors
.
toMap
(
e
->
e
.
getDataAuthId
().
toString
(),
e
->
e
.
getMemberCount
()));
dataAuthList
.
forEach
(
e
->
e
.
setMemberCount
(
map
.
get
(
e
.
getDataAuthId
().
toString
())));
}
}
}
return
ServiceResponse
.
success
(
resultPage
);
}
@Override
public
ServiceResponse
<
List
<
DataAuthDTO
>>
listDataAuth
(
Integer
enterpriseId
,
String
dataAuthName
)
{
return
ServiceResponse
.
success
(
Optional
.
ofNullable
(
EntityUtil
.
changeEntityListNew
(
DataAuthDTO
.
class
,
dataAuthService
.
listDataAuth
(
enterpriseId
,
dataAuthName
))).
orElse
(
Collections
.
EMPTY_LIST
));
}
private
ServiceResponse
validParam
(
DataAuthDTO
dto
)
{
if
(
dto
.
getDataAuthId
()
!=
null
)
{
TabSysDataAuth
record
=
dataAuthService
.
getDataAuth
(
dto
.
getDataAuthId
());
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"数据权限集id错误,查无数据"
);
}
dto
.
setEnterpriseId
(
record
.
getEnterpriseId
());
}
Integer
enterpriseId
=
dto
.
getEnterpriseId
();
String
dataAuthName
=
dto
.
getDataAuthName
();
if
(
StringUtils
.
isBlank
(
dataAuthName
))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"数据权限集名称不能为空"
);
}
if
(
dataAuthService
.
isRepeatDataAuthName
(
enterpriseId
,
dto
.
getDataAuthId
(),
dataAuthName
))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"数据权限集名称重复"
);
}
String
memberCardAuth
=
dto
.
getMemberCardAuth
();
if
(
StringUtils
.
isNotBlank
(
memberCardAuth
))
{
dto
.
setMemberCardAuth
(
"_"
+
memberCardAuth
.
replaceAll
(
","
,
"_"
)
+
"_"
);
}
String
goodsAreaAuth
=
dto
.
getGoodsAreaAuth
();
if
(
StringUtils
.
isNotBlank
(
goodsAreaAuth
))
{
dto
.
setGoodsAreaAuth
(
"_"
+
goodsAreaAuth
.
replaceAll
(
","
,
"_"
)
+
"_"
);
}
return
ServiceResponse
.
success
();
}
}
gic-data-cloud-service/src/main/resources/dubbo-gic-data-cloud-service.xml
View file @
bd92e5a6
...
...
@@ -19,4 +19,5 @@
<dubbo:service
interface=
"com.gic.cloud.service.UserApiService"
ref=
"userApiService"
timeout=
"6000"
/>
<dubbo:service
interface=
"com.gic.cloud.service.FunctionApiService"
ref=
"functionApiService"
timeout=
"6000"
/>
<dubbo:service
interface=
"com.gic.cloud.service.FunctionModuleApiService"
ref=
"functionModuleApiService"
timeout=
"6000"
/>
<dubbo:service
interface=
"com.gic.cloud.service.DataAuthApiService"
ref=
"dataAuthApiService"
timeout=
"6000"
/>
</beans>
gic-data-cloud-service/src/main/resources/mapper/TabSysDataAuthMapper.xml
0 → 100644
View file @
bd92e5a6
<?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.gic.cloud.dao.mapper.TabSysDataAuthMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.gic.cloud.entity.TabSysDataAuth"
>
<id
column=
"data_auth_id"
jdbcType=
"INTEGER"
property=
"dataAuthId"
/>
<result
column=
"data_auth_name"
jdbcType=
"VARCHAR"
property=
"dataAuthName"
/>
<result
column=
"enterprise_id"
jdbcType=
"INTEGER"
property=
"enterpriseId"
/>
<result
column=
"online_performance"
jdbcType=
"VARCHAR"
property=
"onlinePerformance"
/>
<result
column=
"store_widget_id"
jdbcType=
"INTEGER"
property=
"storeWidgetId"
/>
<result
column=
"member_card_auth"
jdbcType=
"VARCHAR"
property=
"memberCardAuth"
/>
<result
column=
"goods_area_auth"
jdbcType=
"VARCHAR"
property=
"goodsAreaAuth"
/>
<result
column=
"status"
jdbcType=
"INTEGER"
property=
"status"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
data_auth_id, data_auth_name, enterprise_id, online_performance, store_widget_id,
member_card_auth, goods_area_auth, status, create_time, update_time
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_data_auth
where data_auth_id = #{dataAuthId,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from tab_sys_data_auth
where data_auth_id = #{dataAuthId,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
parameterType=
"com.gic.cloud.entity.TabSysDataAuth"
useGeneratedKeys=
"true"
keyProperty=
"dataAuthId"
>
insert into tab_sys_data_auth (data_auth_id, data_auth_name, enterprise_id,
online_performance, store_widget_id, member_card_auth,
goods_area_auth, status, create_time,
update_time)
values (#{dataAuthId,jdbcType=INTEGER}, #{dataAuthName,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=INTEGER},
#{onlinePerformance,jdbcType=VARCHAR}, #{storeWidgetId,jdbcType=INTEGER}, #{memberCardAuth,jdbcType=VARCHAR},
#{goodsAreaAuth,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.gic.cloud.entity.TabSysDataAuth"
>
insert into tab_sys_data_auth
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"dataAuthId != null"
>
data_auth_id,
</if>
<if
test=
"dataAuthName != null"
>
data_auth_name,
</if>
<if
test=
"enterpriseId != null"
>
enterprise_id,
</if>
<if
test=
"onlinePerformance != null"
>
online_performance,
</if>
<if
test=
"storeWidgetId != null"
>
store_widget_id,
</if>
<if
test=
"memberCardAuth != null"
>
member_card_auth,
</if>
<if
test=
"goodsAreaAuth != null"
>
goods_area_auth,
</if>
<if
test=
"status != null"
>
status,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"dataAuthId != null"
>
#{dataAuthId,jdbcType=INTEGER},
</if>
<if
test=
"dataAuthName != null"
>
#{dataAuthName,jdbcType=VARCHAR},
</if>
<if
test=
"enterpriseId != null"
>
#{enterpriseId,jdbcType=INTEGER},
</if>
<if
test=
"onlinePerformance != null"
>
#{onlinePerformance,jdbcType=VARCHAR},
</if>
<if
test=
"storeWidgetId != null"
>
#{storeWidgetId,jdbcType=INTEGER},
</if>
<if
test=
"memberCardAuth != null"
>
#{memberCardAuth,jdbcType=VARCHAR},
</if>
<if
test=
"goodsAreaAuth != null"
>
#{goodsAreaAuth,jdbcType=VARCHAR},
</if>
<if
test=
"status != null"
>
#{status,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.gic.cloud.entity.TabSysDataAuth"
>
update tab_sys_data_auth
<set>
<if
test=
"dataAuthName != null"
>
data_auth_name = #{dataAuthName,jdbcType=VARCHAR},
</if>
<if
test=
"enterpriseId != null"
>
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
</if>
<if
test=
"onlinePerformance != null"
>
online_performance = #{onlinePerformance,jdbcType=VARCHAR},
</if>
<if
test=
"storeWidgetId != null"
>
store_widget_id = #{storeWidgetId,jdbcType=INTEGER},
</if>
<if
test=
"memberCardAuth != null"
>
member_card_auth = #{memberCardAuth,jdbcType=VARCHAR},
</if>
<if
test=
"goodsAreaAuth != null"
>
goods_area_auth = #{goodsAreaAuth,jdbcType=VARCHAR},
</if>
<if
test=
"status != null"
>
status = #{status,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where data_auth_id = #{dataAuthId,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.gic.cloud.entity.TabSysDataAuth"
>
update tab_sys_data_auth
set data_auth_name = #{dataAuthName,jdbcType=VARCHAR},
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
online_performance = #{onlinePerformance,jdbcType=VARCHAR},
store_widget_id = #{storeWidgetId,jdbcType=INTEGER},
member_card_auth = #{memberCardAuth,jdbcType=VARCHAR},
goods_area_auth = #{goodsAreaAuth,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where data_auth_id = #{dataAuthId,jdbcType=INTEGER}
</update>
<select
id=
"countByDataAuthName"
resultType=
"int"
>
select count(1) from tab_sys_data_auth
where enterprise_id = #{enterpriseId}
and data_auth_name = #{dataAuthName}
<if
test=
"dataAuthId != null"
>
and data_auth_id
<>
#{dataAuthId}
</if>
and status = 1
</select>
<update
id=
"deleteDataAuth"
>
update tab_sys_data_auth set status = 0
where data_auth_id = #{dataAuthId}
and status = 1
</update>
<select
id=
"listDataAuth"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
></include>
from tab_sys_data_auth
where enterprise_id = #{enterpriseId}
<if
test=
"dataAuthName != null and dataAuthName != ''"
>
and data_auth_name like concat('%', #{dataAuthName}, '%')
</if>
and status = 1
order by create_time desc
</select>
</mapper>
\ No newline at end of file
gic-data-cloud-service/src/main/resources/mapper/TabSysUserMapper.xml
View file @
bd92e5a6
...
...
@@ -245,4 +245,18 @@
</if>
group by function_auth_id
</select>
<select
id=
"countGroupByDataAuthId"
resultType=
"com.gic.cloud.dto.UserDTO"
>
select data_auth_id dataAuthId, count(user_id) memberCount
from tab_sys_user
where enterprise_id = #{enterpriseId}
and status = 1
<if
test=
"dataAuthIdList != null and dataAuthIdList.size() > 0"
>
and data_auth_id in
<foreach
collection=
"dataAuthIdList"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
group by data_auth_id
</select>
</mapper>
\ No newline at end of file
gic-data-cloud-web/src/main/java/com/gic/cloud/web/controller/DataAuthController.java
0 → 100644
View file @
bd92e5a6
package
com
.
gic
.
cloud
.
web
.
controller
;
import
com.gic.cloud.web.vo.DataAuthDetailVO
;
import
com.gic.cloud.web.vo.DataAuthVO
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.gic.cloud.dto.DataAuthDTO
;
import
com.gic.cloud.service.DataAuthApiService
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.utils.ResultControllerUtils
;
import
com.gic.enterprise.utils.UserDetailUtils
;
@RestController
@RequestMapping
(
"/data-auth"
)
public
class
DataAuthController
{
private
static
Logger
LOGGER
=
LogManager
.
getLogger
(
DataAuthController
.
class
);
@Autowired
private
DataAuthApiService
dataAuthApiService
;
@RequestMapping
(
"/save-data-auth"
)
public
RestResponse
saveDataAuth
(
DataAuthDTO
dto
)
{
dto
.
setEnterpriseId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
return
ResultControllerUtils
.
commonResult
(
dataAuthApiService
.
saveDataAuth
(
dto
));
}
@RequestMapping
(
"/edit-data-auth"
)
public
RestResponse
editDataAuth
(
DataAuthDTO
dto
)
{
return
ResultControllerUtils
.
commonResult
(
dataAuthApiService
.
editDataAuth
(
dto
));
}
@RequestMapping
(
"/delete-data-auth"
)
public
RestResponse
deleteDataAuth
(
Integer
dataAuthId
)
{
return
ResultControllerUtils
.
commonResult
(
dataAuthApiService
.
deleteDataAuth
(
dataAuthId
));
}
@RequestMapping
(
"/get-data-auth-detail"
)
public
RestResponse
getDataAuth
(
Integer
dataAuthId
)
{
return
ResultControllerUtils
.
commonResultOne
(
dataAuthApiService
.
getDataAuth
(
dataAuthId
),
DataAuthDetailVO
.
class
);
}
@RequestMapping
(
"/page-data-auth"
)
public
RestResponse
pageDataAuth
(
String
dataAuthName
,
Integer
currentPage
,
Integer
pageSize
)
{
return
ResultControllerUtils
.
commonPageResult
(
dataAuthApiService
.
pageDataAuth
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
(),
dataAuthName
,
currentPage
,
pageSize
),
DataAuthVO
.
class
);
}
}
gic-data-cloud-web/src/main/java/com/gic/cloud/web/controller/UserController.java
View file @
bd92e5a6
...
...
@@ -4,6 +4,7 @@ import java.util.Arrays;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
com.gic.cloud.service.*
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -14,10 +15,6 @@ import org.springframework.web.bind.annotation.RestController;
import
com.gic.cloud.dto.AccountGroupDTO
;
import
com.gic.cloud.dto.UserDTO
;
import
com.gic.cloud.qo.UserQO
;
import
com.gic.cloud.service.AccountGroupApiService
;
import
com.gic.cloud.service.FunctionApiService
;
import
com.gic.cloud.service.FunctionModuleApiService
;
import
com.gic.cloud.service.UserApiService
;
import
com.gic.cloud.web.vo.*
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.utils.ResultControllerUtils
;
...
...
@@ -36,6 +33,8 @@ public class UserController {
private
FunctionApiService
functionApiService
;
@Autowired
private
FunctionModuleApiService
functionModuleApiService
;
@Autowired
private
DataAuthApiService
dataAuthApiService
;
@RequestMapping
(
"/save-account-group"
)
public
RestResponse
saveAccountGroup
(
AccountGroupDTO
dto
)
{
...
...
@@ -96,6 +95,12 @@ public class UserController {
.
listFunction
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
(),
functionName
),
FunctionListVO
.
class
);
}
@RequestMapping
(
"/list-data-auth"
)
public
RestResponse
listDataAuth
(
String
dataAuthName
)
{
return
ResultControllerUtils
.
commonResult
(
dataAuthApiService
.
listDataAuth
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
(),
dataAuthName
),
DataAuthListVO
.
class
);
}
@RequestMapping
(
"/page-user"
)
public
RestResponse
pageUser
(
UserQO
userQO
)
{
userQO
.
setEnterpriseId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
...
...
gic-data-cloud-web/src/main/java/com/gic/cloud/web/vo/DataAuthDetailVO.java
0 → 100644
View file @
bd92e5a6
package
com
.
gic
.
cloud
.
web
.
vo
;
import
org.apache.commons.lang.StringUtils
;
import
java.io.Serializable
;
public
class
DataAuthDetailVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
720678159449334770L
;
/**
* ID
*/
private
Integer
dataAuthId
;
/**
* 名称
*/
private
String
dataAuthName
;
/**
*
*/
private
Integer
enterpriseId
;
/**
* 线上业绩权限,json数组,[{"channel":1,"storeContent":[1]}]
*/
private
String
onlinePerformance
;
/**
* 门店资源,门店选择器ID
*/
private
Integer
storeWidgetId
;
/**
* 会员卡权限,_23232_23232_,可以多选,下划线隔开
*/
private
String
memberCardAuth
;
/**
* 商品域权限,_23232_23232_,可以多选,下划线隔开
*/
private
String
goodsAreaAuth
;
public
Integer
getDataAuthId
()
{
return
dataAuthId
;
}
public
DataAuthDetailVO
setDataAuthId
(
Integer
dataAuthId
)
{
this
.
dataAuthId
=
dataAuthId
;
return
this
;
}
public
String
getDataAuthName
()
{
return
dataAuthName
;
}
public
DataAuthDetailVO
setDataAuthName
(
String
dataAuthName
)
{
this
.
dataAuthName
=
dataAuthName
;
return
this
;
}
public
Integer
getEnterpriseId
()
{
return
enterpriseId
;
}
public
DataAuthDetailVO
setEnterpriseId
(
Integer
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
return
this
;
}
public
String
getOnlinePerformance
()
{
return
onlinePerformance
;
}
public
DataAuthDetailVO
setOnlinePerformance
(
String
onlinePerformance
)
{
this
.
onlinePerformance
=
onlinePerformance
;
return
this
;
}
public
Integer
getStoreWidgetId
()
{
return
storeWidgetId
;
}
public
DataAuthDetailVO
setStoreWidgetId
(
Integer
storeWidgetId
)
{
this
.
storeWidgetId
=
storeWidgetId
;
return
this
;
}
public
String
getMemberCardAuth
()
{
if
(
StringUtils
.
isNotBlank
(
memberCardAuth
))
{
memberCardAuth
=
memberCardAuth
.
substring
(
1
,
memberCardAuth
.
length
()
-
1
);
return
memberCardAuth
.
replaceAll
(
"_"
,
","
);
}
return
memberCardAuth
;
}
public
DataAuthDetailVO
setMemberCardAuth
(
String
memberCardAuth
)
{
this
.
memberCardAuth
=
memberCardAuth
;
return
this
;
}
public
String
getGoodsAreaAuth
()
{
if
(
StringUtils
.
isNotBlank
(
goodsAreaAuth
))
{
goodsAreaAuth
=
goodsAreaAuth
.
substring
(
1
,
goodsAreaAuth
.
length
()
-
1
);
return
goodsAreaAuth
.
replaceAll
(
"_"
,
","
);
}
return
goodsAreaAuth
;
}
public
DataAuthDetailVO
setGoodsAreaAuth
(
String
goodsAreaAuth
)
{
this
.
goodsAreaAuth
=
goodsAreaAuth
;
return
this
;
}
}
gic-data-cloud-web/src/main/java/com/gic/cloud/web/vo/DataAuthListVO.java
0 → 100644
View file @
bd92e5a6
package
com
.
gic
.
cloud
.
web
.
vo
;
import
java.io.Serializable
;
public
class
DataAuthListVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
7549685019392230748L
;
/**
* ID
*/
private
Integer
dataAuthId
;
/**
* 名称
*/
private
String
dataAuthName
;
public
Integer
getDataAuthId
()
{
return
dataAuthId
;
}
public
DataAuthListVO
setDataAuthId
(
Integer
dataAuthId
)
{
this
.
dataAuthId
=
dataAuthId
;
return
this
;
}
public
String
getDataAuthName
()
{
return
dataAuthName
;
}
public
DataAuthListVO
setDataAuthName
(
String
dataAuthName
)
{
this
.
dataAuthName
=
dataAuthName
;
return
this
;
}
}
gic-data-cloud-web/src/main/java/com/gic/cloud/web/vo/DataAuthVO.java
0 → 100644
View file @
bd92e5a6
package
com
.
gic
.
cloud
.
web
.
vo
;
import
java.io.Serializable
;
public
class
DataAuthVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
6485807150571326830L
;
/**
* ID
*/
private
Integer
dataAuthId
;
/**
* 名称
*/
private
String
dataAuthName
;
/**
* 授权人数
*/
private
Integer
memberCount
;
public
Integer
getDataAuthId
()
{
return
dataAuthId
;
}
public
DataAuthVO
setDataAuthId
(
Integer
dataAuthId
)
{
this
.
dataAuthId
=
dataAuthId
;
return
this
;
}
public
String
getDataAuthName
()
{
return
dataAuthName
;
}
public
DataAuthVO
setDataAuthName
(
String
dataAuthName
)
{
this
.
dataAuthName
=
dataAuthName
;
return
this
;
}
public
Integer
getMemberCount
()
{
return
memberCount
;
}
public
DataAuthVO
setMemberCount
(
Integer
memberCount
)
{
this
.
memberCount
=
memberCount
;
return
this
;
}
}
gic-data-cloud-web/src/main/resources/dubbo-gic-data-cloud-web.xml
View file @
bd92e5a6
...
...
@@ -142,4 +142,5 @@
<dubbo:reference
interface=
"com.gic.cloud.service.UserApiService"
id=
"userApiService"
timeout=
"6000"
retries=
"0"
/>
<dubbo:reference
interface=
"com.gic.cloud.service.FunctionApiService"
id=
"functionApiService"
timeout=
"6000"
retries=
"0"
/>
<dubbo:reference
interface=
"com.gic.cloud.service.FunctionModuleApiService"
id=
"functionModuleApiService"
timeout=
"6000"
retries=
"0"
/>
<dubbo:reference
interface=
"com.gic.cloud.service.DataAuthApiService"
id=
"dataAuthApiService"
timeout=
"6000"
retries=
"0"
/>
</beans>
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