| | |
| | | <!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> |