完成学生列表查询,删除,重置密码

main
whb
parent 837baac4ca
commit b7847d26f1

@ -3,6 +3,7 @@ package com.sztzjy.trade.controller.tch;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.sztzjy.trade.annotation.AnonymousAccess;
import com.sztzjy.trade.entity.dto.LoginLogDTO;
import com.sztzjy.trade.entity.dto.RestPassWordDTO;
import com.sztzjy.trade.service.TchLoginLogAndStuListService;
import com.sztzjy.trade.util.ResultEntity;
import io.swagger.annotations.Api;
@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Date;
/**
@ -99,4 +101,40 @@ public class TchLoginLogAndStuListController {
}
@ApiOperation("学生列表")
@GetMapping("/getStuListInfo")
@AnonymousAccess
public ResultEntity getStuListInfo(@ApiParam("学校ID") String schoolId,
@ApiParam("当前页") Integer page,
@ApiParam("每页展示条数") Integer size) {
//"yyyy-MM-dd HH:mm:ss"
return tchLoginLogAndStuListService.getStuListInfo(schoolId, page, size);
}
@ApiOperation("学生列表删除用户")
@PostMapping("/delStuInfo")
@AnonymousAccess
public ResultEntity delStuInfo(String userId) {
//"yyyy-MM-dd HH:mm:ss"
return tchLoginLogAndStuListService.delStuInfo(userId);
}
@ApiOperation("学生列表重置密码")
@PostMapping("/restPwd")
@AnonymousAccess
public ResultEntity restPwd(@RequestBody @Valid RestPassWordDTO restPassWord) {
//"yyyy-MM-dd HH:mm:ss"
return tchLoginLogAndStuListService.restPwd(restPassWord);
}
}

@ -1,6 +1,7 @@
package com.sztzjy.trade.entity;
import java.math.BigDecimal;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
/**
@ -99,6 +100,15 @@ public class StuUser {
@ApiModelProperty("综合得分(学校)(乘完权重后)")
private BigDecimal totalScore;
@ApiModelProperty("创建时间")
private Date createTime;
@ApiModelProperty("0:未删除 1:已删除")
private Integer delState;
@ApiModelProperty("更新时间")
private Date updateTime;
public String getUserId() {
return userId;
}
@ -338,4 +348,28 @@ public class StuUser {
public void setTotalScore(BigDecimal totalScore) {
this.totalScore = totalScore;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getDelState() {
return delState;
}
public void setDelState(Integer delState) {
this.delState = delState;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

@ -2,6 +2,7 @@ package com.sztzjy.trade.entity;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class StuUserExample {
@ -1994,6 +1995,186 @@ public class StuUserExample {
addCriterion("total_score not between", value1, value2, "totalScore");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andDelStateIsNull() {
addCriterion("del_state is null");
return (Criteria) this;
}
public Criteria andDelStateIsNotNull() {
addCriterion("del_state is not null");
return (Criteria) this;
}
public Criteria andDelStateEqualTo(Integer value) {
addCriterion("del_state =", value, "delState");
return (Criteria) this;
}
public Criteria andDelStateNotEqualTo(Integer value) {
addCriterion("del_state <>", value, "delState");
return (Criteria) this;
}
public Criteria andDelStateGreaterThan(Integer value) {
addCriterion("del_state >", value, "delState");
return (Criteria) this;
}
public Criteria andDelStateGreaterThanOrEqualTo(Integer value) {
addCriterion("del_state >=", value, "delState");
return (Criteria) this;
}
public Criteria andDelStateLessThan(Integer value) {
addCriterion("del_state <", value, "delState");
return (Criteria) this;
}
public Criteria andDelStateLessThanOrEqualTo(Integer value) {
addCriterion("del_state <=", value, "delState");
return (Criteria) this;
}
public Criteria andDelStateIn(List<Integer> values) {
addCriterion("del_state in", values, "delState");
return (Criteria) this;
}
public Criteria andDelStateNotIn(List<Integer> values) {
addCriterion("del_state not in", values, "delState");
return (Criteria) this;
}
public Criteria andDelStateBetween(Integer value1, Integer value2) {
addCriterion("del_state between", value1, value2, "delState");
return (Criteria) this;
}
public Criteria andDelStateNotBetween(Integer value1, Integer value2) {
addCriterion("del_state not between", value1, value2, "delState");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

@ -0,0 +1,31 @@
package com.sztzjy.trade.entity.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @author 17803
* @date 2024-08-06 16:08
*/
@Data
@ApiModel(description="重置密码参数")
public class RestPassWordDTO {
@ApiModelProperty("用户ID")
@NotNull
private String userId;
@ApiModelProperty("第一次输入密码")
@NotNull
private String passwordOne;
@ApiModelProperty("第二次输入密码")
@NotNull
private String passwordTwo;
}

