search
HomeDatabaseMysql TutorialIBATIS2.0映射文件 oracle/mysql 版实现示例,功能全面且丰富

IBATIS2.0映射文件oracle/mysql版实现示例,功能全面且丰富,开发参考可以提高一定效率,还不错。呵呵。 实现的功能 1.保存物资项目。 2.保存物资变更记录集合。 3.查询处理返回内容字段。 iBATIS Oracle MySQL ?xml version="1.0" encoding="UTF-8" standalon

IBATIS2.0映射文件 oracle/mysql 版实现示例,功能全面且丰富,开发参考可以提高一定效率,还不错。呵呵。

实现的功能
1.保存物资项目。
2.保存物资变更记录集合。
3.查询处理返回内容字段。 iBATIS Oracle MySQL
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="HuGoods">
	<!-- hu_goods -->
	<sql id="Goods_Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Dec 12 11:53:06 CST 2014.
    -->
    HUGS_ID, HUGS_NAME, HUGS_BRAND, HUGS_VERSION, HUGS_PRODUCT_DATE, HUGS_ASSET_CODE, 
    HUGS_PRICE, HUGS_DEPT_ID, HUGS_DEPT_NAME, HUGS_USER_ID, HUGS_USER_NAME, HUGS_USE_RESON, 
    HUGS_USE_STATUS, HUGS_DESCR, HUGS_STATUS, HUGS_CREATOR, HUGS_CREATE_TIME, HUGS_UPDATE, 
    HUGS_UPDATE_TIME,HUGS_COMPANY
  	</sql>
  	<!-- where条件 -->
	<sql id="Goods_Where_Clause" >
		<dynamic prepend="WHERE HUGS_STATUS = 1">
			<isNotEmpty property="HUGS_ASSET_CODE">
				AND HUGS_ASSET_CODE LIKE '%$HUGS_ASSET_CODE$%'
			</isNotEmpty>
			<isNotEmpty property="HUGS_NAME">
				AND HUGS_NAME LIKE '%$HUGS_NAME$%'
			</isNotEmpty>
			<isNotEmpty property="HUGS_DEPT_NAME">
				AND HUGS_DEPT_NAME LIKE '%$HUGS_DEPT_NAME$%'
			</isNotEmpty>
			<isNotEmpty property="HUGS_USER_NAME">
				AND HUGS_USER_NAME LIKE '%$HUGS_USER_NAME$%'
			</isNotEmpty>
			<isNotEmpty property="HUGS_USE_RESON">
				AND HUGS_USE_RESON LIKE '%$HUGS_USE_RESON$%'
			</isNotEmpty>
			<isNotEmpty property="HUGS_COMPANY">
				AND HUGS_COMPANY = #HUGS_COMPANY#
			</isNotEmpty>
		</dynamic>
  	</sql>
	<!-- 物资总数 -->
	<select id="getGoodsListCnt" resultClass="java.lang.Integer"
		parameterClass="java.util.HashMap">
		SELECT COUNT(*) FROM HU_GOODS
		<isParameterPresent >
	      <include refid="HuGoods.Goods_Where_Clause" />
    	</isParameterPresent>
	</select>
	<!-- 物资分页集合查询 -->
	<select id="getGoodsPageList" resultClass="java.util.HashMap"
		parameterClass="java.util.HashMap">
		<!-- oracle version  -->
		SELECT * FROM
		(
				SELECT
					A .*, ROWNUM r
				FROM
					(
							SELECT <include refid="HuGoods.Goods_Base_Column_List" />
					FROM HU_GOODS
						<isParameterPresent >
						<include refid="HuGoods.Goods_Where_Clause" />
							<isNotEmpty property="sortField">
						ORDER BY $sortField$ $sortOrder$
							</isNotEmpty>
						</isParameterPresent>
					) A
				WHERE
					ROWNUM <![CDATA[ <= ]]> #end#
		) B
		WHERE r <![CDATA[>]]> #start#
		<!-- mysql version  -->
		<!-- 
		SELECT <include refid="HuGoods.Goods_Base_Column_List" />
		FROM HU_GOODS
	    <isParameterPresent >
		  <include refid="HuGoods.Goods_Where_Clause" />
	      <isNotEmpty property="sortField">
			ORDER BY $sortField$ $sortOrder$
	      </isNotEmpty>
    	</isParameterPresent>
		LIMIT #start#,#end#
		 -->
	</select>
	<!-- 物资EXLS导出数据 -->
	<select id="getGoodsEXLSList" resultClass="java.util.HashMap"
		parameterClass="java.util.HashMap">
		<!-- oracle version  -->
			SELECT
		    (
		      SELECT 
		          WM_CONCAT (
		          EM.HUGI_DESCR || ' ' ||'变更时间:'||TO_CHAR(EM.HUGI_CHANGE_DATE,'YYYY-MM-DD')
		          )
		      FROM
		        HU_GOODS_ITEM EM
		      WHERE
		        EM.HUGI_GOODS_ID = GOODS.HUGS_ID
		    ) AS ITEMS,
		    GOODS.HUGS_NAME,
		    GOODS.HUGS_BRAND,
		    GOODS.HUGS_VERSION,
		    GOODS.HUGS_PRODUCT_DATE,
		    GOODS.HUGS_ASSET_CODE,
		    GOODS.HUGS_PRICE,
		    GOODS.HUGS_DEPT_NAME,
		    GOODS.HUGS_USER_NAME,
		    GOODS.HUGS_USE_RESON,
		    GOODS.HUGS_DESCR,
		    GOODS.HUGS_COMPANY,
		    CASE GOODS.HUGS_USE_STATUS
		  WHEN 1 THEN
		    '使用中'
		  WHEN 2 THEN
		    '在库'
		  ELSE
		    '作废'
		  END HUGS_USE_STATUS
			,CASE GOODS.HUGS_CHECK_STATUS
		  WHEN 0 THEN
		    '尚未盘点'
		  WHEN -1 THEN
		    '问题物资'
		  ELSE
		    '盘点无误'
		  END HUGS_CHECK_STATUS
		  FROM
		    HU_GOODS GOODS
			<isParameterPresent >
		      <include refid="HuGoods.Goods_Where_Clause" />
	    	</isParameterPresent>
		  ORDER BY
		    GOODS.HUGS_ID ASC


		<!-- mysql version  -->
		<!-- 
		SELECT
			GROUP_CONCAT(
				CONCAT(
					"变更:",
					CONVERT (
						IFNULL(EM.HUGI_USER_ID, ""),
						CHAR
					),
					"_",
					IFNULL(EM.HUGI_USER_NAME, ""),
					"_",
					IFNULL(EM.HUGI_DEPT_NAME, ""),
					"_",
					IFNULL(EM.HUGI_DESCR, "")
				)
			) AS ITEMS,
			GOODS.HUGS_NAME,
			GOODS.HUGS_BRAND,
			GOODS.HUGS_VERSION,
			GOODS.HUGS_PRODUCT_DATE,
			GOODS.HUGS_ASSET_CODE,
			GOODS.HUGS_PRICE,
			GOODS.HUGS_DEPT_NAME,
			GOODS.HUGS_USER_NAME,
			GOODS.HUGS_USE_RESON,
			GOODS.HUGS_DESCR,
			CASE GOODS.HUGS_USE_STATUS
		WHEN '1' THEN
			'使用中'
		WHEN '2' THEN
			'在库'
		ELSE
			'作废'
		END HUGS_USE_STATUS
		FROM
			HU_GOODS GOODS
		LEFT JOIN HU_GOODS_ITEM EM ON EM.HUGI_GOODS_ID = GOODS.HUGS_ID
		GROUP BY
			GOODS.HUGS_ID
		ORDER BY
			GOODS.HUGS_ID ASC
			 -->
	</select>
	<!-- 查询物资公司种类 -->
	<select id="getGoodsCompany" resultClass="java.util.HashMap"
		parameterClass="java.util.HashMap">
		SELECT OG.HUGS_COMPANY FROM HU_GOODS OG
		WHERE OG.HUGS_ID IN(
		SELECT MAX(GOOD.HUGS_ID) FROM HU_GOODS GOOD
		GROUP BY GOOD.HUGS_COMPANY
		)
		ORDER BY OG.HUGS_ID ASC
	</select>
	<!-- 添加物资 -->
	<insert id="addGoods" parameterClass="java.util.HashMap">
		<!-- mysql version -->
		<!-- 
		INSERT INTO HU_GOODS (
		`HUGS_ID`,
		`HUGS_NAME`,
		`HUGS_BRAND`,
		`HUGS_VERSION`,
		`HUGS_PRODUCT_DATE`,
		`HUGS_ASSET_CODE`,
		`HUGS_PRICE`,
		`HUGS_DEPT_ID`,
		`HUGS_DEPT_NAME`,
		`HUGS_USER_ID`,
		`HUGS_USER_NAME`,
		`HUGS_USE_RESON`,
		`HUGS_USE_STATUS`,
		`HUGS_DESCR`,
		`HUGS_STATUS`,
		`HUGS_CREATOR`,
		`HUGS_CREATE_TIME`,
		`HUGS_UPDATE`,
		`HUGS_UPDATE_TIME`
		)
		VALUES
		(
		NULL,
		#HUGS_NAME#, #HUGS_BRAND#,
		#HUGS_VERSION#,#HUGS_PRODUCT_DATE#,#HUGS_ASSET_CODE#,#HUGS_PRICE#,#HUGS_DEPT_ID#,#HUGS_DEPT_NAME#,#HUGS_USER_ID#,#HUGS_USER_NAME#,#HUGS_USE_RESON#,#HUGS_USE_STATUS#,#HUGS_DESCR#,#HUGS_STATUS#,#HUGS_CREATOR#,SYSDATE(),
		#HUGS_UPDATE#,
		SYSDATE()
		);
		<selectKey resultClass="java.lang.Integer" keyProperty="HUGS_ID">
			SELECT LAST_INSERT_ID()
		</selectKey>
		 -->
		<!-- oracle version -->
		<selectKey resultClass="java.lang.Integer" keyProperty="HUGS_ID" type="pre">   
        SELECT HU_GOODS_SQ.NEXTVAL AS VALUE FROM DUAL  
    	</selectKey> 
		 INSERT INTO HU_GOODS (
		HUGS_ID,
		HUGS_NAME,
		HUGS_BRAND,
		HUGS_VERSION,
		HUGS_PRODUCT_DATE,
		HUGS_ASSET_CODE,
		HUGS_PRICE,
		HUGS_DEPT_ID,
		HUGS_DEPT_NAME,
		HUGS_USER_ID,
		HUGS_USER_NAME,
		HUGS_USE_RESON,
		HUGS_USE_STATUS,
		HUGS_DESCR,
		HUGS_STATUS,
		HUGS_CREATOR,
		HUGS_CREATE_TIME,
		HUGS_UPDATE,
		HUGS_UPDATE_TIME,
		HUGS_COMPANY
		)
		VALUES
		(
		#HUGS_ID#,
		#HUGS_NAME#, #HUGS_BRAND#,
		#HUGS_VERSION#,#HUGS_PRODUCT_DATE#,#HUGS_ASSET_CODE#,#HUGS_PRICE#,#HUGS_DEPT_ID#,#HUGS_DEPT_NAME#,#HUGS_USER_ID#,#HUGS_USER_NAME#,#HUGS_USE_RESON#,#HUGS_USE_STATUS#,#HUGS_DESCR#,#HUGS_STATUS#,#HUGS_CREATOR#,SYSDATE,
		#HUGS_UPDATE#,
		SYSDATE,
		#HUGS_COMPANY#
		)
	</insert>
	
	<!-- 更新物资 -->
	<update id="updateGoods" parameterClass="java.util.HashMap">
		<!-- oracle version -->
		UPDATE HU_GOODS SET
		HUGS_NAME=#HUGS_NAME#, HUGS_BRAND=#HUGS_BRAND#,
		HUGS_VERSION=#HUGS_VERSION#,HUGS_PRODUCT_DATE=#HUGS_PRODUCT_DATE#,HUGS_PRICE=#HUGS_PRICE#,HUGS_DEPT_ID=#HUGS_DEPT_ID#,HUGS_DEPT_NAME=#HUGS_DEPT_NAME#,HUGS_USER_ID=#HUGS_USER_ID#,HUGS_USER_NAME=#HUGS_USER_NAME#,HUGS_USE_RESON=#HUGS_USE_RESON#,HUGS_USE_STATUS=#HUGS_USE_STATUS#,HUGS_DESCR=#HUGS_DESCR#,HUGS_STATUS=#HUGS_STATUS#,HUGS_CREATOR=#HUGS_CREATOR#,HUGS_UPDATE_TIME=SYSDATE
		where HUGS_ASSET_CODE=#HUGS_ASSET_CODE#
		<!-- mysql version -->
		<!-- 
		UPDATE HU_GOODS SET
		HUGS_NAME=#HUGS_NAME#, HUGS_BRAND=#HUGS_BRAND#,
		HUGS_VERSION=#HUGS_VERSION#,HUGS_PRODUCT_DATE=#HUGS_PRODUCT_DATE#,HUGS_PRICE=#HUGS_PRICE#,HUGS_DEPT_ID=#HUGS_DEPT_ID#,HUGS_DEPT_NAME=#HUGS_DEPT_NAME#,HUGS_USER_ID=#HUGS_USER_ID#,HUGS_USER_NAME=#HUGS_USER_NAME#,HUGS_USE_RESON=#HUGS_USE_RESON#,HUGS_USE_STATUS=#HUGS_USE_STATUS#,HUGS_DESCR=#HUGS_DESCR#,HUGS_STATUS=#HUGS_STATUS#,HUGS_CREATOR=#HUGS_CREATOR#,HUGS_UPDATE_TIME=SYSDATE()
		where HUGS_ASSET_CODE=#HUGS_ASSET_CODE#
		 -->
	</update>
	
	<!-- 查询固定资产编码数量 -->
	<select id="selectHugsAssetCodeCount" parameterClass="java.util.HashMap"
		resultClass="int">
		SELECT COUNT(HG.HUGS_ID) AS COUNT FROM HU_GOODS HG WHERE
		HG.HUGS_ASSET_CODE=#HUGS_ASSET_CODE#
	</select>
	<!-- 由固定资产编码查询对应的记录id集合 -->
	<select id="selectGoodsIdListByHugsAssetCode" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
		SELECT HG.HUGS_ID FROM HU_GOODS HG WHERE
		HG.HUGS_ASSET_CODE=#HUGS_ASSET_CODE#
	</select>
	
	<!-- ################################################################################# -->
	<!-- HU_GOODS_ITEM -->
	
	<!-- 变更项列集合 -->
	<sql id="Goods_Item_Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Dec 12 11:53:06 CST 2014.
    -->
    HUGI_ID, HUGI_GOODS_ID, HUGI_DEPT_ID, HUGI_DEPT_NAME, HUGI_USER_ID, HUGI_USER_NAME, 
    HUGI_USE_RESON, HUGI_USE_STATUS, HUGI_DESCR, HUGI_STATUS, HUGI_CREATOR, HUGI_CREATE_TIME, 
    HUGI_UPDATE, HUGI_UPDATE_TIME
  	</sql>
  	<!-- where条件 -->
	<sql id="Goods_Item_Where_Clause" >
		<dynamic prepend="WHERE 1=1">
			<isNotEmpty property="HUGI_GOODS_ID">
					AND HUGI_GOODS_ID = #HUGI_GOODS_ID#
				</isNotEmpty>
				<isNotEmpty property="HUGI_DEPT_NAME">
					AND HUGI_DEPT_NAME LIKE '%$HUGI_DEPT_NAME$%'
				</isNotEmpty>
				<isNotEmpty property="HUGI_USER_NAME">
					AND HUGI_USER_NAME LIKE '%$HUGI_USER_NAME$%'
				</isNotEmpty>
				<isNotEmpty property="HUGI_USE_RESON">
					AND HUGI_USE_RESON LIKE '%$HUGI_USE_RESON$%'
				</isNotEmpty>	
		</dynamic>
  	</sql>
	<!-- 物资变更项总数 -->
	<select id="getGoodsItemListCnt" resultClass="java.lang.Integer"
		parameterClass="java.util.HashMap">
		SELECT COUNT(*) FROM HU_GOODS_ITEM
		<isParameterPresent >
	      <include refid="HuGoods.Goods_Item_Where_Clause" />
    	</isParameterPresent>
	</select>
	<!-- 物资变更项分页集合查询 -->
	<select id="getGoodsItemPageList" resultClass="java.util.HashMap"
		parameterClass="java.util.HashMap">
		<!-- oracle version -->
		SELECT * FROM
		(
				SELECT
					A .*, ROWNUM r
				FROM
					(

							SELECT <include refid="HuGoods.Goods_Item_Base_Column_List" />
				FROM HU_GOODS_ITEM
				<isParameterPresent >
				<include refid="HuGoods.Goods_Item_Where_Clause" />
					<isNotEmpty property="sortField">
				ORDER BY $sortField$ $sortOrder$
					</isNotEmpty>
				</isParameterPresent>

					) A
				WHERE
					ROWNUM <![CDATA[ <= ]]> #end#
		) B
		WHERE r <![CDATA[>]]> #start#
		<!-- mysql version -->
		<!-- 
		SELECT <include refid="HuGoods.Goods_Item_Base_Column_List" />
		FROM HU_GOODS_ITEM
	    <isParameterPresent >
		  <include refid="HuGoods.Goods_Item_Where_Clause" />
	      <isNotEmpty property="sortField">
			ORDER BY $sortField$ $sortOrder$
	      </isNotEmpty>
    	</isParameterPresent>
		LIMIT #start#,#end#
		 -->
	</select>
	
	<!-- 添加记录明细 -->
	<insert id="addGoodsItem" parameterClass="java.util.HashMap">
		<!-- oracle version -->
		<selectKey resultClass="java.lang.Integer" keyProperty="HUGI_ID" type="pre">   
        SELECT HU_GOODS_ITEM_SQ.NEXTVAL AS VALUE FROM DUAL  
    	</selectKey> 
    	INSERT INTO HU_GOODS_ITEM (HUGI_ID,HUGI_GOODS_ID, HUGI_DEPT_ID, HUGI_DEPT_NAME, 
      HUGI_USER_ID, HUGI_USER_NAME, HUGI_USE_RESON, HUGI_USE_STATUS, 
      HUGI_DESCR, HUGI_STATUS, HUGI_CREATOR, HUGI_CREATE_TIME, 
      HUGI_UPDATE, HUGI_UPDATE_TIME)
      VALUES (#HUGI_ID#,#HUGI_GOODS_ID#, #HUGI_DEPT_ID#, #HUGI_DEPT_NAME#, 
      #HUGI_USER_ID#, #HUGI_USER_NAME#, #HUGI_USE_RESON#, #HUGI_USE_STATUS#, 
      #HUGI_DESCR#, #HUGI_STATUS#, #HUGI_CREATOR#, SYSDATE, 
      #HUGI_UPDATE#, SYSDATE)
    	<!-- mysql version -->
    	<!-- 
		INSERT INTO HU_GOODS_ITEM (HUGI_GOODS_ID, HUGI_DEPT_ID, HUGI_DEPT_NAME, 
      HUGI_USER_ID, HUGI_USER_NAME, HUGI_USE_RESON, HUGI_USE_STATUS, 
      HUGI_DESCR, HUGI_STATUS, HUGI_CREATOR, HUGI_CREATE_TIME, 
      HUGI_UPDATE, HUGI_UPDATE_TIME)
      VALUES (#HUGI_GOODS_ID:INTEGER#, #HUGI_DEPT_ID:VARCHAR#, #HUGI_DEPT_NAME:VARCHAR#, 
      #HUGI_USER_ID:INTEGER#, #HUGI_USER_NAME:VARCHAR#, #HUGI_USE_RESON:VARCHAR#, #HUGI_USE_STATUS:INTEGER#, 
      #HUGI_DESCR:VARCHAR#, #HUGI_STATUS:INTEGER#, #HUGI_CREATOR:VARCHAR#, SYSDATE(), 
      #HUGI_UPDATE:VARCHAR#, SYSDATE())
		<selectKey resultClass="java.lang.Integer" keyProperty="HUGI_ID">
			SELECT LAST_INSERT_ID() AS HUGI_ID
		</selectKey>
		 -->
	</insert>
	<!-- 删除物资变更明细 -->
	<delete id="deleteGoodsItem" parameterClass="java.util.HashMap">
		DELETE FROM HU_GOODS_ITEM WHERE HUGI_ID =#HUGI_ID#
	</delete>
</sqlMap>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="HuGoods">
	<!-- hu_goods -->
	<sql id="Goods_Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Dec 12 11:53:06 CST 2014.
    -->
    HUGS_ID, HUGS_NAME, HUGS_BRAND, HUGS_VERSION, HUGS_PRODUCT_DATE, HUGS_ASSET_CODE, 
    HUGS_PRICE, HUGS_DEPT_ID, HUGS_DEPT_NAME, HUGS_USER_ID, HUGS_USER_NAME, HUGS_USE_RESON, 
    HUGS_USE_STATUS, HUGS_DESCR, HUGS_STATUS, HUGS_CREATOR, HUGS_CREATE_TIME, HUGS_UPDATE, 
    HUGS_UPDATE_TIME,HUGS_COMPANY
  	</sql>
  	<!-- where条件 -->
	<sql id="Goods_Where_Clause" >
		<dynamic prepend="WHERE HUGS_STATUS = 1">
			<isNotEmpty property="HUGS_ASSET_CODE">
				AND HUGS_ASSET_CODE LIKE '%$HUGS_ASSET_CODE$%'
			</isNotEmpty>
			<isNotEmpty property="HUGS_NAME">
				AND HUGS_NAME LIKE '%$HUGS_NAME$%'
			</isNotEmpty>
			<isNotEmpty property="HUGS_DEPT_NAME">
				AND HUGS_DEPT_NAME LIKE '%$HUGS_DEPT_NAME$%'
			</isNotEmpty>
			<isNotEmpty property="HUGS_USER_NAME">
				AND HUGS_USER_NAME LIKE '%$HUGS_USER_NAME$%'
			</isNotEmpty>
			<isNotEmpty property="HUGS_USE_RESON">
				AND HUGS_USE_RESON LIKE '%$HUGS_USE_RESON$%'
			</isNotEmpty>
			<isNotEmpty property="HUGS_COMPANY">
				AND HUGS_COMPANY = #HUGS_COMPANY#
			</isNotEmpty>
		</dynamic>
  	</sql>
	<!-- 物资总数 -->
	<select id="getGoodsListCnt" resultClass="java.lang.Integer"
		parameterClass="java.util.HashMap">
		SELECT COUNT(*) FROM HU_GOODS
		<isParameterPresent >
	      <include refid="HuGoods.Goods_Where_Clause" />
    	</isParameterPresent>
	</select>
	<!-- 物资分页集合查询 -->
	<select id="getGoodsPageList" resultClass="java.util.HashMap"
		parameterClass="java.util.HashMap">
		<!-- oracle version  -->
		SELECT * FROM
		(
				SELECT
					A .*, ROWNUM r
				FROM
					(
							SELECT <include refid="HuGoods.Goods_Base_Column_List" />
					FROM HU_GOODS
						<isParameterPresent >
						<include refid="HuGoods.Goods_Where_Clause" />
							<isNotEmpty property="sortField">
						ORDER BY $sortField$ $sortOrder$
							</isNotEmpty>
						</isParameterPresent>
					) A
				WHERE
					ROWNUM <![CDATA[ <= ]]> #end#
		) B
		WHERE r <![CDATA[>]]> #start#
		<!-- mysql version  -->
		<!-- 
		SELECT <include refid="HuGoods.Goods_Base_Column_List" />
		FROM HU_GOODS
	    <isParameterPresent >
		  <include refid="HuGoods.Goods_Where_Clause" />
	      <isNotEmpty property="sortField">
			ORDER BY $sortField$ $sortOrder$
	      </isNotEmpty>
    	</isParameterPresent>
		LIMIT #start#,#end#
		 -->
	</select>
	<!-- 物资EXLS导出数据 -->
	<select id="getGoodsEXLSList" resultClass="java.util.HashMap"
		parameterClass="java.util.HashMap">
		<!-- oracle version  -->
			SELECT
		    (
		      SELECT 
		          WM_CONCAT (
		          EM.HUGI_DESCR || ' ' ||'变更时间:'||TO_CHAR(EM.HUGI_CHANGE_DATE,'YYYY-MM-DD')
		          )
		      FROM
		        HU_GOODS_ITEM EM
		      WHERE
		        EM.HUGI_GOODS_ID = GOODS.HUGS_ID
		    ) AS ITEMS,
		    GOODS.HUGS_NAME,
		    GOODS.HUGS_BRAND,
		    GOODS.HUGS_VERSION,
		    GOODS.HUGS_PRODUCT_DATE,
		    GOODS.HUGS_ASSET_CODE,
		    GOODS.HUGS_PRICE,
		    GOODS.HUGS_DEPT_NAME,
		    GOODS.HUGS_USER_NAME,
		    GOODS.HUGS_USE_RESON,
		    GOODS.HUGS_DESCR,
		    GOODS.HUGS_COMPANY,
		    CASE GOODS.HUGS_USE_STATUS
		  WHEN 1 THEN
		    '使用中'
		  WHEN 2 THEN
		    '在库'
		  ELSE
		    '作废'
		  END HUGS_USE_STATUS
			,CASE GOODS.HUGS_CHECK_STATUS
		  WHEN 0 THEN
		    '尚未盘点'
		  WHEN -1 THEN
		    '问题物资'
		  ELSE
		    '盘点无误'
		  END HUGS_CHECK_STATUS
		  FROM
		    HU_GOODS GOODS
			<isParameterPresent >
		      <include refid="HuGoods.Goods_Where_Clause" />
	    	</isParameterPresent>
		  ORDER BY
		    GOODS.HUGS_ID ASC


		<!-- mysql version  -->
		<!-- 
		SELECT
			GROUP_CONCAT(
				CONCAT(
					"变更:",
					CONVERT (
						IFNULL(EM.HUGI_USER_ID, ""),
						CHAR
					),
					"_",
					IFNULL(EM.HUGI_USER_NAME, ""),
					"_",
					IFNULL(EM.HUGI_DEPT_NAME, ""),
					"_",
					IFNULL(EM.HUGI_DESCR, "")
				)
			) AS ITEMS,
			GOODS.HUGS_NAME,
			GOODS.HUGS_BRAND,
			GOODS.HUGS_VERSION,
			GOODS.HUGS_PRODUCT_DATE,
			GOODS.HUGS_ASSET_CODE,
			GOODS.HUGS_PRICE,
			GOODS.HUGS_DEPT_NAME,
			GOODS.HUGS_USER_NAME,
			GOODS.HUGS_USE_RESON,
			GOODS.HUGS_DESCR,
			CASE GOODS.HUGS_USE_STATUS
		WHEN '1' THEN
			'使用中'
		WHEN '2' THEN
			'在库'
		ELSE
			'作废'
		END HUGS_USE_STATUS
		FROM
			HU_GOODS GOODS
		LEFT JOIN HU_GOODS_ITEM EM ON EM.HUGI_GOODS_ID = GOODS.HUGS_ID
		GROUP BY
			GOODS.HUGS_ID
		ORDER BY
			GOODS.HUGS_ID ASC
			 -->
	</select>
	<!-- 查询物资公司种类 -->
	<select id="getGoodsCompany" resultClass="java.util.HashMap"
		parameterClass="java.util.HashMap">
		SELECT OG.HUGS_COMPANY FROM HU_GOODS OG
		WHERE OG.HUGS_ID IN(
		SELECT MAX(GOOD.HUGS_ID) FROM HU_GOODS GOOD
		GROUP BY GOOD.HUGS_COMPANY
		)
		ORDER BY OG.HUGS_ID ASC
	</select>
	<!-- 添加物资 -->
	<insert id="addGoods" parameterClass="java.util.HashMap">
		<!-- mysql version -->
		<!-- 
		INSERT INTO HU_GOODS (
		`HUGS_ID`,
		`HUGS_NAME`,
		`HUGS_BRAND`,
		`HUGS_VERSION`,
		`HUGS_PRODUCT_DATE`,
		`HUGS_ASSET_CODE`,
		`HUGS_PRICE`,
		`HUGS_DEPT_ID`,
		`HUGS_DEPT_NAME`,
		`HUGS_USER_ID`,
		`HUGS_USER_NAME`,
		`HUGS_USE_RESON`,
		`HUGS_USE_STATUS`,
		`HUGS_DESCR`,
		`HUGS_STATUS`,
		`HUGS_CREATOR`,
		`HUGS_CREATE_TIME`,
		`HUGS_UPDATE`,
		`HUGS_UPDATE_TIME`
		)
		VALUES
		(
		NULL,
		#HUGS_NAME#, #HUGS_BRAND#,
		#HUGS_VERSION#,#HUGS_PRODUCT_DATE#,#HUGS_ASSET_CODE#,#HUGS_PRICE#,#HUGS_DEPT_ID#,#HUGS_DEPT_NAME#,#HUGS_USER_ID#,#HUGS_USER_NAME#,#HUGS_USE_RESON#,#HUGS_USE_STATUS#,#HUGS_DESCR#,#HUGS_STATUS#,#HUGS_CREATOR#,SYSDATE(),
		#HUGS_UPDATE#,
		SYSDATE()
		);
		<selectKey resultClass="java.lang.Integer" keyProperty="HUGS_ID">
			SELECT LAST_INSERT_ID()
		</selectKey>
		 -->
		<!-- oracle version -->
		<selectKey resultClass="java.lang.Integer" keyProperty="HUGS_ID" type="pre">   
        SELECT HU_GOODS_SQ.NEXTVAL AS VALUE FROM DUAL  
    	</selectKey> 
		 INSERT INTO HU_GOODS (
		HUGS_ID,
		HUGS_NAME,
		HUGS_BRAND,
		HUGS_VERSION,
		HUGS_PRODUCT_DATE,
		HUGS_ASSET_CODE,
		HUGS_PRICE,
		HUGS_DEPT_ID,
		HUGS_DEPT_NAME,
		HUGS_USER_ID,
		HUGS_USER_NAME,
		HUGS_USE_RESON,
		HUGS_USE_STATUS,
		HUGS_DESCR,
		HUGS_STATUS,
		HUGS_CREATOR,
		HUGS_CREATE_TIME,
		HUGS_UPDATE,
		HUGS_UPDATE_TIME,
		HUGS_COMPANY
		)
		VALUES
		(
		#HUGS_ID#,
		#HUGS_NAME#, #HUGS_BRAND#,
		#HUGS_VERSION#,#HUGS_PRODUCT_DATE#,#HUGS_ASSET_CODE#,#HUGS_PRICE#,#HUGS_DEPT_ID#,#HUGS_DEPT_NAME#,#HUGS_USER_ID#,#HUGS_USER_NAME#,#HUGS_USE_RESON#,#HUGS_USE_STATUS#,#HUGS_DESCR#,#HUGS_STATUS#,#HUGS_CREATOR#,SYSDATE,
		#HUGS_UPDATE#,
		SYSDATE,
		#HUGS_COMPANY#
		)
	</insert>
	
	<!-- 更新物资 -->
	<update id="updateGoods" parameterClass="java.util.HashMap">
		<!-- oracle version -->
		UPDATE HU_GOODS SET
		HUGS_NAME=#HUGS_NAME#, HUGS_BRAND=#HUGS_BRAND#,
		HUGS_VERSION=#HUGS_VERSION#,HUGS_PRODUCT_DATE=#HUGS_PRODUCT_DATE#,HUGS_PRICE=#HUGS_PRICE#,HUGS_DEPT_ID=#HUGS_DEPT_ID#,HUGS_DEPT_NAME=#HUGS_DEPT_NAME#,HUGS_USER_ID=#HUGS_USER_ID#,HUGS_USER_NAME=#HUGS_USER_NAME#,HUGS_USE_RESON=#HUGS_USE_RESON#,HUGS_USE_STATUS=#HUGS_USE_STATUS#,HUGS_DESCR=#HUGS_DESCR#,HUGS_STATUS=#HUGS_STATUS#,HUGS_CREATOR=#HUGS_CREATOR#,HUGS_UPDATE_TIME=SYSDATE
		where HUGS_ASSET_CODE=#HUGS_ASSET_CODE#
		<!-- mysql version -->
		<!-- 
		UPDATE HU_GOODS SET
		HUGS_NAME=#HUGS_NAME#, HUGS_BRAND=#HUGS_BRAND#,
		HUGS_VERSION=#HUGS_VERSION#,HUGS_PRODUCT_DATE=#HUGS_PRODUCT_DATE#,HUGS_PRICE=#HUGS_PRICE#,HUGS_DEPT_ID=#HUGS_DEPT_ID#,HUGS_DEPT_NAME=#HUGS_DEPT_NAME#,HUGS_USER_ID=#HUGS_USER_ID#,HUGS_USER_NAME=#HUGS_USER_NAME#,HUGS_USE_RESON=#HUGS_USE_RESON#,HUGS_USE_STATUS=#HUGS_USE_STATUS#,HUGS_DESCR=#HUGS_DESCR#,HUGS_STATUS=#HUGS_STATUS#,HUGS_CREATOR=#HUGS_CREATOR#,HUGS_UPDATE_TIME=SYSDATE()
		where HUGS_ASSET_CODE=#HUGS_ASSET_CODE#
		 -->
	</update>
	
	<!-- 查询固定资产编码数量 -->
	<select id="selectHugsAssetCodeCount" parameterClass="java.util.HashMap"
		resultClass="int">
		SELECT COUNT(HG.HUGS_ID) AS COUNT FROM HU_GOODS HG WHERE
		HG.HUGS_ASSET_CODE=#HUGS_ASSET_CODE#
	</select>
	<!-- 由固定资产编码查询对应的记录id集合 -->
	<select id="selectGoodsIdListByHugsAssetCode" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
		SELECT HG.HUGS_ID FROM HU_GOODS HG WHERE
		HG.HUGS_ASSET_CODE=#HUGS_ASSET_CODE#
	</select>
	
	<!-- ################################################################################# -->
	<!-- HU_GOODS_ITEM -->
	
	<!-- 变更项列集合 -->
	<sql id="Goods_Item_Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Dec 12 11:53:06 CST 2014.
    -->
    HUGI_ID, HUGI_GOODS_ID, HUGI_DEPT_ID, HUGI_DEPT_NAME, HUGI_USER_ID, HUGI_USER_NAME, 
    HUGI_USE_RESON, HUGI_USE_STATUS, HUGI_DESCR, HUGI_STATUS, HUGI_CREATOR, HUGI_CREATE_TIME, 
    HUGI_UPDATE, HUGI_UPDATE_TIME
  	</sql>
  	<!-- where条件 -->
	<sql id="Goods_Item_Where_Clause" >
		<dynamic prepend="WHERE 1=1">
			<isNotEmpty property="HUGI_GOODS_ID">
					AND HUGI_GOODS_ID = #HUGI_GOODS_ID#
				</isNotEmpty>
				<isNotEmpty property="HUGI_DEPT_NAME">
					AND HUGI_DEPT_NAME LIKE '%$HUGI_DEPT_NAME$%'
				</isNotEmpty>
				<isNotEmpty property="HUGI_USER_NAME">
					AND HUGI_USER_NAME LIKE '%$HUGI_USER_NAME$%'
				</isNotEmpty>
				<isNotEmpty property="HUGI_USE_RESON">
					AND HUGI_USE_RESON LIKE '%$HUGI_USE_RESON$%'
				</isNotEmpty>	
		</dynamic>
  	</sql>
	<!-- 物资变更项总数 -->
	<select id="getGoodsItemListCnt" resultClass="java.lang.Integer"
		parameterClass="java.util.HashMap">
		SELECT COUNT(*) FROM HU_GOODS_ITEM
		<isParameterPresent >
	      <include refid="HuGoods.Goods_Item_Where_Clause" />
    	</isParameterPresent>
	</select>
	<!-- 物资变更项分页集合查询 -->
	<select id="getGoodsItemPageList" resultClass="java.util.HashMap"
		parameterClass="java.util.HashMap">
		<!-- oracle version -->
		SELECT * FROM
		(
				SELECT
					A .*, ROWNUM r
				FROM
					(

							SELECT <include refid="HuGoods.Goods_Item_Base_Column_List" />
				FROM HU_GOODS_ITEM
				<isParameterPresent >
				<include refid="HuGoods.Goods_Item_Where_Clause" />
					<isNotEmpty property="sortField">
				ORDER BY $sortField$ $sortOrder$
					</isNotEmpty>
				</isParameterPresent>

					) A
				WHERE
					ROWNUM <![CDATA[ <= ]]> #end#
		) B
		WHERE r <![CDATA[>]]> #start#
		<!-- mysql version -->
		<!-- 
		SELECT <include refid="HuGoods.Goods_Item_Base_Column_List" />
		FROM HU_GOODS_ITEM
	    <isParameterPresent >
		  <include refid="HuGoods.Goods_Item_Where_Clause" />
	      <isNotEmpty property="sortField">
			ORDER BY $sortField$ $sortOrder$
	      </isNotEmpty>
    	</isParameterPresent>
		LIMIT #start#,#end#
		 -->
	</select>
	
	<!-- 添加记录明细 -->
	<insert id="addGoodsItem" parameterClass="java.util.HashMap">
		<!-- oracle version -->
		<selectKey resultClass="java.lang.Integer" keyProperty="HUGI_ID" type="pre">   
        SELECT HU_GOODS_ITEM_SQ.NEXTVAL AS VALUE FROM DUAL  
    	</selectKey> 
    	INSERT INTO HU_GOODS_ITEM (HUGI_ID,HUGI_GOODS_ID, HUGI_DEPT_ID, HUGI_DEPT_NAME, 
      HUGI_USER_ID, HUGI_USER_NAME, HUGI_USE_RESON, HUGI_USE_STATUS, 
      HUGI_DESCR, HUGI_STATUS, HUGI_CREATOR, HUGI_CREATE_TIME, 
      HUGI_UPDATE, HUGI_UPDATE_TIME)
      VALUES (#HUGI_ID#,#HUGI_GOODS_ID#, #HUGI_DEPT_ID#, #HUGI_DEPT_NAME#, 
      #HUGI_USER_ID#, #HUGI_USER_NAME#, #HUGI_USE_RESON#, #HUGI_USE_STATUS#, 
      #HUGI_DESCR#, #HUGI_STATUS#, #HUGI_CREATOR#, SYSDATE, 
      #HUGI_UPDATE#, SYSDATE)
    	<!-- mysql version -->
    	<!-- 
		INSERT INTO HU_GOODS_ITEM (HUGI_GOODS_ID, HUGI_DEPT_ID, HUGI_DEPT_NAME, 
      HUGI_USER_ID, HUGI_USER_NAME, HUGI_USE_RESON, HUGI_USE_STATUS, 
      HUGI_DESCR, HUGI_STATUS, HUGI_CREATOR, HUGI_CREATE_TIME, 
      HUGI_UPDATE, HUGI_UPDATE_TIME)
      VALUES (#HUGI_GOODS_ID:INTEGER#, #HUGI_DEPT_ID:VARCHAR#, #HUGI_DEPT_NAME:VARCHAR#, 
      #HUGI_USER_ID:INTEGER#, #HUGI_USER_NAME:VARCHAR#, #HUGI_USE_RESON:VARCHAR#, #HUGI_USE_STATUS:INTEGER#, 
      #HUGI_DESCR:VARCHAR#, #HUGI_STATUS:INTEGER#, #HUGI_CREATOR:VARCHAR#, SYSDATE(), 
      #HUGI_UPDATE:VARCHAR#, SYSDATE())
		<selectKey resultClass="java.lang.Integer" keyProperty="HUGI_ID">
			SELECT LAST_INSERT_ID() AS HUGI_ID
		</selectKey>
		 -->
	</insert>
	<!-- 删除物资变更明细 -->
	<delete id="deleteGoodsItem" parameterClass="java.util.HashMap">
		DELETE FROM HU_GOODS_ITEM WHERE HUGI_ID =#HUGI_ID#
	</delete>
</sqlMap>
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
wpsystem是什么文件夹wpsystem是什么文件夹Sep 01, 2022 am 11:22 AM

wpsystem文件夹是windows应用文件夹;创建WpSystem文件夹是为了存储某些特定“Microsoft Store”应用程序的数据,因此建议不要删该文件夹,因为删除之后就无法使用指定的应用。

winreagent是什么文件夹winreagent是什么文件夹Aug 26, 2022 am 11:23 AM

winreagent是在系统更新或升级的过程中创建的文件夹;该文件夹中通常包含临时文件,当更新或升级失败时,系统将通过还原先前创建的临时文件来回滚到执行更新或升级过程之前的版本。

baidunetdiskdownload是什么文件夹baidunetdiskdownload是什么文件夹Aug 30, 2022 am 10:45 AM

baidunetdiskdownload是百度网盘默认下载文件的文件夹;百度网盘是百度推出的一项云存储服务,只要下载东西到百度网盘里,都会默认保存到这个文件夹中,并且可跨终端随时随地查看和分享。

备份文件的扩展名通常是什么备份文件的扩展名通常是什么Sep 01, 2022 pm 03:55 PM

备份文件的扩展名通常是“.bak”;bak文件是一个备份文件,这类文件一般在'.bak前面加上应该有原来的扩展名,有的则是由原文件的后缀名和bak混合而成,在生成了某种类型的文件后,就会自动生成它的备份文件。

reference assemblies是什么文件夹reference assemblies是什么文件夹Sep 01, 2022 pm 03:12 PM

“reference assemblies”是系统用户设置文件夹;该文件夹中包括各个用户的文档、收藏夹、上网浏览信息、配置文件等,是“NET framework”存储公用类型库数据集的地方,并且该文件中的文件不能随便删除。

resource是什么文件夹resource是什么文件夹Sep 05, 2022 am 10:58 AM

resource是一个资源文件夹;该文件夹通常是由一些需要联网使用的软件在用户使用的时候创建的,属于临时资料文件夹,该文件夹非系统文件夹可以安全删除,文件夹大小会根据用户使用此类软件中相关资源的大小,创建不等值大小的文件夹。

cad文件的后缀是什么cad文件的后缀是什么Sep 08, 2022 am 11:36 AM

cad文件的后缀:1、“.Dwg”,Dwg格式是cad文件的标准文件格式;2、“.dxf”,dxf格式是一种绘图交换文件,是进行CAD数据交换的CAD数据文件格式;3、“.dws”,dws格式的cad文档只能查看不能修改;4、“.dwt”,dwt是CAD的模板文件。

nwd文件能用什么软件打开nwd文件能用什么软件打开Sep 07, 2022 pm 02:51 PM

nwd文件能够使用“Autodesk Navisworks”软件打开;该软件是一款用于分析、仿真和项目信息交流的全面审阅解决方案,被广泛应用于建筑工程项目管理和设计方面,该软件能够帮助用户提前预测和发现项目流程中的错误,避免这些问题导致项目的中断。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function