1
This commit is contained in:
parent
77db6a0963
commit
0efab164cd
@ -0,0 +1,80 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolStudentService;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 驾校学员")
|
||||
@RestController
|
||||
@RequestMapping("/base/dl-drive-school-student")
|
||||
@Validated
|
||||
public class DlDriveSchoolStudentController {
|
||||
|
||||
@Resource
|
||||
private DlDriveSchoolStudentService schoolStudentService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建驾校学员")
|
||||
public CommonResult<String> createDlDriveSchoolStudent(@Valid @RequestBody DlDriveSchoolStudentVO createReqVO) {
|
||||
return success(schoolStudentService.createDlDriveSchoolStudent(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新驾校学员")
|
||||
public CommonResult<Boolean> updateDlDriveSchoolStudent(@Valid @RequestBody DlDriveSchoolStudentVO updateReqVO) {
|
||||
schoolStudentService.updateDlDriveSchoolStudent(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除驾校学员")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
public CommonResult<Boolean> deleteDlDriveSchoolStudent(@RequestParam("id") String id) {
|
||||
schoolStudentService.deleteDlDriveSchoolStudent(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得驾校学员")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<DlDriveSchoolStudent> getDlDriveSchoolStudent(@RequestParam("id") String id) {
|
||||
DlDriveSchoolStudent dlDriveSchoolStudent = schoolStudentService.getById(id);
|
||||
return success(dlDriveSchoolStudent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取学员列表
|
||||
*
|
||||
* @param pageReqVO {@link DlDriveSchoolStudentVO}
|
||||
* @param pageNo 分页参数
|
||||
* @param pageSize 分页参数
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<com.baomidou.mybatisplus.core.metadata.IPage < ?>>
|
||||
* @author PQZ
|
||||
* @date 10:46 2025/1/18
|
||||
**/
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得驾校学员分页")
|
||||
public CommonResult<IPage<?>> getDlDriveSchoolStudentPage(@Valid DlDriveSchoolStudentVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<DlDriveSchoolStudentVO> page = new Page<>(pageNo, pageSize);
|
||||
return success(schoolStudentService.queryListPage(pageReqVO, page));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.yudao.module.base.entity;
|
||||
|
||||
import cn.iocoder.yudao.module.jx.core.page.TenantBaDO;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@ -20,7 +20,7 @@ import java.math.BigDecimal;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DlDriveSchoolCourse extends TenantBaDO {
|
||||
public class DlDriveSchoolCourse extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
|
@ -0,0 +1,85 @@
|
||||
package cn.iocoder.yudao.module.base.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 驾校学员 DO
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
@TableName("drive_school_student")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DlDriveSchoolStudent extends TenantBaseDO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
private Integer age;
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String sex;
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String phone;
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idCard;
|
||||
/**
|
||||
* 工作单位
|
||||
*/
|
||||
private String workName;
|
||||
/**
|
||||
* 户籍地址
|
||||
*/
|
||||
private String registAddress;
|
||||
/**
|
||||
* 家庭住址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 人员类型(暂留)
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 证件照
|
||||
*/
|
||||
private String idPhoto;
|
||||
/**
|
||||
* 生活照
|
||||
*/
|
||||
private String lifePhoto;
|
||||
/**
|
||||
* 其他照片
|
||||
*/
|
||||
private String otherPhoto;
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.base.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 驾校学员 Mapper
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
@Mapper
|
||||
public interface DlDriveSchoolStudentMapper extends BaseMapper<DlDriveSchoolStudent> {
|
||||
|
||||
/**
|
||||
* 分页查询学生
|
||||
*
|
||||
* @param entity DlDriveSchoolStudentVO
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO>
|
||||
* @author PQZ
|
||||
* @date 10:44 2025/1/18
|
||||
**/
|
||||
IPage<DlDriveSchoolStudentVO> queryListPage(@Param("entity") DlDriveSchoolStudentVO entity, Page<DlDriveSchoolStudentVO> page);
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package cn.iocoder.yudao.module.base.service;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 驾校学员 Service 接口
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
public interface DlDriveSchoolStudentService extends IService<DlDriveSchoolStudent> {
|
||||
|
||||
/**
|
||||
* 创建驾校学员
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
String createDlDriveSchoolStudent(@Valid DlDriveSchoolStudentVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新驾校学员
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDlDriveSchoolStudent(@Valid DlDriveSchoolStudentVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除驾校学员
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDlDriveSchoolStudent(String id);
|
||||
|
||||
/**
|
||||
* 获得驾校学员
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 驾校学员
|
||||
*/
|
||||
DlDriveSchoolStudent getDlDriveSchoolStudent(String id);
|
||||
|
||||
/**
|
||||
* 分页查询学生列表
|
||||
*
|
||||
* @param pageReqVO {@link DlDriveSchoolStudentVO}
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<?>
|
||||
* @author PQZ
|
||||
* @date 10:41 2025/1/18
|
||||
**/
|
||||
IPage<DlDriveSchoolStudentVO> queryListPage(DlDriveSchoolStudentVO pageReqVO, Page<DlDriveSchoolStudentVO> page);
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.base.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolCourse;
|
||||
import cn.iocoder.yudao.module.base.mapper.DlDriveSchoolCoachMapper;
|
||||
import cn.iocoder.yudao.module.base.mapper.DlDriveSchoolCourseMapper;
|
||||
@ -55,7 +56,7 @@ public class DlDriveSchoolCourseServiceImpl extends ServiceImpl<DlDriveSchoolCou
|
||||
@Override
|
||||
public List<DlDriveSchoolCourse> queryList(DlDriveSchoolCourseVO courseVO) {
|
||||
LambdaQueryWrapper<DlDriveSchoolCourse> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(TenantBaDO::getDeleted, 0);
|
||||
lambdaQueryWrapper.eq(BaseDO::getDeleted, 0);
|
||||
if (StringUtils.isNotEmpty(courseVO.getName())) {
|
||||
lambdaQueryWrapper.like(DlDriveSchoolCourse::getName, courseVO.getName());
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
package cn.iocoder.yudao.module.base.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
|
||||
import cn.iocoder.yudao.module.base.mapper.DlDriveSchoolStudentMapper;
|
||||
import cn.iocoder.yudao.module.base.service.DlDriveSchoolStudentService;
|
||||
import cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 驾校学员 Service 实现类
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class DlDriveSchoolStudentServiceImpl extends ServiceImpl<DlDriveSchoolStudentMapper, DlDriveSchoolStudent> implements DlDriveSchoolStudentService {
|
||||
|
||||
@Resource
|
||||
private DlDriveSchoolStudentMapper dlDriveSchoolStudentMapper;
|
||||
|
||||
@Override
|
||||
public String createDlDriveSchoolStudent(DlDriveSchoolStudentVO createReqVO) {
|
||||
// 插入
|
||||
DlDriveSchoolStudent dlDriveSchoolStudent = BeanUtils.toBean(createReqVO, DlDriveSchoolStudent.class);
|
||||
dlDriveSchoolStudentMapper.insert(dlDriveSchoolStudent);
|
||||
// 返回
|
||||
return dlDriveSchoolStudent.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDlDriveSchoolStudent(DlDriveSchoolStudentVO updateReqVO) {
|
||||
// 更新
|
||||
DlDriveSchoolStudent updateObj = BeanUtils.toBean(updateReqVO, DlDriveSchoolStudent.class);
|
||||
dlDriveSchoolStudentMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDlDriveSchoolStudent(String id) {
|
||||
// 删除
|
||||
dlDriveSchoolStudentMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public DlDriveSchoolStudent getDlDriveSchoolStudent(String id) {
|
||||
return dlDriveSchoolStudentMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询学生列表
|
||||
*
|
||||
* @param pageReqVO {@link DlDriveSchoolStudentVO}
|
||||
* @param page 分页参数
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<?>
|
||||
* @author PQZ
|
||||
* @date 10:41 2025/1/18
|
||||
**/
|
||||
@Override
|
||||
public IPage<DlDriveSchoolStudentVO> queryListPage(DlDriveSchoolStudentVO pageReqVO, Page<DlDriveSchoolStudentVO> page) {
|
||||
return dlDriveSchoolStudentMapper.queryListPage(pageReqVO,page);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.base.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.base.entity.DlDriveSchoolStudent;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 驾校学员 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class DlDriveSchoolStudentVO extends DlDriveSchoolStudent {
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
<?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="cn.iocoder.yudao.module.base.mapper.DlDriveSchoolStudentMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="queryListPage" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
|
||||
SELECT
|
||||
main.*
|
||||
FROM
|
||||
drive_school_student main
|
||||
<where>
|
||||
main.deleted = 0
|
||||
<if test="entity.name != null and entity.name != ''">and main.name like concat('%', #{entity.name}, '%')</if>
|
||||
</where>
|
||||
order by main.create_time desc
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user