李林
2024-03-12 043c1adb3047489ec8c2d2d50ddc49d7856901ee
功能调整
已修改5个文件
已添加6个文件
376 ■■■■■ 文件已修改
cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-server/src/main/resources/mapper/StructureItemParameterMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/controller/StandardTemplateController.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTemplateMapper.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/pojo/StandardTemplate.java 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/StandardTemplateService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTemplateServiceImpl.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/StandardTemplateMapper.xml 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/mapper/StandardTreeMapper.xml 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java
@@ -29,12 +29,12 @@
    @ApiModelProperty(value = "检验项")
    private String inspectionItem;
    @ValueTableShow(2)
    @ApiModelProperty(value = "检验项分类")
    private String inspectionItemClassify;
//    @ValueTableShow(2)
//    @ApiModelProperty(value = "检验子项")
//    private String inspectionItemClassify;
    @ValueTableShow(3)
    @ApiModelProperty(value = "检验项小类")
    @ApiModelProperty(value = "检验项子项")
    private String inspectionItemSubclass;
    @ValueTableShow(4)
@@ -93,6 +93,10 @@
    @ApiModelProperty(value = "特殊标识")
    private String bsm;
    @ValueTableShow(5)
    @ApiModelProperty(value = "样品名称")
    private String sample;
    @ApiModelProperty(value = "创建人id")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
cnas-server/src/main/resources/mapper/StructureItemParameterMapper.xml
@@ -27,6 +27,7 @@
        method,
        man_day,
        bsm,
        sample,
        inspection_value_type
        from structure_item_parameter
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
inspect-server/src/main/java/com/yuanchu/mom/controller/StandardTemplateController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,50 @@
package com.yuanchu.mom.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.mom.pojo.StandardTemplate;
import com.yuanchu.mom.service.StandardTemplateService;
import com.yuanchu.mom.utils.JackSonUtil;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RequestMapping("/StandardTemplate")
@RestController
@AllArgsConstructor
public class StandardTemplateController {
    private StandardTemplateService standardTemplateService;
    @ApiOperation(value = "获取检验模板列表")
    @PostMapping("/selectStandardTemplatePageList")
    public Result selectStandardTemplatePageList(@RequestBody Map<String, Object> data) throws Exception {
        Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class);
        StandardTemplate standardTemplate = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), StandardTemplate.class);
        return Result.success(standardTemplateService.selectStandardTemplatePageList(page, standardTemplate));
    }
    @ApiOperation(value = "添加检验模板")
    @PostMapping("/addStandardTemplate")
    public Result addStandardTemplate(@RequestBody StandardTemplate standardTemplate) {
        return Result.success(standardTemplateService.addStandardTemplate(standardTemplate));
    }
    @ApiOperation(value = "修改检验模板")
    @PostMapping("/upStandardTemplate")
    public Result<?> upStandardTemplate(@RequestBody StandardTemplate standardTemplate) {
        return Result.success(standardTemplateService.upStandardTemplate(standardTemplate));
    }
    @ApiOperation(value = "删除检验模板")
    @PostMapping("/delStandardTemplate")
    public Result<?> delStandardTemplate(Integer id) {
        return Result.success(standardTemplateService.delStandardTemplate(id));
    }
}
inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTemplateMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package com.yuanchu.mom.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yuanchu.mom.pojo.StandardTemplate;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€standard_template(标准模板)】的数据库操作Mapper
* @createDate 2024-03-11 13:47:52
* @Entity com.yuanchu.mom.pojo.StandardTemplate
*/
public interface StandardTemplateMapper extends BaseMapper<StandardTemplate> {
    IPage<StandardTemplate> selectStandardTemplatePageList(IPage<StandardTemplate> page, QueryWrapper<StandardTemplate> ew);
}
inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java
@@ -19,6 +19,8 @@
    StandardProductList selectStandardProductById(Integer id);
    List<StandardProductList> getStandardProductListBySample(String sample);
}
inspect-server/src/main/java/com/yuanchu/mom/pojo/StandardTemplate.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,78 @@
package com.yuanchu.mom.pojo;
import com.baomidou.mybatisplus.annotation.*;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yuanchu.mom.annotation.ValueTableShow;
import com.yuanchu.mom.common.OrderBy;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * æ ‡å‡†æ¨¡æ¿
 * @TableName standard_template
 */