@ -5,11 +5,9 @@ import com.sztzjy.trade.entity.StuUserExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@Mapper
public interface StuUserMapper {
long countByExample(StuUserExample example);

@ -1,6 +1,7 @@
package com.sztzjy.trade.service;
import com.sztzjy.trade.entity.dto.LoginLogDTO;
import com.sztzjy.trade.entity.dto.RestPassWordDTO;
import com.sztzjy.trade.util.ResultEntity;
import org.apache.ibatis.annotations.Param;
@ -54,4 +55,30 @@ public interface TchLoginLogAndStuListService {
*/
void exportExcel(Date startTime, Date endTime, String schoolId, HttpServletResponse response);
/**
*
* @param schoolId
* @param page
* @param size
* @return
*/
ResultEntity getStuListInfo(String schoolId, Integer page, Integer size);
/**
*
* @param userId
* @return
*/
ResultEntity delStuInfo(@Param("userId") String userId);
/**
*
* @param restPassWord
* @return
*/
ResultEntity restPwd(RestPassWordDTO restPassWord);
}

@ -7,9 +7,12 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sztzjy.trade.entity.StuUser;
import com.sztzjy.trade.entity.StuUserExample;
import com.sztzjy.trade.entity.TchLoginLog;
import com.sztzjy.trade.entity.TchLoginLogExample;
import com.sztzjy.trade.entity.dto.LoginLogDTO;
import com.sztzjy.trade.entity.dto.RestPassWordDTO;
import com.sztzjy.trade.mapper.StuUserMapper;
import com.sztzjy.trade.mapper.TchLoginLogMapper;
import com.sztzjy.trade.service.TchLoginLogAndStuListService;
@ -303,6 +306,90 @@ public class TchLoginLogAndStuListServiceImpl implements TchLoginLogAndStuListSe
}
/**
*
* @param schoolId
* @param page
* @param size
* @return
*/
@Override
public ResultEntity getStuListInfo(String schoolId, Integer page, Integer size) {
PageHelper.startPage(page,size);
StuUserExample stuUserExample = new StuUserExample();
stuUserExample.createCriteria().andSchoolIdEqualTo(schoolId).andDelStateEqualTo(0);
List<StuUser> stuUserList = stuUserMapper.selectByExample(stuUserExample);
if (stuUserList.isEmpty())
{
return new ResultEntity(HttpStatus.OK);
}else {
PageInfo<StuUser> stuUserPageInfo = new PageInfo<>(stuUserList);
return new ResultEntity<>(HttpStatus.OK,stuUserPageInfo);
}
}
/**
*
* @param userId
* @return
*/
@Override
public ResultEntity delStuInfo(String userId) {
StuUserExample stuUserExample = new StuUserExample();
stuUserExample.createCriteria().andUserIdEqualTo(userId);
List<StuUser> stuUserList = stuUserMapper.selectByExample(stuUserExample);
if (stuUserList.isEmpty())
{
return new ResultEntity(HttpStatus.BAD_REQUEST,"用户不存在");
}else {
stuUserList.get(0).setDelState(1);
stuUserMapper.updateByPrimaryKeySelective(stuUserList.get(0));
return new ResultEntity<>(HttpStatus.OK,"删除成功!");
}
}
/**
*
* @param restPassWord
* @return
*/
@Override
public ResultEntity restPwd(RestPassWordDTO restPassWord) {
if (!restPassWord.getPasswordOne().equals(restPassWord.getPasswordTwo()))
{
return new ResultEntity<>(HttpStatus.BAD_REQUEST,"两次输入密码不一致!");
}
StuUserExample stuUserExample = new StuUserExample();
stuUserExample.createCriteria().andUserIdEqualTo(restPassWord.getUserId());
List<StuUser> stuUserList = stuUserMapper.selectByExample(stuUserExample);
if (stuUserList.isEmpty())
{
return new ResultEntity(HttpStatus.BAD_REQUEST,"用户不存在");
}else {
stuUserList.get(0).setPassword(restPassWord.getPasswordOne());
stuUserMapper.updateByPrimaryKeySelective(stuUserList.get(0));
return new ResultEntity<>(HttpStatus.OK,"密码重置成功!");
}
}

@ -44,7 +44,7 @@
<!-- 需要生成的表 -->
<!-- <table tableName="stu_user" domainObjectName="StuUser" />-->
<table tableName="tch_login_log" domainObjectName="TchLoginLog" />
<table tableName="stu_user" domainObjectName="StuUser" />
<!-- <table tableName="tch_homework_manage" domainObjectName="TchHomeworkManage" />-->
<!-- <table tableName="tch_homework_set" domainObjectName="TchHomeworkSet" />-->
<!-- <table tableName="tch_notice_manage" domainObjectName="TchNoticeManage" />-->

