mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 20:28:44 +08:00 
			
		
		
		
	codegen:移除多余的 test 类
This commit is contained in:
		@@ -1,19 +0,0 @@
 | 
			
		||||
### 请求 /infra/test-demo/get 接口 => 成功
 | 
			
		||||
GET {{baseUrl}}/infra/test-demo/get?id=106
 | 
			
		||||
Authorization: Bearer {{token}}
 | 
			
		||||
tenant-id: {{adminTenentId}}
 | 
			
		||||
 | 
			
		||||
### 请求 /infra/test-demo/update 接口 => 成功
 | 
			
		||||
PUT {{baseUrl}}/infra/test-demo/update
 | 
			
		||||
Authorization: Bearer {{token}}
 | 
			
		||||
tenant-id: {{adminTenentId}}
 | 
			
		||||
Content-Type: application/json
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  "id": 106,
 | 
			
		||||
  "name": "测试",
 | 
			
		||||
  "status": "0",
 | 
			
		||||
  "type": 1,
 | 
			
		||||
  "category": 1
 | 
			
		||||
}
 | 
			
		||||
@@ -1,97 +0,0 @@
 | 
			
		||||
package cn.iocoder.yudao.module.infra.controller.admin.test;
 | 
			
		||||
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
 | 
			
		||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
 | 
			
		||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.*;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.convert.test.TestDemoConvert;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.dal.dataobject.test.TestDemoDO;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.service.test.TestDemoService;
 | 
			
		||||
import io.swagger.v3.oas.annotations.tags.Tag;
 | 
			
		||||
import io.swagger.v3.oas.annotations.Parameter;
 | 
			
		||||
import io.swagger.v3.oas.annotations.Operation;
 | 
			
		||||
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.servlet.http.HttpServletResponse;
 | 
			
		||||
import javax.validation.Valid;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 | 
			
		||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
 | 
			
		||||
 | 
			
		||||
@Tag(name = "管理后台 - 字典类型")
 | 
			
		||||
@RestController
 | 
			
		||||
@RequestMapping("/infra/test-demo")
 | 
			
		||||
@Validated
 | 
			
		||||
public class TestDemoController {
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private TestDemoService testDemoService;
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/create")
 | 
			
		||||
    @Operation(summary = "创建字典类型")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('infra:test-demo:create')")
 | 
			
		||||
    public CommonResult<Long> createTestDemo(@Valid @RequestBody TestDemoCreateReqVO createReqVO) {
 | 
			
		||||
        return success(testDemoService.createTestDemo(createReqVO));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PutMapping("/update")
 | 
			
		||||
    @Operation(summary = "更新字典类型")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('infra:test-demo:update')")
 | 
			
		||||
    public CommonResult<Boolean> updateTestDemo(@Valid @RequestBody TestDemoUpdateReqVO updateReqVO) {
 | 
			
		||||
        testDemoService.updateTestDemo(updateReqVO);
 | 
			
		||||
        return success(true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @DeleteMapping("/delete")
 | 
			
		||||
    @Operation(summary = "删除字典类型")
 | 
			
		||||
    @Parameter(name = "id", description = "编号", required = true)
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('infra:test-demo:delete')")
 | 
			
		||||
    public CommonResult<Boolean> deleteTestDemo(@RequestParam("id") Long id) {
 | 
			
		||||
        testDemoService.deleteTestDemo(id);
 | 
			
		||||
        return success(true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/get")
 | 
			
		||||
    @Operation(summary = "获得字典类型")
 | 
			
		||||
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('infra:test-demo:query')")
 | 
			
		||||
    public CommonResult<TestDemoRespVO> getTestDemo(@RequestParam("id") Long id) {
 | 
			
		||||
        TestDemoDO testDemo = testDemoService.getTestDemo(id);
 | 
			
		||||
        return success(TestDemoConvert.INSTANCE.convert(testDemo));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/list")
 | 
			
		||||
    @Operation(summary = "获得字典类型列表")
 | 
			
		||||
    @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('infra:test-demo:query')")
 | 
			
		||||
    public CommonResult<List<TestDemoRespVO>> getTestDemoList(@RequestParam("ids") Collection<Long> ids) {
 | 
			
		||||
        List<TestDemoDO> list = testDemoService.getTestDemoList(ids);
 | 
			
		||||
        return success(TestDemoConvert.INSTANCE.convertList(list));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/page")
 | 
			
		||||
    @Operation(summary = "获得字典类型分页")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('infra:test-demo:query')")    public CommonResult<PageResult<TestDemoRespVO>> getTestDemoPage(@Valid TestDemoPageReqVO pageVO) {
 | 
			
		||||
        PageResult<TestDemoDO> pageResult = testDemoService.getTestDemoPage(pageVO);
 | 
			
		||||
        return success(TestDemoConvert.INSTANCE.convertPage(pageResult));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/export-excel")
 | 
			
		||||
    @Operation(summary = "导出字典类型 Excel")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('infra:test-demo:export')")    @OperateLog(type = EXPORT)
 | 
			
		||||
    public void exportTestDemoExcel(@Valid TestDemoExportReqVO exportReqVO,
 | 
			
		||||
              HttpServletResponse response) throws IOException {
 | 
			
		||||
        List<TestDemoDO> list = testDemoService.getTestDemoList(exportReqVO);
 | 
			
		||||
        // 导出 Excel
 | 
			
		||||
        List<TestDemoExcelVO> datas = TestDemoConvert.INSTANCE.convertList02(list);
 | 
			
		||||
        ExcelUtils.write(response, "字典类型.xls", "数据", TestDemoExcelVO.class, datas);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,32 +0,0 @@
 | 
			
		||||
package cn.iocoder.yudao.module.infra.controller.admin.test.vo;
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
import lombok.*;
 | 
			
		||||
import javax.validation.constraints.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* 字典类型 Base VO,提供给添加、修改、详细的子 VO 使用
 | 
			
		||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
 | 
			
		||||
*/
 | 
			
		||||
@Data
 | 
			
		||||
public class TestDemoBaseVO {
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "名字", requiredMode = Schema.RequiredMode.REQUIRED)
 | 
			
		||||
    @NotNull(message = "名字不能为空")
 | 
			
		||||
    private String name;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED)
 | 
			
		||||
    @NotNull(message = "状态不能为空")
 | 
			
		||||
    private Integer status;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED)
 | 
			
		||||
    @NotNull(message = "类型不能为空")
 | 
			
		||||
    private Integer type;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "分类", requiredMode = Schema.RequiredMode.REQUIRED)
 | 
			
		||||
    @NotNull(message = "分类不能为空")
 | 
			
		||||
    private Integer category;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "备注")
 | 
			
		||||
    private String remark;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,11 +0,0 @@
 | 
			
		||||
package cn.iocoder.yudao.module.infra.controller.admin.test.vo;
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
import lombok.*;
 | 
			
		||||
 | 
			
		||||
@Schema(description = "管理后台 - 字典类型创建 Request VO")
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = true)
 | 
			
		||||
@ToString(callSuper = true)
 | 
			
		||||
public class TestDemoCreateReqVO extends TestDemoBaseVO {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,38 +0,0 @@
 | 
			
		||||
package cn.iocoder.yudao.module.infra.controller.admin.test.vo;
 | 
			
		||||
 | 
			
		||||
import lombok.*;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
 | 
			
		||||
import com.alibaba.excel.annotation.ExcelProperty;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 字典类型 Excel VO
 | 
			
		||||
 *
 | 
			
		||||
 * @author 芋道源码
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
public class TestDemoExcelVO {
 | 
			
		||||
 | 
			
		||||
    @ExcelProperty("编号")
 | 
			
		||||
    private Long id;
 | 
			
		||||
 | 
			
		||||
    @ExcelProperty("名字")
 | 
			
		||||
    private String name;
 | 
			
		||||
 | 
			
		||||
    @ExcelProperty("状态")
 | 
			
		||||
    private Integer status;
 | 
			
		||||
 | 
			
		||||
    @ExcelProperty("类型")
 | 
			
		||||
    private Integer type;
 | 
			
		||||
 | 
			
		||||
    @ExcelProperty("分类")
 | 
			
		||||
    private Integer category;
 | 
			
		||||
 | 
			
		||||
    @ExcelProperty("备注")
 | 
			
		||||
    private String remark;
 | 
			
		||||
 | 
			
		||||
    @ExcelProperty("创建时间")
 | 
			
		||||
    private LocalDateTime createTime;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,33 +0,0 @@
 | 
			
		||||
package cn.iocoder.yudao.module.infra.controller.admin.test.vo;
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
import lombok.*;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import org.springframework.format.annotation.DateTimeFormat;
 | 
			
		||||
 | 
			
		||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
 | 
			
		||||
 | 
			
		||||
@Schema(description = "管理后台 - 字典类型 Excel 导出 Request VO,参数和 TestDemoPageReqVO 是一致的")
 | 
			
		||||
@Data
 | 
			
		||||
public class TestDemoExportReqVO {
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "名字")
 | 
			
		||||
    private String name;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "状态")
 | 
			
		||||
    private Integer status;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "类型")
 | 
			
		||||
    private Integer type;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "分类")
 | 
			
		||||
    private Integer category;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "备注")
 | 
			
		||||
    private String remark;
 | 
			
		||||
 | 
			
		||||
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
 | 
			
		||||
    @Schema(description = "创建时间")
 | 
			
		||||
    private LocalDateTime[] createTime;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,36 +0,0 @@
 | 
			
		||||
package cn.iocoder.yudao.module.infra.controller.admin.test.vo;
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
import lombok.*;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
 | 
			
		||||
import org.springframework.format.annotation.DateTimeFormat;
 | 
			
		||||
 | 
			
		||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
 | 
			
		||||
 | 
			
		||||
@Schema(description = "管理后台 - 字典类型分页 Request VO")
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = true)
 | 
			
		||||
@ToString(callSuper = true)
 | 
			
		||||
public class TestDemoPageReqVO extends PageParam {
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "名字")
 | 
			
		||||
    private String name;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "状态")
 | 
			
		||||
    private Integer status;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "类型")
 | 
			
		||||
    private Integer type;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "分类")
 | 
			
		||||
    private Integer category;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "备注")
 | 
			
		||||
    private String remark;
 | 
			
		||||
 | 
			
		||||
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
 | 
			
		||||
    @Schema(description = "创建时间")
 | 
			
		||||
    private LocalDateTime[] createTime;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,19 +0,0 @@
 | 
			
		||||
package cn.iocoder.yudao.module.infra.controller.admin.test.vo;
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
import lombok.*;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
 | 
			
		||||
@Schema(description = "管理后台 - 字典类型 Response VO")
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = true)
 | 
			
		||||
@ToString(callSuper = true)
 | 
			
		||||
public class TestDemoRespVO extends TestDemoBaseVO {
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED)
 | 
			
		||||
    private Long id;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
 | 
			
		||||
    private LocalDateTime createTime;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,16 +0,0 @@
 | 
			
		||||
package cn.iocoder.yudao.module.infra.controller.admin.test.vo;
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
import lombok.*;
 | 
			
		||||
import javax.validation.constraints.*;
 | 
			
		||||
 | 
			
		||||
@Schema(description = "管理后台 - 字典类型更新 Request VO")
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = true)
 | 
			
		||||
@ToString(callSuper = true)
 | 
			
		||||
public class TestDemoUpdateReqVO extends TestDemoBaseVO {
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED)
 | 
			
		||||
    @NotNull(message = "编号不能为空")
 | 
			
		||||
    private Long id;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,36 +0,0 @@
 | 
			
		||||
package cn.iocoder.yudao.module.infra.convert.test;
 | 
			
		||||
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.TestDemoCreateReqVO;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.TestDemoExcelVO;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.TestDemoRespVO;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.TestDemoUpdateReqVO;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.dal.dataobject.test.TestDemoDO;
 | 
			
		||||
import org.mapstruct.Mapper;
 | 
			
		||||
import org.mapstruct.factory.Mappers;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 字典类型 Convert
 | 
			
		||||
 *
 | 
			
		||||
 * @author 芋道源码
 | 
			
		||||
 */
 | 
			
		||||
@Mapper
 | 
			
		||||
public interface TestDemoConvert {
 | 
			
		||||
 | 
			
		||||
    TestDemoConvert INSTANCE = Mappers.getMapper(TestDemoConvert.class);
 | 
			
		||||
 | 
			
		||||
    TestDemoDO convert(TestDemoCreateReqVO bean);
 | 
			
		||||
 | 
			
		||||
    TestDemoDO convert(TestDemoUpdateReqVO bean);
 | 
			
		||||
 | 
			
		||||
    TestDemoRespVO convert(TestDemoDO bean);
 | 
			
		||||
 | 
			
		||||
    List<TestDemoRespVO> convertList(List<TestDemoDO> list);
 | 
			
		||||
 | 
			
		||||
    PageResult<TestDemoRespVO> convertPage(PageResult<TestDemoDO> page);
 | 
			
		||||
 | 
			
		||||
    List<TestDemoExcelVO> convertList02(List<TestDemoDO> list);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,50 +0,0 @@
 | 
			
		||||
package cn.iocoder.yudao.module.infra.dal.dataobject.test;
 | 
			
		||||
 | 
			
		||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.KeySequence;
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.TableId;
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.TableName;
 | 
			
		||||
import lombok.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 字典类型 DO
 | 
			
		||||
 *
 | 
			
		||||
 * @author 芋道源码
 | 
			
		||||
 */
 | 
			
		||||
@TableName("infra_test_demo")
 | 
			
		||||
@KeySequence("infra_test_demo_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = true)
 | 
			
		||||
@ToString(callSuper = true)
 | 
			
		||||
@Builder
 | 
			
		||||
@NoArgsConstructor
 | 
			
		||||
@AllArgsConstructor
 | 
			
		||||
public class TestDemoDO extends BaseDO {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 编号
 | 
			
		||||
     */
 | 
			
		||||
    @TableId
 | 
			
		||||
    private Long id;
 | 
			
		||||
    /**
 | 
			
		||||
     * 名字
 | 
			
		||||
     */
 | 
			
		||||
    private String name;
 | 
			
		||||
    /**
 | 
			
		||||
     * 状态
 | 
			
		||||
     */
 | 
			
		||||
    private Integer status;
 | 
			
		||||
    /**
 | 
			
		||||
     * 类型
 | 
			
		||||
     */
 | 
			
		||||
    private Integer type;
 | 
			
		||||
    /**
 | 
			
		||||
     * 分类
 | 
			
		||||
     */
 | 
			
		||||
    private Integer category;
 | 
			
		||||
    /**
 | 
			
		||||
     * 备注
 | 
			
		||||
     */
 | 
			
		||||
    private String remark;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,45 +0,0 @@
 | 
			
		||||
package cn.iocoder.yudao.module.infra.dal.mysql.test;
 | 
			
		||||
 | 
			
		||||
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.test.vo.TestDemoExportReqVO;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.TestDemoPageReqVO;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.dal.dataobject.test.TestDemoDO;
 | 
			
		||||
import org.apache.ibatis.annotations.Mapper;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 字典类型 Mapper
 | 
			
		||||
 *
 | 
			
		||||
 * @author 芋道源码
 | 
			
		||||
 */
 | 
			
		||||
@Mapper
 | 
			
		||||
public interface TestDemoMapper extends BaseMapperX<TestDemoDO> {
 | 
			
		||||
 | 
			
		||||
    default PageResult<TestDemoDO> selectPage(TestDemoPageReqVO reqVO) {
 | 
			
		||||
        return selectPage(reqVO, new LambdaQueryWrapperX<TestDemoDO>()
 | 
			
		||||
                .likeIfPresent(TestDemoDO::getName, reqVO.getName())
 | 
			
		||||
                .eqIfPresent(TestDemoDO::getStatus, reqVO.getStatus())
 | 
			
		||||
                .eqIfPresent(TestDemoDO::getType, reqVO.getType())
 | 
			
		||||
                .eqIfPresent(TestDemoDO::getCategory, reqVO.getCategory())
 | 
			
		||||
                .eqIfPresent(TestDemoDO::getRemark, reqVO.getRemark())
 | 
			
		||||
                .betweenIfPresent(TestDemoDO::getCreateTime, reqVO.getCreateTime())
 | 
			
		||||
                .orderByDesc(TestDemoDO::getId));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    default List<TestDemoDO> selectList(TestDemoExportReqVO reqVO) {
 | 
			
		||||
        return selectList(new LambdaQueryWrapperX<TestDemoDO>()
 | 
			
		||||
                .likeIfPresent(TestDemoDO::getName, reqVO.getName())
 | 
			
		||||
                .eqIfPresent(TestDemoDO::getStatus, reqVO.getStatus())
 | 
			
		||||
                .eqIfPresent(TestDemoDO::getType, reqVO.getType())
 | 
			
		||||
                .eqIfPresent(TestDemoDO::getCategory, reqVO.getCategory())
 | 
			
		||||
                .eqIfPresent(TestDemoDO::getRemark, reqVO.getRemark())
 | 
			
		||||
                .betweenIfPresent(TestDemoDO::getCreateTime, reqVO.getCreateTime())
 | 
			
		||||
                .orderByDesc(TestDemoDO::getId));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    List<TestDemoDO> selectList2();
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,75 +0,0 @@
 | 
			
		||||
package cn.iocoder.yudao.module.infra.service.test;
 | 
			
		||||
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.TestDemoCreateReqVO;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.TestDemoExportReqVO;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.TestDemoPageReqVO;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.TestDemoUpdateReqVO;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.dal.dataobject.test.TestDemoDO;
 | 
			
		||||
 | 
			
		||||
import javax.validation.Valid;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 字典类型 Service 接口
 | 
			
		||||
 *
 | 
			
		||||
 * @author 芋道源码
 | 
			
		||||
 */
 | 
			
		||||
public interface TestDemoService {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 创建字典类型
 | 
			
		||||
     *
 | 
			
		||||
     * @param createReqVO 创建信息
 | 
			
		||||
     * @return 编号
 | 
			
		||||
     */
 | 
			
		||||
    Long createTestDemo(@Valid TestDemoCreateReqVO createReqVO);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 更新字典类型
 | 
			
		||||
     *
 | 
			
		||||
     * @param updateReqVO 更新信息
 | 
			
		||||
     */
 | 
			
		||||
    void updateTestDemo(@Valid TestDemoUpdateReqVO updateReqVO);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 删除字典类型
 | 
			
		||||
     *
 | 
			
		||||
     * @param id 编号
 | 
			
		||||
     */
 | 
			
		||||
    void deleteTestDemo(Long id);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获得字典类型
 | 
			
		||||
     *
 | 
			
		||||
     * @param id 编号
 | 
			
		||||
     * @return 字典类型
 | 
			
		||||
     */
 | 
			
		||||
    TestDemoDO getTestDemo(Long id);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获得字典类型列表
 | 
			
		||||
     *
 | 
			
		||||
     * @param ids 编号
 | 
			
		||||
     * @return 字典类型列表
 | 
			
		||||
     */
 | 
			
		||||
    List<TestDemoDO> getTestDemoList(Collection<Long> ids);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获得字典类型分页
 | 
			
		||||
     *
 | 
			
		||||
     * @param pageReqVO 分页查询
 | 
			
		||||
     * @return 字典类型分页
 | 
			
		||||
     */
 | 
			
		||||
    PageResult<TestDemoDO> getTestDemoPage(TestDemoPageReqVO pageReqVO);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获得字典类型列表, 用于 Excel 导出
 | 
			
		||||
     *
 | 
			
		||||
     * @param exportReqVO 查询条件
 | 
			
		||||
     * @return 字典类型列表
 | 
			
		||||
     */
 | 
			
		||||
    List<TestDemoDO> getTestDemoList(TestDemoExportReqVO exportReqVO);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,91 +0,0 @@
 | 
			
		||||
package cn.iocoder.yudao.module.infra.service.test;
 | 
			
		||||
 | 
			
		||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.TestDemoCreateReqVO;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.TestDemoExportReqVO;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.TestDemoPageReqVO;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.controller.admin.test.vo.TestDemoUpdateReqVO;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.convert.test.TestDemoConvert;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.dal.dataobject.test.TestDemoDO;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.dal.mysql.test.TestDemoMapper;
 | 
			
		||||
import org.springframework.cache.annotation.CacheEvict;
 | 
			
		||||
import org.springframework.cache.annotation.Cacheable;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.validation.annotation.Validated;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
 | 
			
		||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.TEST_DEMO_NOT_EXISTS;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 字典类型 Service 实现类
 | 
			
		||||
 *
 | 
			
		||||
 * @author 芋道源码
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
@Validated
 | 
			
		||||
public class TestDemoServiceImpl implements TestDemoService {
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private TestDemoMapper testDemoMapper;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Long createTestDemo(TestDemoCreateReqVO createReqVO) {
 | 
			
		||||
        // 插入
 | 
			
		||||
        TestDemoDO testDemo = TestDemoConvert.INSTANCE.convert(createReqVO);
 | 
			
		||||
        testDemoMapper.insert(testDemo);
 | 
			
		||||
        // 返回
 | 
			
		||||
        return testDemo.getId();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @CacheEvict(value = "test", key = "#updateReqVO.id")
 | 
			
		||||
    public void updateTestDemo(TestDemoUpdateReqVO updateReqVO) {
 | 
			
		||||
        // 校验存在
 | 
			
		||||
        validateTestDemoExists(updateReqVO.getId());
 | 
			
		||||
        // 更新
 | 
			
		||||
        TestDemoDO updateObj = TestDemoConvert.INSTANCE.convert(updateReqVO);
 | 
			
		||||
        testDemoMapper.updateById(updateObj);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @CacheEvict(value = "test", key = "#id")
 | 
			
		||||
    public void deleteTestDemo(Long id) {
 | 
			
		||||
        // 校验存在
 | 
			
		||||
        validateTestDemoExists(id);
 | 
			
		||||
        // 删除
 | 
			
		||||
        testDemoMapper.deleteById(id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void validateTestDemoExists(Long id) {
 | 
			
		||||
        if (testDemoMapper.selectById(id) == null) {
 | 
			
		||||
            throw exception(TEST_DEMO_NOT_EXISTS);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Cacheable(cacheNames = "test", key = "#id")
 | 
			
		||||
    public TestDemoDO getTestDemo(Long id) {
 | 
			
		||||
        return testDemoMapper.selectById(id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<TestDemoDO> getTestDemoList(Collection<Long> ids) {
 | 
			
		||||
        return testDemoMapper.selectBatchIds(ids);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public PageResult<TestDemoDO> getTestDemoPage(TestDemoPageReqVO pageReqVO) {
 | 
			
		||||
//        testDemoMapper.selectList2();
 | 
			
		||||
        return testDemoMapper.selectPage(pageReqVO);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<TestDemoDO> getTestDemoList(TestDemoExportReqVO exportReqVO) {
 | 
			
		||||
        return testDemoMapper.selectList(exportReqVO);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,16 +0,0 @@
 | 
			
		||||
<?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.infra.dal.mysql.test.TestDemoMapper">
 | 
			
		||||
 | 
			
		||||
    <!--
 | 
			
		||||
        一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
 | 
			
		||||
        无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
 | 
			
		||||
        代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
 | 
			
		||||
        文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
 | 
			
		||||
     -->
 | 
			
		||||
 | 
			
		||||
    <select id="selectList2" resultType="cn.iocoder.yudao.module.infra.dal.dataobject.test.TestDemoDO">
 | 
			
		||||
        SELECT * FROM infra_test_demo
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
		Reference in New Issue
	
	Block a user