inspect-server/src/main/java/com/yuanchu/mom/controller/StandardTreeController.java
@@ -1,6 +1,7 @@ package com.yuanchu.mom.controller; import cn.hutool.core.util.ObjectUtil; import com.yuanchu.mom.annotation.ValueAuth; import com.yuanchu.mom.pojo.StandardTree; import com.yuanchu.mom.service.StandardMethodListService; import com.yuanchu.mom.service.StandardTreeService; @@ -39,8 +40,9 @@ @ApiOperation(value = "根据标准树进行标准查询") @PostMapping("/selectsStandardMethodByFLSSM") public Result selectsStandardMethodByFLSSM(){ return Result.success(); @ValueAuth public Result selectsStandardMethodByFLSSM(String tree){ return Result.success(standardMethodListService.selectsStandardMethodByFLSSM(tree)); } } inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java
@@ -3,6 +3,7 @@ import com.yuanchu.mom.pojo.StandardMethodList; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import java.util.List; import java.util.Map; /** @@ -15,6 +16,10 @@ Map<String, String> selectStandardMethodById(Integer id); String selectUserById(Integer id); List<StandardMethodList> selectStandardMethodLists(String data1,String data2,String data3,String data4, String data5); } inspect-server/src/main/java/com/yuanchu/mom/pojo/StandardMethodList.java
@@ -61,6 +61,8 @@ @ApiModelProperty("") @TableField(fill = FieldFill.INSERT) private Integer createUser; private String createUserName; /** * */ inspect-server/src/main/java/com/yuanchu/mom/service/StandardMethodListService.java
@@ -3,6 +3,8 @@ import com.yuanchu.mom.pojo.StandardMethodList; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; /** * @author Administrator * @description 针对表【standard_method_list(标准树下的标准列表)】的数据库操作Service @@ -12,4 +14,6 @@ int addStandardMethodList(Integer standardId, String tree); List<StandardMethodList> selectsStandardMethodByFLSSM(String tree); } inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java
@@ -1,5 +1,6 @@ package com.yuanchu.mom.service.impl; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.yuanchu.mom.pojo.StandardMethodList; import com.yuanchu.mom.service.StandardMethodListService; @@ -7,6 +8,7 @@ import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; /** @@ -38,6 +40,30 @@ }catch (Exception e){} return standardMethodListMapper.insert(list); } @Override public List<StandardMethodList> selectsStandardMethodByFLSSM(String tree) { String[] trees = tree.split(" - "); List<StandardMethodList> standardMethodLists = null; switch (trees.length){ case 5: standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],trees[1],trees[2],trees[3],trees[4]); break; case 4: standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],trees[1],trees[2],trees[3],null); break; case 3: standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],trees[1],trees[2],null,null); break; case 2: standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],trees[1],null,null,null); break; case 1: standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],null,null,null,null); break; } return standardMethodLists; } } inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml
@@ -5,15 +5,15 @@ <mapper namespace="com.yuanchu.mom.mapper.StandardMethodListMapper"> <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.StandardMethodList"> <id property="id" column="id" jdbcType="INTEGER"/> <result property="code" column="code" jdbcType="VARCHAR"/> <result property="name" column="name" jdbcType="VARCHAR"/> <result property="remark" column="remark" jdbcType="VARCHAR"/> <result property="standardTreeId" column="standard_tree_id" jdbcType="INTEGER"/> <result property="createUser" column="create_user" jdbcType="INTEGER"/> <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> <result property="updateUser" column="update_user" jdbcType="INTEGER"/> <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> <id property="id" column="id" jdbcType="INTEGER"/> <result property="code" column="code" jdbcType="VARCHAR"/> <result property="name" column="name" jdbcType="VARCHAR"/> <result property="remark" column="remark" jdbcType="VARCHAR"/> <result property="standardTreeId" column="standard_tree_id" jdbcType="INTEGER"/> <result property="createUser" column="create_user" jdbcType="INTEGER"/> <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> <result property="updateUser" column="update_user" jdbcType="INTEGER"/> <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> </resultMap> <sql id="Base_Column_List"> @@ -22,7 +22,31 @@ create_time,update_user,update_time </sql> <select id="selectStandardMethodById" resultType="java.util.Map"> select code,name,remark from standard_method select code, name, remark from standard_method where id = #{id} </select> <select id="selectUserById" resultType="java.lang.String"> select name from user where id = #{id} </select> <select id="selectStandardMethodLists" resultType="com.yuanchu.mom.pojo.StandardMethodList"> select sml.id, code, sml.name,sml.remark, sml.create_time, u.name create_user_name from standard_method_list sml left join user u on u.id = sml.create_user where factory = #{data1} <if test="data2 != null"> and laboratory = #{data2} </if> <if test="data3 != null"> and sample_type = #{data3} </if> <if test="data4 != null"> and sample = #{data4} </if> <if test="data5 != null"> and model = #{data5} </if> </select> </mapper>