perf:【INFRA 基础设施】代码生成示例 demo 代码格式化

This commit is contained in:
puhui999 2025-05-20 10:24:13 +08:00
parent 15e2121078
commit bc77af09e0
22 changed files with 143 additions and 129 deletions

View File

@ -80,11 +80,11 @@ public class Demo02CategoryController {
@PreAuthorize("@ss.hasPermission('infra:demo02-category:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportDemo02CategoryExcel(@Valid Demo02CategoryListReqVO listReqVO,
HttpServletResponse response) throws IOException {
HttpServletResponse response) throws IOException {
List<Demo02CategoryDO> list = demo02CategoryService.getDemo02CategoryList(listReqVO);
// 导出 Excel
ExcelUtils.write(response, "示例分类.xls", "数据", Demo02CategoryRespVO.class,
BeanUtils.toBean(list, Demo02CategoryRespVO.class));
BeanUtils.toBean(list, Demo02CategoryRespVO.class));
}
}

View File

@ -1,10 +1,9 @@
package cn.iocoder.yudao.module.infra.controller.admin.demo.demo02.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Schema(description = "管理后台 - 示例分类新增/修改 Request VO")
@Data

View File

@ -1,9 +1,12 @@
package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo;
import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

View File

@ -1,12 +1,13 @@
package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 学生 Response VO")
@Data

View File

@ -1,8 +1,9 @@
package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import jakarta.validation.constraints.*;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.time.LocalDateTime;

View File

@ -1,34 +1,33 @@
package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo.*;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo.Demo03StudentNormalPageReqVO;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo.Demo03StudentNormalRespVO;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo.Demo03StudentNormalSaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
import cn.iocoder.yudao.module.infra.service.demo.demo03.normal.Demo03StudentNormalService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 学生")
@RestController
@ -66,7 +65,7 @@ public class Demo03StudentNormalController {
@DeleteMapping("/delete-batch")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除学生")
@PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
@PreAuthorize("@ss.hasPermission('infra:demo03-student:delete')")
public CommonResult<Boolean> deleteDemo03Student(@RequestParam("ids") List<Long> ids) {
demo03StudentNormalService.deleteDemo03StudentByIds(ids);
return success(true);
@ -94,12 +93,12 @@ public class Demo03StudentNormalController {
@PreAuthorize("@ss.hasPermission('infra:demo03-student:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportDemo03StudentExcel(@Valid Demo03StudentNormalPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<Demo03StudentDO> list = demo03StudentNormalService.getDemo03StudentPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "学生.xls", "数据", Demo03StudentNormalRespVO.class,
BeanUtils.toBean(list, Demo03StudentNormalRespVO.class));
BeanUtils.toBean(list, Demo03StudentNormalRespVO.class));
}
// ==================== 子表学生课程 ====================

View File

@ -1,9 +1,12 @@
package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo;
import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

View File

@ -1,12 +1,13 @@
package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 学生 Response VO")
@Data

View File

@ -1,13 +1,14 @@
package cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import java.time.LocalDateTime;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - 学生新增/修改 Request VO")
@Data

View File

@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo01;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.*;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactPageReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo01.Demo01ContactDO;
import org.apache.ibatis.annotations.Mapper;

View File

@ -1,13 +1,13 @@
package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo02;
import java.util.*;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo02.vo.Demo02CategoryListReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo02.Demo02CategoryDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 示例分类 Mapper
*
@ -24,9 +24,9 @@ public interface Demo02CategoryMapper extends BaseMapperX<Demo02CategoryDO> {
.orderByDesc(Demo02CategoryDO::getId));
}
default Demo02CategoryDO selectByParentIdAndName(Long parentId, String name) {
return selectOne(Demo02CategoryDO::getParentId, parentId, Demo02CategoryDO::getName, name);
}
default Demo02CategoryDO selectByParentIdAndName(Long parentId, String name) {
return selectOne(Demo02CategoryDO::getParentId, parentId, Demo02CategoryDO::getName, name);
}
default Long selectCountByParentId(Long parentId) {
return selectCount(Demo02CategoryDO::getParentId, parentId);

View File

@ -19,16 +19,16 @@ public interface Demo03CourseErpMapper extends BaseMapperX<Demo03CourseDO> {
default PageResult<Demo03CourseDO> selectPage(PageParam reqVO, Long studentId) {
return selectPage(reqVO, new LambdaQueryWrapperX<Demo03CourseDO>()
.eq(Demo03CourseDO::getStudentId, studentId)
.orderByDesc(Demo03CourseDO::getId));
.eq(Demo03CourseDO::getStudentId, studentId)
.orderByDesc(Demo03CourseDO::getId));
}
default int deleteByStudentId(Long studentId) {
return delete(Demo03CourseDO::getStudentId, studentId);
}
default int deleteByStudentIds(List<Long> studentIds) {
return delete(Demo03CourseDO::getStudentId, studentIds);
}
default int deleteByStudentIds(List<Long> studentIds) {
return delete(Demo03CourseDO::getStudentId, studentIds);
}
}

