Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dm_project
Project
Project
Details
Activity
Releases
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
姚本章
dm_project
Commits
7c6d61b0
Commit
7c6d61b0
authored
Dec 02, 2020
by
zhangc
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dm_dev' of gitlab.ioubuy.cn:yaobenzhang/dm_project into dm_dev
parents
a9ebb74d
85e41fe9
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
144 additions
and
49 deletions
+144
-49
MybatisPlusConfig.java
...z/dm/mall/config/mybatisPlusConfig/MybatisPlusConfig.java
+1
-1
LoginController.java
...z/dm/mall/moduls/controller/customer/LoginController.java
+60
-0
MallCustomerController.java
...ll/moduls/controller/customer/MallCustomerController.java
+6
-19
MallCustomer.java
.../main/java/com/jz/dm/mall/moduls/entity/MallCustomer.java
+3
-0
MallCustomerDao.java
...in/java/com/jz/dm/mall/moduls/mapper/MallCustomerDao.java
+3
-1
MallCustomerService.java
...va/com/jz/dm/mall/moduls/service/MallCustomerService.java
+11
-3
MallCustomerServiceImpl.java
.../dm/mall/moduls/service/impl/MallCustomerServiceImpl.java
+16
-6
MallCustomerDao.xml
jz-dm-mall/src/main/resources/mapperconf/MallCustomerDao.xml
+13
-0
LoginController.java
.../com/jz/manage/moduls/controller/sys/LoginController.java
+21
-8
SysUserController.java
...om/jz/manage/moduls/controller/sys/SysUserController.java
+0
-8
SysUserDao.java
...src/main/java/com/jz/manage/moduls/mapper/SysUserDao.java
+0
-2
SysUserService.java
...ain/java/com/jz/manage/moduls/service/SysUserService.java
+3
-1
SysUserServiceImpl.java
...com/jz/manage/moduls/service/impl/SysUserServiceImpl.java
+7
-0
No files found.
jz-dm-mall/src/main/java/com/jz/dm/mall/config/mybatisPlusConfig/MybatisPlusConfig.java
View file @
7c6d61b0
...
...
@@ -15,7 +15,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
*/
@EnableTransactionManagement
@Configuration
@MapperScan
(
"com.jz.
manage
.moduls.mapper"
)
@MapperScan
(
"com.jz.
dm.mall
.moduls.mapper"
)
public
class
MybatisPlusConfig
{
@Bean
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/LoginController.java
0 → 100644
View file @
7c6d61b0
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
customer
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.StatusCode
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.dm.mall.moduls.service.MallCustomerService
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/2
* @Version:
*/
@RestController
@RequestMapping
(
"/customer"
)
@Api
(
tags
=
"商城登陆api"
)
public
class
LoginController
{
/**
* 服务对象
*/
@Autowired
private
MallCustomerService
mallCustomerService
;
@Autowired
private
RedisTemplate
redisTemplate
;
/**
* 登录功能
* @param username 账号
* @param password 密码
* @return
*/
@GetMapping
(
value
=
"/login"
)
public
Result
<
MallCustomer
>
login
(
String
username
,
String
password
)
{
// 手机
String
ph
=
"^[1][34578]\\d{9}$"
;
// 如果是手机验证
if
(
username
.
matches
(
username
))
{
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByPhone
(
username
);
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
.
getCustomerPhone
().
equals
(
username
)
&&
mallCustomer
.
getPassword
().
equals
(
password
)){
return
new
Result
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
);
}
return
new
Result
<>(
false
,
"用户名或密码错误!"
,
StatusCode
.
ERROR
);
}
}
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByAccount
(
username
);
if
(
mallCustomer
!=
null
)
{
if
(
mallCustomer
.
getCustomerAccount
().
equals
(
username
)
&&
mallCustomer
.
getPassword
().
equals
(
password
)){
return
new
Result
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
);
}
}
return
new
Result
<>(
false
,
"用户名或密码错误!"
,
StatusCode
.
ERROR
);
}
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/customer/MallCustomerController.java
View file @
7c6d61b0
...
...
@@ -2,8 +2,7 @@ package com.jz.dm.mall.moduls.controller.customer;
import
com.jz.common.base.BaseController
;
import
com.jz.common.constant.RedisMessageConstant
;
import
com.jz.common.entity.MallCustomer
;
import
com.jz.common.entity.SysUser
;
import
com.jz.dm.mall.moduls.entity.MallCustomer
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.StatusCode
;
import
com.jz.dm.mall.moduls.service.MallCustomerService
;
...
...
@@ -32,25 +31,13 @@ public class MallCustomerController extends BaseController {
@Autowired
private
RedisTemplate
redisTemplate
;
/**
* 登录功能
* @param customerAccount 账号
* @param password 密码
* @return
*/
@GetMapping
(
value
=
"/login"
)
public
Result
<
SysUser
>
login
(
String
customerAccount
,
String
password
)
{
// 获取用户的信息
MallCustomer
mallCustomer
=
mallCustomerService
.
selectByUsername
(
customerAccount
);
if
(
mallCustomer
==
null
)
{
return
new
Result
<>(
false
,
"用户不存在!"
,
StatusCode
.
LOGINERROR
);
}
if
(
mallCustomer
.
getCustomerAccount
().
equals
(
customerAccount
)
&&
mallCustomer
.
getPassword
().
equals
(
password
))
{
return
new
Result
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
);
}
return
new
Result
<>(
false
,
"用户名或密码错误!"
,
StatusCode
.
ERROR
);
@PostMapping
(
value
=
"/saveCustomer"
)
public
Result
saveCustomer
(
Map
<
String
,
String
>
paramMap
)
{
return
null
;
}
/**
* 手机号码校验
* @param paramMap
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/entity/MallCustomer.java
View file @
7c6d61b0
package
com
.
jz
.
dm
.
mall
.
moduls
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModel
;
...
...
@@ -19,6 +21,7 @@ public class MallCustomer implements Serializable {
/**
* 用户id
*/
@TableId
(
value
=
"customer_id"
,
type
=
IdType
.
AUTO
)
private
Long
customerId
;
/**
* 企业id
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/mapper/MallCustomerDao.java
View file @
7c6d61b0
package
com
.
jz
.
dm
.
mall
.
moduls
.
mapper
;
import
com.jz.common.base.BaseMapper
;
import
com.jz.
common
.entity.MallCustomer
;
import
com.jz.
dm.mall.moduls
.entity.MallCustomer
;
/**
* 商城用户(TMallCustomer)表数据库访问层
...
...
@@ -11,5 +11,7 @@ import com.jz.common.entity.MallCustomer;
*/
public
interface
MallCustomerDao
extends
BaseMapper
<
MallCustomer
>
{
MallCustomer
selectByAccount
(
String
username
);
MallCustomer
selectByPhone
(
String
username
);
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/MallCustomerService.java
View file @
7c6d61b0
package
com
.
jz
.
dm
.
mall
.
moduls
.
service
;
import
com.jz.
common
.entity.MallCustomer
;
import
com.jz.
dm.mall.moduls
.entity.MallCustomer
;
/**
* 商城用户(TMallCustomer)表服务接口
...
...
@@ -12,8 +12,16 @@ public interface MallCustomerService {
/**
* 通过用户账号进行查询
* @param
customerAccount
* @param
username
* @return
*/
MallCustomer
selectByUsername
(
String
customerAccount
);
MallCustomer
selectByAccount
(
String
username
);
/**
* 通过手机号进行查询
* @param username
* @return
*/
MallCustomer
selectByPhone
(
String
username
);
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/impl/MallCustomerServiceImpl.java
View file @
7c6d61b0
package
com
.
jz
.
dm
.
mall
.
moduls
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.jz.
common
.entity.MallCustomer
;
import
com.jz.
dm.mall.moduls
.entity.MallCustomer
;
import
com.jz.dm.mall.moduls.mapper.MallCustomerDao
;
import
com.jz.dm.mall.moduls.service.MallCustomerService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -21,13 +21,23 @@ public class MallCustomerServiceImpl implements MallCustomerService {
/**
* 通过用户账号进行查询
*
* @param
customerAccount
* @param
username
* @return
*/
@Override
public
MallCustomer
selectByUsername
(
String
customerAccount
)
{
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
queryWrapper
.
eq
(
"customer_account"
,
customerAccount
);
return
tMallCustomerDao
.
selectOne
(
queryWrapper
);
public
MallCustomer
selectByAccount
(
String
username
)
{
return
tMallCustomerDao
.
selectByAccount
(
username
);
}
/**
* 通过手机号进行查询
*
* @param username
* @return
*/
@Override
public
MallCustomer
selectByPhone
(
String
username
)
{
return
tMallCustomerDao
.
selectByPhone
(
username
);
}
}
\ No newline at end of file
jz-dm-mall/src/main/resources/mapperconf/MallCustomerDao.xml
View file @
7c6d61b0
...
...
@@ -165,4 +165,17 @@
delete from t_mall_customer where customer_id = #{customerId}
</delete>
<select
id=
"selectByAccount"
resultMap=
"TMallCustomerMap"
>
select
customer_id, department_id, password, customer_account, customer_name, customer_phone, customer_email, customer_address, customer_point, register_time, customer_level, identity_card, cre_time, upt_time, del_flag
from t_mall_customer
where customer_account = #{username};
</select>
<select
id=
"selectByPhone"
resultMap=
"TMallCustomerMap"
>
select
customer_id, department_id, password, customer_account, customer_name, customer_phone, customer_email, customer_address, customer_point, register_time, customer_level, identity_card, cre_time, upt_time, del_flag
from t_mall_customer
where customer_phone = #{username};
</select>
</mapper>
\ No newline at end of file
jz-dm-manage/src/main/java/com/jz/manage/moduls/controller/sys/LoginController.java
View file @
7c6d61b0
...
...
@@ -28,23 +28,36 @@ public class LoginController extends BaseController {
private
RedisTemplate
redisTemplate
;
/**
* 登录功能
* @param
account
账号
* @param
username
账号
* @param password 密码
* @return
*/
@GetMapping
(
value
=
"login"
)
public
Result
<
SysUser
>
login
(
String
account
,
String
password
)
{
// 获取用户的信息
SysUser
sysUser
=
sysUserService
.
selectByUsername
(
account
);
if
(
sysUser
==
null
)
{
return
new
Result
<>(
false
,
"用户不存在!"
,
StatusCode
.
LOGINERROR
);
public
Result
login
(
String
username
,
String
password
)
{
// 手机
String
ph
=
"^[1][34578]\\d{9}$"
;
// 如果是手机验证
if
(
username
.
matches
(
username
))
{
SysUser
sysUser
=
sysUserService
.
selectByPhone
(
username
);
if
(
sysUser
!=
null
)
{
if
(
sysUser
.
getTelephone
().
equals
(
username
)
&&
sysUser
.
getPassword
().
equals
(
password
)){
return
new
Result
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
);
}
return
new
Result
<>(
false
,
"用户名或密码错误!"
,
StatusCode
.
ERROR
);
}
}
if
(
sysUser
.
getAccount
().
equals
(
account
)
&&
sysUser
.
getPassword
().
equals
(
password
))
{
return
new
Result
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
);
SysUser
sysUser
=
sysUserService
.
selectByUsername
(
username
);
if
(
sysUser
!=
null
)
{
if
(
sysUser
.
getAccount
().
equals
(
username
)
&&
sysUser
.
getPassword
().
equals
(
password
)){
return
new
Result
<>(
true
,
"登录成功!"
,
StatusCode
.
OK
);
}
}
return
new
Result
<>(
false
,
"用户名或密码错误!"
,
StatusCode
.
ERROR
);
}
/**
* 手机号码校验
* @param paramMap
...
...
jz-dm-manage/src/main/java/com/jz/manage/moduls/controller/sys/SysUserController.java
View file @
7c6d61b0
...
...
@@ -7,7 +7,6 @@ import com.jz.manage.moduls.service.SysUserService;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -26,11 +25,4 @@ public class SysUserController extends BaseController {
*/
@Autowired
private
SysUserService
sysUserService
;
// @PostMapping("/register")
// public Result saveSysUser(@RequestBody SysUser sysUser) throws Exception{
// if (sysUser == null) {
// return new Result(false, "注册信息失败!");
// }
// }
}
\ No newline at end of file
jz-dm-manage/src/main/java/com/jz/manage/moduls/mapper/SysUserDao.java
View file @
7c6d61b0
...
...
@@ -17,6 +17,4 @@ public interface SysUserDao extends BaseMapper<SysUser> {
List
<
Map
>
getUserRoleByAccount
(
@Param
(
"account"
)
String
account
);
// void saveSysUser(SysUser)
}
\ No newline at end of file
jz-dm-manage/src/main/java/com/jz/manage/moduls/service/SysUserService.java
View file @
7c6d61b0
...
...
@@ -16,7 +16,9 @@ public interface SysUserService {
/*
* 通过用户帐号进行查询
* */
SysUser
selectByUsername
(
String
account
);
SysUser
selectByUsername
(
String
username
);
SysUser
selectByPhone
(
String
telephone
);
Map
<
String
,
Object
>
getUserRoleByAccount
(
String
account
);
}
\ No newline at end of file
jz-dm-manage/src/main/java/com/jz/manage/moduls/service/impl/SysUserServiceImpl.java
View file @
7c6d61b0
...
...
@@ -31,6 +31,13 @@ public class SysUserServiceImpl implements SysUserService {
return
sysUserDao
.
selectOne
(
queryWrapper
);
}
@Override
public
SysUser
selectByPhone
(
String
username
)
{
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
queryWrapper
.
eq
(
"telephone"
,
username
);
return
sysUserDao
.
selectOne
(
queryWrapper
);
}
@Override
public
Map
<
String
,
Object
>
getUserRoleByAccount
(
String
account
)
{
Set
<
String
>
roleSet
=
new
HashSet
<>();
...
...
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