From 15e31c6e6550f9e8bf6fb1df5ca5ad4cc726b64f Mon Sep 17 00:00:00 2001 From: XiaoRuby <3114200645@qq.com> Date: 星期六, 26 八月 2023 13:30:13 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- standard-server/src/main/resources/mapper/StandardMapper.xml | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/standard-server/src/main/resources/mapper/StandardMapper.xml b/standard-server/src/main/resources/mapper/StandardMapper.xml index 0e0f8ce..b232854 100644 --- a/standard-server/src/main/resources/mapper/StandardMapper.xml +++ b/standard-server/src/main/resources/mapper/StandardMapper.xml @@ -2,4 +2,22 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.yuanchu.limslaboratory.mapper.StandardMapper"> + <resultMap id="BaseResultMap" type="java.util.Map"> + <id property="specificationsId" column="specificationsId" jdbcType="INTEGER"/> + <result property="specificationsName" column="specificationsName" jdbcType="VARCHAR"/> + <collection property="children" resultMap="BaseResultMapChildren" javaType="java.util.List"/> + </resultMap> + <resultMap id="BaseResultMapChildren" type="java.util.Map"> + <id property="modelId" column="modelId" jdbcType="INTEGER"/> + <result property="modelName" column="modelName" jdbcType="VARCHAR"/> + </resultMap> + + <select id="getSpecificationIdAndName" resultMap="BaseResultMap"> + SELECT s.`id` specificationsId, s.`name` specificationsName, f.id modelId, f.name modelName + FROM standard s + LEFT JOIN (SELECT f.`id`, f.`name`, f.`standard_id` FROM specifications f WHERE f.`state` = 1) f + ON s.`id` = f.`standard_id` + WHERE s.`material_id` = #{materialId} + AND s.`state` = 1 + </select> </mapper> -- Gitblit v1.9.3