Merge pull request 'feat commit' (#1) from server_2024_3_23_liyuan into server_2024_3_23
Reviewed-on: #1server_2024_3_23
commit
fcec1f7e93
|
@ -11,8 +11,9 @@
|
|||
|
||||
<artifactId>zhilian-mybatis-plus</artifactId>
|
||||
|
||||
|
||||
<description>
|
||||
zhilian-modules-file文件服务
|
||||
zhilian-mybatis-plus测试
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
@ -67,14 +68,25 @@
|
|||
<artifactId>zhilian-common-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.zhilian</groupId>
|
||||
<artifactId>zhilian-common-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zhilian</groupId>
|
||||
<artifactId>zhilian-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.zhilian.mybatis_plus;
|
||||
|
||||
import com.zhilian.common.security.annotation.EnableCustomConfig;
|
||||
import com.zhilian.common.security.annotation.EnableMyFeignClients;
|
||||
import com.zhilian.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @version:
|
||||
* @Author: Seer
|
||||
* @description:
|
||||
* @date: 2024/3/24 10:51
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class MybatisPlusApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MybatisPlusApplication.class,args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
package com.zhilian.mybatis_plus.controller;
|
||||
|
||||
import com.zhilian.common.core.domain.Result;
|
||||
import com.zhilian.common.core.web.controller.BaseController;
|
||||
import com.zhilian.common.core.web.page.TableDataInfo;
|
||||
import com.zhilian.common.log.enums.BusinessType;
|
||||
import com.zhilian.common.security.annotation.RequiresPermissions;
|
||||
import com.zhilian.common.security.utils.SecurityUtils;
|
||||
import com.zhilian.mybatis_plus.domain.Clazz;
|
||||
import com.zhilian.mybatis_plus.service.ClazzService;
|
||||
import com.zhilian.common.log.annotation.Log;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version:
|
||||
* @Author: Seer
|
||||
* @description:
|
||||
* @date: 2024/3/24 10:45
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/clazz")
|
||||
public class ClazzController extends BaseController{
|
||||
|
||||
@Autowired
|
||||
private ClazzService clazzService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询班级列表
|
||||
* @param clazz
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<Clazz>> list (Clazz clazz) {
|
||||
startPage();
|
||||
List<Clazz> list = clazzService.pageQuery(clazz);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增班级
|
||||
* @param clazz
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "班级管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody Clazz clazz) {
|
||||
if (!clazzService.checkConfigKeyUnique(clazz)) {
|
||||
return error("新增参数'" + clazz.getName() + "'失败,班级名称已存在");
|
||||
}
|
||||
clazz.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(clazzService.save(clazz));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改班级
|
||||
*/
|
||||
@Log(title = "班级管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit (@Validated @RequestBody Clazz clazz) {
|
||||
if (!clazzService.checkConfigKeyUnique(clazz)) {
|
||||
return error("修改参数'" + clazz.getName() + "'失败,班级名称已存在");
|
||||
}
|
||||
clazz.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(clazzService.updateById(clazz));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除班级
|
||||
*/
|
||||
@RequiresPermissions("system:config:remove")
|
||||
@Log(title = "班级管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{clazzIds}")
|
||||
public Result remove (@PathVariable Long[] clazzIds) {
|
||||
clazzService.removeBatchByIds(Arrays.asList(clazzIds));
|
||||
return success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package com.zhilian.mybatis_plus.controller;
|
||||
|
||||
import com.zhilian.common.core.domain.Result;
|
||||
import com.zhilian.common.core.web.controller.BaseController;
|
||||
import com.zhilian.common.core.web.page.TableDataInfo;
|
||||
import com.zhilian.common.log.annotation.Log;
|
||||
import com.zhilian.common.log.enums.BusinessType;
|
||||
import com.zhilian.common.security.annotation.RequiresPermissions;
|
||||
import com.zhilian.common.security.utils.SecurityUtils;
|
||||
import com.zhilian.mybatis_plus.domain.Student;
|
||||
import com.zhilian.mybatis_plus.domain.response.StudentRes;
|
||||
import com.zhilian.mybatis_plus.service.StudentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version:
|
||||
* @Author: LiYuan
|
||||
* @description:
|
||||
* @date: 2024/3/25 15:12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/student")
|
||||
public class StudentController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private StudentService studentService;
|
||||
|
||||
/**
|
||||
* 查询学生列表
|
||||
* @param student
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<StudentRes>> list (Student student) {
|
||||
startPage();
|
||||
List<StudentRes> list = studentService.pageQuery(student);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增学生
|
||||
* @param student
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "学生管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add (@Validated @RequestBody Student student) {
|
||||
if (!studentService.checkConfigKeyUnique(student)) {
|
||||
return error("新增参数'" + student.getName() + "'失败,学生名称已存在");
|
||||
}
|
||||
student.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(studentService.save(student));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改学生
|
||||
*/
|
||||
@Log(title = "班级管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit (@Validated @RequestBody Student student) {
|
||||
if (!studentService.checkConfigKeyUnique(student)) {
|
||||
return error("修改参数'" + student.getName() + "'失败,学生名称已存在");
|
||||
}
|
||||
student.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(studentService.updateById(student));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除学生
|
||||
*/
|
||||
@RequiresPermissions("system:config:remove")
|
||||
@Log(title = "学生管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{studentIds}")
|
||||
public Result remove (@PathVariable Long[] studentIds) {
|
||||
studentService.removeBatchByIds(Arrays.asList(studentIds));
|
||||
return success();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package com.zhilian.mybatis_plus.domain;//package com.zhilian.mybatis_plus.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.zhilian.common.core.annotation.Excel;
|
||||
import com.zhilian.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @version:
|
||||
* @Author: Seer
|
||||
* @description:
|
||||
* @date: 2024/3/24 10:37
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_clazz")
|
||||
public class Clazz extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 班级编号 主键
|
||||
*/
|
||||
@Excel(name = "班级编号",cellType = Excel.ColumnType.NUMERIC)
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 班级名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
// /**
|
||||
// * 创建者
|
||||
// */
|
||||
// private String createBy;
|
||||
//
|
||||
// /**
|
||||
// * 创建时间
|
||||
// */
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
// private Date createTime;
|
||||
//
|
||||
// /**
|
||||
// * 更新者
|
||||
// */
|
||||
// private String updateBy;
|
||||
//
|
||||
// /**
|
||||
// * 更新时间
|
||||
// */
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
// private Date updateTime;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.zhilian.mybatis_plus.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.zhilian.common.core.annotation.Excel;
|
||||
import com.zhilian.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @version:
|
||||
* @Author: Seer
|
||||
* @description:
|
||||
* @date: 2024/3/24 10:37
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_student")
|
||||
public class Student extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 学生 编号 主键
|
||||
*/
|
||||
@Excel(name = "学生编号",cellType = Excel.ColumnType.NUMERIC)
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 学生姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 学生照片
|
||||
*/
|
||||
private String photo;
|
||||
|
||||
/**
|
||||
* 学生班级
|
||||
*/
|
||||
private Long tClazz;
|
||||
|
||||
/**
|
||||
* 学生性别
|
||||
*/
|
||||
private Integer sex;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.zhilian.mybatis_plus.domain.response;
|
||||
|
||||
import com.zhilian.mybatis_plus.domain.Clazz;
|
||||
import com.zhilian.mybatis_plus.domain.Student;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* @version:
|
||||
* @Author: LiYuan
|
||||
* @description: 学生+所属班级
|
||||
* @date: 2024/3/25 15:17
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class StudentRes {
|
||||
|
||||
/**
|
||||
* 学生
|
||||
*/
|
||||
private Student student;
|
||||
|
||||
/**
|
||||
* 该学生所属班级
|
||||
*/
|
||||
private Clazz clazz;
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.zhilian.mybatis_plus.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zhilian.mybatis_plus.domain.Clazz;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @version:
|
||||
* @Author: Seer
|
||||
* @description:
|
||||
* @date: 2024/3/24 10:48
|
||||
*/
|
||||
@Mapper
|
||||
public interface ClazzMapper extends BaseMapper<Clazz> {
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.zhilian.mybatis_plus.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zhilian.mybatis_plus.domain.Student;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @version:
|
||||
* @Author: LiYuan
|
||||
* @description:
|
||||
* @date: 2024/3/25 15:14
|
||||
*/
|
||||
@Mapper
|
||||
public interface StudentMapper extends BaseMapper<Student> {
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.zhilian.mybatis_plus.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhilian.mybatis_plus.domain.Clazz;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version:
|
||||
* @Author: Seer
|
||||
* @description:
|
||||
* @date: 2024/3/24 10:46
|
||||
*/
|
||||
|
||||
public interface ClazzService extends IService<Clazz> {
|
||||
|
||||
/**
|
||||
* 查询班级列表
|
||||
* @param clazz
|
||||
* @return
|
||||
*/
|
||||
List<Clazz> pageQuery(Clazz clazz);
|
||||
|
||||
|
||||
/**
|
||||
* 检测参数是否唯一
|
||||
* @param clazz
|
||||
* @return
|
||||
*/
|
||||
boolean checkConfigKeyUnique(Clazz clazz);
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.zhilian.mybatis_plus.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhilian.mybatis_plus.domain.Student;
|
||||
import com.zhilian.mybatis_plus.domain.response.StudentRes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version:
|
||||
* @Author: LiYuan
|
||||
* @description:
|
||||
* @date: 2024/3/25 15:13
|
||||
*/
|
||||
public interface StudentService extends IService<Student> {
|
||||
/**
|
||||
* 查询学生列表
|
||||
* @param student
|
||||
* @return
|
||||
*/
|
||||
List<StudentRes> pageQuery(Student student);
|
||||
|
||||
/**
|
||||
* 检测参数学生名称是否唯一
|
||||
* @param student
|
||||
* @return
|
||||
*/
|
||||
boolean checkConfigKeyUnique(Student student);
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.zhilian.mybatis_plus.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhilian.common.core.utils.StringUtils;
|
||||
import com.zhilian.mybatis_plus.domain.Clazz;
|
||||
import com.zhilian.mybatis_plus.mapper.ClazzMapper;
|
||||
import com.zhilian.mybatis_plus.service.ClazzService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* @version:
|
||||
* @Author: Seer
|
||||
* @description:
|
||||
* @date: 2024/3/24 10:46
|
||||
*/
|
||||
@Service
|
||||
public class ClazzServiceImpl extends ServiceImpl<ClazzMapper,Clazz> implements ClazzService {
|
||||
|
||||
/**
|
||||
* 查询班级列表
|
||||
* @param clazz
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Clazz> pageQuery(Clazz clazz) {
|
||||
LambdaQueryWrapper<Clazz> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotEmpty(clazz.getName())){
|
||||
queryWrapper.like(Clazz::getName,clazz.getName());
|
||||
}
|
||||
Object beginTime = clazz.getParams().get("beginTime");
|
||||
if (Objects.nonNull(beginTime) && beginTime instanceof Date beginDate){
|
||||
queryWrapper.gt(Clazz::getCreateTime, beginDate);
|
||||
}
|
||||
Object endTime = clazz.getParams().get("endTime");
|
||||
if (Objects.nonNull(endTime) && endTime instanceof Date endDate){
|
||||
queryWrapper.lt(Clazz::getCreateTime, endDate);
|
||||
}
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检测参数班级名称是否唯一
|
||||
* @param clazz
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean checkConfigKeyUnique(Clazz clazz) {
|
||||
LambdaQueryWrapper<Clazz> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Clazz::getName, clazz.getName());
|
||||
return this.count(queryWrapper) > 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package com.zhilian.mybatis_plus.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.zhilian.common.core.utils.StringUtils;
|
||||
import com.zhilian.mybatis_plus.domain.Clazz;
|
||||
import com.zhilian.mybatis_plus.domain.Student;
|
||||
import com.zhilian.mybatis_plus.domain.response.StudentRes;
|
||||
import com.zhilian.mybatis_plus.mapper.StudentMapper;
|
||||
import com.zhilian.mybatis_plus.service.StudentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @version:
|
||||
* @Author: LiYuan
|
||||
* @description:
|
||||
* @date: 2024/3/25 15:13
|
||||
*/
|
||||
@Service
|
||||
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> implements StudentService {
|
||||
|
||||
@Autowired
|
||||
private StudentMapper studentMapper;
|
||||
@Autowired
|
||||
private ClazzServiceImpl clazzService;
|
||||
|
||||
/**
|
||||
* 查询学生列表
|
||||
*
|
||||
* @param student
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<StudentRes> pageQuery(Student student) {
|
||||
//获取班级列表
|
||||
List<Clazz> clazzList = clazzService.pageQuery(new Clazz() {{
|
||||
setId(student.getTClazz());
|
||||
}});
|
||||
//获取学生列表
|
||||
LambdaQueryWrapper<Student> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotEmpty(student.getName())) {
|
||||
queryWrapper.like(Student::getName, student.getName());
|
||||
}
|
||||
if (StringUtils.isNotNull(student.getTClazz()) && 0 != student.getTClazz()) {
|
||||
queryWrapper.like(Student::getTClazz, student.getTClazz());
|
||||
}
|
||||
Object beginTime = student.getParams().get("beginTime");
|
||||
if (Objects.nonNull(beginTime) && beginTime instanceof Date beginDate) {
|
||||
queryWrapper.gt(Student::getCreateTime, beginDate);
|
||||
}
|
||||
Object endTime = student.getParams().get("endTime");
|
||||
if (Objects.nonNull(endTime) && endTime instanceof Date endDate) {
|
||||
queryWrapper.lt(Student::getCreateTime, endDate);
|
||||
}
|
||||
List<Student> list = this.list(queryWrapper);
|
||||
|
||||
//将学生对象与班级对象进行关联
|
||||
List<StudentRes> studentRes = list.stream().map(stu -> {
|
||||
StudentRes res = new StudentRes();
|
||||
Long tClazz = stu.getTClazz();
|
||||
Optional<Clazz> foundClazz = clazzList.stream().filter(clazz -> Objects.equals(clazz.getId(), tClazz)).findFirst();
|
||||
|
||||
//未找到班级对象则说明脏数据出现
|
||||
if (!foundClazz.isPresent()) {
|
||||
throw new RuntimeException("班级数据异常");
|
||||
}
|
||||
Clazz targetClass = foundClazz.get();
|
||||
res.setStudent(stu);
|
||||
res.setClazz(targetClass);
|
||||
return res;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return studentRes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测参数学生名称是否唯一
|
||||
* @param student
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean checkConfigKeyUnique(Student student) {
|
||||
LambdaQueryWrapper<Student> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Student::getName, student.getName());
|
||||
return this.count(queryWrapper) > 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9202
|
||||
port: 9301
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: zhilian-gmybatis-plus
|
||||
name: zhilian-mybatis
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?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.zhilian.mybatis_plus.mapper.ClazzMapper">
|
||||
|
||||
<resultMap id="ClazzResult" type="com.zhilian.mybatis_plus.domain.Clazz">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,7 @@
|
|||
<?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.zhilian.mybatis_plus.mapper.StudentMapper">
|
||||
|
||||
</mapper>
|
|
@ -80,6 +80,7 @@ public class SysConfigController extends BaseController {
|
|||
return toAjax(configService.save(config));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue