学生管理

hehai
mzh820631607 4 years ago
parent bfa0273c69
commit 87d116dc32
  1. 3
      src/main/java/com/msdw/tms/api/StudentControllerApi.java
  2. 6
      src/main/java/com/msdw/tms/controller/StudentController.java
  3. 30
      src/main/java/com/msdw/tms/controller/SystemSettingController.java
  4. 17
      src/main/java/com/msdw/tms/dao/SystemSetttingDao.java
  5. 9
      src/main/java/com/msdw/tms/dao/UserInfoDao.java
  6. 35
      src/main/java/com/msdw/tms/entity/StaffEntity.java
  7. 55
      src/main/java/com/msdw/tms/entity/vo/StaffVo.java
  8. 40
      src/main/java/com/msdw/tms/entity/vo/StudentImportFailureVo.java
  9. 5
      src/main/java/com/msdw/tms/service/StudentService.java
  10. 11
      src/main/java/com/msdw/tms/service/SystemSetttingService.java
  11. 131
      src/main/java/com/msdw/tms/service/impl/StudentServiceImpl.java
  12. 55
      src/main/java/com/msdw/tms/service/impl/SystemSettingServiceImpl.java
  13. 2
      src/main/resources/application.yml
  14. BIN
      src/main/resources/excel-template/学生导入失败数据导出模板.xlsx
  15. 13
      src/main/resources/mapper/tms/SystemSetting.xml
  16. 21
      src/main/resources/mapper/tms/UserInfoDao.xml

@ -38,4 +38,7 @@ public interface StudentControllerApi {
@ApiOperation(value = "批量导入学生信息",notes = "批量导入学生信息")
public R uploadFile(MultipartFile file) throws IOException;
@ApiOperation(value = "导入学生失败原因导出",notes = "导入学生失败原因导出")
public void exportFailureRecord(HttpServletResponse response, String token) throws Exception;
}

@ -21,6 +21,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 学生管理
@ -196,11 +197,12 @@ public class StudentController implements StudentControllerApi{
@PostMapping("/uploadFile")
public R uploadFile(MultipartFile file) throws IOException{
Integer schoolId = ConstantUtils.Keda_schoolId;
HashMap<String,Object> upload = studentService.upload(file,schoolId);
Map<String,String> upload = studentService.upload(file,schoolId);
return R.ok().put("data",upload);
}
@PostMapping("/export_failure")
@Override
@GetMapping("/export_failure")
public void exportFailureRecord(HttpServletResponse response, String token) throws Exception{
studentService.exportFailureRecord(response,token);

@ -0,0 +1,30 @@
package com.msdw.tms.controller;
import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.common.utils.R;
import com.msdw.tms.entity.vo.StaffVo;
import com.msdw.tms.service.SystemSetttingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 系统设置
*/
@RestController
@RequestMapping("/tms/system")
public class SystemSettingController {
@Autowired
private SystemSetttingService systemSetttingService;
@PostMapping("/addStaff")
public R addStaff(@RequestBody StaffVo staffVo){
systemSetttingService.addStaff(staffVo);
return R.ok();
}
@PostMapping("/queryStaff")
public R queryStaff(@RequestBody StaffVo staffVo){
PageUtils query = systemSetttingService.queryStaff(staffVo);
return R.ok().put("data",query);
}
}

@ -0,0 +1,17 @@
package com.msdw.tms.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.msdw.tms.entity.vo.StaffVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.poi.ss.formula.functions.T;
import java.util.List;
@Mapper
public interface SystemSetttingDao {
boolean addStaff(StaffVo staffVo);
IPage<StaffVo> queryStaff(Page<T> tPage, String searchContent, StaffVo staffVo);
}

@ -1,14 +1,10 @@
package com.msdw.tms.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.msdw.tms.common.utils.R;
import com.msdw.tms.entity.StudentEntity;
import com.msdw.tms.entity.UserEntity;
import com.msdw.tms.entity.UserInfoEntity;
import com.msdw.tms.entity.vo.StudentVo;
import com.msdw.tms.entity.vo.UserEntityVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -27,12 +23,13 @@ public interface UserInfoDao extends BaseMapper<UserInfoEntity> {
Integer disableAccount(StudentVo studentIds);
List<StudentEntity> queryStudentAccount(String account,Integer schoolId);
List<StudentEntity> queryStudentAccount(String account, Integer schoolId);
List<StudentEntity> queryStudentPhone(String phone,Integer schoolId);
List<StudentEntity> queryStudentPhone(String phone, Integer schoolId);
int bacthAddStudents(List<StudentVo> students);
int batchSaveUserInfo(StudentVo studentVo);
Integer addUserinfo(UserInfoEntity userInfo);
}

@ -0,0 +1,35 @@
package com.msdw.tms.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@TableName("staff")
public class StaffEntity {
//员工主键id
private Integer staffId;
//员工工号
private String workNumber;
//绑定年级id
private Integer staffGradeId;
//绑定专业id
private Integer staffProfessionalArchitectureId;
//绑定年级名称
private String staffGradeName;
//绑定专业名称
private String staffProfessionalArchitectureName;
//角色id
private Integer roleId;
//绑定学校id
private Integer schoolId;
//绑定用户id
private Integer userId;
//是否删除
private Integer isdel;
//绑定平台
private Integer platformId;
}

@ -0,0 +1,55 @@
package com.msdw.tms.entity.vo;
import com.msdw.tms.entity.UserInfoEntity;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 员工管理
*/
@Data
@Accessors(chain = true)
public class StaffVo extends UserInfoEntity {
//---------------------------------员工信息staff(未完全)
//员工主键id
private Integer staffId;
//员工工号
private String workNumber;
//绑定年级id
private Integer staffGradeId;
//绑定专业id
private Integer staffProfessionalArchitectureId;
//绑定年级名称
private String staffGradeName;
//绑定专业名称
private String staffProfessionalArchitectureName;
//绑定平台
private Integer platformId;
//----------------------------------分页
//第几页
private Integer page;
//每页数据量
private Integer size;
//搜索内容
private String searchContent;
//----------------------------------员工年级staff_grade
//员工年级表主键id
// private Integer staffGradeId;
//员工年纪表名称
// private String staffGradeName;
//绑定员工专业组织架构id
// private Integer staffProfessionalArchitectureId;
// private Integer isdel;
//----------------------------------员工组织关系staff_professional_architecture
//员工组织架构主键
// private Integer staffProfessionalArchitectureId;
//员工组织架构名称
// private String staffProfessionalArchitectureName;
//绑定学校id
// private Integer schoolId;
// private Integer isdel;
}

@ -0,0 +1,40 @@
package com.msdw.tms.entity.vo;
import com.msdw.tms.common.utils.poi.ExcelAttribute;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
@Data
@ToString
@Accessors(chain = true)
public class StudentImportFailureVo {
//第几行
private Long index;
//用户姓名
@ExcelAttribute(sort = 0)
private String userName;
//所属院校
@ExcelAttribute(sort = 1)
private String schoolAppellationName;
//账号
@ExcelAttribute(sort = 2)
private String account;
//学号
@ExcelAttribute(sort = 3)
private String workNumber;
//手机号码
@ExcelAttribute(sort = 4)
private String phone;
//邮箱
@ExcelAttribute(sort = 5)
private String email;
//失败原因
@ExcelAttribute(sort = 6)
private String failureMsg;
//
// @ExcelAttribute(sort = 7)
// private String message;
}

@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public interface StudentService extends IService<StudentEntity>{
@ -31,7 +32,7 @@ public interface StudentService extends IService<StudentEntity>{
void downloadFiles(HttpServletResponse response) throws IOException;
HashMap<String ,Object> upload(MultipartFile file, Integer schoolId) throws IOException;
Map<String ,String> upload(MultipartFile file, Integer schoolId) throws IOException;
void exportFailureRecord(HttpServletResponse response,String token);
void exportFailureRecord(HttpServletResponse response,String token) throws Exception;
}

@ -0,0 +1,11 @@
package com.msdw.tms.service;
import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.entity.vo.StaffVo;
public interface SystemSetttingService {
boolean addStaff(StaffVo staffVo);
PageUtils queryStaff(StaffVo staffVo);
}

@ -1,16 +1,21 @@
package com.msdw.tms.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.msdw.tms.common.exception.ExceptionCast;
import com.msdw.tms.common.utils.*;
import com.msdw.tms.common.utils.poi.ExcelExportUtil;
import com.msdw.tms.dao.StudentDao;
import com.msdw.tms.dao.UserInfoDao;
import com.msdw.tms.entity.StudentEntity;
import com.msdw.tms.entity.UserInfoEntity;
import com.msdw.tms.entity.XlsxTemplateEntity;
import com.msdw.tms.entity.response.CommonCode;
import com.msdw.tms.entity.vo.QuestionsImportFailureVO;
import com.msdw.tms.entity.vo.StudentImportFailureVo;
import com.msdw.tms.entity.vo.StudentVo;
import com.msdw.tms.service.AliyunOssService;
import com.msdw.tms.service.StudentService;
@ -18,6 +23,9 @@ import com.msdw.tms.service.XlsxTemplateService;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@ -25,9 +33,9 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.io.InputStream;
import java.util.*;
import java.util.concurrent.TimeUnit;
@Service("studentService")
public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> implements StudentService {
@ -44,6 +52,9 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
@Autowired
private UserInfoDao userInfoDao;
@Resource
StringRedisTemplate stringRedisTemplate;
@Override
public Integer queryStudentIdNumber(String workNumber,Integer schoolId) {
List<Integer> result = studentDao.queryStudentIdNumber(workNumber,schoolId);
@ -88,7 +99,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
public boolean updateStudent(StudentVo studentVo) {
try {
Integer update = studentDao.updateStudent(studentVo);
return true;
return true;
}catch (RuntimeException e){
e.printStackTrace();
return false;
@ -105,14 +116,14 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
R r = new R();
boolean result = studentDao.addStudentInfo(userInfoEntity);
if (result==false){
r.put("code",300);
r.put("errmessage","注册失败!");
return r;
}else{
r.put("code",200);
r.put("errmessage","注册成功!");
return r;
}
r.put("code",300);
r.put("errmessage","注册失败!");
return r;
}else{
r.put("code",200);
r.put("errmessage","注册成功!");
return r;
}
}
@Override
@ -123,30 +134,40 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
@Transactional
@Override
public HashMap<String, Object> upload(MultipartFile file, Integer schoolId) throws IOException{
public Map<String, String> upload(MultipartFile file, Integer schoolId) throws IOException{
List<StudentVo> students = ExcelImportHelper.readStudent(file);
List<StudentImportFailureVo> failVo1 = new ArrayList<>();
// 参数合法性校验,只能上传.xlsx后缀的文件
if (StringUtils.isBlank(file.getOriginalFilename())
|| !file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")).equals(Constant.EXCEL_SUFFIX)) {
ExceptionCast.cast(CommonCode.EXCEL_FILE_INVALID);
}
HashMap<String, Object> map = new HashMap<>();
int size = students.size();
Map<String, String> map = new HashMap<>();
Long ii = 1L;//用于记录序列号
try {
for (int i = 0;i<students.size();i++){
StudentVo student = students.get(i);
String phone = student.getPhone();
String workNumber = student.getWorkNumber();
String account = student.getAccount();
StudentVo studentVo = new StudentVo();
String schoolAppellationName = student.getSchoolAppellationName();
List<Integer> result1 = studentDao.queryStudentIdNumber(workNumber,schoolId);
List<StudentEntity> result4 = userInfoDao.queryStudentAccount(account, schoolId);
String email = student.getEmail();
if (phone!=null&&phone!=""){
List<StudentEntity> result2 = userInfoDao.queryStudentPhone(phone, schoolId);
if (result2.size()==1){
log.error("该号码已被使用");
map.put("被占用电话号码序列:"+System.currentTimeMillis(),"电话号码:"+phone);
StudentImportFailureVo vo = new StudentImportFailureVo();
++ii;
vo.setIndex(ii).setUserName(student.getUserName()).setSchoolAppellationName(student.getSchoolAppellationName())
.setAccount(student.getAccount()).setWorkNumber(student.getWorkNumber()).setPhone(student.getPhone()+" (重复的号码)").setEmail(student.getEmail())
;
// .setFailureMsg("重复的号码");
failVo1.add(vo);
// map.put("被占用电话号码序列:"+System.currentTimeMillis(),"电话号码:"+phone);
students.remove(i);
i--;
continue;
@ -161,22 +182,50 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
studentVo.setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis())).
setPassword(ConstantUtils.INITIAL_PASSWORD)
.setSchoolId(ConstantUtils.Keda_schoolId).setRoleId(ConstantUtils.STUDENT_ROLE)
;
;
studentVo.setAccount(student.getAccount()).setSchoolAppellationName(schoolAppellationName).setUserName(student.getUserName()).setIsdel(Constant.IsDel.NOT_DEL.getType());
if (result1.size()==1){
log.error("该学号已存在");
map.put("学号已存在序列:"+System.currentTimeMillis(),"学号:"+workNumber);
StudentImportFailureVo vo = new StudentImportFailureVo();
++ii;
vo.setIndex(ii).setUserName(student.getUserName()).setSchoolAppellationName(student.getSchoolAppellationName())
.setAccount(student.getAccount()).setWorkNumber(student.getWorkNumber()+" (重复的学号)").setPhone(student.getPhone()).setEmail(student.getEmail())
;
// .setFailureMsg("重复的学号");
failVo1.add(vo);
// map.put("学号已存在序列:"+System.currentTimeMillis(),"学号:"+workNumber);
students.remove(i);
i--;
continue;
}else if(result4.size()==1){
log.error("账号已存在");
StudentImportFailureVo vo = new StudentImportFailureVo();
++ii;
vo.setIndex(ii).setUserName(student.getUserName()).setSchoolAppellationName(student.getSchoolAppellationName())
.setAccount(student.getAccount()+" (重复的账号)").setWorkNumber(student.getWorkNumber()).setPhone(student.getPhone()).setEmail(student.getEmail())
;
// .setFailureMsg("重复的账号");
failVo1.add(vo);
// map.put("学号已存在序列:"+System.currentTimeMillis(),"学号:"+workNumber);
students.remove(i);
i--;
continue;
}else if(result3.size()!=1){
}
else if(result3.size()!=1){
log.error("不存在该院校");
map.put("错误的学校名称序列:"+System.currentTimeMillis(),"学校名称:"+schoolAppellationName);
StudentImportFailureVo vo = new StudentImportFailureVo();
++ii;
vo.setIndex(ii).setUserName(student.getUserName()).setSchoolAppellationName(student.getSchoolAppellationName())
.setAccount(student.getAccount()).setWorkNumber(student.getWorkNumber()).setPhone(student.getPhone()).setEmail(student.getEmail())
.setFailureMsg("不存在的院校");
failVo1.add(vo);
// map.put("错误的学校名称序列:"+System.currentTimeMillis(),"学校名称:"+schoolAppellationName);
students.remove(i);
i--;
continue;
}
++ii;
if (!students.isEmpty()&&students.size()>0){
userInfoDao.batchSaveUserInfo(studentVo);
student.setUserId(studentVo.getUserId()).setIsdel(Constant.IsDel.NOT_DEL.getType()).setPlatformId(ConstantUtils.PLATFORMID);
@ -185,18 +234,56 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao,StudentEntity> im
throw new RuntimeException();
}
}
}
}catch (RuntimeException e){
log.error(e.getMessage());
map.put("failura","添加失败");
throw new RuntimeException();
}
String token = "";
// 有导入失败的数据,才会存入redis
if (failVo1.size() > 0) {
//生成token
token = "FAILURE_IMPORT" + UUID.randomUUID().toString().replace("-", "");
ValueOperations<String, String> ops = stringRedisTemplate.opsForValue();
String failureVOJson = JSON.toJSONString(failVo1);
ops.set(token, failureVOJson, 30 * 60, TimeUnit.SECONDS);
}
map.put("token", token);
map.put("successNum", (size-failVo1.size())+"");
map.put("failureNum", failVo1.size()+"");
return map;
}
@Override
public void exportFailureRecord(HttpServletResponse response,String token) {
public void exportFailureRecord(HttpServletResponse response,String token) throws Exception{
if (StringUtils.isEmpty(token)) {
return;
}
ValueOperations<String, String> ops = stringRedisTemplate.opsForValue();
//获取数据
String record = ops.get(token);
if (StringUtils.isEmpty(record)) {
return;
}
List<StudentImportFailureVo> parse = JSON.parseObject(record, new TypeReference<List<StudentImportFailureVo>>() {
});
parse.sort(Comparator.comparing(StudentImportFailureVo::getIndex));
//2.加载模板流数据
org.springframework.core.io.Resource resource = new ClassPathResource("excel-template/学生导入失败数据导出模板.xlsx");
InputStream inputStream = resource.getInputStream();
//3、通过工具类下载文件
new ExcelExportUtil(StudentImportFailureVo.class, Constant.ROW_INDEX, Constant.STYLE_INDEX).
export(response, inputStream, parse, "学生信息导入失败表.xlsx");
}
// public HashMap<String, Object> readStudent(Integer schoolId, MultipartFile file) {

@ -0,0 +1,55 @@
package com.msdw.tms.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.msdw.tms.common.utils.Constant;
import com.msdw.tms.common.utils.ConstantUtils;
import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.dao.SystemSetttingDao;
import com.msdw.tms.dao.UserInfoDao;
import com.msdw.tms.entity.UserInfoEntity;
import com.msdw.tms.entity.vo.StaffVo;
import com.msdw.tms.entity.vo.StudentVo;
import com.msdw.tms.service.SystemSetttingService;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
@Service("systemSetttingService")
public class SystemSettingServiceImpl implements SystemSetttingService {
@Autowired
private SystemSetttingDao systemSetttingDao;
@Autowired
private UserInfoDao userInfoDao;
@Override
@Transactional
public boolean addStaff(StaffVo staffVo) {
// UserInfoEntity userInfo = new UserInfoEntity();
staffVo.setPlatformId(ConstantUtils.PLATFORMID).setUniqueIdentificationAccount(String.valueOf(System.currentTimeMillis())).setIsdel(Constant.IsDel.NOT_DEL.getType())
.setSchoolId(ConstantUtils.Keda_schoolId);
Integer userId = userInfoDao.addUserinfo(staffVo);
boolean result = systemSetttingDao.addStaff(staffVo);
if (!result){
throw new RuntimeException();
}
return result;
}
@Override
public PageUtils queryStaff(StaffVo staffVo) {
Page<T> tPage = new Page<>(staffVo.getPage(),staffVo.getSize());
// IPage<StudentVo> saveStudent = studentDao.queryStudent(tPage,searchContent,schoolId);
IPage<StaffVo> staff = systemSetttingDao.queryStaff(tPage,staffVo.getSearchContent(),staffVo);
PageUtils pageUtils = new PageUtils(staff);
return pageUtils;
}
}

@ -17,7 +17,7 @@ spring:
# port: 6379
# password: huoran
redis:
host: 192.168.31.125
host: 127.0.0.1
port: 6379
password:
mybatis-plus:

@ -0,0 +1,13 @@
<?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.msdw.tms.dao.SystemSetttingDao">
<insert id="addStaff">
INSERT INTO staff (userId,schoolId,workNumber,staffGradeId,staffProfessionalArchitectureId,staffGradeName,staffProfessionalArchitectureName,platformId,roleId)
VALUES
(#{userId},#{schoolId},#{workNumber},#{staffGradeId},#{staffProfessionalArchitectureId},#{staffGradeName},#{staffProfessionalArchitectureName},#{platformId},#{roleId})
</insert>
<select id="queryStaff" resultType="com.msdw.tms.entity.vo.StaffVo">
select * FROM staff
</select>
</mapper>

@ -6,10 +6,10 @@
<insert id="add" useGeneratedKeys="true" keyProperty="userId" keyColumn="userId">
insert into hr_user_info(
userName, uniqueIdentificationAccount, provinceId,
cityId, schoolId, phone,account,password,roleId,schoolAppellationId)
cityId, schoolId, phone,account,password,roleId,schoolAppellationId,creationTime)
values(
#{userName}, #{uniqueIdentificationAccount}, #{provinceId},
#{cityId}, #{schoolId},#{phone}, #{account},#{password},#{roleId},#{schoolAppellationId})
#{cityId}, #{schoolId},#{phone}, #{account},#{password},#{roleId},#{schoolAppellationId},now())
</insert>
<update id="userInfupdateUserInfoById" parameterType="com.msdw.tms.entity.UserInfoEntity">
@ -81,27 +81,32 @@
</select>
<insert id="saveUserInfo" useGeneratedKeys="true" keyProperty="userId" keyColumn="userId">
INSERT INTO hr_user_info ( userName,email,phone,uniqueIdentificationAccount, schoolId, account,password, roleId,isdel,schoolAppellationId)
INSERT INTO hr_user_info ( userName,email,phone,uniqueIdentificationAccount, schoolId, account,password, roleId,isdel,schoolAppellationId,creationTime)
VALUES
( #{userName},#{email},#{phone},#{uniqueIdentificationAccount}, #{schoolId}, #{account}, #{password}, 4 ,0,#{schoolAppellationId})
( #{userName},#{email},#{phone},#{uniqueIdentificationAccount}, #{schoolId}, #{account}, #{password}, 4 ,0,#{schoolAppellationId},now())
</insert>
<insert id="bacthAddStudents">
insert into hr_user_info(
userName, uniqueIdentificationAccount, schoolId, phone,account,password,roleId, schoolAppellationId)
userName, uniqueIdentificationAccount, schoolId, phone,account,password,roleId, schoolAppellationId,creationTime)
values
<foreach collection ="list" item="studentVo" index= "index" separator =",">
(#{studentVo.userName}, #{studentVo.uniqueIdentificationAccount},#{studentVo.schoolId},
#{studentVo.phone}, #{studentVo.account},#{studentVo.password},#{studentVo.roleId},
(SELECT schoolId FROM school WHERE schoolName = #{studentVo.schoolAppellationName}))
(SELECT schoolId FROM school WHERE schoolName = #{studentVo.schoolAppellationName}),now())
</foreach>
</insert>
<insert id="batchSaveUserInfo" useGeneratedKeys="true" keyProperty="userId" keyColumn="userId">
insert into hr_user_info(
userName, uniqueIdentificationAccount, schoolId, phone,account,password,roleId, schoolAppellationId)
userName, uniqueIdentificationAccount, schoolId, phone,account,password,roleId, schoolAppellationId,creationTime)
values
(#{userName}, #{uniqueIdentificationAccount},#{schoolId},
#{phone}, #{account},#{password},#{roleId},
(SELECT schoolId FROM school WHERE schoolName = #{schoolAppellationName}))
(SELECT schoolId FROM school WHERE schoolName = #{schoolAppellationName}),now())
</insert>
<insert id="addUserinfo">
INSERT INTO hr_user_info ( account, userName, roleId, phone, email, uniqueIdentificationAccount, schoolId,creationTime)
VALUES
(#{account},#{userName},#{roleId},#{phone},#{email},#{uniqueIdentificationAccount},#{schoolId},now())
</insert>
<update id="initialPassword">

Loading…
Cancel
Save