自动生成配置文件和mapper xml
parent
93dd731bbe
commit
e8fda05a6b
@ -1,33 +1,40 @@
|
||||
//package com.sztzjy.financial_bigdata.config.security;
|
||||
//
|
||||
//import com.sztzjy.financial_bigdata.entity.User;
|
||||
//import com.sztzjy.financial_bigdata.service.IUserService;
|
||||
//import io.jsonwebtoken.lang.Assert;
|
||||
//import org.springframework.security.core.userdetails.UserDetails;
|
||||
//import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
//import javax.annotation.Resource;
|
||||
//
|
||||
//
|
||||
//@Service
|
||||
//public class AuthenticationService implements UserDetailsService {
|
||||
// @Resource
|
||||
// private IUserService userService;
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
// User user = userService.findByUsername(username);
|
||||
// Assert.notNull(user, "用户不存在");
|
||||
//
|
||||
// JwtUser jwtUser = new JwtUser();
|
||||
// jwtUser.setUsername(user.getUsername());
|
||||
// jwtUser.setPassword(user.getPassword());
|
||||
// jwtUser.setUserId(user.getUserid());
|
||||
// jwtUser.setName(user.getName());
|
||||
// jwtUser.setRoleId(user.getRoleId());
|
||||
// return jwtUser;
|
||||
// }
|
||||
//}
|
||||
package com.sztzjy.financial_bigdata.config.security;
|
||||
|
||||
import com.sztzjy.financial_bigdata.entity.StuUser;
|
||||
import com.sztzjy.financial_bigdata.entity.StuUserExample;
|
||||
import com.sztzjy.financial_bigdata.mapper.StuUserMapper;
|
||||
import io.jsonwebtoken.lang.Assert;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class AuthenticationService implements UserDetailsService {
|
||||
@Resource
|
||||
private StuUserMapper stuUserMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
StuUserExample stuUserExample = new StuUserExample();
|
||||
stuUserExample.createCriteria().andUsernameEqualTo(username);
|
||||
List<StuUser> list = stuUserMapper.selectByExample(stuUserExample);
|
||||
Assert.notNull(list, "用户不存在");
|
||||
StuUser user = list.get(0);
|
||||
com.sztzjy.financial_bigdata.config.security.JwtUser jwtUser = new com.sztzjy.financial_bigdata.config.security.JwtUser();
|
||||
jwtUser.setUsername(user.getUsername());
|
||||
jwtUser.setPassword(new BCryptPasswordEncoder().encode(user.getPassword())); //不加密会报错Encoded password does not look like BCrypt
|
||||
jwtUser.setUserId(user.getUserid());
|
||||
jwtUser.setName(user.getName());
|
||||
jwtUser.setRoleId(user.getRoleId());
|
||||
jwtUser.setStudentId(user.getStudentId());
|
||||
return jwtUser;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,61 @@
|
||||
package com.sztzjy.financial_bigdata.entity.tea_dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 实训报告表
|
||||
*
|
||||
* @author xcj
|
||||
* training_report
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class TrainingReportDto {
|
||||
@ApiModelProperty("实训报告ID")
|
||||
private String reportId;
|
||||
|
||||
@ApiModelProperty("章节ID")
|
||||
private String chapterId;
|
||||
|
||||
@ApiModelProperty("章节名称")
|
||||
private String chapterName;
|
||||
|
||||
@ApiModelProperty("用户ID")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("学号")
|
||||
private String studentId;
|
||||
|
||||
@ApiModelProperty("班级")
|
||||
private String className;
|
||||
|
||||
@ApiModelProperty("实训报告名称")
|
||||
private String reportName;
|
||||
|
||||
@ApiModelProperty("实训报告上传时间")
|
||||
private Date uploadTime;
|
||||
|
||||
@ApiModelProperty("实训报告大小/单位MB")
|
||||
private Integer reportSize;
|
||||
|
||||
@ApiModelProperty("教师评分")
|
||||
private BigDecimal teacherScore;
|
||||
|
||||
@ApiModelProperty("文件地址")
|
||||
private String filePath;
|
||||
|
||||
@ApiModelProperty("学校ID")
|
||||
private String schoolId;
|
||||
|
||||
@ApiModelProperty("教师评语")
|
||||
private String teacherComment;
|
||||
|
||||
}
|
Loading…
Reference in New Issue