|
|
@ -7,13 +7,13 @@ |
|
|
<!-- This code was generated by TableGo tools, mark 1 begin. --> |
|
|
<!-- This code was generated by TableGo tools, mark 1 begin. --> |
|
|
<!-- 字段映射 --> |
|
|
<!-- 字段映射 --> |
|
|
<resultMap id="materialMap" type="com.dreamchaser.depository_manage.entity.Material"> |
|
|
<resultMap id="materialMap" type="com.dreamchaser.depository_manage.entity.Material"> |
|
|
<id column="id" property="id" jdbcType="INTEGER" /> |
|
|
<id column="id" property="id" jdbcType="INTEGER"/> |
|
|
<result column="depository_id" property="depositoryId" jdbcType="INTEGER" /> |
|
|
<result column="depository_id" property="depositoryId" jdbcType="INTEGER"/> |
|
|
<result column="mname" property="mname" jdbcType="VARCHAR" /> |
|
|
<result column="mname" property="mname" jdbcType="VARCHAR"/> |
|
|
<result column="quantity" property="quantity" jdbcType="VARCHAR" /> |
|
|
<result column="quantity" property="quantity" jdbcType="VARCHAR"/> |
|
|
<result column="price" property="price" jdbcType="INTEGER" /> |
|
|
<result column="price" property="price" jdbcType="INTEGER"/> |
|
|
<result column="type_id" property="materialTypeId" jdbcType="INTEGER" /> |
|
|
<result column="type_id" property="materialTypeId" jdbcType="INTEGER"/> |
|
|
<result column="state" property="state" jdbcType="INTEGER" /> |
|
|
<result column="state" property="state" jdbcType="INTEGER"/> |
|
|
<result column="code" property="code" jdbcType="VARCHAR"/> |
|
|
<result column="code" property="code" jdbcType="VARCHAR"/> |
|
|
<result column="version" property="version" jdbcType="VARCHAR"/> |
|
|
<result column="version" property="version" jdbcType="VARCHAR"/> |
|
|
<result column="amounts" property="amounts" jdbcType="INTEGER"/> |
|
|
<result column="amounts" property="amounts" jdbcType="INTEGER"/> |
|
|
@ -31,14 +31,14 @@ |
|
|
|
|
|
|
|
|
<!-- 字段映射 --> |
|
|
<!-- 字段映射 --> |
|
|
<resultMap id="InventoryMap" type="com.dreamchaser.depository_manage.entity.Inventory"> |
|
|
<resultMap id="InventoryMap" type="com.dreamchaser.depository_manage.entity.Inventory"> |
|
|
<id column="id" property="id" jdbcType="INTEGER" /> |
|
|
<id column="id" property="id" jdbcType="INTEGER"/> |
|
|
<result column="mid" property="mid" jdbcType="INTEGER"/> |
|
|
<result column="mid" property="mid" jdbcType="INTEGER"/> |
|
|
<result column="depositoryId" property="depositoryId" jdbcType="INTEGER" /> |
|
|
<result column="depositoryId" property="depositoryId" jdbcType="INTEGER"/> |
|
|
<result column="mname" property="mname" jdbcType="VARCHAR" /> |
|
|
<result column="mname" property="mname" jdbcType="VARCHAR"/> |
|
|
<result column="quantity" property="quantity" jdbcType="VARCHAR" /> |
|
|
<result column="quantity" property="quantity" jdbcType="VARCHAR"/> |
|
|
<result column="price" property="price" jdbcType="INTEGER" /> |
|
|
<result column="price" property="price" jdbcType="INTEGER"/> |
|
|
<result column="mtid" property="materialTypeId" jdbcType="INTEGER" /> |
|
|
<result column="mtid" property="materialTypeId" jdbcType="INTEGER"/> |
|
|
<result column="mstate" property="state" jdbcType="INTEGER" /> |
|
|
<result column="mstate" property="state" jdbcType="INTEGER"/> |
|
|
<result column="mcode" property="code" jdbcType="VARCHAR"/> |
|
|
<result column="mcode" property="code" jdbcType="VARCHAR"/> |
|
|
<result column="version" property="version" jdbcType="VARCHAR"/> |
|
|
<result column="version" property="version" jdbcType="VARCHAR"/> |
|
|
<result column="amounts" property="amounts" jdbcType="INTEGER"/> |
|
|
<result column="amounts" property="amounts" jdbcType="INTEGER"/> |
|
|
@ -53,16 +53,15 @@ |
|
|
</resultMap> |
|
|
</resultMap> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 字段映射--> |
|
|
<!-- 字段映射--> |
|
|
|
|
|
<resultMap id="materialAndTypeMap" type="com.dreamchaser.depository_manage.entity.Material"> |
|
|
<resultMap id="materialAndTypeMap" type="com.dreamchaser.depository_manage.entity.Material"> |
|
|
<id column="id" property="id" jdbcType="INTEGER" /> |
|
|
<id column="id" property="id" jdbcType="INTEGER"/> |
|
|
<result column="depository_id" property="depositoryId" jdbcType="INTEGER" /> |
|
|
<result column="depository_id" property="depositoryId" jdbcType="INTEGER"/> |
|
|
<result column="mname" property="mname" jdbcType="VARCHAR" /> |
|
|
<result column="mname" property="mname" jdbcType="VARCHAR"/> |
|
|
<result column="quantity" property="quantity" jdbcType="VARCHAR" /> |
|
|
<result column="quantity" property="quantity" jdbcType="VARCHAR"/> |
|
|
<result column="price" property="price" jdbcType="VARCHAR" /> |
|
|
<result column="price" property="price" jdbcType="VARCHAR"/> |
|
|
<result column="type_id" property="materialTypeId" jdbcType="INTEGER" /> |
|
|
<result column="type_id" property="materialTypeId" jdbcType="INTEGER"/> |
|
|
<result column="state" property="state" jdbcType="VARCHAR" /> |
|
|
<result column="state" property="state" jdbcType="VARCHAR"/> |
|
|
<result column="code" property="code" jdbcType="VARCHAR"/> |
|
|
<result column="code" property="code" jdbcType="VARCHAR"/> |
|
|
<result column="version" property="version" jdbcType="VARCHAR"/> |
|
|
<result column="version" property="version" jdbcType="VARCHAR"/> |
|
|
<result column="amounts" property="amounts" jdbcType="DOUBLE"/> |
|
|
<result column="amounts" property="amounts" jdbcType="DOUBLE"/> |
|
|
@ -74,36 +73,38 @@ |
|
|
<result column="productionPlace" property="productionPlace" jdbcType="VARCHAR"/> |
|
|
<result column="productionPlace" property="productionPlace" jdbcType="VARCHAR"/> |
|
|
<result column="brand" property="brand" jdbcType="VARCHAR"/> |
|
|
<result column="brand" property="brand" jdbcType="VARCHAR"/> |
|
|
<result column="remark" property="remark" jdbcType="VARCHAR"/> |
|
|
<result column="remark" property="remark" jdbcType="VARCHAR"/> |
|
|
<association property="materialType" column="typeId" javaType="com.dreamchaser.depository_manage.entity.MaterialType"> |
|
|
<association property="materialType" column="typeId" |
|
|
<id column="id" property="id" jdbcType="INTEGER" /> |
|
|
javaType="com.dreamchaser.depository_manage.entity.MaterialType"> |
|
|
<result column="tname" property="tname" jdbcType="VARCHAR" /> |
|
|
<id column="id" property="id" jdbcType="INTEGER"/> |
|
|
<result column="introduce" property="introduce" jdbcType="VARCHAR" /> |
|
|
<result column="tname" property="tname" jdbcType="VARCHAR"/> |
|
|
|
|
|
<result column="introduce" property="introduce" jdbcType="VARCHAR"/> |
|
|
</association> |
|
|
</association> |
|
|
<association property="depository" column="depositoryId" javaType="com.dreamchaser.depository_manage.entity.Depository"> |
|
|
<association property="depository" column="depositoryId" |
|
|
<id column="id" property="id" jdbcType="INTEGER" /> |
|
|
javaType="com.dreamchaser.depository_manage.entity.Depository"> |
|
|
<result column="dname" property="dname" jdbcType="VARCHAR" /> |
|
|
<id column="id" property="id" jdbcType="INTEGER"/> |
|
|
<result column="address" property="address" jdbcType="VARCHAR" /> |
|
|
<result column="dname" property="dname" jdbcType="VARCHAR"/> |
|
|
<result column="introduce" property="introduce" jdbcType="VARCHAR" /> |
|
|
<result column="address" property="address" jdbcType="VARCHAR"/> |
|
|
|
|
|
<result column="introduce" property="introduce" jdbcType="VARCHAR"/> |
|
|
</association> |
|
|
</association> |
|
|
</resultMap> |
|
|
</resultMap> |
|
|
|
|
|
|
|
|
<!-- 当前批次中物料与生产日期字段映射--> |
|
|
<!-- 当前批次中物料与生产日期字段映射--> |
|
|
<resultMap id="MaterialAndProducedDate" type="com.dreamchaser.depository_manage.entity.MaterialAndProducedDate"> |
|
|
<resultMap id="MaterialAndProducedDate" type="com.dreamchaser.depository_manage.entity.MaterialAndProducedDate"> |
|
|
<id column="id" property="id" jdbcType="INTEGER" /> |
|
|
<id column="id" property="id" jdbcType="INTEGER"/> |
|
|
<result column="inid" property="inid" jdbcType="INTEGER" /> |
|
|
<result column="inid" property="inid" jdbcType="INTEGER"/> |
|
|
<result column="mid" property="mid" jdbcType="INTEGER" /> |
|
|
<result column="mid" property="mid" jdbcType="INTEGER"/> |
|
|
<result column="quantity" property="quantity" jdbcType="INTEGER" /> |
|
|
<result column="quantity" property="quantity" jdbcType="INTEGER"/> |
|
|
<result column="expendnum" property="expendnum" jdbcType="INTEGER" /> |
|
|
<result column="expendnum" property="expendnum" jdbcType="INTEGER"/> |
|
|
<result column="inventory" property="inventory" jdbcType="INTEGER" /> |
|
|
<result column="inventory" property="inventory" jdbcType="INTEGER"/> |
|
|
<result column="producedDate" property="producedDate" jdbcType="INTEGER" /> |
|
|
<result column="producedDate" property="producedDate" jdbcType="INTEGER"/> |
|
|
<result column="barCode" property="barCode" jdbcType="VARCHAR" /> |
|
|
<result column="barCode" property="barCode" jdbcType="VARCHAR"/> |
|
|
<result column="qrCode" property="qrCode" jdbcType="VARCHAR" /> |
|
|
<result column="qrCode" property="qrCode" jdbcType="VARCHAR"/> |
|
|
</resultMap> |
|
|
</resultMap> |
|
|
|
|
|
|
|
|
<!-- 条形码与物料对应--> |
|
|
<!-- 条形码与物料对应--> |
|
|
<resultMap id="BarCodeAndMaterialMap" type="com.dreamchaser.depository_manage.entity.MaterialAndBarCode"> |
|
|
<resultMap id="BarCodeAndMaterialMap" type="com.dreamchaser.depository_manage.entity.MaterialAndBarCode"> |
|
|
<id column="id" property="id" jdbcType="INTEGER" /> |
|
|
<id column="id" property="id" jdbcType="INTEGER"/> |
|
|
<result column="price" property="price" jdbcType="INTEGER" /> |
|
|
<result column="price" property="price" jdbcType="INTEGER"/> |
|
|
<result column="texture" property="texture" jdbcType="VARCHAR"/> |
|
|
<result column="texture" property="texture" jdbcType="VARCHAR"/> |
|
|
<result column="mname" property="mname" jdbcType="VARCHAR"/> |
|
|
<result column="mname" property="mname" jdbcType="VARCHAR"/> |
|
|
<result column="unit" property="unit" jdbcType="VARCHAR"/> |
|
|
<result column="unit" property="unit" jdbcType="VARCHAR"/> |
|
|
@ -142,8 +143,7 @@ |
|
|
</sql> |
|
|
</sql> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 表查询字段,用于查询物料与条形码视图--> |
|
|
<!-- 表查询字段,用于查询物料与条形码视图--> |
|
|
|
|
|
<sql id="materialAndBarCode"> |
|
|
<sql id="materialAndBarCode"> |
|
|
id,bmcode,mcode,mid,depositoryId,mname,mtid,version,texture,unit,tname,price,shelfLife |
|
|
id,bmcode,mcode,mid,depositoryId,mname,mtid,version,texture,unit,tname,price,shelfLife |
|
|
</sql> |
|
|
</sql> |
|
|
@ -185,13 +185,13 @@ |
|
|
and #{shelfLife} >= shelfLife |
|
|
and #{shelfLife} >= shelfLife |
|
|
</if> |
|
|
</if> |
|
|
<if test="producedDate != null"> |
|
|
<if test="producedDate != null"> |
|
|
and producedDate >= #{producedDate} |
|
|
and producedDate >= #{producedDate} |
|
|
</if> |
|
|
</if> |
|
|
<if test="productionPlace != null and productionPlace !=''"> |
|
|
<if test="productionPlace != null and productionPlace !=''"> |
|
|
and productionPlace = #{productionPlace} |
|
|
and productionPlace = #{productionPlace} |
|
|
</if> |
|
|
</if> |
|
|
<if test="brand != '' and brand != null"> |
|
|
<if test="brand != '' and brand != null"> |
|
|
and brand = #{brand} |
|
|
and brand = #{brand} |
|
|
</if> |
|
|
</if> |
|
|
<if test="remark != '' and remark != null"> |
|
|
<if test="remark != '' and remark != null"> |
|
|
and remark = #{remark} |
|
|
and remark = #{remark} |
|
|
@ -202,7 +202,7 @@ |
|
|
|
|
|
|
|
|
<select id="findMaterialByMnameAndVersion" resultMap="materialMap" parameterType="map"> |
|
|
<select id="findMaterialByMnameAndVersion" resultMap="materialMap" parameterType="map"> |
|
|
SELECT |
|
|
SELECT |
|
|
<include refid="allColumnsAndTypeNameOnView" /> |
|
|
<include refid="allColumnsAndTypeNameOnView"/> |
|
|
from findMaterial |
|
|
from findMaterial |
|
|
where 1 = 1 |
|
|
where 1 = 1 |
|
|
<if test="mname != null and mname != ''"> |
|
|
<if test="mname != null and mname != ''"> |
|
|
@ -218,11 +218,10 @@ |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 根据条件参数查询数据列表 --> |
|
|
<!-- 根据条件参数查询数据列表 --> |
|
|
<select id="findMaterialByCondition" resultMap="materialMap" parameterType="map"> |
|
|
<select id="findMaterialByCondition" resultMap="materialMap" parameterType="map"> |
|
|
SELECT |
|
|
SELECT |
|
|
<include refid="allColumnsAndTypeNameOnView" /> |
|
|
<include refid="allColumnsAndTypeNameOnView"/> |
|
|
from findMaterial |
|
|
from findMaterial |
|
|
where 1 = 1 |
|
|
where 1 = 1 |
|
|
<if test="mid != null"> |
|
|
<if test="mid != null"> |
|
|
@ -253,7 +252,7 @@ |
|
|
and #{shelfLife} >= shelfLife |
|
|
and #{shelfLife} >= shelfLife |
|
|
</if> |
|
|
</if> |
|
|
<if test="producedDate != null"> |
|
|
<if test="producedDate != null"> |
|
|
and producedDate >= #{producedDate} |
|
|
and producedDate >= #{producedDate} |
|
|
</if> |
|
|
</if> |
|
|
<if test="productionPlace != null and productionPlace !=''"> |
|
|
<if test="productionPlace != null and productionPlace !=''"> |
|
|
and productionPlace = #{productionPlace} |
|
|
and productionPlace = #{productionPlace} |
|
|
@ -273,7 +272,7 @@ |
|
|
</if> |
|
|
</if> |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<!-- 根据物料id查询所有物料与生产日期的对应--> |
|
|
<!-- 根据物料id查询所有物料与生产日期的对应--> |
|
|
<select id="findMaterialAndProducedDateByMid" resultMap="MaterialAndProducedDate" parameterType="int"> |
|
|
<select id="findMaterialAndProducedDateByMid" resultMap="MaterialAndProducedDate" parameterType="int"> |
|
|
select |
|
|
select |
|
|
<include refid="allColumnsByMaterialAndProducedDate"/> |
|
|
<include refid="allColumnsByMaterialAndProducedDate"/> |
|
|
@ -281,12 +280,13 @@ |
|
|
where mp.mid = #{mid} and mp.inventory != 0 and producedDate is not null ORDER BY producedDate |
|
|
where mp.mid = #{mid} and mp.inventory != 0 and producedDate is not null ORDER BY producedDate |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<!-- 根据物料id与生产日期获取对应关系--> |
|
|
<!-- 根据物料id与生产日期获取对应关系--> |
|
|
<select id="findMaterialAndProducedDateByMidAndProducedDate" resultMap="MaterialAndProducedDate" parameterType="map"> |
|
|
<select id="findMaterialAndProducedDateByMidAndProducedDate" resultMap="MaterialAndProducedDate" |
|
|
|
|
|
parameterType="map"> |
|
|
select |
|
|
select |
|
|
<include refid="allColumnsByMaterialAndProducedDate"/> |
|
|
<include refid="allColumnsByMaterialAndProducedDate"/> |
|
|
from materialandproduceddate mp |
|
|
from materialandproduceddate mp |
|
|
where 1 = 1 |
|
|
where 1 = 1 |
|
|
<if test="mid != null and mid != ''"> |
|
|
<if test="mid != null and mid != ''"> |
|
|
and mp.mid = #{mid} |
|
|
and mp.mid = #{mid} |
|
|
</if> |
|
|
</if> |
|
|
@ -298,7 +298,7 @@ |
|
|
<!--根据条件查询库存--> |
|
|
<!--根据条件查询库存--> |
|
|
<select id="findInventory" resultMap="InventoryMap" parameterType="map"> |
|
|
<select id="findInventory" resultMap="InventoryMap" parameterType="map"> |
|
|
SELECT |
|
|
SELECT |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory" /> |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory"/> |
|
|
from findInventory |
|
|
from findInventory |
|
|
where 1 = 1 |
|
|
where 1 = 1 |
|
|
<if test="mid != null"> |
|
|
<if test="mid != null"> |
|
|
@ -332,7 +332,7 @@ |
|
|
and #{shelfLife} >= shelfLife |
|
|
and #{shelfLife} >= shelfLife |
|
|
</if> |
|
|
</if> |
|
|
<if test="producedDate != null"> |
|
|
<if test="producedDate != null"> |
|
|
and producedDate >= #{producedDate} |
|
|
and producedDate >= #{producedDate} |
|
|
</if> |
|
|
</if> |
|
|
<if test="productionPlace != null and productionPlace !=''"> |
|
|
<if test="productionPlace != null and productionPlace !=''"> |
|
|
and productionPlace = #{productionPlace} |
|
|
and productionPlace = #{productionPlace} |
|
|
@ -350,10 +350,10 @@ |
|
|
|
|
|
|
|
|
<!--根据条件查询库存--> |
|
|
<!--根据条件查询库存--> |
|
|
<select id="findInventoryForImport" resultMap="InventoryMap" parameterType="map"> |
|
|
<select id="findInventoryForImport" resultMap="InventoryMap" parameterType="map"> |
|
|
SELECT |
|
|
SELECT |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory" /> |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory"/> |
|
|
from findInventory |
|
|
from findInventory |
|
|
where 1 = 1 |
|
|
where 1 = 1 |
|
|
<if test="depositoryId != null"> |
|
|
<if test="depositoryId != null"> |
|
|
AND depositoryId = #{depositoryId} |
|
|
AND depositoryId = #{depositoryId} |
|
|
</if> |
|
|
</if> |
|
|
@ -397,7 +397,7 @@ |
|
|
and #{shelfLife} >= m.shelfLife |
|
|
and #{shelfLife} >= m.shelfLife |
|
|
</if> |
|
|
</if> |
|
|
<if test="producedDate != null"> |
|
|
<if test="producedDate != null"> |
|
|
and m.producedDate >= #{producedDate} |
|
|
and m.producedDate >= #{producedDate} |
|
|
</if> |
|
|
</if> |
|
|
<if test="productionPlace != null and productionPlace !=''"> |
|
|
<if test="productionPlace != null and productionPlace !=''"> |
|
|
and m.productionPlace = #{productionPlace} |
|
|
and m.productionPlace = #{productionPlace} |
|
|
@ -414,7 +414,7 @@ |
|
|
<!--根据条件查询库存数量--> |
|
|
<!--根据条件查询库存数量--> |
|
|
<select id="findInventoryCount" parameterType="map" resultType="int"> |
|
|
<select id="findInventoryCount" parameterType="map" resultType="int"> |
|
|
SELECT |
|
|
SELECT |
|
|
count(*) |
|
|
count(*) |
|
|
from findInventory |
|
|
from findInventory |
|
|
where 1 = 1 |
|
|
where 1 = 1 |
|
|
<if test="mid != null"> |
|
|
<if test="mid != null"> |
|
|
@ -448,7 +448,7 @@ |
|
|
and #{shelfLife} >= shelfLife |
|
|
and #{shelfLife} >= shelfLife |
|
|
</if> |
|
|
</if> |
|
|
<if test="producedDate != null"> |
|
|
<if test="producedDate != null"> |
|
|
and producedDate >= #{producedDate} |
|
|
and producedDate >= #{producedDate} |
|
|
</if> |
|
|
</if> |
|
|
<if test="productionPlace != null and productionPlace !=''"> |
|
|
<if test="productionPlace != null and productionPlace !=''"> |
|
|
and productionPlace = #{productionPlace} |
|
|
and productionPlace = #{productionPlace} |
|
|
@ -462,10 +462,10 @@ |
|
|
|
|
|
|
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<!-- 根据仓库查询物料--> |
|
|
<!-- 根据仓库查询物料--> |
|
|
<select id="findMaterialByDepositorys" resultMap="InventoryMap" parameterType="list"> |
|
|
<select id="findMaterialByDepositorys" resultMap="InventoryMap" parameterType="list"> |
|
|
SELECT |
|
|
SELECT |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory" /> |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory"/> |
|
|
from findInventory |
|
|
from findInventory |
|
|
where depositoryId in |
|
|
where depositoryId in |
|
|
<foreach collection="list" index="index" item="item" open="(" |
|
|
<foreach collection="list" index="index" item="item" open="(" |
|
|
@ -477,7 +477,7 @@ |
|
|
|
|
|
|
|
|
<select id="findMaterialByTypeIds" resultMap="materialMap" parameterType="list"> |
|
|
<select id="findMaterialByTypeIds" resultMap="materialMap" parameterType="list"> |
|
|
SELECT |
|
|
SELECT |
|
|
<include refid="allColumns" /> |
|
|
<include refid="allColumns"/> |
|
|
from material m |
|
|
from material m |
|
|
where m.type_id in |
|
|
where m.type_id in |
|
|
<foreach collection="list" index="index" item="item" open="(" |
|
|
<foreach collection="list" index="index" item="item" open="(" |
|
|
@ -489,12 +489,12 @@ |
|
|
|
|
|
|
|
|
<select id="findMaterialByTypeIdsAndMname" resultMap="materialMap" parameterType="map"> |
|
|
<select id="findMaterialByTypeIdsAndMname" resultMap="materialMap" parameterType="map"> |
|
|
SELECT |
|
|
SELECT |
|
|
<include refid="allColumns" /> |
|
|
<include refid="allColumns"/> |
|
|
from material m |
|
|
from material m |
|
|
where |
|
|
where |
|
|
m.mname like concat('%',#{mname},'%') |
|
|
m.mname like concat('%',#{mname},'%') |
|
|
and |
|
|
and |
|
|
m.type_id in |
|
|
m.type_id in |
|
|
<foreach collection="list" index="index" item="item" open="(" |
|
|
<foreach collection="list" index="index" item="item" open="(" |
|
|
separator="," close=")"> |
|
|
separator="," close=")"> |
|
|
#{item} |
|
|
#{item} |
|
|
@ -504,7 +504,7 @@ |
|
|
|
|
|
|
|
|
<select id="findMaterialByDepositorysAndType" resultMap="InventoryMap" parameterType="map"> |
|
|
<select id="findMaterialByDepositorysAndType" resultMap="InventoryMap" parameterType="map"> |
|
|
SELECT |
|
|
SELECT |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory" /> |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory"/> |
|
|
from findInventory |
|
|
from findInventory |
|
|
where depositoryId in |
|
|
where depositoryId in |
|
|
<foreach collection="list" index="index" item="item" open="(" |
|
|
<foreach collection="list" index="index" item="item" open="(" |
|
|
@ -514,10 +514,10 @@ |
|
|
and mtid = #{materialTypeId} |
|
|
and mtid = #{materialTypeId} |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<!-- 根据条形码查询物料--> |
|
|
<!-- 根据条形码查询物料--> |
|
|
<select id="findMaterialByBarCodeByCondition" resultMap="BarCodeAndMaterialMap" parameterType="map"> |
|
|
<select id="findMaterialByBarCodeByCondition" resultMap="BarCodeAndMaterialMap" parameterType="map"> |
|
|
select |
|
|
select |
|
|
<include refid="materialAndBarCode" /> |
|
|
<include refid="materialAndBarCode"/> |
|
|
from materialandbarcode |
|
|
from materialandbarcode |
|
|
where 1 = 1 |
|
|
where 1 = 1 |
|
|
<if test="barCode != null and barCode != ''"> |
|
|
<if test="barCode != null and barCode != ''"> |
|
|
@ -548,7 +548,7 @@ |
|
|
and #{shelfLife} >= shelfLife |
|
|
and #{shelfLife} >= shelfLife |
|
|
</if> |
|
|
</if> |
|
|
<if test="producedDate != null"> |
|
|
<if test="producedDate != null"> |
|
|
and producedDate >= #{producedDate} |
|
|
and producedDate >= #{producedDate} |
|
|
</if> |
|
|
</if> |
|
|
<if test="productionPlace != null and productionPlace !=''"> |
|
|
<if test="productionPlace != null and productionPlace !=''"> |
|
|
and productionPlace = #{productionPlace} |
|
|
and productionPlace = #{productionPlace} |
|
|
@ -565,10 +565,10 @@ |
|
|
group by bmcode |
|
|
group by bmcode |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<!-- 根据物料编码code查询对应的二维码--> |
|
|
<!-- 根据物料编码code查询对应的二维码--> |
|
|
<select id="findMaterialByBarCodeByMcode" resultMap="BarCodeAndMaterialMap" parameterType="String"> |
|
|
<select id="findMaterialByBarCodeByMcode" resultMap="BarCodeAndMaterialMap" parameterType="String"> |
|
|
select |
|
|
select |
|
|
<include refid="materialAndBarCode" /> |
|
|
<include refid="materialAndBarCode"/> |
|
|
from materialandbarcode |
|
|
from materialandbarcode |
|
|
where 1 = 1 |
|
|
where 1 = 1 |
|
|
<if test="mcode != null and mcode != ''"> |
|
|
<if test="mcode != null and mcode != ''"> |
|
|
@ -581,7 +581,7 @@ |
|
|
|
|
|
|
|
|
<select id="findMaterialAndBarCodeByQrCode" resultMap="BarCodeAndMaterialMap" parameterType="map"> |
|
|
<select id="findMaterialAndBarCodeByQrCode" resultMap="BarCodeAndMaterialMap" parameterType="map"> |
|
|
select |
|
|
select |
|
|
<include refid="materialAndBarCode" /> |
|
|
<include refid="materialAndBarCode"/> |
|
|
from materialandbarcode |
|
|
from materialandbarcode |
|
|
where 1 = 1 |
|
|
where 1 = 1 |
|
|
<if test="mcode != null and mcode != ''"> |
|
|
<if test="mcode != null and mcode != ''"> |
|
|
@ -625,12 +625,11 @@ |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 根据仓库查询物料--> |
|
|
<!-- 根据仓库查询物料--> |
|
|
<select id="findMaterialByDepository" resultMap="InventoryMap" parameterType="map"> |
|
|
<select id="findMaterialByDepository" resultMap="InventoryMap" parameterType="map"> |
|
|
SELECT |
|
|
SELECT |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory" /> |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory"/> |
|
|
from findInventory |
|
|
from findInventory |
|
|
where depositoryId = #{depositoryId} |
|
|
where depositoryId = #{depositoryId} |
|
|
<if test="begin != null and size != null"> |
|
|
<if test="begin != null and size != null"> |
|
|
LIMIT #{begin},#{size} |
|
|
LIMIT #{begin},#{size} |
|
|
@ -649,25 +648,25 @@ |
|
|
<!-- 根据主键查询数据 --> |
|
|
<!-- 根据主键查询数据 --> |
|
|
<select id="findMaterialById" resultMap="materialMap" parameterType="integer"> |
|
|
<select id="findMaterialById" resultMap="materialMap" parameterType="integer"> |
|
|
SELECT |
|
|
SELECT |
|
|
<include refid="allColumns" /> |
|
|
<include refid="allColumns"/> |
|
|
FROM material m WHERE m.id =#{id} |
|
|
FROM material m WHERE m.id =#{id} |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="findInventoryById" resultMap="InventoryMap" parameterType="integer"> |
|
|
<select id="findInventoryById" resultMap="InventoryMap" parameterType="integer"> |
|
|
SELECT |
|
|
SELECT |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory" /> |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory"/> |
|
|
FROM findInventory WHERE id =#{mid} |
|
|
FROM findInventory WHERE id =#{mid} |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="findInventoryByMid" resultMap="InventoryMap" parameterType="integer"> |
|
|
<select id="findInventoryByMid" resultMap="InventoryMap" parameterType="integer"> |
|
|
SELECT |
|
|
SELECT |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory" /> |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory"/> |
|
|
FROM findInventory WHERE mid =#{mid} |
|
|
FROM findInventory WHERE mid =#{mid} |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="findInventoryByMidAndDid" resultMap="InventoryMap" parameterType="map"> |
|
|
<select id="findInventoryByMidAndDid" resultMap="InventoryMap" parameterType="map"> |
|
|
select |
|
|
select |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory" /> |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory"/> |
|
|
from findInventory |
|
|
from findInventory |
|
|
where |
|
|
where |
|
|
mid = #{mid} |
|
|
mid = #{mid} |
|
|
@ -676,7 +675,7 @@ |
|
|
|
|
|
|
|
|
<select id="findInventoryByMidAndDids" resultMap="InventoryMap" parameterType="map"> |
|
|
<select id="findInventoryByMidAndDids" resultMap="InventoryMap" parameterType="map"> |
|
|
select |
|
|
select |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory" /> |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory"/> |
|
|
from findInventory |
|
|
from findInventory |
|
|
where |
|
|
where |
|
|
mid = #{mid} |
|
|
mid = #{mid} |
|
|
@ -701,10 +700,18 @@ |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="findMaxMaterialCodeForMt" resultType="string" parameterType="long"> |
|
|
|
|
|
select |
|
|
|
|
|
max(code) |
|
|
|
|
|
from material m |
|
|
|
|
|
where m.type_id = #{oldId} |
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 根据主键查询数据 --> |
|
|
<!-- 根据主键查询数据 --> |
|
|
<select id="findInventoryByIds" resultMap="InventoryMap" parameterType="list"> |
|
|
<select id="findInventoryByIds" resultMap="InventoryMap" parameterType="list"> |
|
|
SELECT |
|
|
SELECT |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory" /> |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory"/> |
|
|
FROM findInventory WHERE id IN |
|
|
FROM findInventory WHERE id IN |
|
|
<foreach collection="list" index="index" item="id" open="(" separator="," close=")"> |
|
|
<foreach collection="list" index="index" item="id" open="(" separator="," close=")"> |
|
|
#{id} |
|
|
#{id} |
|
|
@ -714,7 +721,7 @@ |
|
|
|
|
|
|
|
|
<select id="findInventoryByTypeIdsAndMname" resultMap="InventoryMap" parameterType="map"> |
|
|
<select id="findInventoryByTypeIdsAndMname" resultMap="InventoryMap" parameterType="map"> |
|
|
SELECT |
|
|
SELECT |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory" /> |
|
|
<include refid="allColumnsAndTypeNameOnViewByInventory"/> |
|
|
FROM findInventory |
|
|
FROM findInventory |
|
|
where |
|
|
where |
|
|
mname like concat('%',#{mname},'%') |
|
|
mname like concat('%',#{mname},'%') |
|
|
@ -739,18 +746,19 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 插入数据 --> |
|
|
<!-- 插入数据 --> |
|
|
<insert id="insertMaterial" useGeneratedKeys="true" keyProperty="id"> |
|
|
<insert id="insertMaterial" useGeneratedKeys="true" keyProperty="id"> |
|
|
INSERT INTO material ( |
|
|
INSERT INTO material ( |
|
|
id, depository_id, mname, quantity, price, type_id,code,unit,version,texture,amounts,depositoryCode,producedDate,shelfLife,brand,productionPlace,remark |
|
|
id, depository_id, mname, quantity, price, |
|
|
|
|
|
type_id,code,unit,version,texture,amounts,depositoryCode,producedDate,shelfLife,brand,productionPlace,remark |
|
|
) VALUES ( |
|
|
) VALUES ( |
|
|
#{id}, |
|
|
#{id}, |
|
|
<if test="depositoryId != null"> |
|
|
<if test="depositoryId != null"> |
|
|
#{depositoryId}, |
|
|
#{depositoryId}, |
|
|
</if> |
|
|
</if> |
|
|
<if test="depositoryId == null"> |
|
|
<if test="depositoryId == null"> |
|
|
null, |
|
|
null, |
|
|
</if> |
|
|
</if> |
|
|
#{mname}, |
|
|
#{mname}, |
|
|
<if test="quantity != null"> |
|
|
<if test="quantity != null"> |
|
|
#{quantity}, |
|
|
#{quantity}, |
|
|
</if> |
|
|
</if> |
|
|
@ -763,11 +771,11 @@ |
|
|
<if test="price == null"> |
|
|
<if test="price == null"> |
|
|
0, |
|
|
0, |
|
|
</if> |
|
|
</if> |
|
|
#{materialTypeId}, |
|
|
#{materialTypeId}, |
|
|
#{code}, |
|
|
#{code}, |
|
|
#{unit}, |
|
|
#{unit}, |
|
|
#{version}, |
|
|
#{version}, |
|
|
#{texture}, |
|
|
#{texture}, |
|
|
<if test="amounts != null"> |
|
|
<if test="amounts != null"> |
|
|
#{amounts}, |
|
|
#{amounts}, |
|
|
</if> |
|
|
</if> |
|
|
@ -780,15 +788,15 @@ |
|
|
<if test="depositoryCode == null"> |
|
|
<if test="depositoryCode == null"> |
|
|
'', |
|
|
'', |
|
|
</if> |
|
|
</if> |
|
|
#{producedDate}, |
|
|
#{producedDate}, |
|
|
#{shelfLife}, |
|
|
#{shelfLife}, |
|
|
#{brand}, |
|
|
#{brand}, |
|
|
#{productionPlace}, |
|
|
#{productionPlace}, |
|
|
#{remark} |
|
|
#{remark} |
|
|
) |
|
|
) |
|
|
</insert> |
|
|
</insert> |
|
|
<!-- 插入数据 --> |
|
|
<!-- 插入数据 --> |
|
|
<insert id="insertInventory" useGeneratedKeys="true" keyProperty="id"> |
|
|
<insert id="insertInventory" useGeneratedKeys="true" keyProperty="id"> |
|
|
insert into inventory(id,mid,quantity,producedDate,depository_id) |
|
|
insert into inventory(id,mid,quantity,producedDate,depository_id) |
|
|
values ( |
|
|
values ( |
|
|
#{id}, |
|
|
#{id}, |
|
|
@ -837,30 +845,30 @@ |
|
|
</insert> |
|
|
</insert> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 批量插入数据--> |
|
|
<!-- 批量插入数据--> |
|
|
<insert id="insertMaterials" parameterType="list"> |
|
|
<insert id="insertMaterials" parameterType="list"> |
|
|
INSERT INTO material ( |
|
|
INSERT INTO material ( |
|
|
id, depository_id, mname, quantity, price, type_id,code,unit,version,texture,amounts,depositoryCode |
|
|
id, depository_id, mname, quantity, price, type_id,code,unit,version,texture,amounts,depositoryCode |
|
|
) VALUES |
|
|
) VALUES |
|
|
<foreach collection="list" index="index" item="item" separator=","> |
|
|
<foreach collection="list" index="index" item="item" separator=","> |
|
|
( |
|
|
( |
|
|
#{item.id}, |
|
|
#{item.id}, |
|
|
#{item.depositoryId}, |
|
|
#{item.depositoryId}, |
|
|
#{item.mname}, |
|
|
#{item.mname}, |
|
|
#{item.quantity}, |
|
|
#{item.quantity}, |
|
|
#{item.price}, |
|
|
#{item.price}, |
|
|
#{item.typeId}, |
|
|
#{item.typeId}, |
|
|
#{item.code}, |
|
|
#{item.code}, |
|
|
#{item.unit}, |
|
|
#{item.unit}, |
|
|
#{item.version}, |
|
|
#{item.version}, |
|
|
#{item.texture}, |
|
|
#{item.texture}, |
|
|
#{item.amounts}, |
|
|
#{item.amounts}, |
|
|
#{item.depositoryCode} |
|
|
#{item.depositoryCode} |
|
|
) |
|
|
) |
|
|
</foreach> |
|
|
</foreach> |
|
|
</insert> |
|
|
</insert> |
|
|
|
|
|
|
|
|
<!-- 删除映射--> |
|
|
<!-- 删除映射--> |
|
|
<delete id="deleteBarCodeAndMaterial" parameterType="map"> |
|
|
<delete id="deleteBarCodeAndMaterial" parameterType="map"> |
|
|
delete |
|
|
delete |
|
|
from qrcodeandmaterial |
|
|
from qrcodeandmaterial |
|
|
@ -879,13 +887,11 @@ |
|
|
</delete> |
|
|
</delete> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<update id="updateMaterialAndProducedDate"> |
|
|
<update id="updateMaterialAndProducedDate"> |
|
|
update materialandproduceddate |
|
|
update materialandproduceddate |
|
|
<set> |
|
|
<set> |
|
|
<if test="inid != null and inid != ''"> |
|
|
<if test="inid != null and inid != ''"> |
|
|
inid = #{inid}, |
|
|
inid = #{inid}, |
|
|
</if> |
|
|
</if> |
|
|
<if test="mid != null and mid != ''"> |
|
|
<if test="mid != null and mid != ''"> |
|
|
mid = #{mid}, |
|
|
mid = #{mid}, |
|
|
@ -970,7 +976,7 @@ |
|
|
</if> |
|
|
</if> |
|
|
|
|
|
|
|
|
<if test="remark != '' and remark != null"> |
|
|
<if test="remark != '' and remark != null"> |
|
|
remark = #{remark} |
|
|
remark = #{remark} |
|
|
</if> |
|
|
</if> |
|
|
</set> |
|
|
</set> |
|
|
WHERE id = #{id} |
|
|
WHERE id = #{id} |
|
|
@ -1027,7 +1033,6 @@ |
|
|
</update> |
|
|
</update> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 根据主键删除数据 --> |
|
|
<!-- 根据主键删除数据 --> |
|
|
<delete id="deleteMaterialById" parameterType="int"> |
|
|
<delete id="deleteMaterialById" parameterType="int"> |
|
|
DELETE FROM material WHERE id = #{id} |
|
|
DELETE FROM material WHERE id = #{id} |
|
|
|