ept_out_storageMapper.xml 8.0 KB
<?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.eport.rest.dao.EptOutStorageDao">
    
	<sql id="EptOutStorageEntityColumns">
		a1.ID AS "id"
		,a1.BOOK_ID AS "bookId"
		,a1.DOC_NO AS "docNo"
		,a1.DEPOT_NAME AS "depotName"
		,a1.LIB_FLAG AS "libFlag"
		,a1.PO_NO AS "poNo"
		,a1.IN_TIME AS "inTime"
		,a1.RELATE_NO AS "relateNo"
		,a1.RELATE_DEPT AS "relateDept"
		,a1.IN_TYPE AS "inType"
		,a1.COP_G_NO AS "copGNo"
		,a1.G_NO AS "gNo"
		,a1.TICKET_NO AS "ticketNo"
		,a1.NUM_VAL AS "numVal"
		,a1.UNIT AS "unit"
		,a1.PRICE AS "price"
		,a1.CURR AS "curr"
		,a1.NOTE_1 AS "note1"
		,a1.NOTE_2 AS "note2"
		,a1.IS_DELETE AS "isDelete"
		,a1.CREATE_ID AS "createId"
		,a1.CREATE_DATE AS "createDate"
		,a1.UPDATE_ID AS "updateId"
		,a1.UPDATE_DATE AS "updateDate"
	</sql>
	
	<sql id="EptOutStorageEntityListColumns">
		a1.ID AS "id"
		,a1.DOC_NO AS "docNo"
		,a1.DEPOT_NAME AS "depotName"
		,a1.IN_TIME AS "inTime"
		,a1.RELATE_NO AS "relateNo"
		,a1.IN_TYPE AS "inType"
		,a1.COP_G_NO AS "copGNo"
		,a1.G_NO AS "gNo"
		,a1.NUM_VAL AS "numVal"
		,a1.UNIT AS "unit"
	</sql>
	
	
	
		<!--查询表中所有资料(所有字段) -->
		<select id="listAll"  
		parameterType="HashMap" 
		resultType="com.eport.rest.entity.EptOutStorageEntity"
		>
		select  
			<include refid="EptOutStorageEntityColumns"/>
			,(select PAR_NAME from ept_parameter  c1 where c1.ID = a1.DEPOT_NAME) as depotCnName
			,(select CURR_NAME from curr  c1 where c1.CURR_CODE = a1.CURR) as currName
		FROM ept_out_storage  a1
		WHERE 1=1
		<if test="docNo != null">
		and DOC_NO like CONCAT(CONCAT('%',#{docNo}),'%')
		</if>
		<if test="depotName != null">
		and DEPOT_NAME = #{depotName}
		</if>
		<if test="relateNo != null">
		and RELATE_NO like CONCAT(CONCAT('%',#{relateNo}),'%')
		</if>
		<if test="gNo != null">
		and G_NO = #{gNo}
		</if>
		 and IS_DELETE = 0
		</select>
		
	
		<!--分页查询资料(所有字段) -->
		<select id="pageAll"  
		parameterType="HashMap" 
		resultType="com.eport.rest.entity.EptOutStorageEntity"
		>
		select  
			<include refid="EptOutStorageEntityColumns"/>
			,(select PAR_NAME from ept_parameter  c1 where c1.ID = a1.DEPOT_NAME) as depotCnName
			,(select CURR_NAME from curr  c1 where c1.CURR_CODE = a1.CURR) as currName
		FROM ept_out_storage  a1
		WHERE 1=1
		<if test="docNo != null">
		and DOC_NO like CONCAT(CONCAT('%',#{docNo}),'%')
		</if>
		<if test="depotName != null">
		and DEPOT_NAME = #{depotName}
		</if>
		<if test="relateNo != null">
		and RELATE_NO like CONCAT(CONCAT('%',#{relateNo}),'%')
		</if>
		<if test="gNo != null">
		and G_NO = #{gNo}
		</if>
		 and IS_DELETE = 0
		</select>
		
	
		<!--查询表中所有资料(仅列表显示字段) -->
		<select id="list"  
		parameterType="HashMap" 
		resultType="com.eport.rest.entity.EptOutStorageEntity"
		>
		select  
			<include refid="EptOutStorageEntityListColumns"/>
			,(select PAR_NAME from ept_parameter  c1 where c1.ID = a1.DEPOT_NAME) as depotCnName
		FROM ept_out_storage  a1
		WHERE 1=1
		<if test="docNo != null">
		and DOC_NO like CONCAT(CONCAT('%',#{docNo}),'%')
		</if>
		<if test="depotName != null">
		and DEPOT_NAME = #{depotName}
		</if>
		<if test="relateNo != null">
		and RELATE_NO like CONCAT(CONCAT('%',#{relateNo}),'%')
		</if>
		<if test="gNo != null">
		and G_NO = #{gNo}
		</if>
		 and IS_DELETE = 0
		</select>
		
	
		<!--分页查询资料(仅列表显示字段) -->
		<select id="page"  
		parameterType="HashMap" 
		resultType="com.eport.rest.entity.EptOutStorageEntity"
		>
		select  
			<include refid="EptOutStorageEntityListColumns"/>
			,(select PAR_NAME from ept_parameter  c1 where c1.ID = a1.DEPOT_NAME) as depotCnName
		FROM ept_out_storage  a1
		WHERE 1=1
		<if test="docNo != null">
		and DOC_NO like CONCAT(CONCAT('%',#{docNo}),'%')
		</if>
		<if test="depotName != null">
		and DEPOT_NAME = #{depotName}
		</if>
		<if test="relateNo != null">
		and RELATE_NO like CONCAT(CONCAT('%',#{relateNo}),'%')
		</if>
		<if test="gNo != null">
		and G_NO = #{gNo}
		</if>
		 and IS_DELETE = 0
		</select>
		
	
		<!--根据主键查询数据 -->
		<select id="findByPK"  
		parameterType="Integer" 
		resultType="com.eport.rest.entity.EptOutStorageEntity"
		>
		select  
		<include refid="EptOutStorageEntityColumns"/>
			,(select PAR_NAME from ept_parameter  c1 where c1.ID = a1.DEPOT_NAME) as depotCnName
			,(select CURR_NAME from curr  c1 where c1.CURR_CODE = a1.CURR) as currName
		FROM ept_out_storage  a1
		WHERE a1.ID=#{par}
		 and IS_DELETE = 0
		</select>
		
	
		<!--新增数据 -->
		<insert id="insert"  
		parameterType="com.eport.rest.entity.EptOutStorageEntity" 
		>
		<selectKey resultType="Integer" order="AFTER" keyProperty="id">
		<if test="id != null ">
		select #{id} from dual
		</if>
		<if test="id == null ">
		SELECT LAST_INSERT_ID() AS id
		</if>
		 </selectKey>
		insert  
		  INTO ept_out_storage (
		BOOK_ID
		,DOC_NO
		,DEPOT_NAME
		,LIB_FLAG
		,PO_NO
		,IN_TIME
		,RELATE_NO
		,RELATE_DEPT
		,IN_TYPE
		,COP_G_NO
		,G_NO
		,TICKET_NO
		,NUM_VAL
		,UNIT
		,PRICE
		,CURR
		,NOTE_1
		,NOTE_2
		,IS_DELETE
		,CREATE_ID
		,CREATE_DATE
		,UPDATE_ID
		,UPDATE_DATE
		<if test="id != null ">
		,ID
		</if>
		  ) VALUES (
		#{bookId,jdbcType=INTEGER}
		,#{docNo,jdbcType=VARCHAR}
		,#{depotName,jdbcType=VARCHAR}
		,#{libFlag,jdbcType=VARCHAR}
		,#{poNo,jdbcType=VARCHAR}
		,#{inTime,jdbcType=DATE}
		,#{relateNo,jdbcType=VARCHAR}
		,#{relateDept,jdbcType=VARCHAR}
		,#{inType,jdbcType=VARCHAR}
		,#{copGNo,jdbcType=VARCHAR}
		,#{gNo,jdbcType=INTEGER}
		,#{ticketNo,jdbcType=VARCHAR}
		,#{numVal,jdbcType=INTEGER}
		,#{unit,jdbcType=VARCHAR}
		,#{price,jdbcType=FLOAT}
		,#{curr,jdbcType=VARCHAR}
		,#{note1,jdbcType=VARCHAR}
		,#{note2,jdbcType=VARCHAR}
		,#{isDelete,jdbcType=INTEGER}
		,#{createId,jdbcType=INTEGER}
		,#{createDate,jdbcType=DATE}
		,#{updateId,jdbcType=INTEGER}
		,#{updateDate,jdbcType=DATE}
		<if test="id != null ">
		,#{id,jdbcType=INTEGER}
		</if>
		  )
		</insert>
		
	
		<!--更新数据 -->
		<update id="update"  
		parameterType="com.eport.rest.entity.EptOutStorageEntity" 
		>
		update  
		ept_out_storage
		<set>
		<if test="bookId != null ">
		BOOK_ID = #{bookId},
		</if>
		<if test="docNo != null ">
		DOC_NO = #{docNo},
		</if>
		<if test="depotName != null ">
		DEPOT_NAME = #{depotName},
		</if>
		<if test="libFlag != null ">
		LIB_FLAG = #{libFlag},
		</if>
		<if test="poNo != null ">
		PO_NO = #{poNo},
		</if>
		<if test="inTime != null ">
		IN_TIME = #{inTime},
		</if>
		<if test="relateNo != null ">
		RELATE_NO = #{relateNo},
		</if>
		<if test="relateDept != null ">
		RELATE_DEPT = #{relateDept},
		</if>
		<if test="inType != null ">
		IN_TYPE = #{inType},
		</if>
		<if test="copGNo != null ">
		COP_G_NO = #{copGNo},
		</if>
		<if test="gNo != null ">
		G_NO = #{gNo},
		</if>
		<if test="ticketNo != null ">
		TICKET_NO = #{ticketNo},
		</if>
		<if test="numVal != null ">
		NUM_VAL = #{numVal},
		</if>
		<if test="unit != null ">
		UNIT = #{unit},
		</if>
		<if test="price != null ">
		PRICE = #{price},
		</if>
		<if test="curr != null ">
		CURR = #{curr},
		</if>
		<if test="note1 != null ">
		NOTE_1 = #{note1},
		</if>
		<if test="note2 != null ">
		NOTE_2 = #{note2},
		</if>
		<if test="isDelete != null ">
		IS_DELETE = #{isDelete},
		</if>
		<if test="createId != null ">
		CREATE_ID = #{createId},
		</if>
		<if test="createDate != null ">
		CREATE_DATE = #{createDate},
		</if>
		<if test="updateId != null ">
		UPDATE_ID = #{updateId},
		</if>
		<if test="updateDate != null ">
		UPDATE_DATE = #{updateDate},
		</if>
		</set>
		WHERE ID = #{id}
		</update>
		
	
		<!--根据主键删除数据 -->
		<update id="delete"  
		parameterType="HashMap" 
		>
		update  
		ept_out_storage set IS_DELETE = 1
		where ID in (${par})
		</update>
		
	
		<!--根据单证编号查询数据 -->
		<select id="findByDocNo"  
		parameterType="HashMap" 
		resultType="HashMap"
		>
		select a1.ID AS "id"
		,a1.BOOK_ID AS "bookId"
		,a1.DOC_NO AS "docNo"
		from ept_out_storage a1
		where DOC_NO=#{docNo} and is_delete=0
		</select>
		
	
</mapper>