新增userInfo

hehai
zhiyong.ning 4 years ago
parent 94ed79ddc9
commit 8a147a9984
  1. 3
      src/main/java/com/msdw/tms/api/UserControllerApi.java
  2. 19
      src/main/java/com/msdw/tms/api/UserInfoControllerApi.java
  3. 75
      src/main/java/com/msdw/tms/controller/UserInfoController.java
  4. 14
      src/main/java/com/msdw/tms/dao/UserInfoDao.java
  5. 58
      src/main/java/com/msdw/tms/entity/UserInfoEntity.java
  6. 15
      src/main/java/com/msdw/tms/service/UserInfoService.java
  7. 48
      src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java
  8. 1
      src/main/resources/mapper/tms/ExperimentalTeachingDao.xml
  9. 14
      src/main/resources/mapper/tms/UserInfoDao.xml

@ -18,7 +18,4 @@ public interface UserControllerApi {
@ApiOperation(value = "更新密码",notes = "更新密码") @ApiOperation(value = "更新密码",notes = "更新密码")
R examinePassword(UserEntityVo entity); R examinePassword(UserEntityVo entity);
@ApiOperation(value = "注册",notes = "注册")
R save(UserEntity entity);
} }

@ -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;
}
}
}

@ -48,6 +48,7 @@
<if test="exp.month!=null"> <if test="exp.month!=null">
AND DATE_SUB(CURDATE(), INTERVAL #{exp.month} month ) &lt;= date(creation_time) AND DATE_SUB(CURDATE(), INTERVAL #{exp.month} month ) &lt;= date(creation_time)
</if> </if>
order by creation_time desc
</select> </select>
</mapper> </mapper>

@ -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…
Cancel
Save