parent
94ed79ddc9
commit
8a147a9984
9 changed files with 244 additions and 3 deletions
@ -0,0 +1,19 @@ |
||||
package com.msdw.tms.api; |
||||
|
||||
import com.msdw.tms.common.utils.R; |
||||
import com.msdw.tms.entity.UserEntity; |
||||
import com.msdw.tms.entity.UserInfoEntity; |
||||
import com.msdw.tms.entity.vo.UserEntityVo; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
|
||||
@Api(value = "用户管理",tags = "用户管理") |
||||
public interface UserInfoControllerApi { |
||||
|
||||
@ApiOperation(value = "个人中心信息修改",notes = "个人中心信息修改") |
||||
R update(UserInfoEntity userEntity); |
||||
|
||||
@ApiOperation(value = "注册",notes = "注册") |
||||
R save(UserInfoEntity entity); |
||||
|
||||
} |
@ -0,0 +1,75 @@ |
||||
package com.msdw.tms.controller; |
||||
|
||||
import com.msdw.tms.api.UserControllerApi; |
||||
import com.msdw.tms.api.UserInfoControllerApi; |
||||
import com.msdw.tms.common.utils.PageUtils; |
||||
import com.msdw.tms.common.utils.R; |
||||
import com.msdw.tms.entity.UserEntity; |
||||
import com.msdw.tms.entity.UserInfoEntity; |
||||
import com.msdw.tms.entity.vo.UserEntityVo; |
||||
import com.msdw.tms.service.UserInfoService; |
||||
import com.msdw.tms.service.UserService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.Arrays; |
||||
import java.util.Map; |
||||
|
||||
@RestController |
||||
@RequestMapping("tms/userInfo") |
||||
public class UserInfoController implements UserInfoControllerApi { |
||||
@Autowired |
||||
private UserInfoService userInfoService; |
||||
|
||||
/** |
||||
* 列表 |
||||
*/ |
||||
@GetMapping("/list") |
||||
public R list(@RequestParam Map<String, Object> params){ |
||||
PageUtils page = userInfoService.queryPage(params); |
||||
|
||||
return R.ok().put("page", page); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 信息 |
||||
*/ |
||||
@GetMapping("/info/{id}") |
||||
public R info(@PathVariable("id") Long id){ |
||||
UserInfoEntity userEntity = userInfoService.getById(id); |
||||
|
||||
return R.ok().put("growthChangeHistory", userEntity); |
||||
} |
||||
|
||||
/** |
||||
* 注册 |
||||
*/ |
||||
@PostMapping("/add") |
||||
public R save(@RequestBody UserInfoEntity userInfoEntity){ |
||||
userInfoService.add(userInfoEntity); |
||||
|
||||
return R.ok(); |
||||
} |
||||
|
||||
/** |
||||
* 修改 |
||||
*/ |
||||
@PutMapping("/update") |
||||
public R update(@RequestBody UserInfoEntity userEntity){ |
||||
userInfoService.updateById(userEntity); |
||||
|
||||
return R.ok(); |
||||
} |
||||
|
||||
/** |
||||
* 删除 |
||||
*/ |
||||
@DeleteMapping("/delete") |
||||
public R delete(@RequestBody Long[] ids){ |
||||
userInfoService.removeByIds(Arrays.asList(ids)); |
||||
|
||||
return R.ok(); |
||||
} |
||||
} |
@ -0,0 +1,14 @@ |
||||
package com.msdw.tms.dao; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.msdw.tms.common.utils.R; |
||||
import com.msdw.tms.entity.UserEntity; |
||||
import com.msdw.tms.entity.UserInfoEntity; |
||||
import com.msdw.tms.entity.vo.UserEntityVo; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
@Mapper |
||||
public interface UserInfoDao extends BaseMapper<UserInfoEntity> { |
||||
|
||||
Boolean add(UserInfoEntity userEntity); |
||||
} |
@ -0,0 +1,58 @@ |
||||
package com.msdw.tms.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
@Accessors(chain = true) |
||||
@Data |
||||
@TableName("hr_user_info") |
||||
public class UserInfoEntity { |
||||
//用户id
|
||||
@TableId |
||||
private Integer userId; |
||||
//用户姓名
|
||||
private String userName; |
||||
//用户账号
|
||||
private String account; |
||||
//用户密码
|
||||
private String password; |
||||
//国家
|
||||
private String countries; |
||||
//绑定省份id
|
||||
private Integer provinceId; |
||||
//绑定城市id
|
||||
private Integer cityId; |
||||
//创建时间
|
||||
private String creationTime; |
||||
//登陆次数
|
||||
private Integer logInNumber; |
||||
//性别
|
||||
private Integer sex; |
||||
//证件类型(1、身份证)
|
||||
private Integer documenttype; |
||||
//身份证
|
||||
private String IDNumber; |
||||
//教育程度(1、研究数及以上)
|
||||
private Integer educationDegree; |
||||
//电话
|
||||
private String phone; |
||||
//微信账号
|
||||
private String wechatId; |
||||
//出生日期
|
||||
private String dateBirth; |
||||
//邮箱
|
||||
private String email; |
||||
//学校id
|
||||
private Integer schoolId; |
||||
//唯一标示性账号
|
||||
private String uniqueIdentificationAccount; |
||||
//用户头像路径
|
||||
private String userAvatars; |
||||
//是否删除
|
||||
private Integer isdel; |
||||
//角色id
|
||||
private String roleId; |
||||
|
||||
} |
@ -0,0 +1,15 @@ |
||||
package com.msdw.tms.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.msdw.tms.common.utils.PageUtils; |
||||
import com.msdw.tms.common.utils.R; |
||||
import com.msdw.tms.entity.UserInfoEntity; |
||||
|
||||
import java.util.Map; |
||||
|
||||
public interface UserInfoService extends IService<UserInfoEntity> { |
||||
|
||||
PageUtils queryPage(Map<String, Object> params); |
||||
|
||||
R add(UserInfoEntity userInfoEntity); |
||||
} |
@ -0,0 +1,48 @@ |
||||
package com.msdw.tms.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.msdw.tms.common.utils.PageUtils; |
||||
import com.msdw.tms.common.utils.Query; |
||||
import com.msdw.tms.common.utils.R; |
||||
import com.msdw.tms.dao.UserInfoDao; |
||||
import com.msdw.tms.entity.UserInfoEntity; |
||||
import com.msdw.tms.entity.response.CommonCode; |
||||
import com.msdw.tms.entity.response.ResponseResult; |
||||
import com.msdw.tms.entity.response.ResultCode; |
||||
import com.msdw.tms.service.UserInfoService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
@Service("userInfoService") |
||||
public class UserInfoServiceImpl extends ServiceImpl<UserInfoDao, UserInfoEntity> implements UserInfoService { |
||||
|
||||
@Override |
||||
public PageUtils queryPage(Map<String, Object> params) { |
||||
|
||||
IPage<UserInfoEntity> page = this.page( |
||||
new Query<UserInfoEntity>().getPage(params), |
||||
new QueryWrapper<UserInfoEntity>() |
||||
); |
||||
return new PageUtils(page); |
||||
} |
||||
|
||||
@Override |
||||
public R add(UserInfoEntity userInfoEntity) { |
||||
R r = new R(); |
||||
UserInfoDao userDao = this.getBaseMapper(); |
||||
Boolean vo = userDao.add(userInfoEntity); |
||||
if (vo==false){ |
||||
r.put("code",300); |
||||
r.put("errmessage","注册失败!"); |
||||
return r; |
||||
}else{ |
||||
r.put("code",200); |
||||
r.put("errmessage","注册成功!"); |
||||
return r; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,14 @@ |
||||
<?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.msdw.tms.dao.UserInfoDao"> |
||||
|
||||
<insert id="add" useGeneratedKeys="true" keyProperty="userId"> |
||||
insert into hr_user_info( |
||||
userName, uniqueIdentificationAccount, provinceId, |
||||
cityId, schoolId, phone,account,password,roleId) |
||||
values( |
||||
#{userName}, #{uniqueIdentificationAccount}, #{provinceId}, |
||||
#{cityId}, #{schoolId},#{phone}, #{account},#{password},#{roleId}) |
||||
</insert> |
||||
</mapper> |
Loading…
Reference in new issue