Commit 88a0be2c authored by machengbo's avatar machengbo

Merge branch 'dm_dev' of http://gitlab.ioubuy.cn/yaobenzhang/dm_project into dm_dev

parents e6c4de2f 9dabe269
...@@ -2,19 +2,22 @@ package com.jz.dm.mall.moduls.controller.customer; ...@@ -2,19 +2,22 @@ package com.jz.dm.mall.moduls.controller.customer;
import com.jz.common.base.CurrentUser; import com.jz.common.base.CurrentUser;
import com.jz.common.constant.RedisMessageConstant;
import com.jz.dm.mall.moduls.entity.MallCustomer; import com.jz.dm.mall.moduls.entity.MallCustomer;
import com.jz.common.utils.Result; import com.jz.common.utils.Result;
import com.jz.common.utils.StatusCode; import com.jz.common.utils.StatusCode;
import com.jz.dm.mall.moduls.service.MallCustomerService; import com.jz.dm.mall.moduls.service.MallCustomerService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import org.apache.catalina.servlet4preview.http.HttpServletRequest; import org.apache.catalina.servlet4preview.http.HttpServletRequest;
import java.util.Map;
/** /**
* @ClassName: * @ClassName:
...@@ -57,8 +60,6 @@ public class LoginController { ...@@ -57,8 +60,6 @@ public class LoginController {
MallCustomer mallCustomer = mallCustomerService.selectByAccount(username, request); MallCustomer mallCustomer = mallCustomerService.selectByAccount(username, request);
if (mallCustomer != null) { if (mallCustomer != null) {
if (mallCustomer.getCustomerAccount().equals(username) && mallCustomer.getPassword().equals(password)){ if (mallCustomer.getCustomerAccount().equals(username) && mallCustomer.getPassword().equals(password)){
System.out.println(CurrentUser.getCurrentUser(request));
return new Result<>(true, "登录成功!", StatusCode.OK); return new Result<>(true, "登录成功!", StatusCode.OK);
} }
} }
...@@ -66,4 +67,76 @@ public class LoginController { ...@@ -66,4 +67,76 @@ public class LoginController {
return new Result<>(false, "用户名或密码错误!", StatusCode.ERROR); return new Result<>(false, "用户名或密码错误!", StatusCode.ERROR);
} }
/**
* 手机获取验证码
* @param paramMap
* @return
*/
@PostMapping(value = "/getCode")
public Result loginCheck(@RequestParam(required = false) Map<String, String> paramMap) {
// 获取手机号码
String telephone = paramMap.get("telephone");
String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
// 获取redis中key对应的值
String codeInRedis = (String) redisTemplate.opsForValue().get(key);
if (StringUtils.isEmpty(codeInRedis)) {
return new Result(false, "请重新获取验证码!", StatusCode.ERROR);
}
// 判断验证码是否一致
if (!codeInRedis.equals(paramMap.get("validateCode"))) {
return new Result(false, "验证码不正确!", StatusCode.ERROR);
}
// 删除redis的验证码
redisTemplate.delete(key);
return new Result(true, "验证码正确!", StatusCode.OK);
}
/**
* 手机号码校验
* @param telephone
* @return
*/
@GetMapping(value = "/phoneCheck")
@ApiOperation(value = "手机号码校验接口", notes = "手机号码是否已注册")
public Result phoneCheck(String telephone) {
if (telephone == null) {
return new Result(false, "请重新输入手机号!");
}
MallCustomer mallCustomer = mallCustomerService.selectByPhone(telephone);
if (mallCustomer != null) {
return new Result(false, "手机号码已注册!");
}
return new Result(true, "手机号码未注册!");
}
/**
* 手机号码及用户名重复校验
* @param username
* @param telephone
* @param request
* @return
*/
@GetMapping(value = "/phoneUserCheck")
@ApiOperation(value = "手机号用户名重复校验接口", notes = "手机号用户名是否重复")
public Result phoneCheck(String username, String telephone, HttpServletRequest request) {
String ph = "^[1][34578]\\d{9}$";
if (telephone.matches(ph)) {
MallCustomer mallCustomer = mallCustomerService.selectByPhone(telephone);
if (mallCustomer != null) {
if (mallCustomer.getCustomerPhone().equals(telephone)) {
return new Result(false, "手机号相同");
}
}
}
// 根据手机号查询用户信息
MallCustomer mallCustomer = mallCustomerService.selectByAccount(username, request);
if (mallCustomer != null) {
if (mallCustomer.getCustomerAccount().equals(username)) {
return new Result(false, "用户名相同!");
}
}
return new Result(true, "用户名不同!");
}
} }
package com.jz.dm.mall.moduls.controller.customer; package com.jz.dm.mall.moduls.controller.customer;
import com.baomidou.mybatisplus.extension.api.R;
import com.jz.common.base.BaseController; import com.jz.common.base.BaseController;
import com.jz.common.constant.RedisMessageConstant; import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.constant.ResultCode; import com.jz.common.constant.ResultCode;
...@@ -8,11 +9,14 @@ import com.jz.dm.mall.moduls.entity.MallCustomer; ...@@ -8,11 +9,14 @@ import com.jz.dm.mall.moduls.entity.MallCustomer;
import com.jz.common.utils.Result; import com.jz.common.utils.Result;
import com.jz.common.utils.StatusCode; import com.jz.common.utils.StatusCode;
import com.jz.dm.mall.moduls.service.MallCustomerService; import com.jz.dm.mall.moduls.service.MallCustomerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Map; import java.util.Map;
...@@ -24,6 +28,7 @@ import java.util.Map; ...@@ -24,6 +28,7 @@ import java.util.Map;
*/ */
@RestController @RestController
@RequestMapping("/mallCustomer") @RequestMapping("/mallCustomer")
@Api(tags = "商城用户api")
public class MallCustomerController extends BaseController { public class MallCustomerController extends BaseController {
/** /**
* 服务对象 * 服务对象
...@@ -40,51 +45,31 @@ public class MallCustomerController extends BaseController { ...@@ -40,51 +45,31 @@ public class MallCustomerController extends BaseController {
* @return * @return
*/ */
@PostMapping("/saveCustomer") @PostMapping("/saveCustomer")
public Result saveCustomer(@RequestParam(required = false) Map<String, String> paramMap) { @ApiOperation(value = "注册用户", notes = "添加用户")
public Result saveCustomer(@RequestParam(required = false) Map<String, String> paramMap, HttpServletRequest request) {
if (paramMap != null) { if (paramMap != null) {
String username = paramMap.get("username"); String username = paramMap.get("username");
String telephone = paramMap.get("telephone"); String telephone = paramMap.get("telephone");
if (username == null) { String ph = "^[1][34578]\\d{9}$";
return new Result(false, "请输入用户名!"); if (telephone.matches(ph)) {
MallCustomer mallCustomer = mallCustomerService.selectByPhone(telephone);
if (mallCustomer != null) {
if (mallCustomer.getCustomerPhone().equals(telephone)) {
return new Result(false, "手机号相同");
} }
// // 根据用户名查询用户信息
//// MallCustomer mallCustomer = mallCustomerService.selectByAccount(username);
//// if (mallCustomer.getCustomerAccount().equals(username)) {
//// return new Result(false, "用户名相同!");
//// }
//// if (mallCustomer.getCustomerPhone().equals(telephone)) {
//// return new Result(false,"手机号相同!");
//// }
mallCustomerService.saveCustomer(paramMap);
return new Result(true, "注册成功!", StatusCode.OK);
} }
return new Result(false, "注册失败!", StatusCode.ERROR);
} }
// 根据手机号查询用户信息
/** MallCustomer mallCustomer = mallCustomerService.selectByAccount(username, request);
* 手机号码校验 if (mallCustomer != null) {
* @param paramMap if (mallCustomer.getCustomerAccount().equals(username)) {
* @return return new Result(false, "用户名相同");
*/
@PostMapping(value = "/check")
public Result loginCheck(@RequestBody Map<String, String> paramMap) {
// 获取手机号码
String telephone = paramMap.get("telephone");
String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
// 获取redis中key对应的值
String codeInRedis = (String) redisTemplate.opsForValue().get(key);
if (StringUtils.isEmpty(codeInRedis)) {
return new Result(false, "请重新获取验证码!", StatusCode.ERROR);
} }
// 判断验证码是否一致
if (!codeInRedis.equals(paramMap.get("validateCode"))) {
return new Result(false, "验证码不正确!", StatusCode.ERROR);
} }
// 删除redis的验证码 mallCustomerService.saveCustomer(paramMap);
redisTemplate.delete(key); return new Result(true, "注册成功!", StatusCode.OK);
}
return new Result(true, "验证码正确!", StatusCode.OK); return new Result(false, "注册失败!", StatusCode.ERROR);
} }
} }
\ No newline at end of file
...@@ -11,10 +11,7 @@ import io.swagger.annotations.Api; ...@@ -11,10 +11,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
/** /**
...@@ -36,13 +33,24 @@ public class LogInfoController { ...@@ -36,13 +33,24 @@ public class LogInfoController {
private LogInfoService logInfoService; private LogInfoService logInfoService;
/** /**
* @Description: 添加企业认证信息 * @Description: 获取商城用户日志信息列表
* @Author: Mr.zhang * @Author: Mr.zhang
* @Date: 2020-12-2 * @Date: 2020-12-2
*/ */
@PostMapping("/getMallLogInfo") @PostMapping("/getMallLogInfo")
@ApiOperation(value = "获取商城用户日志信息") @ApiOperation(value = "获取商城用户日志信息列表")
public Mono<Result<PageInfoResponse<PlatformLog>>> getLogInfo(@RequestBody @Validated LogInfoQueryReq req) { public Mono<Result<PageInfoResponse<PlatformLog>>> getLogInfo(@RequestBody @Validated LogInfoQueryReq req) {
return Mono.fromSupplier(() -> logInfoService.getMallUserLogInfo(req)); return Mono.fromSupplier(() -> logInfoService.getMallUserLogInfo(req));
} }
/**
* @Description: 获取商城用户日志信息详情
* @Author: Mr.zhang
* @Date: 2020-12-2
*/
@PostMapping("/getMallLogDetail")
@ApiOperation(value = "获取商城用户日志信息详情")
public Mono<Result> getLogInfoDetail(@RequestParam(value = "日志信息Id") Long platformLogId) {
return Mono.fromSupplier(() -> logInfoService.getMallUserLogDetail(platformLogId));
}
} }
...@@ -30,10 +30,22 @@ public interface MallCustomerDao extends BaseMapper<MallCustomer> { ...@@ -30,10 +30,22 @@ public interface MallCustomerDao extends BaseMapper<MallCustomer> {
*/ */
MallCustomer selectByPhone(String username); MallCustomer selectByPhone(String username);
/**
* 根据手机号查询是否已注册
* @param telephone
* @return
*/
MallCustomer selectByPhoneExist(String telephone);
/**
* 添加用户
* @param mallCustomer
*/
@Insert("INSERT into t_mall_customer(customer_account, customer_phone, password) VALUES (#{customerAccount},#{customerPhone}, #{password})") @Insert("INSERT into t_mall_customer(customer_account, customer_phone, password) VALUES (#{customerAccount},#{customerPhone}, #{password})")
@ResultType(MallCustomer.class)
void saveCustomer(MallCustomer mallCustomer); void saveCustomer(MallCustomer mallCustomer);
/** /**
* 根据ID查询用户信息 * 根据ID查询用户信息
* @param customerId * @param customerId
......
...@@ -23,4 +23,11 @@ public interface LogInfoService { ...@@ -23,4 +23,11 @@ public interface LogInfoService {
* @return * @return
*/ */
Result<PageInfoResponse<PlatformLog>> getMallUserLogInfo(LogInfoQueryReq req); Result<PageInfoResponse<PlatformLog>> getMallUserLogInfo(LogInfoQueryReq req);
/**
* 获取商城用户日志信息详情
* @param platformLogId
* @return
*/
Result getMallUserLogDetail(Long platformLogId);
} }
...@@ -32,4 +32,12 @@ public interface MallCustomerService { ...@@ -32,4 +32,12 @@ public interface MallCustomerService {
* @param paramMap * @param paramMap
*/ */
void saveCustomer(Map<String, String> paramMap); void saveCustomer(Map<String, String> paramMap);
/**
* 通过手机号查询是否已注册
* @param telephone
* @return
*/
MallCustomer selectByPhone(String telephone);
} }
\ No newline at end of file
...@@ -59,4 +59,18 @@ public class LogInfoServiceImpl implements LogInfoService { ...@@ -59,4 +59,18 @@ public class LogInfoServiceImpl implements LogInfoService {
pageInfoResponse.setData(pageInfo); pageInfoResponse.setData(pageInfo);
return Result.of_success(pageInfoResponse); return Result.of_success(pageInfoResponse);
} }
/**
* 获取商城用户日志信息详情
* @param platformLogId
* @return
*/
@Override
public Result getMallUserLogDetail(Long platformLogId) {
PlatformLog platformLog = platformLogDao.selectById(platformLogId);
if (null == platformLog){
return Result.of_error(ResultMsg.DATA_NOT_FOUND);
}
return Result.of_success(platformLog);
}
} }
...@@ -3,6 +3,7 @@ package com.jz.dm.mall.moduls.service.impl; ...@@ -3,6 +3,7 @@ package com.jz.dm.mall.moduls.service.impl;
import com.jz.common.constant.RedisMessageConstant; import com.jz.common.constant.RedisMessageConstant;
import com.jz.common.enums.UserTypeEnum; import com.jz.common.enums.UserTypeEnum;
import com.jz.common.utils.Result;
import com.jz.common.utils.SessionUtils; import com.jz.common.utils.SessionUtils;
import com.jz.common.bean.MallCustomerApiDto; import com.jz.common.bean.MallCustomerApiDto;
import com.jz.dm.mall.moduls.entity.MallCustomer; import com.jz.dm.mall.moduls.entity.MallCustomer;
...@@ -59,8 +60,6 @@ public class MallCustomerServiceImpl implements MallCustomerService { ...@@ -59,8 +60,6 @@ public class MallCustomerServiceImpl implements MallCustomerService {
return mallCustomer; return mallCustomer;
} }
/** /**
* 通过手机号进行查询 * 通过手机号进行查询
* *
...@@ -96,18 +95,35 @@ public class MallCustomerServiceImpl implements MallCustomerService { ...@@ -96,18 +95,35 @@ public class MallCustomerServiceImpl implements MallCustomerService {
MallCustomer mallCustomer = new MallCustomer(); MallCustomer mallCustomer = new MallCustomer();
// 获取验证码 // 获取验证码
String vailCode = paramMap.get("vailCode"); String vailCode = paramMap.get("vailCode");
String username = paramMap.get("username");
String telephone = paramMap.get("telephone"); String telephone = paramMap.get("telephone");
// 从redis获取验证码 // 从redis获取验证码
// String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone; // String key = RedisMessageConstant.SENDTYPE_LOGIN + "_" + telephone;
String key = "18179617425"; String key = "18179617425";
// String codeInRedis = (String) redisTemplate.opsForValue().get(key); // String codeInRedis = (String) redisTemplate.opsForValue().get(key);
String codeInRedis = "147826"; String codeInRedis = "147826";
if (codeInRedis.equals(vailCode)) { if (codeInRedis.equals(vailCode)) {
mallCustomer.setCustomerAccount(paramMap.get("username")); mallCustomer.setCustomerAccount(username);
mallCustomer.setPassword(paramMap.get("password")); mallCustomer.setPassword(paramMap.get("password"));
mallCustomer.setCustomerPhone(telephone); mallCustomer.setCustomerPhone(telephone);
tMallCustomerDao.saveCustomer(mallCustomer); tMallCustomerDao.saveCustomer(mallCustomer);
} }
} }
/**
* 通过手机号查询是否已注册
*
* @param telephone@return
*/
@Override
public MallCustomer selectByPhone(String telephone) {
MallCustomer mallCustomer = tMallCustomerDao.selectByPhoneExist(telephone);
if (mallCustomer != null) {
return mallCustomer;
}
return null;
}
} }
\ No newline at end of file
...@@ -178,4 +178,11 @@ ...@@ -178,4 +178,11 @@
from t_mall_customer from t_mall_customer
where customer_phone = #{username}; where customer_phone = #{username};
</select> </select>
<select id="selectByPhoneExist" 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 = #{telephone};
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -3,5 +3,7 @@ ...@@ -3,5 +3,7 @@
<mapper namespace="com.jz.dm.mall.moduls.mapper.PlatformLogDao"> <mapper namespace="com.jz.dm.mall.moduls.mapper.PlatformLogDao">
<select id="listMallLogInfo" resultType="com.jz.common.entity.PlatformLog">
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -141,6 +141,10 @@ ...@@ -141,6 +141,10 @@
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
</dependency>
<!--阿里云服务器短信平台--> <!--阿里云服务器短信平台-->
<dependency> <dependency>
<groupId>com.aliyun</groupId> <groupId>com.aliyun</groupId>
......
package com.jz.manage.moduls.controller.log; package com.jz.manage.moduls.controller.log;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.entity.PlatformLog;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.controller.BaseController; import com.jz.manage.moduls.controller.BaseController;
import com.jz.manage.moduls.controller.log.bean.ManageLogInfoQueryReq;
import com.jz.manage.moduls.service.PlatformLogService; import com.jz.manage.moduls.service.PlatformLogService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;
/** /**
* 日志管理(TPlatformLog)表控制层 * 日志管理(TPlatformLog)表控制层
...@@ -21,5 +27,25 @@ public class PlatformLogController extends BaseController { ...@@ -21,5 +27,25 @@ public class PlatformLogController extends BaseController {
@Autowired @Autowired
private PlatformLogService tPlatformLogService; private PlatformLogService tPlatformLogService;
/**
* @Description: 后台用户日志信息列表
* @Author: Mr.zhang
* @Date: 2020-12-2
*/
@PostMapping("/listManageLogInfo")
@ApiOperation(value = "后台用户日志信息列表")
public Mono<Result<PageInfoResponse<PlatformLog>>> getLogInfo(@RequestBody @Validated ManageLogInfoQueryReq req) {
return Mono.fromSupplier(() -> tPlatformLogService.listManageUserLogInfo(req));
}
/**
* @Description: 获取用户日志信息详情
* @Author: Mr.zhang
* @Date: 2020-12-2
*/
@PostMapping("/getLogDetail")
@ApiOperation(value = "获取用户日志信息详情")
public Mono<Result> getLogInfoDetail(@RequestParam(value = "日志信息Id") Long platformLogId) {
return Mono.fromSupplier(() -> tPlatformLogService.getMallUserLogDetail(platformLogId));
}
} }
\ No newline at end of file
...@@ -3,6 +3,8 @@ package com.jz.manage.moduls.mapper; ...@@ -3,6 +3,8 @@ package com.jz.manage.moduls.mapper;
import com.jz.common.base.BaseMapper; import com.jz.common.base.BaseMapper;
import com.jz.common.entity.PlatformLog; import com.jz.common.entity.PlatformLog;
import java.util.List;
/** /**
* 日志管理(TPlatformLog)表数据库访问层 * 日志管理(TPlatformLog)表数据库访问层
* *
...@@ -11,4 +13,11 @@ import com.jz.common.entity.PlatformLog; ...@@ -11,4 +13,11 @@ import com.jz.common.entity.PlatformLog;
*/ */
public interface PlatformLogDao extends BaseMapper<PlatformLog> { public interface PlatformLogDao extends BaseMapper<PlatformLog> {
/**
* 查询平台用户日志列表
* @return
*/
List<PlatformLog> listMallLogInfo();
} }
\ No newline at end of file
package com.jz.manage.moduls.service; package com.jz.manage.moduls.service;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.entity.PlatformLog;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.controller.log.bean.ManageLogInfoQueryReq;
/** /**
* 日志管理(TPlatformLog)表服务接口 * 日志管理(TPlatformLog)表服务接口
* *
...@@ -9,4 +14,17 @@ package com.jz.manage.moduls.service; ...@@ -9,4 +14,17 @@ package com.jz.manage.moduls.service;
public interface PlatformLogService { public interface PlatformLogService {
/**
* 平台用户日志列表
* @param req
* @return
*/
Result<PageInfoResponse<PlatformLog>> listManageUserLogInfo(ManageLogInfoQueryReq req);
/**
* 获取用户日志详情
* @param platformLogId
* @return
*/
Result getMallUserLogDetail(Long platformLogId);
} }
\ No newline at end of file
package com.jz.manage.moduls.service.impl; package com.jz.manage.moduls.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.constant.ResultMsg;
import com.jz.common.entity.PlatformLog;
import com.jz.common.utils.Result;
import com.jz.manage.moduls.controller.log.bean.ManageLogInfoQueryReq;
import com.jz.manage.moduls.mapper.PlatformLogDao; import com.jz.manage.moduls.mapper.PlatformLogDao;
import com.jz.manage.moduls.service.PlatformLogService; import com.jz.manage.moduls.service.PlatformLogService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 日志管理(TPlatformLog)表服务实现类 * 日志管理(TPlatformLog)表服务实现类
* *
...@@ -15,4 +25,31 @@ import org.springframework.stereotype.Service; ...@@ -15,4 +25,31 @@ import org.springframework.stereotype.Service;
public class PlatformLogServiceImpl implements PlatformLogService { public class PlatformLogServiceImpl implements PlatformLogService {
@Autowired @Autowired
private PlatformLogDao tPlatformLogDao; private PlatformLogDao tPlatformLogDao;
@Override
public Result<PageInfoResponse<PlatformLog>> listManageUserLogInfo(ManageLogInfoQueryReq req) {
PageInfoResponse<PlatformLog> pageInfoResponse = new PageInfoResponse<>();
PageHelper.startPage(req.getPageNum(), req.getPageSize());
List<PlatformLog> list = tPlatformLogDao.listMallLogInfo();
PageInfo<PlatformLog> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(Constants.SUCCESS_CODE);
pageInfoResponse.setMessage(ResultMsg.SUCCESS.getMsg());
pageInfoResponse.setData(pageInfo);
return Result.of_success(pageInfoResponse);
}
/**
* 获取用户日志详情
* @param platformLogId
* @return
*/
@Override
public Result getMallUserLogDetail(Long platformLogId) {
PlatformLog platformLog = tPlatformLogDao.selectById(platformLogId);
if (null == platformLog){
return Result.of_error(ResultMsg.DATA_NOT_FOUND);
}
return Result.of_success(platformLog);
}
} }
\ No newline at end of file
...@@ -25,189 +25,8 @@ ...@@ -25,189 +25,8 @@
<result property="creTime" column="cre_time" jdbcType="TIMESTAMP"/> <result property="creTime" column="cre_time" jdbcType="TIMESTAMP"/>
<result property="delFlag" column="del_flag" jdbcType="VARCHAR"/> <result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<select id="listMallLogInfo" resultMap="TPlatformLogMap">
<!--查询单个--> SELECT * FROM t_t_platform_log
<select id="queryById" resultMap="TPlatformLogMap">
select
platform_log_id, request_ip, caller_id, data_goods_id, api_key, request_params, return_params, request_url, request_time, service_type, data_goods_type, download_address, data_price, price_type, total_times, used_times, remain_times, start_time, end_time, cre_time, del_flag
from t_platform_log
where platform_log_id = #{platformLogId}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="TPlatformLogMap">
select
platform_log_id, request_ip, caller_id, data_goods_id, api_key, request_params, return_params, request_url, request_time, service_type, data_goods_type, download_address, data_price, price_type, total_times, used_times, remain_times, start_time, end_time, cre_time, del_flag
from t_platform_log
limit #{offset}, #{limit}
</select>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="TPlatformLogMap">
select
platform_log_id, request_ip, caller_id, data_goods_id, api_key, request_params, return_params, request_url,
request_time, service_type, data_goods_type, download_address, data_price, price_type, total_times, used_times,
remain_times, start_time, end_time, cre_time, del_flag
from t_platform_log
<where>
<if test="platformLogId != null">
and platform_log_id = #{platformLogId}
</if>
<if test="requestIp != null and requestIp != ''">
and request_ip = #{requestIp}
</if>
<if test="callerId != null and callerId != ''">
and caller_id = #{callerId}
</if>
<if test="dataGoodsId != null">
and data_goods_id = #{dataGoodsId}
</if>
<if test="apiKey != null and apiKey != ''">
and api_key = #{apiKey}
</if>
<if test="requestParams != null and requestParams != ''">
and request_params = #{requestParams}
</if>
<if test="returnParams != null and returnParams != ''">
and return_params = #{returnParams}
</if>
<if test="requestUrl != null and requestUrl != ''">
and request_url = #{requestUrl}
</if>
<if test="requestTime != null">
and request_time = #{requestTime}
</if>
<if test="serviceType != null and serviceType != ''">
and service_type = #{serviceType}
</if>
<if test="dataGoodsType != null and dataGoodsType != ''">
and data_goods_type = #{dataGoodsType}
</if>
<if test="downloadAddress != null and downloadAddress != ''">
and download_address = #{downloadAddress}
</if>
<if test="dataPrice != null">
and data_price = #{dataPrice}
</if>
<if test="priceType != null and priceType != ''">
and price_type = #{priceType}
</if>
<if test="totalTimes != null">
and total_times = #{totalTimes}
</if>
<if test="usedTimes != null">
and used_times = #{usedTimes}
</if>
<if test="remainTimes != null">
and remain_times = #{remainTimes}
</if>
<if test="startTime != null">
and start_time = #{startTime}
</if>
<if test="endTime != null">
and end_time = #{endTime}
</if>
<if test="creTime != null">
and cre_time = #{creTime}
</if>
<if test="delFlag != null and delFlag != ''">
and del_flag = #{delFlag}
</if>
</where>
</select> </select>
<!--新增所有列-->
<insert id="insert" keyProperty="platformLogId" useGeneratedKeys="true">
insert into t_platform_log(request_ip, caller_id, data_goods_id, api_key, request_params, return_params, request_url, request_time, service_type, data_goods_type, download_address, data_price, price_type, total_times, used_times, remain_times, start_time, end_time, cre_time, del_flag)
values (#{requestIp}, #{callerId}, #{dataGoodsId}, #{apiKey}, #{requestParams}, #{returnParams}, #{requestUrl}, #{requestTime}, #{serviceType}, #{dataGoodsType}, #{downloadAddress}, #{dataPrice}, #{priceType}, #{totalTimes}, #{usedTimes}, #{remainTimes}, #{startTime}, #{endTime}, #{creTime}, #{delFlag})
</insert>
<insert id="insertBatch" keyProperty="platformLogId" useGeneratedKeys="true">
insert into t_platform_log(request_ip, caller_id, data_goods_id, api_key, request_params,
return_params, request_url, request_time, service_type, data_goods_type, download_address, data_price,
price_type, total_times, used_times, remain_times, start_time, end_time, cre_time, del_flag)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.requestIp}, #{entity.callerId}, #{entity.dataGoodsId}, #{entity.apiKey}, #{entity.requestParams},
#{entity.returnParams}, #{entity.requestUrl}, #{entity.requestTime}, #{entity.serviceType},
#{entity.dataGoodsType}, #{entity.downloadAddress}, #{entity.dataPrice}, #{entity.priceType},
#{entity.totalTimes}, #{entity.usedTimes}, #{entity.remainTimes}, #{entity.startTime}, #{entity.endTime},
#{entity.creTime}, #{entity.delFlag})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update t_platform_log
<set>
<if test="requestIp != null and requestIp != ''">
request_ip = #{requestIp},
</if>
<if test="callerId != null and callerId != ''">
caller_id = #{callerId},
</if>
<if test="dataGoodsId != null">
data_goods_id = #{dataGoodsId},
</if>
<if test="apiKey != null and apiKey != ''">
api_key = #{apiKey},
</if>
<if test="requestParams != null and requestParams != ''">
request_params = #{requestParams},
</if>
<if test="returnParams != null and returnParams != ''">
return_params = #{returnParams},
</if>
<if test="requestUrl != null and requestUrl != ''">
request_url = #{requestUrl},
</if>
<if test="requestTime != null">
request_time = #{requestTime},
</if>
<if test="serviceType != null and serviceType != ''">
service_type = #{serviceType},
</if>
<if test="dataGoodsType != null and dataGoodsType != ''">
data_goods_type = #{dataGoodsType},
</if>
<if test="downloadAddress != null and downloadAddress != ''">
download_address = #{downloadAddress},
</if>
<if test="dataPrice != null">
data_price = #{dataPrice},
</if>
<if test="priceType != null and priceType != ''">
price_type = #{priceType},
</if>
<if test="totalTimes != null">
total_times = #{totalTimes},
</if>
<if test="usedTimes != null">
used_times = #{usedTimes},
</if>
<if test="remainTimes != null">
remain_times = #{remainTimes},
</if>
<if test="startTime != null">
start_time = #{startTime},
</if>
<if test="endTime != null">
end_time = #{endTime},
</if>
<if test="creTime != null">
cre_time = #{creTime},
</if>
<if test="delFlag != null and delFlag != ''">
del_flag = #{delFlag},
</if>
</set>
where platform_log_id = #{platformLogId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from t_platform_log where platform_log_id = #{platformLogId}
</delete>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment