<?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.gx.obe.server.management.dictionary.dao.StructMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.gx.obe.server.management.dictionary.entity.Struct"> <id column="STRUCT_ID" property="id"/> <result column="TENDER_ID" property="tenderId"/> <result column="SUPPLIER_ID" property="supplierId"/> <result column="FACTOR_ID" property="factorId"/> <result column="USER_ID" property="userId"/> <result column="STRUCT_TYPE" property="structType"/> <result column="STRUCT_STATE" property="structState"/> <result column="REASON" property="reason"/> <result column="QUA_TYPE" property="quaType"/> <result column="ATTACHMENT_LIST" property="attachmentList"/> <result column="STRUCT_CONTENT" property="structContent"/> </resultMap> <!-- 通用查询结果列 --> <sql id="Base_Column_List"> STRUCT_ID, TENDER_ID, SUPPLIER_ID, FACTOR_ID, USER_ID, STRUCT_TYPE, STRUCT_STATE, REASON, QUA_TYPE, ATTACHMENT_LIST, STRUCT_CONTENT </sql> <!-- 批量更新 --> <update id="updateBatchList" parameterType="java.util.List"> <foreach collection="ObeStructList" item="ObeStruct" index="index" open="" close="" separator=";"> UPDATE obe_struct <set> <if test="ObeStruct.tenderId != null"> TENDER_ID = #{ObeStruct.tenderId} , </if> <if test="ObeStruct.supplierId != null"> SUPPLIER_ID = #{ObeStruct.supplierId} , </if> <if test="ObeStruct.factorId != null"> FACTOR_ID = #{ObeStruct.factorId} , </if> <if test="ObeStruct.userId != null"> USER_ID = #{ObeStruct.userId} , </if> <if test="ObeStruct.structType != null"> STRUCT_TYPE = #{ObeStruct.structType} , </if> <if test="ObeStruct.structState != null"> STRUCT_STATE = #{ObeStruct.structState} , </if> <if test="ObeStruct.reason != null"> REASON = #{ObeStruct.reason} , </if> <if test="ObeStruct.quaType != null"> QUA_TYPE = #{ObeStruct.quaType} , </if> <if test="ObeStruct.attachmentList != null"> ATTACHMENT_LIST = #{ObeStruct.attachmentList} , </if> <if test="ObeStruct.structContent != null"> STRUCT_CONTENT = #{ObeStruct.structContent} </if> </set> <where> STRUCT_ID = #{ObeStruct.id} </where> </foreach> </update> <!-- 批量插入--> <insert id="insertByBatch" parameterType="java.util.List"> insert into obe_struct ( STRUCT_ID, TENDER_ID, SUPPLIER_ID, FACTOR_ID, USER_ID, STRUCT_TYPE, STRUCT_STATE, REASON, QUA_TYPE, ATTACHMENT_LIST, STRUCT_CONTENT ) values <foreach collection="ObeStructList" item="ObeStruct" index="index" open="" close="" separator=","> ( #{ObeStruct.id} , #{ObeStruct.tenderId} , #{ObeStruct.supplierId} , #{ObeStruct.factorId} , #{ObeStruct.userId} , #{ObeStruct.structType} , #{ObeStruct.structState} , #{ObeStruct.reason} , #{ObeStruct.quaType} , #{ObeStruct.attachmentList} , #{ObeStruct.structContent} ) </foreach> </insert> <!-- --> <select id="getStructBySupplierIdAndFactorIdList" resultMap="BaseResultMap"> SELECT * FROM obe_struct s WHERE s.TENDER_ID = #{tenderId} <if test=" supplierId != null and supplierId !=''"> AND s.SUPPLIER_ID = #{supplierId} </if> <if test=" factorId != null and factorId !=''"> AND s.FACTOR_ID = #{factorId} </if> </select> </mapper>