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>
相关推荐
Seven977 分钟前
剑指offer-3、从尾到头打印链表
java
chanalbert11 分钟前
SpringBoot设计基石:约定优于配置与模块化架构
spring boot·spring·spring cloud
林太白12 分钟前
Rust项目搭建
前端·后端·rust
江小北20 分钟前
今天去面试了,遇到一个面试题,spring单例bean是线程安全的吗?
java·后端·spring
天天摸鱼的java工程师21 分钟前
设计一个多租户 SaaS 系统,如何实现租户数据隔离(数据库级别 / 表级别)与资源配额控制?
java·后端·面试
用户67570498850222 分钟前
Go语言切片,使用技巧与避坑指南
后端
Nero1825 分钟前
代码随想录二刷第三天 | 203.移除链表元素、707.设计链表、206.反转链表
后端
木西26 分钟前
Nest.js实战:构建聊天室的群聊与私聊模块
前端·后端·nestjs
数字人直播27 分钟前
跨境电商如何选择高转化率的AI数字人直播平台?
前端·后端
倚栏听风雨1 小时前
SwingUtilities.invokeAndWait()详解
后端