Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-auth
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-platform-auth
Commits
2bf401e2
Commit
2bf401e2
authored
Sep 02, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户角色关联表
parent
4bca6a30
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
275 additions
and
422 deletions
+275
-422
TabSysUserMapper.java
...c/main/java/com/gic/auth/dao/mapper/TabSysUserMapper.java
+21
-0
TabSysUserRoleMapper.java
...in/java/com/gic/auth/dao/mapper/TabSysUserRoleMapper.java
+23
-0
TabUserMapper.java
.../src/main/java/com/gic/auth/dao/mapper/TabUserMapper.java
+0
-74
TabSysUser.java
...service/src/main/java/com/gic/auth/entity/TabSysUser.java
+1
-1
TabUser.java
...th-service/src/main/java/com/gic/auth/entity/TabUser.java
+0
-139
UserRoleService.java
...e/src/main/java/com/gic/auth/service/UserRoleService.java
+46
-0
UserService.java
...rvice/src/main/java/com/gic/auth/service/UserService.java
+5
-4
UserRoleServiceImpl.java
...n/java/com/gic/auth/service/impl/UserRoleServiceImpl.java
+37
-0
UserServiceImpl.java
.../main/java/com/gic/auth/service/impl/UserServiceImpl.java
+15
-13
UserResourceApiServiceImpl.java
...c/auth/service/outer/impl/UserResourceApiServiceImpl.java
+14
-0
UserRoleApiServiceImpl.java
...m/gic/auth/service/outer/impl/UserRoleApiServiceImpl.java
+41
-0
TabSysUserMapper.xml
...th-service/src/main/resources/mapper/TabSysUserMapper.xml
+38
-0
TabSysUserRoleMapper.xml
...ervice/src/main/resources/mapper/TabSysUserRoleMapper.xml
+15
-0
TabUserMapper.xml
...-auth-service/src/main/resources/mapper/TabUserMapper.xml
+0
-191
UserController.java
...main/java/com/gic/auth/web/controller/UserController.java
+19
-0
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/dao/mapper/TabSysUserMapper.java
View file @
2bf401e2
package
com
.
gic
.
auth
.
dao
.
mapper
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
import
com.gic.auth.entity.TabSysUser
;
public
interface
TabSysUserMapper
{
...
...
@@ -50,4 +54,20 @@ public interface TabSysUserMapper {
* @return 更新条目数
*/
int
updateByPrimaryKey
(
TabSysUser
record
);
/**
* 手机号码查询个数
* @param phone
* @param userId
* @return
*/
int
countByPhone
(
@Param
(
"phone"
)
String
phone
,
@Param
(
"userId"
)
Integer
userId
);
TabSysUser
selectByEnterpriseId
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
);
List
<
TabSysUser
>
listAllUserByPhoneNumber
(
@Param
(
"phoneNumber"
)
String
phoneNumber
);
TabSysUser
login
(
@Param
(
"phoneNumber"
)
String
phoneNumber
,
@Param
(
"password"
)
String
password
,
@Param
(
"enterpriseId"
)
Integer
enterpriseId
);
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/dao/mapper/TabSysUserRoleMapper.java
View file @
2bf401e2
package
com
.
gic
.
auth
.
dao
.
mapper
;
import
com.gic.auth.entity.TabSysUserRole
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
TabSysUserRoleMapper
{
/**
...
...
@@ -50,4 +53,23 @@ public interface TabSysUserRoleMapper {
* @return 更新条目数
*/
int
updateByPrimaryKey
(
TabSysUserRole
record
);
/**
* 删除用户关联数据
* @Title: deleteByUserId
* @Description:
* @author guojuxing
* @param userId
* @return int
*/
int
deleteByUserId
(
@Param
(
"userId"
)
Integer
userId
);
/**
* 查询用户关联数据
* @Title: listUserRoleByUserId
* @Description:
* @author guojuxing
* @param userId
* @return java.util.List<com.gic.auth.entity.TabSysUserRole>
*/
List
<
TabSysUserRole
>
listUserRoleByUserId
(
@Param
(
"userId"
)
Integer
userId
);
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/dao/mapper/TabUserMapper.java
deleted
100644 → 0
View file @
4bca6a30
package
com
.
gic
.
auth
.
dao
.
mapper
;
import
com.gic.auth.dto.UserDTO
;
import
com.gic.auth.entity.TabUser
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
public
interface
TabUserMapper
{
/**
* 根据主键删除
*
* @param userId 主键
* @return 更新条目数
*/
int
deleteByPrimaryKey
(
Integer
userId
);
/**
* 插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
insert
(
TabUser
record
);
/**
* 动态插入一条记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
insertSelective
(
TabUser
record
);
/**
* 根据主键查询
*
* @param userId 主键
* @return 实体对象
*/
TabUser
selectByPrimaryKey
(
Integer
userId
);
/**
* 根据主键动态更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
updateByPrimaryKeySelective
(
TabUser
record
);
/**
* 根据主键更新记录
*
* @param record 实体对象
* @return 更新条目数
*/
int
updateByPrimaryKey
(
TabUser
record
);
/**
* 手机号码查询个数
* @param phone
* @param userId
* @return
*/
int
countByPhone
(
@Param
(
"phone"
)
String
phone
,
@Param
(
"userId"
)
Integer
userId
);
TabUser
selectByEnterpriseId
(
@Param
(
"enterpriseId"
)
Integer
enterpriseId
);
List
<
TabUser
>
listAllUserByPhoneNumber
(
@Param
(
"phoneNumber"
)
String
phoneNumber
);
TabUser
login
(
@Param
(
"phoneNumber"
)
String
phoneNumber
,
@Param
(
"password"
)
String
password
,
@Param
(
"enterpriseId"
)
Integer
enterpriseId
);
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/entity/TabSysUser.java
View file @
2bf401e2
...
...
@@ -64,7 +64,7 @@ public class TabSysUser {
/**
* 登陆账号类型 1:运营 0:默认GIC
*/
private
Integer
loginType
;
private
Integer
loginType
=
0
;
public
Integer
getUserId
()
{
return
userId
;
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/entity/TabUser.java
deleted
100644 → 0
View file @
4bca6a30
package
com
.
gic
.
auth
.
entity
;
import
java.util.Date
;
/**
* tab_user
*/
public
class
TabUser
{
/**
* 用户id
*/
private
Integer
userId
;
/**
* 用户名
*/
private
String
userName
;
/**
* 手机号码
*/
private
String
phoneNumber
;
/**
* 密码
*/
private
String
password
;
/**
* 是否是超级管理员
*/
private
Integer
superAdmin
;
/**
* 状态,1有效,0无效
*/
private
Integer
status
;
/**
*
*/
private
Date
createTime
;
/**
*
*/
private
Date
updateTime
;
/**
*
*/
private
Integer
enterpriseId
;
/**
* 国际区号,如中国 86
*/
private
String
phoneAreaCode
;
public
Integer
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
Integer
userId
)
{
this
.
userId
=
userId
;
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getPhoneNumber
()
{
return
phoneNumber
;
}
public
void
setPhoneNumber
(
String
phoneNumber
)
{
this
.
phoneNumber
=
phoneNumber
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
Integer
getSuperAdmin
()
{
return
superAdmin
;
}
public
void
setSuperAdmin
(
Integer
superAdmin
)
{
this
.
superAdmin
=
superAdmin
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
Integer
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
Integer
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
String
getPhoneAreaCode
()
{
return
phoneAreaCode
;
}
public
void
setPhoneAreaCode
(
String
phoneAreaCode
)
{
this
.
phoneAreaCode
=
phoneAreaCode
;
}
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/service/UserRoleService.java
0 → 100644
View file @
2bf401e2
package
com
.
gic
.
auth
.
service
;
import
com.gic.auth.dto.UserRoleDTO
;
import
com.gic.auth.entity.TabSysUserRole
;
import
java.util.List
;
/**
* 用户角色关联
* @ClassName: UserRoleService
* @Description:
* @author guojuxing
* @date 2019/9/2 11:01 AM
*/
public
interface
UserRoleService
{
/**
* 新增
* @Title: save
* @Description:
* @author guojuxing
* @param dto
* @return void
*/
void
save
(
UserRoleDTO
dto
);
/**
* 删除用户关联数据
* @Title: deleteByUserId
* @Description:
* @author guojuxing
* @param userId
* @return void
*/
void
deleteByUserId
(
Integer
userId
);
/**
* 查询用户关联数据
* @Title: listUserRoleByUserId
* @Description:
* @author guojuxing
* @param userId
* @return java.util.List<com.gic.auth.entity.TabSysUserRole>
*/
List
<
UserRoleDTO
>
listUserRoleByUserId
(
Integer
userId
);
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/UserService.java
View file @
2bf401e2
package
com
.
gic
.
auth
.
service
;
import
com.gic.auth.dto.UserDTO
;
import
com.gic.auth.entity.TabSysUser
;
import
com.gic.auth.entity.TabUser
;
import
java.util.List
;
...
...
@@ -25,7 +26,7 @@ public interface UserService {
* @param userId
* @return
*/
TabUser
getUserById
(
Integer
userId
);
Tab
Sys
User
getUserById
(
Integer
userId
);
/**
* 手机号码是否重复
...
...
@@ -35,9 +36,9 @@ public interface UserService {
*/
boolean
isPhoneRepeat
(
Integer
userId
,
String
phone
);
TabUser
getUserByEnterpriseId
(
Integer
enterpriseId
);
Tab
Sys
User
getUserByEnterpriseId
(
Integer
enterpriseId
);
List
<
TabUser
>
listAllUserByPhoneNumber
(
String
phoneNumber
);
List
<
Tab
Sys
User
>
listAllUserByPhoneNumber
(
String
phoneNumber
);
TabUser
login
(
String
phoneNumber
,
Integer
enterpriseId
,
String
password
);
Tab
Sys
User
login
(
String
phoneNumber
,
Integer
enterpriseId
,
String
password
);
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/UserRoleServiceImpl.java
0 → 100644
View file @
2bf401e2
package
com
.
gic
.
auth
.
service
.
impl
;
import
com.gic.auth.dao.mapper.TabSysUserRoleMapper
;
import
com.gic.auth.dto.UserRoleDTO
;
import
com.gic.auth.entity.TabSysUserRole
;
import
com.gic.auth.service.UserRoleService
;
import
com.gic.commons.util.EntityUtil
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
(
"userRoleService"
)
public
class
UserRoleServiceImpl
implements
UserRoleService
{
@Autowired
private
TabSysUserRoleMapper
tabSysUserRoleMapper
;
@Override
public
void
save
(
UserRoleDTO
dto
)
{
tabSysUserRoleMapper
.
insert
(
EntityUtil
.
changeEntityNew
(
TabSysUserRole
.
class
,
dto
));
}
@Override
public
void
deleteByUserId
(
Integer
userId
)
{
tabSysUserRoleMapper
.
deleteByUserId
(
userId
);
}
@Override
public
List
<
UserRoleDTO
>
listUserRoleByUserId
(
Integer
userId
)
{
List
<
TabSysUserRole
>
list
=
tabSysUserRoleMapper
.
listUserRoleByUserId
(
userId
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
return
EntityUtil
.
changeEntityListNew
(
UserRoleDTO
.
class
,
list
);
}
return
new
ArrayList
<>();
}
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/UserServiceImpl.java
View file @
2bf401e2
package
com
.
gic
.
auth
.
service
.
impl
;
import
com.gic.auth.dao.mapper.TabSysUserMapper
;
import
com.gic.auth.dto.UserDTO
;
import
com.gic.auth.entity.TabSysUser
;
import
com.gic.auth.entity.TabUser
;
import
com.gic.auth.service.UserService
;
import
com.gic.commons.util.EntityUtil
;
...
...
@@ -17,28 +19,28 @@ import java.util.List;
@Service
(
"userService"
)
public
class
UserServiceImpl
implements
UserService
{
@Autowired
private
Tab
UserMapper
tab
UserMapper
;
private
Tab
SysUserMapper
tabSys
UserMapper
;
@Override
public
int
saveUser
(
UserDTO
userDTO
)
{
Tab
User
tabUser
=
EntityUtil
.
changeEntityNew
(
Tab
User
.
class
,
userDTO
);
tabUserMapper
.
insert
(
tabUser
);
Tab
SysUser
tabUser
=
EntityUtil
.
changeEntityNew
(
TabSys
User
.
class
,
userDTO
);
tab
Sys
UserMapper
.
insert
(
tabUser
);
return
tabUser
.
getUserId
();
}
@Override
public
void
editUser
(
UserDTO
userDTO
)
{
Tab
User
tabUser
=
EntityUtil
.
changeEntityNew
(
Tab
User
.
class
,
userDTO
);
tabUserMapper
.
updateByPrimaryKeySelective
(
tabUser
);
Tab
SysUser
tabUser
=
EntityUtil
.
changeEntityNew
(
TabSys
User
.
class
,
userDTO
);
tab
Sys
UserMapper
.
updateByPrimaryKeySelective
(
tabUser
);
}
@Override
public
TabUser
getUserById
(
Integer
userId
)
{
return
tabUserMapper
.
selectByPrimaryKey
(
userId
);
public
Tab
Sys
User
getUserById
(
Integer
userId
)
{
return
tab
Sys
UserMapper
.
selectByPrimaryKey
(
userId
);
}
@Override
public
boolean
isPhoneRepeat
(
Integer
userId
,
String
phone
)
{
int
count
=
tabUserMapper
.
countByPhone
(
phone
,
userId
);
int
count
=
tab
Sys
UserMapper
.
countByPhone
(
phone
,
userId
);
if
(
count
>
0
)
{
return
true
;
}
...
...
@@ -46,17 +48,17 @@ public class UserServiceImpl implements UserService {
}
@Override
public
TabUser
getUserByEnterpriseId
(
Integer
enterpriseId
)
{
public
Tab
Sys
User
getUserByEnterpriseId
(
Integer
enterpriseId
)
{
return
null
;
}
@Override
public
List
<
TabUser
>
listAllUserByPhoneNumber
(
String
phoneNumber
)
{
return
this
.
tabUserMapper
.
listAllUserByPhoneNumber
(
phoneNumber
);
public
List
<
Tab
Sys
User
>
listAllUserByPhoneNumber
(
String
phoneNumber
)
{
return
this
.
tab
Sys
UserMapper
.
listAllUserByPhoneNumber
(
phoneNumber
);
}
@Override
public
TabUser
login
(
String
phoneNumber
,
Integer
enterpriseId
,
String
password
)
{
return
this
.
tabUserMapper
.
login
(
phoneNumber
,
password
,
enterpriseId
);
public
Tab
Sys
User
login
(
String
phoneNumber
,
Integer
enterpriseId
,
String
password
)
{
return
this
.
tab
Sys
UserMapper
.
login
(
phoneNumber
,
password
,
enterpriseId
);
}
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/UserResourceApiServiceImpl.java
0 → 100644
View file @
2bf401e2
package
com
.
gic
.
auth
.
service
.
outer
.
impl
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.dto.UserResourceDTO
;
import
com.gic.auth.service.UserResourceApiService
;
import
org.springframework.stereotype.Service
;
@Service
(
"userResourceApiService"
)
public
class
UserResourceApiServiceImpl
implements
UserResourceApiService
{
@Override
public
ServiceResponse
<
Void
>
save
(
UserResourceDTO
dto
)
{
return
null
;
}
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/UserRoleApiServiceImpl.java
0 → 100644
View file @
2bf401e2
package
com
.
gic
.
auth
.
service
.
outer
.
impl
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.dto.UserRoleDTO
;
import
com.gic.auth.entity.TabSysUser
;
import
com.gic.auth.service.UserRoleApiService
;
import
com.gic.auth.service.UserRoleService
;
import
com.gic.auth.service.UserService
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.utils.valid.ValidParamsUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
@Service
(
"userRoleApiService"
)
public
class
UserRoleApiServiceImpl
implements
UserRoleApiService
{
@Autowired
private
UserRoleService
userRoleService
;
@Autowired
private
UserService
userService
;
@Override
public
ServiceResponse
<
Void
>
save
(
UserRoleDTO
dto
)
{
ServiceResponse
paramValid
=
ValidParamsUtils
.
allCheckValidate
(
dto
,
UserRoleDTO
.
SaveUserRoleValid
.
class
);
if
(!
paramValid
.
isSuccess
())
{
return
paramValid
;
}
TabSysUser
user
=
userService
.
getUserById
(
dto
.
getUserId
());
if
(
user
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"用户数据有误,查无数据"
);
}
userRoleService
.
deleteByUserId
(
user
.
getUserId
());
dto
.
setCreateTime
(
new
Date
());
dto
.
setUpdateTime
(
new
Date
());
dto
.
setStatus
(
1
);
userRoleService
.
save
(
dto
);
return
ServiceResponse
.
success
();
}
}
gic-platform-auth-service/src/main/resources/mapper/TabSysUserMapper.xml
View file @
2bf401e2
...
...
@@ -174,4 +174,41 @@
login_type = #{loginType,jdbcType=INTEGER}
where user_id = #{userId,jdbcType=INTEGER}
</update>
<select
id=
"countByPhone"
resultType=
"int"
>
select count(1) from tab_sys_user
where status = 1
<if
test=
"userId != null"
>
user_id
<![CDATA[ <> ]]>
#{userId}
</if>
and phone_number = #{phone}
</select>
<select
id=
"selectByEnterpriseId"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_user
where enterprise_id = #{enterpriseId,jdbcType=INTEGER}
and status = 1
and super_admin = 1
</select>
<select
id=
"listAllUserByPhoneNumber"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_user
where phone_number = #{phoneNumber}
and status = 1
</select>
<select
id=
"login"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_user
where phone_number = #{phoneNumber}
and status = 1
and enterprise_id = #{enterpriseId}
and password = #{password}
</select>
</mapper>
\ No newline at end of file
gic-platform-auth-service/src/main/resources/mapper/TabSysUserRoleMapper.xml
View file @
2bf401e2
...
...
@@ -114,4 +114,18 @@
update_time = #{updateTime,jdbcType=TIMESTAMP}
where user_role_id = #{userRoleId,jdbcType=INTEGER}
</update>
<update
id=
"deleteByUserId"
parameterType=
"java.lang.Integer"
>
UPDATE tab_sys_user_role set status = 0
where user_id = #{userId}
and status = 1
</update>
<select
id=
"listUserRoleByUserId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_user_role
where user_id = #{userId}
and status = 1
</select>
</mapper>
\ No newline at end of file
gic-platform-auth-service/src/main/resources/mapper/TabUserMapper.xml
deleted
100644 → 0
View file @
4bca6a30
<?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.auth.dao.mapper.TabUserMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.gic.auth.entity.TabUser"
>
<id
column=
"user_id"
jdbcType=
"INTEGER"
property=
"userId"
/>
<result
column=
"user_name"
jdbcType=
"VARCHAR"
property=
"userName"
/>
<result
column=
"phone_number"
jdbcType=
"VARCHAR"
property=
"phoneNumber"
/>
<result
column=
"password"
jdbcType=
"VARCHAR"
property=
"password"
/>
<result
column=
"super_admin"
jdbcType=
"INTEGER"
property=
"superAdmin"
/>
<result
column=
"status"
jdbcType=
"INTEGER"
property=
"status"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"enterprise_id"
jdbcType=
"INTEGER"
property=
"enterpriseId"
/>
<result
column=
"phone_area_code"
jdbcType=
"VARCHAR"
property=
"phoneAreaCode"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
user_id, user_name, phone_number, password, super_admin, status, create_time, update_time,
enterprise_id, phone_area_code
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_user
where user_id = #{userId,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from tab_sys_user
where user_id = #{userId,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
parameterType=
"com.gic.auth.entity.TabUser"
useGeneratedKeys=
"true"
keyProperty=
"userId"
>
insert into tab_sys_user (user_id, user_name, phone_number,
password, super_admin, status,
create_time, update_time, enterprise_id,
phone_area_code)
values (#{userId,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{phoneNumber,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{superAdmin,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{enterpriseId,jdbcType=INTEGER},
#{phoneAreaCode,jdbcType=VARCHAR})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.gic.auth.entity.TabUser"
>
insert into tab_sys_user
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"userId != null"
>
user_id,
</if>
<if
test=
"userName != null"
>
user_name,
</if>
<if
test=
"phoneNumber != null"
>
phone_number,
</if>
<if
test=
"password != null"
>
password,
</if>
<if
test=
"superAdmin != null"
>
super_admin,
</if>
<if
test=
"status != null"
>
status,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"enterpriseId != null"
>
enterprise_id,
</if>
<if
test=
"phoneAreaCode != null"
>
phone_area_code,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"userId != null"
>
#{userId,jdbcType=INTEGER},
</if>
<if
test=
"userName != null"
>
#{userName,jdbcType=VARCHAR},
</if>
<if
test=
"phoneNumber != null"
>
#{phoneNumber,jdbcType=VARCHAR},
</if>
<if
test=
"password != null"
>
#{password,jdbcType=VARCHAR},
</if>
<if
test=
"superAdmin != null"
>
#{superAdmin,jdbcType=INTEGER},
</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>
<if
test=
"enterpriseId != null"
>
#{enterpriseId,jdbcType=INTEGER},
</if>
<if
test=
"phoneAreaCode != null"
>
#{phoneAreaCode,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.gic.auth.entity.TabUser"
>
update tab_sys_user
<set>
<if
test=
"userName != null"
>
user_name = #{userName,jdbcType=VARCHAR},
</if>
<if
test=
"phoneNumber != null"
>
phone_number = #{phoneNumber,jdbcType=VARCHAR},
</if>
<if
test=
"password != null"
>
password = #{password,jdbcType=VARCHAR},
</if>
<if
test=
"superAdmin != null"
>
super_admin = #{superAdmin,jdbcType=INTEGER},
</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>
<if
test=
"enterpriseId != null"
>
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
</if>
<if
test=
"phoneAreaCode != null"
>
phone_area_code = #{phoneAreaCode,jdbcType=VARCHAR},
</if>
</set>
where user_id = #{userId,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.gic.auth.entity.TabUser"
>
update tab_sys_user
set user_name = #{userName,jdbcType=VARCHAR},
phone_number = #{phoneNumber,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
super_admin = #{superAdmin,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
phone_area_code = #{phoneAreaCode,jdbcType=VARCHAR}
where user_id = #{userId,jdbcType=INTEGER}
</update>
<select
id=
"countByPhone"
resultType=
"int"
>
select count(1) from tab_sys_user
where status = 1
<if
test=
"userId != null"
>
user_id
<![CDATA[ <> ]]>
#{userId}
</if>
and phone_number = #{phone}
</select>
<select
id=
"selectByEnterpriseId"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_user
where enterprise_id = #{enterpriseId,jdbcType=INTEGER}
and status = 1
and super_admin = 1
</select>
<select
id=
"listAllUserByPhoneNumber"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_user
where phone_number = #{phoneNumber}
and status = 1
</select>
<select
id=
"login"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_user
where phone_number = #{phoneNumber}
and status = 1
and enterprise_id = #{enterpriseId}
and password = #{password}
</select>
</mapper>
\ No newline at end of file
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/UserController.java
0 → 100644
View file @
2bf401e2
package
com
.
gic
.
auth
.
web
.
controller
;
import
com.gic.auth.service.UserApiService
;
import
org.apache.log4j.LogManager
;
import
org.apache.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/user"
)
public
class
UserController
{
private
final
Logger
logger
=
LogManager
.
getLogger
(
UserController
.
class
);
@Autowired
private
UserApiService
userApiService
;
}
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