From c0e7f848236e1ab5f945b98c32d12c81e3e9c991 Mon Sep 17 00:00:00 2001 From: Fixiaobai <fixiaobai@163.com> Date: 星期四, 24 八月 2023 18:04:09 +0800 Subject: [PATCH] 角色管理 --- standard-server/src/main/resources/mapper/MaterialMapper.xml | 53 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 44 insertions(+), 9 deletions(-) diff --git a/standard-server/src/main/resources/mapper/MaterialMapper.xml b/standard-server/src/main/resources/mapper/MaterialMapper.xml index a14fe8e..e879a4e 100644 --- a/standard-server/src/main/resources/mapper/MaterialMapper.xml +++ b/standard-server/src/main/resources/mapper/MaterialMapper.xml @@ -1,15 +1,15 @@ <?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.yuanchu.limslaboratory.mapper.MaterialMapper"> - - <select id="selectMaterialLimit" resultType="com.yuanchu.limslaboratory.pojo.Material"> - select id, name - from material + <select id="selectMaterialLimit" resultType="Map"> + select id, code, name + from lims_laboratory.material where state = 1 + and type = #{type} order by create_time desc - limit #{num1},#{num2} + limit #{num1}, #{num2} </select> - <select id="selectMaterialById" resultType="java.util.Map"> + <select id="selectMaterialById" resultType="Map"> select m.id, m.num, m.supplier, @@ -22,10 +22,45 @@ s.cross_section crossSection, s.number_of_cores numberOfCores, s.instruct - from material m, - specifications s, - serial_number sn + from lims_laboratory.material m, + lims_laboratory.specifications s, + lims_laboratory.serial_number sn where m.specifications_id = s.id and s.serial_id = sn.id + and m.id = #{materialId} </select> + + <resultMap id="OneLevelTreeMap" type="Map"> + <id property="type" column="type"/> + <collection property="children" resultMap="TwoLevelTreeMap" javaType="List"/> + </resultMap> + + <resultMap id="TwoLevelTreeMap" type="Map"> + <id property="id" column="materialId"/> + <result property="name" column="materialName"/> + <collection property="children" resultMap="ThreeLevelTreeMap" javaType="List"/> + </resultMap> + + <resultMap id="ThreeLevelTreeMap" type="Map"> + <id property="id" column="standardId"/> + <result property="name" column="standardName"/> + <collection property="children" resultMap="FourLevelTreeMap" javaType="List"/> + </resultMap> + + <resultMap id="FourLevelTreeMap" type="Map"> + <id property="id" column="specificationsId"/> + <result property="name" column="specificationsName"/> + </resultMap> + + <select id="FourTree" resultMap="OneLevelTreeMap"> + SELECT m.`type`, m.`id` materialId, m.`name` materialName, s.id standardId, s.name standardName, + f.id specificationsId, f.name specificationsName + FROM material m + LEFT JOIN (SELECT s.`id`, s.`name`, s.`material_id` FROM standard s WHERE s.`state` = 1) s + ON s.material_id = m.`id` + LEFT JOIN (SELECT f.`id`, f.`name`, f.`standard_id` FROM specifications f WHERE f.`state` = 1) f + ON f.standard_id = s.id + WHERE m.`state` = 1 + </select> + </mapper> -- Gitblit v1.9.3