瀏覽代碼

新增安全工具CRUD

wuhonghao 4 年之前
父節點
當前提交
1a6ab1cbb8

+ 63 - 0
railway-admin/src/main/java/com/railway/web/controller/business/safetool/BaseSafetyToolController.java

@@ -0,0 +1,63 @@
+package com.railway.web.controller.business.safetool;
+
+import com.railway.business.safetool.domain.BaseSafetyTool;
+import com.railway.business.safetool.service.IBaseSafetyToolService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.WebDataBinder;
+import com.railway.common.core.controller.BaseController;
+import com.railway.common.core.domain.AjaxResult;
+import com.railway.common.core.page.TableDataInfo;
+import javax.validation.Valid;
+import java.util.List;
+
+import javax.validation.Valid;
+
+@Api(value = "rest/safetool/base/safety/tool", tags = "安全工具-基础数据")
+@RestController
+@Validated
+@RequestMapping(value = "business/safetool/base/safety/tool")
+public class BaseSafetyToolController extends BaseController {
+    @Autowired
+    private IBaseSafetyToolService baseSafetyToolService;
+
+    @ApiOperation(value = "新增")
+    @PostMapping("/add")
+    public AjaxResult add(@Validated @RequestBody BaseSafetyTool baseSafetyTool) {
+        return toAjax(baseSafetyToolService.create(baseSafetyTool));
+    }
+
+    @ApiOperation(value = "删除")
+    @DeleteMapping("/{toolIds}")
+    public AjaxResult delete(@RequestParam String[] toolIds) {
+        return toAjax(baseSafetyToolService.delete(toolIds));
+    }
+
+    @ApiOperation(value = "更新")
+    @PutMapping("/update")
+    public AjaxResult update(@RequestBody @Valid BaseSafetyTool baseSafetyTool) {
+        return toAjax(baseSafetyToolService.update(baseSafetyTool));
+    }
+
+    @ApiOperation(value = "单个")
+    @GetMapping(value = {"/", "/{toolId}"})
+    public AjaxResult getInfo(String toolId) {
+        BaseSafetyTool info = baseSafetyToolService.getInfo(toolId);
+        AjaxResult ajax = AjaxResult.success();
+        ajax.put("info",info);
+        return ajax;
+    }
+
+    @ApiOperation(value = "列表")
+    @GetMapping(value = "list")
+    public TableDataInfo getList(BaseSafetyTool baseSafetyTool) {
+        startPage();
+        List<BaseSafetyTool> list = baseSafetyToolService.getList(baseSafetyTool);
+        return getDataTable(list);
+    }
+
+}

+ 13 - 0
railway-admin/src/main/java/com/railway/web/core/config/SwaggerConfig.java

@@ -191,6 +191,19 @@ public class SwaggerConfig {
     });
   }
 
+  /**
+   * 安全工具
+   *
+   * @return Docket
+   */
+  @Bean
+  public Docket saftoolDocket(Environment environment) {
+    return getDocket(environment, "006.安全工具", "安全工具", "安全工具", new String[]{
+            "/login",
+            "/business/safetool/.*"
+    });
+  }
+
   /**
    * 创建API
    */

+ 121 - 0
railway-business/src/main/java/com/railway/business/safetool/domain/BaseSafetyTool.java

@@ -0,0 +1,121 @@
+package com.railway.business.safetool.domain;
+
+import com.railway.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import java.util.Date;
+
+import org.hibernate.validator.constraints.Length;
+import javax.validation.constraints.NotNull;
+/**
+ * 安全工具-基础数据
+ * @author wuhonghao 2021-12-01
+ */
+@Data
+@ApiModel("安全工具-基础数据")
+@EqualsAndHashCode(callSuper = true)
+public class BaseSafetyTool extends BaseEntity{
+
+    @ApiModelProperty(value = "主键", hidden = true)
+    private String toolId;
+
+    @ApiModelProperty(value = "车间id")
+    private Long deptId;
+
+    @ApiModelProperty(value = "车间名称")
+    private String deptName;
+
+    @ApiModelProperty(value = "存放处所")
+    @Length(min = 1, max = 100, message = "【存放处所】长度必须介于 {min} 和 {max} 之间")
+    private String storePlace;
+
+    @ApiModelProperty(value = "名称")
+    @Length(min = 1, max = 100, message = "【名称】长度必须介于 {min} 和 {max} 之间")
+    private String toolName;
+
+    @ApiModelProperty(value = "类型(名称字典)")
+    @Length(min = 1, max = 10, message = "【类型(名称字典)】长度必须介于 {min} 和 {max} 之间")
+    private String toolType;
+
+    @ApiModelProperty(value = "编号")
+    @Length(min = 1, max = 50, message = "【编号】长度必须介于 {min} 和 {max} 之间")
+    private String toolCode;
+
+    @ApiModelProperty(value = "电压等级")
+    @Length(min = 1, max = 10, message = "【电压等级】长度必须介于 {min} 和 {max} 之间")
+    private String elecLevel;
+
+    @ApiModelProperty(value = "单位")
+    @Length(min = 1, max = 10, message = "【单位】长度必须介于 {min} 和 {max} 之间")
+    private String unit;
+
+    @ApiModelProperty(value = "试验周期")
+    private Integer testCycle;
+
+    @ApiModelProperty(value = "试验周期")
+    private String testCycleText;
+
+    @ApiModelProperty(value = "上次试验日期")
+    private Date lastTestDate;
+
+    @ApiModelProperty(value = "下次试验日期")
+    private Date nextTestDate;
+
+    @ApiModelProperty(value = "试验结果(0:失败1:成功)")
+    @Length(min = 1, max = 1, message = "【试验结果(0:失败1:成功)】长度必须介于 {min} 和 {max} 之间")
+    private String testResult;
+
+    @ApiModelProperty(value = "实际试验时间")
+    private Date testDate;
+
+    @ApiModelProperty(value = "试验结果描述")
+    @Length(min = 1, max = 255, message = "【试验结果描述】长度必须介于 {min} 和 {max} 之间")
+    private String testResultDesc;
+
+    @ApiModelProperty(value = "状态 0:报废 1:正常")
+    @Length(min = 1, max = 1, message = "【状态 0:报废 1:正常】长度必须介于 {min} 和 {max} 之间")
+    private String state;
+
+    @ApiModelProperty(value = "报废原因")
+    @Length(min = 1, max = 255, message = "【报废原因】长度必须介于 {min} 和 {max} 之间")
+    private String scrapReason;
+
+    @ApiModelProperty(value = "报废时间")
+    private Date scrapDate;
+
+    @ApiModelProperty(value = "报废操作人")
+    @Length(min = 1, max = 20, message = "【报废操作人】长度必须介于 {min} 和 {max} 之间")
+    private String scrapUser;
+
+    @ApiModelProperty(value = "生产厂家")
+    @Length(min = 1, max = 100, message = "【生产厂家】长度必须介于 {min} 和 {max} 之间")
+    private String produceFactory;
+
+    @ApiModelProperty(value = "生产日期")
+    private Date produceDate;
+
+    @ApiModelProperty(value = "备注")
+    @Length(min = 1, max = 255, message = "【备注】长度必须介于 {min} 和 {max} 之间")
+    private String remark;
+
+    @ApiModelProperty(value = "del_flag")
+    @Length(min = 1, max = 1, message = "【del_flag】长度必须介于 {min} 和 {max} 之间")
+    private String delFlag;
+
+    @ApiModelProperty(value = "create_by")
+    @Length(min = 1, max = 64, message = "【create_by】长度必须介于 {min} 和 {max} 之间")
+    private String createBy;
+
+    @ApiModelProperty(value = "update_by")
+    @Length(min = 1, max = 64, message = "【update_by】长度必须介于 {min} 和 {max} 之间")
+    private String updateBy;
+
+    @ApiModelProperty(value = "update_time")
+    private Date updateTime;
+
+    public BaseSafetyTool() {
+    }
+
+}

+ 43 - 0
railway-business/src/main/java/com/railway/business/safetool/mapper/BaseSafetyToolMapper.java

@@ -0,0 +1,43 @@
+package com.railway.business.safetool.mapper;
+
+import com.github.pagehelper.Page;
+import com.railway.business.safetool.domain.BaseSafetyTool;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+/**
+* 安全工具-基础数据
+* @author wuhonghao
+* @date 2021/12/01
+*/
+@Mapper
+@Repository
+public interface BaseSafetyToolMapper {
+
+    /**
+    * 新增
+    */
+    int insert(BaseSafetyTool baseSafetyTool);
+
+    /**
+    * 删除
+    */
+    int delete(@Param("toolId") String toolId);
+
+    /**
+    * 更新
+    */
+    int update(BaseSafetyTool baseSafetyTool);
+
+    /**
+    * 获取单个
+    */
+    BaseSafetyTool getInfo(@Param("toolId") String toolId);
+
+    /**
+    * 查询列表
+    */
+    Page<BaseSafetyTool> getList(BaseSafetyTool baseSafetyTool);
+
+}

