| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442 |
- <?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.usoftchina.saas.purchase.mapper.ProdInOutMapper">
- <resultMap id="BaseResultMap" type="com.usoftchina.saas.purchase.po.ProdInOut">
- <id column="pi_id" jdbcType="INTEGER" property="id" />
- <result column="pi_inoutno" jdbcType="VARCHAR" property="pi_inoutno" />
- <result column="pi_class" jdbcType="VARCHAR" property="pi_class" />
- <result column="pi_date" jdbcType="TIMESTAMP" property="pi_date" />
- <result column="pi_vendid" jdbcType="INTEGER" property="pi_vendid" />
- <result column="pi_vendcode" jdbcType="VARCHAR" property="pi_vendcode" />
- <result column="pi_vendname" jdbcType="VARCHAR" property="pi_vendname" />
- <result column="pi_custid" jdbcType="INTEGER" property="pi_custid" />
- <result column="pi_custcode" jdbcType="VARCHAR" property="pi_custcode" />
- <result column="pi_custname" jdbcType="VARCHAR" property="pi_custname" />
- <result column="pi_puid" jdbcType="INTEGER" property="pi_puid" />
- <result column="pi_pucode" jdbcType="VARCHAR" property="pi_pucode" />
- <result column="pi_said" jdbcType="INTEGER" property="pi_said" />
- <result column="pi_sacode" jdbcType="VARCHAR" property="pi_sacode" />
- <result column="pi_total" jdbcType="DOUBLE" property="pi_total" />
- <result column="pi_status" jdbcType="VARCHAR" property="pi_status" />
- <result column="pi_statuscode" jdbcType="VARCHAR" property="pi_statuscode" />
- <result column="pi_printstatus" jdbcType="VARCHAR" property="pi_printstatus" />
- <result column="pi_printstatuscode" jdbcType="VARCHAR" property="pi_printstatuscode" />
- <result column="companyid" property="companyId" jdbcType="BIGINT" />
- <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
- <result column="updaterName" jdbcType="VARCHAR" property="updaterName" />
- <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
- <result column="creatorid" property="creatorId" jdbcType="INTEGER"/>
- <result column="creatorName" jdbcType="VARCHAR" property="creatorName" />
- <result column="createtime" property="createTime" jdbcType="TIMESTAMP" />
- <result column="pi_text1" jdbcType="VARCHAR" property="pi_text1" />
- <result column="pi_text2" jdbcType="VARCHAR" property="pi_text2" />
- <result column="pi_text3" jdbcType="VARCHAR" property="pi_text3" />
- <result column="pi_text4" jdbcType="VARCHAR" property="pi_text4" />
- <result column="pi_text5" jdbcType="VARCHAR" property="pi_text5" />
- <result column="pi_auditdate" jdbcType="TIMESTAMP" property="pi_auditdate" />
- <result column="pi_auditman" jdbcType="VARCHAR" property="pi_auditman" />
- <result column="pi_remark" jdbcType="VARCHAR" property="pi_remark" />
- <result column="pi_ioid" jdbcType="INTEGER" property="pi_ioid" />
- <result column="pi_iocode" jdbcType="VARCHAR" property="pi_iocode" />
- <result column="pi_prstatus" jdbcType="VARCHAR" property="pi_prstatus" />
- <result column="pi_prstatuscode" jdbcType="VARCHAR" property="pi_prstatuscode" />
- </resultMap>
- <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.usoftchina.saas.purchase.po.ProdInOut">
- <result column="pi_address" jdbcType="LONGVARCHAR" property="pi_address" />
- </resultMap>
- <sql id="Base_Column_List">
- pi_id, pi_inoutno, pi_class, pi_date, pi_vendid, pi_vendcode, pi_vendname, pi_custid,
- pi_custcode, pi_custname, pi_puid, pi_pucode, pi_said, pi_sacode, pi_total, pi_status, pi_statuscode, pi_printstatus, pi_printstatuscode,
- companyid, updaterid,updaterName,updatetime,creatorid,creatorName,createtime, pi_text1, pi_text2, pi_text3, pi_text4, pi_text5,pi_auditdate,
- pi_auditman,pi_remark,pi_ioid,pi_iocode,pi_prstatus,pi_prstatuscode
- </sql>
- <sql id="Blob_Column_List">
- pi_address
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
- select
- <include refid="Base_Column_List" />
- ,
- <include refid="Blob_Column_List" />
- from prodinout
- where pi_id = #{pi_id,jdbcType=INTEGER}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
- delete from prodinout
- where pi_id = #{pi_id,jdbcType=INTEGER}
- </delete>
- <insert id="insertSelective" parameterType="com.usoftchina.saas.purchase.po.ProdInOut">
- <selectKey resultType="java.lang.Long" keyProperty="id">
- SELECT LAST_INSERT_ID() AS ID
- </selectKey>
- insert into prodinout
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="pi_inoutno != null">
- pi_inoutno,
- </if>
- <if test="pi_class != null">
- pi_class,
- </if>
- <if test="pi_date != null">
- pi_date,
- </if>
- <if test="pi_vendid != null">
- pi_vendid,
- </if>
- <if test="pi_vendcode != null">
- pi_vendcode,
- </if>
- <if test="pi_vendname != null">
- pi_vendname,
- </if>
- <if test="pi_custid != null">
- pi_custid,
- </if>
- <if test="pi_custcode != null">
- pi_custcode,
- </if>
- <if test="pi_custname != null">
- pi_custname,
- </if>
- <if test="pi_puid != null">
- pi_puid,
- </if>
- <if test="pi_pucode != null">
- pi_pucode,
- </if>
- <if test="pi_said != null">
- pi_said,
- </if>
- <if test="pi_sacode != null">
- pi_sacode,
- </if>
- <if test="pi_total != null">
- pi_total,
- </if>
- <if test="pi_status != null">
- pi_status,
- </if>
- <if test="pi_statuscode != null">
- pi_statuscode,
- </if>
- <if test="pi_printstatus != null">
- pi_printstatus,
- </if>
- <if test="pi_printstatuscode != null">
- pi_printstatuscode,
- </if>
- <if test="companyId != null" >
- companyid,
- </if>
- <if test="updaterId != null" >
- updaterId,
- </if>
- <if test="updaterName != null" >
- updaterName,
- </if>
- <if test="updateTime != null" >
- updateTime,
- </if>
- <if test="creatorId != null" >
- creatorId,
- </if>
- <if test="creatorName != null" >
- creatorName,
- </if>
- <if test="createTime != null" >
- createTime,
- </if>
- <if test="pi_text1 != null">
- pi_text1,
- </if>
- <if test="pi_text2 != null">
- pi_text2,
- </if>
- <if test="pi_text3 != null">
- pi_text3,
- </if>
- <if test="pi_text4 != null">
- pi_text4,
- </if>
- <if test="pi_text5 != null">
- pi_text5,
- </if>
- <if test="pi_address != null">
- pi_address,
- </if>
- <if test="pi_auditdate != null">
- pi_auditdate,
- </if>
- <if test="pi_auditman != null">
- pi_auditman,
- </if>
- <if test="pi_remark != null">
- pi_remark,
- </if>
- <if test="pi_ioid != null">
- pi_ioid,
- </if>
- <if test="pi_iocode != null">
- pi_iocode,
- </if>
- <if test="pi_prstatus != null">
- pi_prstatus,
- </if>
- <if test="pi_prstatuscode != null">
- pi_prstatuscode,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="pi_inoutno != null">
- #{pi_inoutno,jdbcType=VARCHAR},
- </if>
- <if test="pi_class != null">
- #{pi_class,jdbcType=VARCHAR},
- </if>
- <if test="pi_date != null">
- #{pi_date,jdbcType=TIMESTAMP},
- </if>
- <if test="pi_vendid != null">
- #{pi_vendid,jdbcType=INTEGER},
- </if>
- <if test="pi_vendcode != null">
- #{pi_vendcode,jdbcType=VARCHAR},
- </if>
- <if test="pi_vendname != null">
- #{pi_vendname,jdbcType=VARCHAR},
- </if>
- <if test="pi_custid != null">
- #{pi_custid,jdbcType=INTEGER},
- </if>
- <if test="pi_custcode != null">
- #{pi_custcode,jdbcType=VARCHAR},
- </if>
- <if test="pi_custname != null">
- #{pi_custname,jdbcType=VARCHAR},
- </if>
- <if test="pi_puid != null">
- #{pi_puid,jdbcType=INTEGER},
- </if>
- <if test="pi_pucode != null">
- #{pi_pucode,jdbcType=VARCHAR},
- </if>
- <if test="pi_said != null">
- #{pi_said,jdbcType=INTEGER},
- </if>
- <if test="pi_sacode != null">
- #{pi_sacode,jdbcType=VARCHAR},
- </if>
- <if test="pi_total != null">
- #{pi_total,jdbcType=DOUBLE},
- </if>
- <if test="pi_status != null">
- #{pi_status,jdbcType=VARCHAR},
- </if>
- <if test="pi_statuscode != null">
- #{pi_statuscode,jdbcType=VARCHAR},
- </if>
- <if test="pi_printstatus != null">
- #{pi_printstatus,jdbcType=VARCHAR},
- </if>
- <if test="pi_printstatuscode != null">
- #{pi_printstatuscode,jdbcType=VARCHAR},
- </if>
- <if test="companyId != null" >
- #{companyId,jdbcType=INTEGER},
- </if>
- <if test="updaterId != null" >
- #{updaterId,jdbcType=INTEGER},
- </if>
- <if test="updaterName != null">
- #{updaterName,jdbcType=VARCHAR},
- </if>
- <if test="updateTime != null" >
- #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="creatorId != null" >
- #{creatorId,jdbcType=INTEGER},
- </if>
- <if test="creatorName != null">
- #{creatorName,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="pi_text1 != null">
- #{pi_text1,jdbcType=VARCHAR},
- </if>
- <if test="pi_text2 != null">
- #{pi_text2,jdbcType=VARCHAR},
- </if>
- <if test="pi_text3 != null">
- #{pi_text3,jdbcType=VARCHAR},
- </if>
- <if test="pi_text4 != null">
- #{pi_text4,jdbcType=VARCHAR},
- </if>
- <if test="pi_text5 != null">
- #{pi_text5,jdbcType=VARCHAR},
- </if>
- <if test="pi_address != null">
- #{pi_address,jdbcType=LONGVARCHAR},
- </if>
- <if test="pi_auditdate != null">
- #{pi_auditdate,jdbcType=TIMESTAMP},
- </if>
- <if test="pi_auditman != null">
- #{pi_auditman,jdbcType=VARCHAR},
- </if>
- <if test="pi_remark != null">
- #{pi_remark,jdbcType=VARCHAR},
- </if>
- <if test="pi_ioid != null">
- #{pi_ioid,jdbcType=INTEGER},
- </if>
- <if test="pi_iocode != null">
- #{pi_iocode,jdbcType=VARCHAR},
- </if>
- <if test="pi_prstatus != null">
- #{pi_prstatus,jdbcType=VARCHAR},
- </if>
- <if test="pi_prstatuscode != null">
- #{pi_prstatuscode,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.purchase.po.ProdInOut">
- update prodinout
- <set>
- <if test="pi_inoutno != null">
- pi_inoutno = #{pi_inoutno,jdbcType=VARCHAR},
- </if>
- <if test="pi_class != null">
- pi_class = #{pi_class,jdbcType=VARCHAR},
- </if>
- <if test="pi_date != null">
- pi_date = #{pi_date,jdbcType=TIMESTAMP},
- </if>
- <if test="pi_vendid != null">
- pi_vendid = #{pi_vendid,jdbcType=INTEGER},
- </if>
- <if test="pi_vendcode != null">
- pi_vendcode = #{pi_vendcode,jdbcType=VARCHAR},
- </if>
- <if test="pi_vendname != null">
- pi_vendname = #{pi_vendname,jdbcType=VARCHAR},
- </if>
- <if test="pi_custid != null">
- pi_custid = #{pi_custid,jdbcType=INTEGER},
- </if>
- <if test="pi_custcode != null">
- pi_custcode = #{pi_custcode,jdbcType=VARCHAR},
- </if>
- <if test="pi_custname != null">
- pi_custname = #{pi_custname,jdbcType=VARCHAR},
- </if>
- <if test="pi_puid != null">
- pi_puid = #{pi_puid,jdbcType=INTEGER},
- </if>
- <if test="pi_pucode != null">
- pi_pucode = #{pi_pucode,jdbcType=VARCHAR},
- </if>
- <if test="pi_said != null">
- pi_said = #{pi_said,jdbcType=INTEGER},
- </if>
- <if test="pi_sacode != null">
- pi_sacode = #{pi_sacode,jdbcType=VARCHAR},
- </if>
- <if test="pi_total != null">
- pi_total = #{pi_total,jdbcType=DOUBLE},
- </if>
- <if test="pi_status != null">
- pi_status = #{pi_status,jdbcType=VARCHAR},
- </if>
- <if test="pi_statuscode != null">
- pi_statuscode = #{pi_statuscode,jdbcType=VARCHAR},
- </if>
- <if test="pi_printstatus != null">
- pi_printstatus = #{pi_printstatus,jdbcType=VARCHAR},
- </if>
- <if test="pi_printstatuscode != null">
- pi_printstatuscode = #{pi_printstatuscode,jdbcType=VARCHAR},
- </if>
- <if test="companyId != null" >
- companyid = #{companyId,jdbcType=INTEGER},
- </if>
- <if test="updaterId != null" >
- updaterId = #{updaterId,jdbcType=INTEGER},
- </if>
- <if test="updateTime != null" >
- updateTime = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="pi_text1 != null">
- pi_text1 = #{pi_text1,jdbcType=VARCHAR},
- </if>
- <if test="pi_text2 != null">
- pi_text2 = #{pi_text2,jdbcType=VARCHAR},
- </if>
- <if test="pi_text3 != null">
- pi_text3 = #{pi_text3,jdbcType=VARCHAR},
- </if>
- <if test="pi_text4 != null">
- pi_text4 = #{pi_text4,jdbcType=VARCHAR},
- </if>
- <if test="pi_text5 != null">
- pi_text5 = #{pi_text5,jdbcType=VARCHAR},
- </if>
- <if test="pi_address != null">
- pi_address = #{pi_address,jdbcType=LONGVARCHAR},
- </if>
- <if test="pi_auditdate != null">
- pi_auditdate = #{pi_auditdate,jdbcType=TIMESTAMP},
- </if>
- <if test="pi_auditman != null">
- pi_auditman = #{pi_auditman,jdbcType=VARCHAR},
- </if>
- <if test="pi_remark != null">
- pi_remark = #{pi_remark,jdbcType=VARCHAR},
- </if>
- </set>
- where pi_id = #{id,jdbcType=INTEGER}
- </update>
- <select id="validateCodeWhenInsert" resultType="int">
- select count(1) from prodinout where pi_inoutno = #{pi_inoutno} and companyid = #{companyId}
- </select>
- <select id="validateCodeWhenUpdate" resultType="int" >
- select count(1) from prodinout where pi_inoutno = #{pi_inoutno} and pi_id != #{id} and companyid = #{companyId}
- </select>
- <select id="selectCodeById" resultType="string" parameterType="long">
- select pi_inoutno from prodinout where pi_id=#{id}
- </select>
- <select id="checkQtyFromPurchase" resultType="int" parameterType="string">
- select count(1) from(
- select sum(pd_inqty) nowqty,(select pd_qty from purchasedetail where pd_id = pd_orderid) totalqty from prodiodetail where pd_ordercode=#{pu_code}
- GROUP BY pd_orderid) t where t.nowqty>t.totalqty
- </select>
- <select id="checkQtyFromProdIn" resultType="int" parameterType="long">
- select count(1) from(
- select sum(b.pd_outqty) nowqty,(select a.pd_inqty from prodiodetail a where a.pd_id = b.pd_ioid and a.pd_piclass='采购验收单') totalqty from prodiodetail b where b.pd_piid = #{id} and b.pd_piclass='采购验退单'
- GROUP BY b.pd_ioid) t where t.nowqty>t.totalqty
- </select>
- <update id="updateCreator">
- update prodinout set creatorId = #{userId} , creatorName=#{userName} where pi_id=#{id}
- </update>
- </mapper>
|