From 8a147a99841f83d721ee5c1d52a62f17dbe71f94 Mon Sep 17 00:00:00 2001 From: "zhiyong.ning" <354350178@qq.com> Date: Mon, 28 Sep 2020 11:31:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EuserInfo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/msdw/tms/api/UserControllerApi.java | 3 - .../msdw/tms/api/UserInfoControllerApi.java | 19 +++++ .../tms/controller/UserInfoController.java | 75 +++++++++++++++++++ .../java/com/msdw/tms/dao/UserInfoDao.java | 14 ++++ .../com/msdw/tms/entity/UserInfoEntity.java | 58 ++++++++++++++ .../com/msdw/tms/service/UserInfoService.java | 15 ++++ .../tms/service/impl/UserInfoServiceImpl.java | 48 ++++++++++++ .../mapper/tms/ExperimentalTeachingDao.xml | 1 + src/main/resources/mapper/tms/UserInfoDao.xml | 14 ++++ 9 files changed, 244 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/msdw/tms/api/UserInfoControllerApi.java create mode 100644 src/main/java/com/msdw/tms/controller/UserInfoController.java create mode 100644 src/main/java/com/msdw/tms/dao/UserInfoDao.java create mode 100644 src/main/java/com/msdw/tms/entity/UserInfoEntity.java create mode 100644 src/main/java/com/msdw/tms/service/UserInfoService.java create mode 100644 src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java create mode 100644 src/main/resources/mapper/tms/UserInfoDao.xml diff --git a/src/main/java/com/msdw/tms/api/UserControllerApi.java b/src/main/java/com/msdw/tms/api/UserControllerApi.java index da2b123..56c016a 100644 --- a/src/main/java/com/msdw/tms/api/UserControllerApi.java +++ b/src/main/java/com/msdw/tms/api/UserControllerApi.java @@ -18,7 +18,4 @@ public interface UserControllerApi { @ApiOperation(value = "更新密码",notes = "更新密码") R examinePassword(UserEntityVo entity); - @ApiOperation(value = "注册",notes = "注册") - R save(UserEntity entity); - } diff --git a/src/main/java/com/msdw/tms/api/UserInfoControllerApi.java b/src/main/java/com/msdw/tms/api/UserInfoControllerApi.java new file mode 100644 index 0000000..6415f74 --- /dev/null +++ b/src/main/java/com/msdw/tms/api/UserInfoControllerApi.java @@ -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); + +} diff --git a/src/main/java/com/msdw/tms/controller/UserInfoController.java b/src/main/java/com/msdw/tms/controller/UserInfoController.java new file mode 100644 index 0000000..5b25442 --- /dev/null +++ b/src/main/java/com/msdw/tms/controller/UserInfoController.java @@ -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 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(); + } +} diff --git a/src/main/java/com/msdw/tms/dao/UserInfoDao.java b/src/main/java/com/msdw/tms/dao/UserInfoDao.java new file mode 100644 index 0000000..4241002 --- /dev/null +++ b/src/main/java/com/msdw/tms/dao/UserInfoDao.java @@ -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 { + + Boolean add(UserInfoEntity userEntity); +} diff --git a/src/main/java/com/msdw/tms/entity/UserInfoEntity.java b/src/main/java/com/msdw/tms/entity/UserInfoEntity.java new file mode 100644 index 0000000..de5b717 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/UserInfoEntity.java @@ -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; + +} diff --git a/src/main/java/com/msdw/tms/service/UserInfoService.java b/src/main/java/com/msdw/tms/service/UserInfoService.java new file mode 100644 index 0000000..82f52f0 --- /dev/null +++ b/src/main/java/com/msdw/tms/service/UserInfoService.java @@ -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 { + + PageUtils queryPage(Map params); + + R add(UserInfoEntity userInfoEntity); +} diff --git a/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java new file mode 100644 index 0000000..45616bf --- /dev/null +++ b/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java @@ -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 implements UserInfoService { + + @Override + public PageUtils queryPage(Map params) { + + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper() + ); + 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; + } +} +} diff --git a/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml b/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml index d696e84..fc47806 100644 --- a/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml +++ b/src/main/resources/mapper/tms/ExperimentalTeachingDao.xml @@ -48,6 +48,7 @@ AND DATE_SUB(CURDATE(), INTERVAL #{exp.month} month ) <= date(creation_time) + order by creation_time desc \ No newline at end of file diff --git a/src/main/resources/mapper/tms/UserInfoDao.xml b/src/main/resources/mapper/tms/UserInfoDao.xml new file mode 100644 index 0000000..4297025 --- /dev/null +++ b/src/main/resources/mapper/tms/UserInfoDao.xml @@ -0,0 +1,14 @@ + + + + + + + insert into hr_user_info( + userName, uniqueIdentificationAccount, provinceId, + cityId, schoolId, phone,account,password,roleId) + values( + #{userName}, #{uniqueIdentificationAccount}, #{provinceId}, + #{cityId}, #{schoolId},#{phone}, #{account},#{password},#{roleId}) + + \ No newline at end of file