<?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.huaheng.pc.monitor.workOrderRecoding.mapper.WorkOrderRecodingMapper"> <insert id="insert"> INSERT INTO work_order_recoding <trim prefix="(" suffix=")" suffixOverrides=","> <if test="inventoryId != null"> inventoryId, </if> <if test="materialCode != null"> materialCode, </if> <if test="materialName != null"> materialName, </if> <if test="specification != null"> specification, </if> <if test="type != null"> type, </if> <if test="qty != null"> qty, </if> <if test="created != null"> created, </if> <if test="moCode != null"> moCode, </if> <if test="receiptId != null"> receiptId, </if> <if test="receiptCode != null"> receiptCode, </if> <if test="receiptDetailId != null"> receiptDetailId, </if> <if test="createdBy != null"> createdBy, </if> </trim> <trim prefix=" values (" suffix=")" suffixOverrides=","> <if test="inventoryId != null"> #{inventoryId, jdbcType=INTEGER}, </if> <if test="materialCode != null"> #{materialCode, jdbcType=VARCHAR}, </if> <if test="materialName != null"> #{materialName, jdbcType=VARCHAR}, </if> <if test="specification != null"> #{specification, jdbcType=VARCHAR}, </if> <if test="type != null"> #{type, jdbcType=INTEGER}, </if> <if test="qty != null"> #{qty, jdbcType=DECIMAL}, </if> <if test="created != null"> #{created,jdbcType=TIMESTAMP}, </if> <if test="moCode != null"> #{moCode,jdbcType=VARCHAR}, </if> <if test="receiptId != null"> #{receiptId, jdbcType=INTEGER}, </if> <if test="receiptCode != null"> #{receiptCode, jdbcType=VARCHAR}, </if> <if test="receiptDetailId != null"> #{receiptDetailId, jdbcType=VARCHAR}, </if> <if test="createdBy != null"> #{createdBy, jdbcType=VARCHAR}, </if> </trim> </insert> <select id="selectListEntityByLike" resultType="com.huaheng.pc.monitor.workOrderRecoding.domain.WorkOrderRecoding"> SELECT * FROM work_order_recoding <where> <if test="inventoryId != null and inventoryId != '' "> AND inventoryId =#{inventoryId} </if> <if test="materialCode != null and materialCode != '' "> AND materialCode like concat('%', #{materialCode}, '%') </if> <if test="materialName != null and materialName != '' "> AND materialName like concat('%', #{materialName}, '%') </if> <if test="specification != null and specification != '' "> AND specification like concat('%', #{specification}, '%') </if> <if test="type != null and type != '' "> AND type = #{type} </if> <if test="created != null and created != '' "> AND created >= #{created} </if> <if test="moCode != null and moCode != '' "> AND moCode like concat('%', #{moCode}, '%') </if> <if test="receiptCode != null and receiptCode != '' "> AND receiptCode like concat('%', #{receiptCode}, '%') </if> </where> order by id desc </select> </mapper>