View File

@ -19,19 +19,20 @@ public interface Demo03GradeErpMapper extends BaseMapperX<Demo03GradeDO> {
default PageResult<Demo03GradeDO> selectPage(PageParam reqVO, Long studentId) {
return selectPage(reqVO, new LambdaQueryWrapperX<Demo03GradeDO>()
.eq(Demo03GradeDO::getStudentId, studentId)
.orderByDesc(Demo03GradeDO::getId));
.eq(Demo03GradeDO::getStudentId, studentId)
.orderByDesc(Demo03GradeDO::getId));
}
default Demo03GradeDO selectByStudentId(Long studentId) {
default Demo03GradeDO selectByStudentId(Long studentId) {
return selectOne(Demo03GradeDO::getStudentId, studentId);
}
}
default int deleteByStudentId(Long studentId) {
return delete(Demo03GradeDO::getStudentId, studentId);
}
default int deleteByStudentIds(List<Long> studentIds) {
return delete(Demo03GradeDO::getStudentId, studentIds);
}
default int deleteByStudentIds(List<Long> studentIds) {
return delete(Demo03GradeDO::getStudentId, studentIds);
}
}

View File

@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.erp;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo.*;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo.Demo03StudentErpPageReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
import org.apache.ibatis.annotations.Mapper;

View File

@ -1,11 +1,11 @@
package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.normal;
import java.util.*;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 学生课程 Mapper
*
@ -22,8 +22,8 @@ public interface Demo03CourseNormalMapper extends BaseMapperX<Demo03CourseDO> {
return delete(Demo03CourseDO::getStudentId, studentId);
}
default int deleteByStudentIds(List<Long> studentIds) {
return delete(Demo03CourseDO::getStudentId, studentIds);
}
default int deleteByStudentIds(List<Long> studentIds) {
return delete(Demo03CourseDO::getStudentId, studentIds);
}
}

View File

@ -1,11 +1,11 @@
package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.normal;
import java.util.*;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 学生班级 Mapper
*
@ -22,8 +22,8 @@ public interface Demo03GradeNormalMapper extends BaseMapperX<Demo03GradeDO> {
return delete(Demo03GradeDO::getStudentId, studentId);
}
default int deleteByStudentIds(List<Long> studentIds) {
return delete(Demo03GradeDO::getStudentId, studentIds);
}
default int deleteByStudentIds(List<Long> studentIds) {
return delete(Demo03GradeDO::getStudentId, studentIds);
}
}

View File

@ -1,11 +1,11 @@
package cn.iocoder.yudao.module.infra.dal.mysql.demo.demo03.normal;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo.Demo03StudentNormalPageReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo.*;
/**
* 学生 Mapper

View File

@ -1,7 +1,8 @@
package cn.iocoder.yudao.module.infra.service.demo.demo01;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.*;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactPageReqVO;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo01.vo.Demo01ContactSaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo01.Demo01ContactDO;
import jakarta.validation.Valid;
@ -37,10 +38,10 @@ public interface Demo01ContactService {
void deleteDemo01Contact(Long id);
/**
* 批量删除示例联系人
*
* @param ids 编号
*/
* 批量删除示例联系人
*
* @param ids 编号
*/
void deleteDemo01ContactByIds(List<Long> ids);
/**

View File

@ -1,11 +1,11 @@
package cn.iocoder.yudao.module.infra.service.demo.demo02;
import java.util.*;
import jakarta.validation.*;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo02.vo.Demo02CategoryListReqVO;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo02.vo.Demo02CategorySaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo02.Demo02CategoryDO;
import jakarta.validation.Valid;
import java.util.List;
/**
* 示例分类 Service 接口

View File

@ -5,10 +5,10 @@ import cn.iocoder.yudao.module.infra.controller.admin.demo.demo02.vo.Demo02Categ
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo02.vo.Demo02CategorySaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo02.Demo02CategoryDO;
import cn.iocoder.yudao.module.infra.dal.mysql.demo.demo02.Demo02CategoryMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import jakarta.annotation.Resource;
import java.util.List;
import java.util.Objects;

View File

@ -1,13 +1,15 @@
package cn.iocoder.yudao.module.infra.service.demo.demo03.erp;
import java.util.*;
import jakarta.validation.*;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo.*;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo.Demo03StudentErpPageReqVO;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.erp.vo.Demo03StudentErpSaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
import jakarta.validation.Valid;
import java.util.List;
/**
* 学生 Service 接口
@ -39,10 +41,10 @@ public interface Demo03StudentErpService {
void deleteDemo03Student(Long id);
/**
* 批量删除学生
*
* @param ids 编号
*/
* 批量删除学生
*
* @param ids 编号
*/
void deleteDemo03StudentByIds(List<Long> ids);
/**
@ -95,18 +97,18 @@ public interface Demo03StudentErpService {
void deleteDemo03Course(Long id);
/**
* 批量删除学生课程
*
* @param ids 编号
*/
* 批量删除学生课程
*
* @param ids 编号
*/
void deleteDemo03CourseByIds(List<Long> ids);
/**
* 获得学生课程
*
* @param id 编号
/**
* 获得学生课程
*
* @param id 编号
* @return 学生课程
*/
*/
Demo03CourseDO getDemo03Course(Long id);
// ==================== 子表学生班级 ====================
@ -143,18 +145,18 @@ public interface Demo03StudentErpService {
void deleteDemo03Grade(Long id);
/**
* 批量删除学生班级
*
* @param ids 编号
*/
* 批量删除学生班级
*
* @param ids 编号
*/
void deleteDemo03GradeByIds(List<Long> ids);
/**
* 获得学生班级
*
* @param id 编号
/**
* 获得学生班级
*
* @param id 编号
* @return 学生班级
*/
*/
Demo03GradeDO getDemo03Grade(Long id);
}

View File

@ -1,12 +1,14 @@
package cn.iocoder.yudao.module.infra.service.demo.demo03.normal;
import java.util.*;
import jakarta.validation.*;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo.*;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo.Demo03StudentNormalPageReqVO;
import cn.iocoder.yudao.module.infra.controller.admin.demo.demo03.normal.vo.Demo03StudentNormalSaveReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03CourseDO;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03GradeDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.infra.dal.dataobject.demo.demo03.Demo03StudentDO;
import jakarta.validation.Valid;
import java.util.List;
/**
* 学生 Service 接口
@ -38,10 +40,10 @@ public interface Demo03StudentNormalService {
void deleteDemo03Student(Long id);
/**
* 批量删除学生
*
* @param ids 编号
*/
* 批量删除学生
*
* @param ids 编号
*/
void deleteDemo03StudentByIds(List<Long> ids);
/**