+ 37 - 0
railway-business/src/main/java/com/railway/business/safetool/service/IBaseSafetyToolService.java

@@ -0,0 +1,37 @@
+package com.railway.business.safetool.service;
+
+import com.railway.business.safetool.domain.BaseSafetyTool;
+import java.util.List;
+/**
+* 安全工具-基础数据
+* @author wuhonghao
+* @date 2021/12/01
+*/
+public interface IBaseSafetyToolService{
+
+    /**
+    * 新增
+    */
+    int create(BaseSafetyTool baseSafetyTool);
+
+    /**
+    * 删除
+    */
+    int delete(String[] toolIds);
+
+    /**
+    * 更新
+    */
+    int update(BaseSafetyTool baseSafetyTool);
+
+    /**
+    * 获取单个
+    */
+    BaseSafetyTool getInfo(String toolId);
+
+    /**
+    * 查询列表
+    */
+    List<BaseSafetyTool> getList(BaseSafetyTool baseSafetyTool);
+
+}

+ 71 - 0
railway-business/src/main/java/com/railway/business/safetool/service/impl/BaseSafetyToolServiceImpl.java

@@ -0,0 +1,71 @@
+package com.railway.business.safetool.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.railway.business.safetool.mapper.BaseSafetyToolMapper;
+import com.railway.business.safetool.domain.BaseSafetyTool;
+import com.railway.business.safetool.service.IBaseSafetyToolService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.railway.common.utils.SecurityUtils;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.List;
+import java.util.Date;
+/**
+* 安全工具-基础数据
+* @author wuhonghao
+* @date 2021/12/01
+*/
+@Service
+@Transactional(readOnly = true)
+public class BaseSafetyToolServiceImpl implements IBaseSafetyToolService{
+@Autowired
+private BaseSafetyToolMapper baseSafetyToolMapper;
+
+	/**
+	* 新增
+	*/
+	@Transactional(rollbackFor = Exception.class)
+	public int create(BaseSafetyTool baseSafetyTool) {
+	    baseSafetyTool.setCreateTime(new Date());
+        baseSafetyTool.setCreateBy(SecurityUtils.getUsername());
+		return baseSafetyToolMapper.insert(baseSafetyTool);
+	}
+
+	/**
+	* 删除
+	*/
+	@Transactional(rollbackFor = Exception.class)
+	public int delete(String[] toolIds) {
+		int r =0;
+		for (String toolId : toolIds) {
+			int j= baseSafetyToolMapper.delete(toolId);
+			r = r + j;
+		}
+		return	r;
+	}
+
+	/**
+	* 更新
+	*/
+	@Transactional(rollbackFor = Exception.class)
+	public int update(BaseSafetyTool baseSafetyTool) {
+		baseSafetyTool.setUpdateTime(new Date());
+    	baseSafetyTool.setUpdateBy(SecurityUtils.getUsername());
+		return baseSafetyToolMapper.update(baseSafetyTool);
+	}
+
+	/**
+	* 获取单个
+	*/
+	public BaseSafetyTool getInfo(String toolId) {
+		return baseSafetyToolMapper.getInfo(toolId);
+	}
+
+	/**
+	* 查询列表
+	*/
+	public List<BaseSafetyTool> getList(BaseSafetyTool baseSafetyTool) {
+		return baseSafetyToolMapper.getList(baseSafetyTool);
+	}
+}

+ 363 - 0
railway-business/src/main/resources/mapper/safetool/BaseSafetyToolMapper.xml

@@ -0,0 +1,363 @@
+<?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.railway.business.safetool.mapper.BaseSafetyToolMapper">
+
+    <resultMap id="BaseResultMap" type="com.railway.business.safetool.domain.BaseSafetyTool">
+                <result column="tool_id" property="toolId"/>
+                <result column="dept_id" property="deptId"/>
+                <result column="dept_name" property="deptName"/>
+                <result column="store_place" property="storePlace"/>
+                <result column="tool_name" property="toolName"/>
+                <result column="tool_type" property="toolType"/>
+                <result column="tool_code" property="toolCode"/>
+                <result column="elec_level" property="elecLevel"/>
+                <result column="unit" property="unit"/>
+                <result column="test_cycle" property="testCycle"/>
+                <result column="test_cycle_text" property="testCycleText"/>
+                <result column="last_test_date" property="lastTestDate"/>
+                <result column="next_test_date" property="nextTestDate"/>
+                <result column="test_result" property="testResult"/>
+                <result column="test_date" property="testDate"/>
+                <result column="test_result_desc" property="testResultDesc"/>
+                <result column="state" property="state"/>
+                <result column="scrap_reason" property="scrapReason"/>
+                <result column="scrap_date" property="scrapDate"/>
+                <result column="scrap_user" property="scrapUser"/>
+                <result column="produce_factory" property="produceFactory"/>
+                <result column="produce_date" property="produceDate"/>
+                <result column="remark" property="remark"/>
+                <result column="del_flag" property="delFlag"/>
+                <result column="create_by" property="createBy"/>
+                <result column="create_time" property="createTime"/>
+                <result column="update_by" property="updateBy"/>
+                <result column="update_time" property="updateTime"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        t.tool_id,
+        t.dept_id,
+        dept.dept_name,
+        t.store_place,
+        dict1.dict_label as tool_name,
+        t.tool_type,
+        t.tool_code,
+        t.elec_level,
+        dict1.remark unit,
+        t.test_cycle,
+        dict2.dict_label as test_cycle_text,
+        t.last_test_date,
+        t.next_test_date,
+        t.test_result,
+        t.test_date,
+        t.test_result_desc,
+        t.state,
+        t.scrap_reason,
+        t.scrap_date,
+        t.scrap_user,
+        t.produce_factory,
+        t.produce_date,
+        t.remark,
+        t.del_flag,
+        t.create_by,
+        t.create_time,
+        t.update_by,
+        t.update_time
+    </sql>
+
+    <insert id="insert" parameterType="com.railway.business.safetool.domain.BaseSafetyTool">
+        <selectKey keyProperty="toolId" order="BEFORE" resultType="String">
+            select replace(uuid(), '-', '') from dual
+        </selectKey>
+        INSERT INTO base_safety_tool
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+                    <if test ='null != deptId'>
+                    dept_id,
+                    </if>
+                    <if test ='null != storePlace'>
+                    store_place,
+                    </if>
+                    <if test ='null != toolName'>
+                    tool_name,
+                    </if>
+                    <if test ='null != toolType'>
+                    tool_type,
+                    </if>
+                    <if test ='null != toolCode'>
+                    tool_code,
+                    </if>
+                    <if test ='null != elecLevel'>
+                    elec_level,
+                    </if>
+                    <if test ='null != unit'>
+                    unit,
+                    </if>
+                    <if test ='null != testCycle'>
+                    test_cycle,
+                    </if>
+                    <if test ='null != lastTestDate'>
+                    last_test_date,
+                    </if>
+                    <if test ='null != nextTestDate'>
+                    next_test_date,
+                    </if>
+                    <if test ='null != testResult'>
+                    test_result,
+                    </if>
+                    <if test ='null != testDate'>
+                    test_date,
+                    </if>
+                    <if test ='null != testResultDesc'>
+                    test_result_desc,
+                    </if>
+                    <if test ='null != state'>
+                    state,
+                    </if>
+                    <if test ='null != scrapReason'>
+                    scrap_reason,
+                    </if>
+                    <if test ='null != scrapDate'>
+                    scrap_date,
+                    </if>
+                    <if test ='null != scrapUser'>
+                    scrap_user,
+                    </if>
+                    <if test ='null != produceFactory'>
+                    produce_factory,
+                    </if>
+                    <if test ='null != produceDate'>
+                    produce_date,
+                    </if>
+                    <if test ='null != remark'>
+                    remark,
+                    </if>
+                    <if test ='null != delFlag'>
+                    del_flag,
+                    </if>
+                    <if test ='null != createBy'>
+                    create_by,
+                    </if>
+                    <if test ='null != createTime'>
+                    create_time,
+                    </if>
+                    <if test ='null != updateBy'>
+                    update_by,
+                    </if>
+                    <if test ='null != updateTime'>
+                    update_time
+                    </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+                    <if test ='null != deptId'>
+                    #{deptId},
+                    </if>
+                    <if test ='null != storePlace'>
+                    #{storePlace},
+                    </if>
+                    <if test ='null != toolName'>
+                    #{toolName},
+                    </if>
+                    <if test ='null != toolType'>
+                    #{toolType},
+                    </if>
+                    <if test ='null != toolCode'>
+                    #{toolCode},
+                    </if>
+                    <if test ='null != elecLevel'>
+                    #{elecLevel},
+                    </if>
+                    <if test ='null != unit'>
+                    #{unit},
+                    </if>
+                    <if test ='null != testCycle'>
+                    #{testCycle},
+                    </if>
+                    <if test ='null != lastTestDate'>
+                    #{lastTestDate},
+                    </if>
+                    <if test ='null != nextTestDate'>
+                    #{nextTestDate},
+                    </if>
+                    <if test ='null != testResult'>
+                    #{testResult},
+                    </if>
+                    <if test ='null != testDate'>
+                    #{testDate},
+                    </if>
+                    <if test ='null != testResultDesc'>
+                    #{testResultDesc},
+                    </if>
+                    <if test ='null != state'>
+                    1,
+                    </if>
+                    <if test ='null != scrapReason'>
+                    #{scrapReason},
+                    </if>
+                    <if test ='null != scrapDate'>
+                    #{scrapDate},
+                    </if>
+                    <if test ='null != scrapUser'>
+                    #{scrapUser},
+                    </if>
+                    <if test ='null != produceFactory'>
+                    #{produceFactory},
+                    </if>
+                    <if test ='null != produceDate'>
+                    #{produceDate},
+                    </if>
+                    <if test ='null != remark'>
+                    #{remark},
+                    </if>
+                    <if test ='null != delFlag'>
+                    #{delFlag},
+                    </if>
+                    <if test ='null != createBy'>
+                    #{createBy},
+                    </if>
+                    <if test ='null != createTime'>
+                    #{createTime},
+                    </if>
+                    <if test ='null != updateBy'>
+                    #{updateBy},
+                    </if>
+                    <if test ='null != updateTime'>
+                    #{updateTime}
+                    </if>
+        </trim>
+    </insert>
+
+    <delete id="delete">
+        UPDATE base_safety_tool
+        set del_flag='1'
+        WHERE tool_id = #{toolId}
+    </delete>
+
+    <update id="update" parameterType="com.railway.business.safetool.domain.BaseSafetyTool">
+        UPDATE base_safety_tool
+        <set>
+                    <if test ='null != deptId'>dept_id = #{deptId},</if>
+                    <if test ='null != storePlace'>store_place = #{storePlace},</if>
+                    <if test ='null != toolName'>tool_name = #{toolName},</if>
+                    <if test ='null != toolType'>tool_type = #{toolType},</if>
+                    <if test ='null != toolCode'>tool_code = #{toolCode},</if>
+                    <if test ='null != elecLevel'>elec_level = #{elecLevel},</if>
+                    <if test ='null != unit'>unit = #{unit},</if>
+                    <if test ='null != testCycle'>test_cycle = #{testCycle},</if>
+                    <if test ='null != lastTestDate'>last_test_date = #{lastTestDate},</if>
+                    <if test ='null != nextTestDate'>next_test_date = #{nextTestDate},</if>
+                    <if test ='null != testResult'>test_result = #{testResult},</if>
+                    <if test ='null != testDate'>test_date = #{testDate},</if>
+                    <if test ='null != testResultDesc'>test_result_desc = #{testResultDesc},</if>
+                    <if test ='null != state'>state = #{state},</if>
+                    <if test ='null != scrapReason'>scrap_reason = #{scrapReason},</if>
+                    <if test ='null != scrapDate'>scrap_date = #{scrapDate},</if>
+                    <if test ='null != scrapUser'>scrap_user = #{scrapUser},</if>
+                    <if test ='null != produceFactory'>produce_factory = #{produceFactory},</if>
+                    <if test ='null != produceDate'>produce_date = #{produceDate},</if>
+                    <if test ='null != remark'>remark = #{remark},</if>
+                    <if test ='null != delFlag'>del_flag = #{delFlag},</if>
+                    <if test ='null != createBy'>create_by = #{createBy},</if>
+                    <if test ='null != createTime'>create_time = #{createTime},</if>
+                    <if test ='null != updateBy'>update_by = #{updateBy},</if>
+                    <if test ='null != updateTime'>update_time = #{updateTime}</if>
+        </set>
+        WHERE tool_id = #{toolId}
+    </update>
+
+
+    <select id="getInfo" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM base_safety_tool t
+        LEFT JOIN sys_dept dept on t.dept_id = dept.dept_id
+        LEFT JOIN sys_dict_data dict1 ON (t.tool_type = dict1.dict_value AND dict1.dict_type = 'tool_type')
+        LEFT JOIN sys_dict_data dict2 ON (t.test_cycle = dict2.dict_value AND dict2.dict_type = 'test_cycle')
+        WHERE t.del_flag='0' and t.tool_id = #{toolId}
+
+    </select>
+
+    <select id="getList" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM base_safety_tool t
+        LEFT JOIN sys_dept dept on t.dept_id = dept.dept_id
+        LEFT JOIN sys_dict_data dict1 ON (t.tool_type = dict1.dict_value AND dict1.dict_type = 'tool_type')
+        LEFT JOIN sys_dict_data dict2 ON (t.test_cycle = dict2.dict_value AND dict2.dict_type = 'test_cycle')
+        <where>
+            t.del_flag='0'
+                <if test="deptId!=null and deptId!=''">
+                    and t.dept_id=#{deptId}
+                </if>
+                <if test="storePlace!=null and storePlace!=''">
+                    and t.store_place=#{storePlace}
+                </if>
+                <if test="toolName!=null and toolName!=''">
+                    and t.tool_name=#{toolName}
+                </if>
+                <if test="toolType!=null and toolType!=''">
+                    and t.tool_type=#{toolType}
+                </if>
+                <if test="toolCode!=null and toolCode!=''">
+                    and t.tool_code=#{toolCode}
+                </if>
+                <if test="elecLevel!=null and elecLevel!=''">
+                    and t.elec_level=#{elecLevel}
+                </if>
+                <if test="unit!=null and unit!=''">
+                    and t.unit=#{unit}
+                </if>
+                <if test="testCycle!=null and testCycle!=''">
+                    and t.test_cycle=#{testCycle}
+                </if>
+                <if test="lastTestDate!=null and lastTestDate!=''">
+                    and t.last_test_date=#{lastTestDate}
+                </if>
+                <if test="nextTestDate!=null and nextTestDate!=''">
+                    and t.next_test_date=#{nextTestDate}
+                </if>
+                <if test="testResult!=null and testResult!=''">
+                    and t.test_result=#{testResult}
+                </if>
+                <if test="testDate!=null and testDate!=''">
+                    and t.test_date=#{testDate}
+                </if>
+                <if test="testResultDesc!=null and testResultDesc!=''">
+                    and t.test_result_desc=#{testResultDesc}
+                </if>
+                <if test="state!=null and state!=''">
+                    and t.state=#{state}
+                </if>
+                <if test="scrapReason!=null and scrapReason!=''">
+                    and t.scrap_reason=#{scrapReason}
+                </if>
+                <if test="scrapDate!=null and scrapDate!=''">
+                    and t.scrap_date=#{scrapDate}
+                </if>
+                <if test="scrapUser!=null and scrapUser!=''">
+                    and t.scrap_user=#{scrapUser}
+                </if>
+                <if test="produceFactory!=null and produceFactory!=''">
+                    and t.produce_factory=#{produceFactory}
+                </if>
+                <if test="produceDate!=null and produceDate!=''">
+                    and t.produce_date=#{produceDate}
+                </if>
+                <if test="remark!=null and remark!=''">
+                    and t.remark=#{remark}
+                </if>
+                <if test="createBy!=null and createBy!=''">
+                    and t.create_by=#{createBy}
+                </if>
+                <if test="createTime!=null and createTime!=''">
+                    and t.create_time=#{createTime}
+                </if>
+                <if test="updateBy!=null and updateBy!=''">
+                    and t.update_by=#{updateBy}
+                </if>
+                <if test="updateTime!=null and updateTime!=''">
+                    and t.update_time=#{updateTime}
+                </if>
+        </where>
+    </select>
+
+</mapper>