@ -32,6 +32,9 @@
<result column="cross_border_payment_results_score" jdbcType="DECIMAL" property="crossBorderPaymentResultsScore" />
<result column="total_rank" jdbcType="INTEGER" property="totalRank" />
<result column="total_score" jdbcType="DECIMAL" property="totalScore" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="del_state" jdbcType="INTEGER" property="delState" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -97,7 +100,8 @@
consensus_layer_socre, exciting_layer_socre, contract_layer_socre, concept_score,
concept_rank, technology_socre, technology_rank, digital_currency_score, digital_currency_rank,
invoice_score, supply_chain_finance_score, traceability_and_anti_counterfeiting_score,
ticket_results_score, cross_border_payment_results_score, total_rank, total_score
ticket_results_score, cross_border_payment_results_score, total_rank, total_score,
create_time, del_state, update_time
</sql>
<select id="selectByExample" parameterType="com.sztzjy.trade.entity.StuUserExample" resultMap="BaseResultMap">
select
@ -141,7 +145,8 @@
invoice_score, supply_chain_finance_score,
traceability_and_anti_counterfeiting_score, ticket_results_score,
cross_border_payment_results_score, total_rank,
total_score)
total_score, create_time, del_state,
update_time)
values (#{userId,jdbcType=VARCHAR}, #{studentId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{roleId,jdbcType=INTEGER}, #{classId,jdbcType=VARCHAR},
#{className,jdbcType=VARCHAR}, #{major,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR},
@ -153,7 +158,8 @@
#{invoiceScore,jdbcType=DECIMAL}, #{supplyChainFinanceScore,jdbcType=DECIMAL},
#{traceabilityAndAntiCounterfeitingScore,jdbcType=DECIMAL}, #{ticketResultsScore,jdbcType=DECIMAL},
#{crossBorderPaymentResultsScore,jdbcType=DECIMAL}, #{totalRank,jdbcType=INTEGER},
#{totalScore,jdbcType=DECIMAL})
#{totalScore,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, #{delState,jdbcType=INTEGER},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.trade.entity.StuUser">
insert into stu_user
@ -248,6 +254,15 @@
<if test="totalScore != null">
total_score,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="delState != null">
del_state,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
@ -340,6 +355,15 @@
<if test="totalScore != null">
#{totalScore,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="delState != null">
#{delState,jdbcType=INTEGER},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.trade.entity.StuUserExample" resultType="java.lang.Long">
@ -348,7 +372,7 @@
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<update id="updateByExampleSelective" parameterType="map">
update stu_user
<set>
<if test="record.userId != null">
@ -441,6 +465,15 @@
<if test="record.totalScore != null">
total_score = #{record.totalScore,jdbcType=DECIMAL},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.delState != null">
del_state = #{record.delState,jdbcType=INTEGER},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -477,7 +510,10 @@
ticket_results_score = #{record.ticketResultsScore,jdbcType=DECIMAL},
cross_border_payment_results_score = #{record.crossBorderPaymentResultsScore,jdbcType=DECIMAL},
total_rank = #{record.totalRank,jdbcType=INTEGER},
total_score = #{record.totalScore,jdbcType=DECIMAL}
total_score = #{record.totalScore,jdbcType=DECIMAL},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
del_state = #{record.delState,jdbcType=INTEGER},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -572,6 +608,15 @@
<if test="totalScore != null">
total_score = #{totalScore,jdbcType=DECIMAL},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="delState != null">
del_state = #{delState,jdbcType=INTEGER},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where user_id = #{userId,jdbcType=VARCHAR}
</update>
@ -605,10 +650,15 @@
ticket_results_score = #{ticketResultsScore,jdbcType=DECIMAL},
cross_border_payment_results_score = #{crossBorderPaymentResultsScore,jdbcType=DECIMAL},
total_rank = #{totalRank,jdbcType=INTEGER},
total_score = #{totalScore,jdbcType=DECIMAL}
total_score = #{totalScore,jdbcType=DECIMAL},
create_time = #{createTime,jdbcType=TIMESTAMP},
del_state = #{delState,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where user_id = #{userId,jdbcType=VARCHAR}
</update>
<select id="getStartCourseNameList" resultType="com.sztzjy.trade.entity.StuUser" resultMap="BaseResultMap">
SELECT * FROM stu_user
<where>
@ -643,4 +693,5 @@
</foreach>
</where>
</select>
</mapper>
Loading…
Cancel
Save