pick-pack-mapper.xml 2.23 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">

<!-- 提货封装设置(hs_asset)(关联表hs_asset.pick_pack) @author togxiaochuan -->
<mapper namespace="com.cjs.site.dao.user.pick.PickPackDao">
	
	<sql id="pick_pack_field">
		ID, OTC_CODE, OTC_NAME, PACK_STATUS, TRUST_STATUS, 
		CREATE_DATE, CREATE_TIME, CREATE_BY
	</sql>
	
	<select id="queryAll" resultType="PickPackInfo">
		SELECT <include refid="pick_pack_field" /> 
		FROM HS_ASSET.PICK_PACK 
		WHERE PACK_STATUS = '1'
		ORDER BY ID DESC 
	</select>
	
	<select id="queryById" parameterType="int" resultType="PickPackInfo">
		SELECT <include refid="pick_pack_field" /> 
		FROM HS_ASSET.PICK_PACK 
		WHERE ID = #{id}
	</select>


	<select id="queryUserPosition" parameterType="string" resultType="PickPackInfo">
		  select
		   a.otc_code as otcCode ,
		   d.otc_name AS otcName ,
		   a.current_amount as currentAmount
		  from hs_otc.otcstockreal a, hs_asset.clientinfo b, hs_asset.client c,hs_otc.otccode d
		 where a.client_id = b.client_id
		   and a.client_id = c.client_id
		   and a.otc_code=d.otc_code
		   and a.client_id = #{userId}
	</select>


	<select id="queryUserFundAccount" resultType="java.util.HashMap" parameterType="string" >
		select current_balance from hs_fund.fundreal a where a.client_id =#{userId}
	</select>

	<update id="ducueUserFundAmount">
		update hs_fund.fundreal set current_balance = current_balance-#{money} where client_id =#{userId}
	</update>

	<update id="ducueUserInventory">
		update hs_otc.otcstockreal  set current_amount = current_amount-#{amount} where client_id =#{userId} and otc_code=#{otcCode}
	</update>

	<insert id="insertPick" parameterType="java.util.HashMap">
		insert into  HS_ASSET.OUTPROPAPPLY(
		 OTC_CODE, OTC_NAME, OCCUR_AMOUNT, PICKING_DATE,
				PHONE_CODE, PICKING_ADDRESS,REMARK, OP_STATION,
				SDCPROPAPPLY_STATUS, EXPRESS_ADRESS,
				INIT_DATE,PICKING_NAME,POSITION_STR
		) values(
		#{otcCode},#{otcName},#{occurAmount},#{pickDate},
		#{phone,jdbcType=VARCHAR},#{pikingAddress,jdbcType=VARCHAR},'临时解决',#{opStation},
		0,#{address,jdbcType=VARCHAR},#{initDate},#{pickName,jdbcType=VARCHAR},#{postionStr,jdbcType=VARCHAR}
		)
	</insert>
</mapper>