Commit bdf3b516 by ypenglv

Merge branch 'dev' of http://gitlab.polyhome.net/polysoft-nafmii/polysoft-parent into dev

# Conflicts:
#	nafmii-app/pom.xml
#	nafmii-app/src/main/java/org/nafmii/controller/UserController.java
#	nafmii-app/src/main/java/org/nafmii/service/UserService.java
#	nafmii-app/src/main/java/org/nafmii/service/impl/UserServiceImpl.java
#	nafmii-mbg/src/main/java/org/nafmii/nafmiimbg/model/CenterRole.java
#	nafmii-mbg/src/main/java/org/nafmii/nafmiimbg/model/CenterRoleExample.java
#	nafmii-mbg/src/main/resources/org/nafmii/nafmiimbg/mapper/CenterRoleMapper.xml
1 parent 95cbb269
package org.nafmii; package org.nafmii;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
...@@ -8,6 +9,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients; ...@@ -8,6 +9,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication(scanBasePackages={"org.nafmii","org.nafmii.exception"}) @SpringBootApplication(scanBasePackages={"org.nafmii","org.nafmii.exception"})
@EnableEurekaClient @EnableEurekaClient
@EnableFeignClients @EnableFeignClients
@MapperScan("org.nafmii/**/mapper")
public class NafmiiAppApplication { public class NafmiiAppApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -3,11 +3,10 @@ package org.nafmii.controller; ...@@ -3,11 +3,10 @@ package org.nafmii.controller;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.nafmii.dto.user.RegisterDto; import org.nafmii.dto.user.RegisterDto;
import org.nafmii.response.Result; import org.nafmii.response.ApiResponse;
import org.nafmii.service.UserService; import org.nafmii.service.UserService;
import org.nafmii.vo.UserVO; import org.nafmii.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
/** /**
...@@ -28,16 +27,16 @@ public class UserController { ...@@ -28,16 +27,16 @@ public class UserController {
@ApiOperation( value = "模拟用户登陆",notes = "模拟用户登陆") @ApiOperation( value = "模拟用户登陆",notes = "模拟用户登陆")
@PostMapping("/login") @PostMapping("/login")
@ResponseBody @ResponseBody
public Result<UserVO> login (){ public ApiResponse<UserVO> login (){
Result<UserVO> login = userService.login(); ApiResponse<UserVO> login = userService.login();
return login; return login;
} }
@ApiOperation( value = "app用户注册接口",notes = "app用户注册接口") @ApiOperation( value = "app用户注册接口",notes = "app用户注册接口")
@PostMapping("/register") @PostMapping("/register")
@ResponseBody @ResponseBody
public Result register (@RequestBody RegisterDto registerDto){ public ApiResponse register (@RequestBody RegisterDto registerDto){
Result register = userService.register(registerDto); ApiResponse register = userService.register(registerDto);
return register; return register;
} }
......
package org.nafmii.mapper.user; package org.nafmii.mapper.user;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.nafmii.entity.user.AppUser; import org.nafmii.entity.user.AppUser;
import org.nafmii.entity.user.AppUserExample; import org.nafmii.entity.user.AppUserExample;
import java.util.List; import java.util.List;
@Mapper
public interface AppUserMapper { public interface AppUserMapper {
long countByExample(AppUserExample example); long countByExample(AppUserExample example);
......
package org.nafmii.service; package org.nafmii.service;
import org.nafmii.dto.user.RegisterDto; import org.nafmii.dto.user.RegisterDto;
import org.nafmii.response.Result; import org.nafmii.response.ApiResponse;
import org.nafmii.vo.UserVO; import org.nafmii.vo.UserVO;
/** /**
...@@ -14,7 +14,7 @@ import org.nafmii.vo.UserVO; ...@@ -14,7 +14,7 @@ import org.nafmii.vo.UserVO;
*/ */
public interface UserService { public interface UserService {
//模拟用户登陆接口 //模拟用户登陆接口
Result<UserVO> login(); ApiResponse<UserVO> login();
//app注册接口 //app注册接口
Result register(RegisterDto registerDto); ApiResponse register(RegisterDto registerDto);
} }
...@@ -8,7 +8,7 @@ import org.nafmii.entity.user.AppUser; ...@@ -8,7 +8,7 @@ import org.nafmii.entity.user.AppUser;
import org.nafmii.enums.UserEnum; import org.nafmii.enums.UserEnum;
import org.nafmii.exception.BusinessException; import org.nafmii.exception.BusinessException;
import org.nafmii.mapper.user.AppUserMapper; import org.nafmii.mapper.user.AppUserMapper;
import org.nafmii.response.Result; import org.nafmii.response.ApiResponse;
import org.nafmii.service.UserService; import org.nafmii.service.UserService;
import org.nafmii.utils.GuavaUtil; import org.nafmii.utils.GuavaUtil;
import org.nafmii.utils.JwtUtils; import org.nafmii.utils.JwtUtils;
...@@ -18,6 +18,7 @@ import org.nafmii.vo.UserVO; ...@@ -18,6 +18,7 @@ import org.nafmii.vo.UserVO;
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 javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -34,15 +35,15 @@ import java.util.List; ...@@ -34,15 +35,15 @@ import java.util.List;
@Slf4j @Slf4j
public class UserServiceImpl implements UserService { public class UserServiceImpl implements UserService {
@Autowired @Resource
private AppUserMapper appUserMapper; private AppUserMapper appUserMapper;
/** /**
* 模拟用户登陆 * 模拟用户登陆
* @return * @return
*/ */
@Override @Override
public Result<UserVO> login() { public ApiResponse<UserVO> login() {
Result result = new Result(); ApiResponse result = new ApiResponse();
//假设验证数据通过 //假设验证数据通过
UserVO userVO = new UserVO(); UserVO userVO = new UserVO();
userVO.setPassword("zzz"); userVO.setPassword("zzz");
...@@ -75,7 +76,7 @@ public class UserServiceImpl implements UserService { ...@@ -75,7 +76,7 @@ public class UserServiceImpl implements UserService {
* @return * @return
*/ */
@Override @Override
public Result register(RegisterDto registerDto) { public ApiResponse register(RegisterDto registerDto) {
//用户实体类 //用户实体类
AppUser appUser = new AppUser(); AppUser appUser = new AppUser();
appUser.setId(SnowFlakeUtil.nextId()); appUser.setId(SnowFlakeUtil.nextId());
...@@ -106,8 +107,8 @@ public class UserServiceImpl implements UserService { ...@@ -106,8 +107,8 @@ public class UserServiceImpl implements UserService {
int i = appUserMapper.insertSelective(appUser); int i = appUserMapper.insertSelective(appUser);
if (i<0){ if (i<0){
return Result.failed("新增失败"); return new ApiResponse().fail("新增失败");
} }
return Result.success(null); return new ApiResponse();
} }
} }
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nafmii.nafmiimbg.mapper.AppUserMapper"> <mapper namespace="org.nafmii.mapper.user.AppUserMapper">
<resultMap id="BaseResultMap" type="org.nafmii.nafmiimbg.model.AppUser"> <resultMap id="BaseResultMap" type="org.nafmii.entity.user.AppUser">
<id column="ID" jdbcType="BIGINT" property="id" /> <id column="ID" jdbcType="BIGINT" property="id" />
<result column="USER_NAME" jdbcType="VARCHAR" property="userName" /> <result column="USER_NAME" jdbcType="VARCHAR" property="userName" />
<result column="LOGIN_PWD" jdbcType="VARCHAR" property="loginPwd" /> <result column="LOGIN_PWD" jdbcType="VARCHAR" property="loginPwd" />
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
ID, USER_NAME, LOGIN_PWD, REAL_NAME, PHONE, BIRTHDAY, EMAIL, HEAD_PICTURE, NATIONALITY, ID, USER_NAME, LOGIN_PWD, REAL_NAME, PHONE, BIRTHDAY, EMAIL, HEAD_PICTURE, NATIONALITY,
UNIT_NAME, OPEN_ID, FIGERPRINT_FALG, FACEID_FALG, CREATE_TIME, UPDATE_TIME, IS_ENABLE UNIT_NAME, OPEN_ID, FIGERPRINT_FALG, FACEID_FALG, CREATE_TIME, UPDATE_TIME, IS_ENABLE
</sql> </sql>
<select id="selectByExample" parameterType="org.nafmii.nafmiimbg.model.AppUserExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="org.nafmii.entity.user.AppUserExample" resultMap="BaseResultMap">
select select
<if test="distinct"> <if test="distinct">
distinct distinct
......
...@@ -40,7 +40,10 @@ public class ApiResponse <T> implements Serializable { ...@@ -40,7 +40,10 @@ public class ApiResponse <T> implements Serializable {
this.data = data; this.data = data;
} }
public ApiResponse<T> fail(String msg){
return new ApiResponse<>(-1,msg);
}
public long getStatus() { public long getStatus() {
return this.status; return this.status;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!