1 changed files with 170 additions and 0 deletions
@ -0,0 +1,170 @@ |
|||
<?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"> |
|||
|
|||
<!-- user --> |
|||
<mapper namespace="com.dreamchaser.depository_manage.mapper.SplitUnitMapper"> |
|||
<!-- 字段映射(权限) --> |
|||
|
|||
<!-- 权限映射--> |
|||
<resultMap id="splitInfoMap" type="com.dreamchaser.depository_manage.entity.SplitInfo"> |
|||
<id column="id" property="id" jdbcType="INTEGER" /> |
|||
<result column="mid" property="mid" jdbcType="INTEGER" /> |
|||
<result column="quantity" property="quantity" jdbcType="INTEGER" /> |
|||
<result column="parentId" property="parentId" jdbcType="INTEGER" /> |
|||
<result column="state" property="state" jdbcType="INTEGER" /> |
|||
<result column="oldUnit" property="oldUnit" jdbcType="VARCHAR" /> |
|||
<result column="newUnit" property="newUnit" jdbcType="VARCHAR" /> |
|||
</resultMap> |
|||
|
|||
<resultMap id="splitInventoryMap" type="com.dreamchaser.depository_manage.entity.SplitInventory"> |
|||
<id column="id" property="id" jdbcType="INTEGER" /> |
|||
<result column="iid" property="iid" jdbcType="INTEGER"/> |
|||
<result column="sid" property="sid" jdbcType="INTEGER"/> |
|||
<result column="outQuantity" property="outQuantity" jdbcType="INTEGER"/> |
|||
<result column="inQuantity" property="inQuantity" jdbcType="INTEGER"/> |
|||
<result column="saveQuantity" property="saveQuantity" jdbcType="INTEGER"/> |
|||
</resultMap> |
|||
|
|||
<sql id="splitInfoAllColumns"> |
|||
s.id,s.mid,s.oldUnit,s.newUnit,s.quantity,s.parentId,s.state |
|||
</sql> |
|||
|
|||
<sql id="splitInventoryAllColumns"> |
|||
si.id,si.iid,si.sid.si.outQuantity,si.inQuantity,si.saveQuantity |
|||
</sql> |
|||
|
|||
<select id="findSplitInfoByMidAndUnit" parameterType="map" resultMap="splitInfoMap"> |
|||
select |
|||
<include refid="splitInfoAllColumns"/> |
|||
from `split` s |
|||
where 1 = 1 |
|||
<if test="mid != null and mid != ''"> |
|||
and s.mid = #{mid} |
|||
</if> |
|||
<if test="oldUnit != null and oldUnit != ''"> |
|||
and s.oldUnit = #{oldUnit} |
|||
</if> |
|||
<if test="newUnit != null and newUnit != ''"> |
|||
and s.newUnit = #{newUnit} |
|||
</if> |
|||
</select> |
|||
|
|||
|
|||
<select id="findSplitInventoryByIidAndSid" parameterType="map" resultMap="splitInventoryMap"> |
|||
select |
|||
<include refid="splitInventoryAllColumns"/> |
|||
from `split_inventory` si |
|||
where 1 = 1 |
|||
<if test="iid != null and iid != ''"> |
|||
and si.iid = #{iid}, |
|||
</if> |
|||
<if test="sid != null and sid != ''"> |
|||
and si.sid = #{sid} |
|||
</if> |
|||
</select> |
|||
|
|||
|
|||
<update id="updateSplitInfo"> |
|||
update `split` |
|||
<set> |
|||
<if test="mid != null and mid != ''"> |
|||
mid = #{mid}, |
|||
</if> |
|||
<if test="oldUnit != null and oldUnit != ''"> |
|||
oldUnit = #{oldUnit}, |
|||
</if> |
|||
<if test="newUnit != null and newUnit != ''"> |
|||
newUnit = #{newUnit}, |
|||
</if> |
|||
<if test="quantity != null and quantity != ''"> |
|||
quantity = #{quantity}, |
|||
</if> |
|||
<if test="parentId != null and parentId != ''"> |
|||
parentId = #{parentId}, |
|||
</if> |
|||
<if test="state != null and state != ''"> |
|||
state = #{state} |
|||
</if> |
|||
</set> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<update id="updateSplitInventory"> |
|||
update `split_inventory` |
|||
<set> |
|||
<if test="iid != null and iid != ''"> |
|||
iid = #{iid}, |
|||
</if> |
|||
<if test="sid != null and sid != ''"> |
|||
sid = #{sid}, |
|||
</if> |
|||
<if test="outQuantity != null and outQuantity != ''"> |
|||
outQuantity = #{outQuantity}, |
|||
</if> |
|||
<if test="inQuantity != null and inQuantity != ''"> |
|||
inQuantity = #{inQuantity}, |
|||
</if> |
|||
<if test="saveQuantity != null and saveQuantity != ''"> |
|||
saveQuantity = #{saveQuantity}, |
|||
</if> |
|||
</set> |
|||
where id = #{id} |
|||
</update> |
|||
|
|||
<insert id="addSplitInfo" parameterType="map" useGeneratedKeys="true" keyProperty="id"> |
|||
INSERT INTO `split` ( |
|||
id, mid, oldUnit,newUnit,quantity,parentId,state |
|||
) VALUES ( |
|||
#{id}, |
|||
#{mid}, |
|||
#{oldUnit}, |
|||
#{newUnit}, |
|||
#{quantity}, |
|||
#{parentId}, |
|||
#{state} |
|||
) |
|||
</insert> |
|||
|
|||
<insert id="addSplitInventory" parameterType="map" useGeneratedKeys="true" keyProperty="id"> |
|||
INSERT INTO `split_inventory` ( |
|||
id, iid, sid,outQuantity,inQuantity,saveQuantity |
|||
) VALUES ( |
|||
#{id}, |
|||
#{iid}, |
|||
#{sid}, |
|||
#{outQuantity}, |
|||
#{inQuantity}, |
|||
#{saveQuantity} |
|||
) |
|||
</insert> |
|||
|
|||
<delete id="delSplitInfoById" parameterType="int"> |
|||
delete from `split` WHERE id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="delSplitInfoByIds" parameterType="int"> |
|||
delete from `split` |
|||
where id in |
|||
<foreach collection="list" index="index" item="id" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
|
|||
<delete id="delSplitInventoryById" parameterType="int"> |
|||
delete from `split_inventory` WHERE id = #{id} |
|||
</delete> |
|||
|
|||
<delete id="delSplitInventoryByIds" parameterType="int"> |
|||
delete from `split_inventory` |
|||
where id in |
|||
<foreach collection="list" index="index" item="id" open="(" separator="," close=")"> |
|||
#{id} |
|||
</foreach> |
|||
</delete> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
</mapper> |
|||
Loading…
Reference in new issue