From c215a20e09565a917f77b5dabd7c79c6685ca534 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期一, 22 一月 2024 08:03:00 +0800
Subject: [PATCH] 修改xml

---
 north-glass-erp/src/main/resources/mapper/sd/Product.xml |   54 ++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 36 insertions(+), 18 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/sd/Product.xml b/north-glass-erp/src/main/resources/mapper/sd/Product.xml
index 1778fba..f95d31d 100644
--- a/north-glass-erp/src/main/resources/mapper/sd/Product.xml
+++ b/north-glass-erp/src/main/resources/mapper/sd/Product.xml
@@ -3,24 +3,42 @@
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.example.erp.mapper.sd.ProductMapper">
-    <select id="defaultProduct">
-        select
-            a.id,
-            prodID,
-            product,
-            glassType,
-            typeName,
-            totalThickness,
-            thickness,
-            Query,
-            remarks,
-            state,
-            creator,
-            date(a.createTime) as 'createTime',
-            updateTime
-        from
-            product as a
-        left join basic_glass_type bgt on bgt.typeID = a.glassType
+
+<resultMap id="productmap" type="com.example.erp.entity.sd.Product" >
+    <id column="id" property="id"/>
+    <result column="product" property="product"/>
+    <result column="total_thickness" property="totalThickness"/>
+    <result column="thickness" property="thickness"/>
+    <result column="query" property="query"/>
+    <result column="remarks" property="remarks"/>
+    <result column="state" property="state"/>
+    <result column="creator" property="creator"/>
+    <result column="create_time" property="createTime"/>
+    <result column="update_time" property="updateTime"/>
+    <association property="glassTypes" javaType="com.example.erp.entity.sd.GlassType">
+        <result column="type_id" property="typeId"/>
+        <result column="type_name" property="typeName"/>
+    </association>
+    <!--<result column="g_typeId" property="glassTypes.typeId"/>
+    <result column="g_type" property="glassTypes.type"/>-->
+
+</resultMap>
+
+    <select id="defaultProduct" resultMap="productmap">
+        select a.id                as id,
+               a.product,
+               a.total_thickness,
+               a.thickness,
+               a.query,
+               a.remarks,
+               a.state,
+               a.creator,
+               date(a.create_time) as create_time,
+               a.update_time       as update_time,
+               bgt.type_id         as type_id,
+               bgt.type            as type
+        from product as a
+                 left join glass_type bgt on bgt.type_id = a.type_id
 
         order by id desc
         limit #{offset},#{pageSize}

--
Gitblit v1.8.0