第七次课

This commit is contained in:
raohanghui 2024-09-12 10:06:09 +08:00
parent 924cbb1586
commit 0e1642448b
7 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,31 @@
#-------------------------------------------------------------------------------#
# Qodana analysis is configured by qodana.yaml file #
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
#-------------------------------------------------------------------------------#
version: "1.0"
#Specify inspection profile for code analysis
profile:
name: qodana.starter
#Enable inspections
#include:
# - name: <SomeEnabledInspectionId>
#Disable inspections
#exclude:
# - name: <SomeDisabledInspectionId>
# paths:
# - <path/where/not/run/inspection>
projectJDK: 18 #(Applied in CI/CD pipeline)
#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
#bootstrap: sh ./prepare-qodana.sh
#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
#plugins:
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)
#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
linter: jetbrains/qodana-jvm:latest

View File

@ -0,0 +1,5 @@
package com.raohanghui.springboot.springboot.dao;
public interface OrderMapper {
public List<Order> getOrderById(int id);
}

View File

@ -0,0 +1,10 @@
package com.raohanghui.springboot.springboot.model;
import lombok.Date;
public class Order {
private int id;
private int userid;
private int orderprice;
private String orderinfo;
}

View File

@ -8,4 +8,5 @@ public class Person {
private int age; private int age;
private int id; private int id;
private IdCard idCard; private IdCard idCard;
private List<Order> orderList;
} }

View File

@ -0,0 +1,10 @@
<?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="com.raohanghui.springboot.springboot.dao.OrderMapper">
<select id="getOrderById" parameterType="Integer"
resultType="com.raohanghui.springboot.springboot.model.Order">
select * from orders where userid=#{id}
</select>
</mapper>

View File

@ -19,6 +19,13 @@
select="com.raohanghui.springboot.springboot.dao.PersonIdcardMapper.getIdCard"> select="com.raohanghui.springboot.springboot.dao.PersonIdcardMapper.getIdCard">
</association> </association>
<collection property="orderList"
ofType="com.raohanghui.springboot.springboot.model.Order"
column="id"
select="com.raohanghui.springboot.springboot.dao.PersonIdcardMapper.getOrderById">
</collection>
</resultMap> </resultMap>
</mapper> </mapper>

View File

@ -36,6 +36,14 @@
<td><a th:href="@{/deleteperson(id=${person.id},idcardid=${person.idCard.id})} ">删除</a></td> <td><a th:href="@{/deleteperson(id=${person.id},idcardid=${person.idCard.id})} ">删除</a></td>
<td><a th:href="@{/deleteperson(id=${person.id},age=${person.age},name=${person.name})} ">更新</a></td> <td><a th:href="@{/deleteperson(id=${person.id},age=${person.age},name=${person.name})} ">更新</a></td>
</div> </div>
<div th:if="${person.orderList} !=null">
<td>
<ul th:each="order:${person.orderList}">
<li th:text="${order.orderinfo}"></li>
</ul>
</td>
</div>
</tr> </tr>
</table> </table>