@TableName(value ="standard_template")
@Data
public class StandardTemplate extends OrderBy implements Serializable {
    /**
     *
     */
    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
     * æ¨¡æ¿åç§°
     */
    @ApiModelProperty("模板名称")
    @ValueTableShow(1)
    private String name;
    /**
     * å¤‡æ³¨
     */
    @ApiModelProperty("备注")
    @ValueTableShow(2)
    private String remark;
    /**
     * æ¨¡æ¿ç»“æž„
     */
    private String thing;
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    /**
     *
     */
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ValueTableShow(4)
    private LocalDateTime createTime;
    /**
     *
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    /**
     *
     */
    @ApiModelProperty("修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ValueTableShow(6)
    private LocalDateTime updateTime;
    @ApiModelProperty("创建用户")
    @ValueTableShow(3)
    private String createUserName;
    @ApiModelProperty("更新用户")
    @ValueTableShow(5)
    private String updateUserName;
}
inspect-server/src/main/java/com/yuanchu/mom/service/StandardTemplateService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,24 @@
package com.yuanchu.mom.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yuanchu.mom.pojo.StandardTemplate;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Map;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€standard_template(标准模板)】的数据库操作Service
* @createDate 2024-03-11 13:47:52
*/
public interface StandardTemplateService extends IService<StandardTemplate> {
    Map<String, Object> selectStandardTemplatePageList(IPage<StandardTemplate> page, StandardTemplate standardTemplate);
    int addStandardTemplate(StandardTemplate standardTemplate);
    int upStandardTemplate(StandardTemplate standardTemplate);
    int delStandardTemplate(Integer id);
}
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTemplateServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,59 @@
package com.yuanchu.mom.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.common.GetLook;
import com.yuanchu.mom.common.PrintChina;
import com.yuanchu.mom.pojo.StandardTemplate;
import com.yuanchu.mom.service.StandardTemplateService;
import com.yuanchu.mom.mapper.StandardTemplateMapper;
import com.yuanchu.mom.utils.QueryWrappers;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€standard_template(标准模板)】的数据库操作Service实现
* @createDate 2024-03-11 13:47:52
*/
@Service
@AllArgsConstructor
public class StandardTemplateServiceImpl extends ServiceImpl<StandardTemplateMapper, StandardTemplate>
    implements StandardTemplateService{
    private GetLook getLook;
    private StandardTemplateMapper standardTemplateMapper;
    @Override
    public Map<String, Object> selectStandardTemplatePageList(IPage<StandardTemplate> page, StandardTemplate standardTemplate) {
        Map<String, Object> map = new HashMap<>();
        map.put("head", PrintChina.printChina(StandardTemplate.class));
        Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("selectStandardTemplatePageList");
        if(map1.get("look")==1) standardTemplate.setCreateUser(map1.get("userId"));
        map.put("body", standardTemplateMapper.selectStandardTemplatePageList(page, QueryWrappers.queryWrappers(standardTemplate)));
        return map;
    }
    @Override
    public int addStandardTemplate(StandardTemplate standardTemplate) {
        return standardTemplateMapper.insert(standardTemplate);
    }
    @Override
    public int upStandardTemplate(StandardTemplate standardTemplate) {
        return standardTemplateMapper.updateById(standardTemplate);
    }
    @Override
    public int delStandardTemplate(Integer id) {
        return standardTemplateMapper.deleteById(id);
    }
}
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java
@@ -45,7 +45,19 @@
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int addStandardTree(StandardTree standardTree) {
        if(standardTree.getSample()!=null){
            List<StandardProductList> list = standardTreeMapper.getStandardProductListBySample(standardTree.getSample());
            for (StandardProductList standardProductList : list) {
                standardProductList.setFactory(standardTree.getFactory());
                standardProductList.setLaboratory(standardTree.getLaboratory());
                standardProductList.setSampleType(standardTree.getSampleType());
                standardProductList.setSample(standardTree.getSample());
                standardProductList.setModel(standardTree.getModel());
                standardProductListMapper.insert(standardProductList);
            }
        }
        return standardTreeMapper.insert(standardTree);
    }
inspect-server/src/main/resources/mapper/StandardTemplateMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
<?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.mom.mapper.StandardTemplateMapper">
    <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.StandardTemplate">
            <id property="id" column="id" jdbcType="INTEGER"/>
            <result property="name" column="name" jdbcType="VARCHAR"/>
            <result property="remark" column="remark" jdbcType="VARCHAR"/>
            <result property="thing" column="thing" jdbcType="VARCHAR"/>
            <result property="createUser" column="create_user" jdbcType="INTEGER"/>
            <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
    </resultMap>
    <sql id="Base_Column_List">
        id,name,remark,
        thing,create_user,update_user,
        create_time,update_time
    </sql>
    <select id="selectStandardTemplatePageList" resultType="com.yuanchu.mom.pojo.StandardTemplate">
        select * from (
        select st.id, st.name, remark, thing, u2.name create_user_name, u3.name update_user_name, st.create_time, st.update_time
        from standard_template st
        left join user u2 on u2.id = st.create_user
        left join user u3 on u3.id = st.update_user
        ) a
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
</mapper>
inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
@@ -5,16 +5,16 @@
<mapper namespace="com.yuanchu.mom.mapper.StandardTreeMapper">
    <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.StandardTree">
            <id property="id" column="id" jdbcType="INTEGER"/>
            <result property="factory" column="factory" jdbcType="VARCHAR"/>
            <result property="laboratory" column="laboratory" jdbcType="VARCHAR"/>
            <result property="sampleType" column="sample_type" jdbcType="VARCHAR"/>
            <result property="sample" column="sample" jdbcType="VARCHAR"/>
            <result property="model" column="model" jdbcType="VARCHAR"/>
            <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="factory" column="factory" jdbcType="VARCHAR"/>
        <result property="laboratory" column="laboratory" jdbcType="VARCHAR"/>
        <result property="sampleType" column="sample_type" jdbcType="VARCHAR"/>
        <result property="sample" column="sample" jdbcType="VARCHAR"/>
        <result property="model" column="model" jdbcType="VARCHAR"/>
        <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>
    <resultMap id="FactoryDto" type="com.yuanchu.mom.dto.FactoryDto">
@@ -47,29 +47,51 @@
    </resultMap>
    <select id="selectStandardTreeList" resultMap="FactoryDto">
        select factory,laboratory,sample_type,sample,model from standard_tree
        select factory, laboratory, sample_type, sample, model
        from standard_tree
    </select>
    <select id="selectStandardProductById" resultType="com.yuanchu.mom.pojo.StandardProductList">
        select
            inspection_item,
            inspection_item_classify,
            inspection_item_subclass,
            laboratory,
            unit,
            price,
            man_hour,
            man_hour_group,
            inspection_item_type,
            inspection_value_type,
            device_group,
            checkout_number,
            section,
            value_type,
            method,
            man_day,
            bsm
        select inspection_item,
               inspection_item_classify,
               inspection_item_subclass,
               laboratory,
               unit,
               price,
               man_hour,
               man_hour_group,
               inspection_item_type,
               inspection_value_type,
               device_group,
               checkout_number,
               section,
               value_type,
               method,
               man_day,
               bsm
        from structure_item_parameter
        where id = #{id}
    </select>
    <select id="getStandardProductListBySample" resultType="com.yuanchu.mom.pojo.StandardProductList">
        select inspection_item,
               inspection_item_classify,
               inspection_item_subclass,
               laboratory,
               unit,
               price,
               man_hour,
               man_hour_group,
               inspection_item_type,
               inspection_value_type,
               device_group,
               checkout_number,
               section,
               value_type,
               method,
               man_day,
               sample,
               bsm
        from structure_item_parameter
        where sample = #{sample}
    </select>
</mapper>