1.任务量:10天。
目前已经花的时间:3天。
还剩余的时间:7天
3.
4.写完用户的部分内容。
package com.medicalretrieval.pojo.user; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.*; @Entity @Data @NoArgsConstructor @AllArgsConstructor public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id; @Column(columnDefinition = "varchar(128) not null default '' ") private String account=""; @Column(columnDefinition = "varchar(128) not null default '' ") private String password=""; @Column(columnDefinition = "varchar(128) not null default '' ") private String email=""; @Column(columnDefinition = "int not null default '0'") private int sex = 0; @Column(columnDefinition = "varchar(128) not null default '' ") private String telephone=""; @Column(columnDefinition = "int not null default '0' ") private int permissionGroupId=0; @Column(columnDefinition = "varchar(128) not null default '' ") private String avatar="http://192.168.43.144:8080/avatar/default_avatar_man.png"; @Column(columnDefinition = "int not null default '0' ") private int disabled=0; }
package com.medicalretrieval.controller; import com.medicalretrieval.pojo.user.User; import com.medicalretrieval.service.UserService; import com.medicalretrieval.utils.Result; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/user") public class UserController { @Autowired private UserService userService; @PostMapping("/") User addUser(@RequestBody User user){ if (user.getSex()==1){ user.setAvatar("http://192.168.43.144:8080/avatar/default_avatar_female.png"); } System.out.println(user); userService.save(user); System.out.println("添加成功:"+user); return user; } @DeleteMapping("/{id}") Object deleteUser(@PathVariable String id){ userService.deleteById(Long.parseLong(id)); return Result.success(); } @PutMapping("/") Object updateUser(@RequestBody User user){ userService.updatePasswordAndEmailAndTelephoneAndPermissionGroupIdAndAvatarAndDisabledById(user.getPassword(),user.getEmail(),user.getTelephone(), user.getPermissionGroupId(), user.getAvatar(), user.getDisabled(), user.getId()); System.out.println("修改成功:"+user); return Result.success(); } @GetMapping("/") Object queryUser(String account,String password){ User user = userService.findByAccountAndPassword(account,password); if (user==null){ return Result.fail("登录失败,用户名或密码错误"); } System.out.println("查询成功:"+user); return Result.success(user); } }
标签:null,String,default,private,user,import,团队,冲刺 From: https://www.cnblogs.com/teamno12/p/17331441.html