zoukankan      html  css  js  c++  java
  • springboot-vue项目后台2---pojo对查询结果手动分组

      <resultMap id="PResult" type="packs" >
        <result column="device_type" property="deviceType" jdbcType="VARCHAR" />
        <result column="car_model" property="carModel" jdbcType="VARCHAR" />
        <collection property="pcks" ofType="pcks" javaType="ArrayList">  
            <id column="pid" property="pid" jdbcType="INTEGER" />
            <result column="package_version" property="packageVersion" jdbcType="VARCHAR" />
            <result column="state" property="state" jdbcType="INTEGER" />
            <result column="description" property="description" jdbcType="VARCHAR" />
            <result column="update_time" property="updateTime" jdbcType="VARCHAR" />
            <result column="device_type" property="deviceType" jdbcType="VARCHAR" />
            <result column="car_model" property="carModel" jdbcType="VARCHAR" />
            <result column="pcktype" property="pcktype" jdbcType="VARCHAR" />
            <result column="old_num" property="oldNnum" jdbcType="VARCHAR" />
            <result column="new_num" property="newNum" jdbcType="VARCHAR" />
            <collection property="files" ofType="packFile" javaType="ArrayList">
                <id property="fid" column="fid" />  
                <result property="orignName" column="orignName" />  
                <result property="newName" column="newName" />  
                <result property="filePath" column="filePath" />  
                <result property="size" column="size" /> 
                <result property="md5" column="md5" /> 
            </collection> 
        </collection>  
        <select id="selectAllPackages" resultMap="PResult">  
          select
          p.device_type,
          p.car_model,
          p.pid,
          p.package_version,
          p.state,
          p.description,
          p.update_time,
          p.device_type,
          p.car_model, 
          p.pcktype, 
          p.old_num, 
          p.new_num, 
          f.fid ,
          f.orign_name as orignName, 
          f.new_name as newName,
          f.file_path as filePath,
          f.size,
          f.md5 
          from t_package p  
          left join t_package_file pf on pf.package_id=p.pid 
          left join t_file f on pf.file_id=f.fid where p.state!=2
        </select> 
    package com.hcxy.car.bean.pojo;
    
    import java.io.Serializable;
    import java.util.ArrayList;
    
    import org.apache.ibatis.type.Alias;
    
    import com.hcxy.car.bean.PackageFile;
    
    @Alias("packs") 
    public class Packs {
        private String deviceType;// tbox,vin,ipc
        private String carModel;// 版本号
        private ArrayList<Pcks> pcks;
        
        public String getDeviceType() {
            return deviceType;
        }
        public void setDeviceType(String deviceType) {
            this.deviceType = deviceType;
        }
        public String getCarModel() {
            return carModel;
        }
        public void setCarModel(String carModel) {
            this.carModel = carModel;
        }
        public ArrayList<Pcks> getPcks() {
            return pcks;
        }
        public void setPcks(ArrayList<Pcks> pcks) {
            this.pcks = pcks;
        }
    }
    package com.hcxy.car.bean.pojo;
    
    import java.io.Serializable;
    import java.util.ArrayList;
    
    import org.apache.ibatis.type.Alias;
    
    import com.hcxy.car.bean.PackageFile;
    
    @Alias("pcks") 
    public class Pcks {
        private int pid;// 主键.
        private String packageVersion;// 文件名
        private int state;
        private String description;
        private String updateTime;
        private String deviceType;// tbox,vin,ipc
        private String carModel;// 版本号
        private String pcktype;// 包类型
        private String oldNnum;// 包类型
        private String newNum;// 包类型
        private ArrayList<PackageFile> files;
        
        public int getPid() {
            return pid;
        }
        public void setPid(int pid) {
            this.pid = pid;
        }
        public String getPackageVersion() {
            return packageVersion;
        }
        public void setPackageVersion(String packageVersion) {
            this.packageVersion = packageVersion;
        }
        public int getState() {
            return state;
        }
        public void setState(int state) {
            this.state = state;
        }
        public String getDescription() {
            return description;
        }
        public void setDescription(String description) {
            this.description = description;
        }
        public String getUpdateTime() {
            return updateTime;
        }
        public void setUpdateTime(String updateTime) {
            this.updateTime = updateTime;
        }
        public ArrayList<PackageFile> getFiles() {
            return files;
        }
        public void setFiles(ArrayList<PackageFile> files) {
            this.files = files;
        }
        public String getDeviceType() {
            return deviceType;
        }
        public void setDeviceType(String deviceType) {
            this.deviceType = deviceType;
        }
        public String getCarModel() {
            return carModel;
        }
        public void setCarModel(String carModel) {
            this.carModel = carModel;
        }
        public String getPcktype() {
            return pcktype;
        }
        public void setPcktype(String pcktype) {
            this.pcktype = pcktype;
        }
        public String getOldNnum() {
            return oldNnum;
        }
        public void setOldNnum(String oldNnum) {
            this.oldNnum = oldNnum;
        }
        public String getNewNum() {
            return newNum;
        }
        public void setNewNum(String newNum) {
            this.newNum = newNum;
        }
        
    }
  • 相关阅读:
    初识面向对象
    Git 子模块
    至今为止项目中遇到的问题
    vuex , 简单入(liao)门(jie)
    Git rebase
    Git
    js设计模式工厂模式
    vue slot
    Jquery学习,一道笔试题:关于表格【最近记】
    闭包与this学习
  • 原文地址:https://www.cnblogs.com/yaowen/p/9019371.html
Copyright © 2011-2022 走看看