• jpa框架部分重点


    1.自定义vo类接收多个实体数据时,返回数据是list集合的

    1.1 service 业务层

    @Override
    public List> getDistrictCounty() {
        List> list = enterpriseFiscalRepository.getDistrictCounty();
        return list;
    }

    1.2  repository 层

    @Query(value = "select \n" +
            "sum(elect.value) as electValue ,\n" +
            "sum(fiscal.output_value)  as monthValue ,\n" +
            "fiscal.year as years,\n" +
            "fiscal.months  as months ,\n" +
            "sum(fiscal.trade_income) as tradeIncome \n" +
            "from enterprise enterprise \n" +
            "left join enterprise_fiscal fiscal on fiscal.enterprise_id = enterprise.id \n" +
            "left join enterprise_elect elect on elect.enterprise_id = enterprise.id \n" +
            "group by  months , years \n" +
            "order by months , years desc",nativeQuery = true)
    List> getDistrictCounty();

     2.yml配置

    spring:

            jpa:
                   hibernate:
                          #create 每次运行程序,没有表格会新建表格,表格内数据会清空
                          #create-drop 每次运行结束的时候回清空表
                          #update 每次运行程序,没有表格会新建表格,没有表格不会清空,只会更新
                          #validate 每次运行程序会效验数据与数据库字段类型是否相同,不同会报错
                          ddl-auto: validate

                 #是否输出SQL,工作台里面是否输出
                 show-sql: false
                 open-in-view: false

  • 相关阅读:
    进程调度,进程
    Leetcode算法解析——快乐数
    【ROS系统】Ubuntu22.04系统中安装ROS2系统_ubuntu 安装ros2_GoesM
    Spring IOC 常用注解与使用
    【C++】setjmp,longjmp的详细使用说明
    【C++】C++11中的智能指针
    TDengineGUI无法连接TDengine
    【无标题】
    斜率优化DP day47
    App Store和Google Play之间的关键区别
  • 原文地址:https://blog.csdn.net/m0_69712602/article/details/132650539