自动生成配置文件和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;
|
||||
|
||||
}
|
@ -1,196 +1,203 @@
|
||||
<?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.sztzjy.financial_bigdata.mapper.StuClassMapper">
|
||||
<resultMap id="BaseResultMap" type="com.sztzjy.financial_bigdata.entity.StuClass">
|
||||
<id column="class_id" jdbcType="VARCHAR" property="classId" />
|
||||
<result column="class_name" jdbcType="VARCHAR" property="className" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="school_name" jdbcType="VARCHAR" property="schoolName" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
<resultMap id="BaseResultMap" type="com.sztzjy.financial_bigdata.entity.StuClass">
|
||||
<id column="class_id" jdbcType="VARCHAR" property="classId"/>
|
||||
<result column="class_name" jdbcType="VARCHAR" property="className"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="school_name" jdbcType="VARCHAR" property="schoolName"/>
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="("
|
||||
separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="("
|
||||
separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
class_id
|
||||
, class_name, create_time, school_name
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuClassExample"
|
||||
resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List"/>
|
||||
from stu_class
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause"/>
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from stu_class
|
||||
where class_id = #{classId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete
|
||||
from stu_class
|
||||
where class_id = #{classId,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuClassExample">
|
||||
delete from stu_class
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause"/>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
class_id, class_name, create_time, school_name
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuClassExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from stu_class
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from stu_class
|
||||
where class_id = #{classId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from stu_class
|
||||
where class_id = #{classId,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuClassExample">
|
||||
delete from stu_class
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.sztzjy.financial_bigdata.entity.StuClass">
|
||||
insert into stu_class (class_id, class_name, create_time,
|
||||
school_name)
|
||||
values (#{classId,jdbcType=VARCHAR}, #{className,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{schoolName,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.StuClass">
|
||||
insert into stu_class
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="classId != null">
|
||||
class_id,
|
||||
</if>
|
||||
<if test="className != null">
|
||||
class_name,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="schoolName != null">
|
||||
school_name,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="classId != null">
|
||||
#{classId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="className != null">
|
||||
#{className,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="schoolName != null">
|
||||
#{schoolName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuClassExample" resultType="java.lang.Long">
|
||||
select count(*) from stu_class
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update stu_class
|
||||
<set>
|
||||
<if test="record.classId != null">
|
||||
class_id = #{record.classId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.className != null">
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.sztzjy.financial_bigdata.entity.StuClass">
|
||||
insert into stu_class (class_id, class_name, create_time,
|
||||
school_name)
|
||||
values (#{classId,jdbcType=VARCHAR}, #{className,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{schoolName,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.StuClass">
|
||||
insert into stu_class
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="classId != null">
|
||||
class_id,
|
||||
</if>
|
||||
<if test="className != null">
|
||||
class_name,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="schoolName != null">
|
||||
school_name,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="classId != null">
|
||||
#{classId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="className != null">
|
||||
#{className,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="schoolName != null">
|
||||
#{schoolName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuClassExample"
|
||||
resultType="java.lang.Long">
|
||||
select count(*) from stu_class
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause"/>
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update stu_class
|
||||
<set>
|
||||
<if test="record.classId != null">
|
||||
class_id = #{record.classId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.className != null">
|
||||
class_name = #{record.className,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="record.schoolName != null">
|
||||
school_name = #{record.schoolName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause"/>
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update stu_class
|
||||
set class_id = #{record.classId,jdbcType=VARCHAR},
|
||||
class_name = #{record.className,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="record.schoolName != null">
|
||||
school_name = #{record.schoolName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update stu_class
|
||||
set class_id = #{record.classId,jdbcType=VARCHAR},
|
||||
class_name = #{record.className,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
school_name = #{record.schoolName,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.financial_bigdata.entity.StuClass">
|
||||
update stu_class
|
||||
<set>
|
||||
<if test="className != null">
|
||||
class_name = #{className,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="schoolName != null">
|
||||
school_name = #{schoolName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where class_id = #{classId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.sztzjy.financial_bigdata.entity.StuClass">
|
||||
update stu_class
|
||||
set class_name = #{className,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
school_name = #{schoolName,jdbcType=VARCHAR}
|
||||
where class_id = #{classId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
school_name = #{record.schoolName,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause"/>
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.financial_bigdata.entity.StuClass">
|
||||
update stu_class
|
||||
<set>
|
||||
<if test="className != null">
|
||||
class_name = #{className,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="schoolName != null">
|
||||
school_name = #{schoolName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where class_id = #{classId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.sztzjy.financial_bigdata.entity.StuClass">
|
||||
update stu_class
|
||||
set class_name = #{className,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
school_name = #{schoolName,jdbcType=VARCHAR}
|
||||
where class_id = #{classId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue