springboot 嵌套vo demo

java 复制代码
public class CarInfoVO {
    /**
     * 指导价min
     */
    private BigDecimal guidePriceMin;
    /**
     * 指导价max
     */
    private BigDecimal guidePriceMax;
    /**
     * 产品服役开始时间
     */
    private LocalDate startTime;
    /**
     * 产品服役结束时间
     */
    private LocalDate endTime;
    /**
     * FAQ
     */
    private List<String> faqs;
    /**
     * 产品配置详情(图片)
     */
    private List<String> details;
    /**
     * 图片
     */
    private String picture;
    /**
     * 视频
     */
    private String video;
    /**
     * 车辆
     */
    private List<Car> cars;

    @Data
    public static class Car {
        /**
         * 车辆id
         */
        private String carId;
        /**
         * 车牌号
         */
        private String carNumber;
        /**
         * 车辆显示图
         */
        private String display;
        /**
         * 车辆图片(包含外观、内饰、空间)
         */
        private List<String> pictures;
        /**
         * 车辆名称
         */
        private String title;
        /**
         * 上架状态 0未上架 1上架
         */
        private Integer status;
        /**
         * 排期状态 0无排期1有排期
         */
        private Integer schedule;
        /**
         * 租金
         */
        private BigDecimal price;
        /**
         * 添加时间
         */
        private LocalDateTime createTime;
        /**
         * 上牌时间
         */
        private String registrationTime;
        /**
         * 车牌属地
         */
        private String carModelTerritory;
        /**
         * 表显里程
         */
        private BigDecimal currentMileage;
        /**
         * 自定义车辆配置
         */
        private List<CustomCarConfig> customCarConfigs;

        @Data
        public static class CustomCarConfig {
            private String title;
            private String resume;
            private String detail;
        }
    }

    /**
     * 标签
     */
    private List<String> tags;
    /**
     * 保险
     */
    private List<Insure> insures;

    @Data
    public static class Insure {
        /**
         * 保险id
         */
        private String id;
        /**
         * 名称
         */
        private String title;
        /**
         * 价格
         */
        private BigDecimal price;
        /**
         * 标签
         */
        private String tag;
        /**
         * 简述
         */
        private String sketch;
        /**
         * 详情
         */
        private String detail;
        /**
         * 条目
         */
        private List<Term> terms;

        @Data
        public static class Term {
            /**
             * 名称
             */
            private String title;
            /**
             * 简述
             */
            private String sketch;
            /**
             * 详情
             */
            private String detail;
        }
    }

    /**
     * 订阅特权
     */
    private List<GeneralConfiguration> privileges;
    /**
     * 取消策略
     */
    private List<GeneralConfiguration> cancelPolicies;
    /**
     * 取车说明
     */
    private List<GeneralConfiguration> pickupInstructions;
    /**
     * 还车说明
     */
    private List<GeneralConfiguration> returnInstructions;
    /**
     * 押金说明
     */
    private List<GeneralConfiguration> despositInstructions;

    @Data
    public static class GeneralConfiguration {
        /**
         * 名称
         */
        private String title;
        /**
         * 名称
         */
        private String sketch;
        /**
         * 详情
         */
        private String detail;
        /**
         * 图标
         */
        private String icon;
    }
}

对应的map

xml 复制代码
 <resultMap id="getCarInfoListMap" type="com.fy.middleground.subscribe.vo.app.CarInfoVO" autoMapping="true">
        <id column="id"/>
        <collection property="privileges" 
                    ofType="com.fy.middleground.subscribe.vo.app.CarInfoVO$GeneralConfiguration" autoMapping="true">
            <id column="title"/>
            <result property="title" column="legalTitle"/>
            <result property="sketch" column="legalSketch"/>
            <result property="detail" column="legalDetail"/>
            <result property="icon" column="legalIcon"/>
        </collection>
        <collection property="cars" ofType="com.fy.middleground.subscribe.vo.app.CarInfoVO$Car" autoMapping="true">
            <id column="carId"/>
        </collection>
    </resultMap>
相关推荐
hrrrrb1 小时前
【Spring Security】Spring Security 概念
java·数据库·spring
小信丶1 小时前
Spring 中解决 “Could not autowire. There is more than one bean of type“ 错误
java·spring
周杰伦_Jay2 小时前
【Java虚拟机(JVM)全面解析】从原理到面试实战、JVM故障处理、类加载、内存区域、垃圾回收
java·jvm
摇滚侠3 小时前
Spring Boot 3零基础教程,IOC容器中组件的注册,笔记08
spring boot·笔记·后端
程序员小凯5 小时前
Spring Boot测试框架详解
java·spring boot·后端
豐儀麟阁贵5 小时前
基本数据类型
java·算法
_extraordinary_6 小时前
Java SpringMVC(二) --- 响应,综合性练习
java·开发语言
你的人类朋友6 小时前
什么是断言?
前端·后端·安全
程序员 Harry6 小时前
深度解析:使用ZIP流式读取大型PPTX文件的最佳实践
java
程序员小凯7 小时前
Spring Boot缓存机制详解
spring boot·后端·缓存