从源更新
This commit is contained in:
@@ -41,6 +41,18 @@
|
||||
<result column="MaterialUnit" jdbcType="VARCHAR" property="MaterialUnit" />
|
||||
<result column="MColor" jdbcType="VARCHAR" property="MColor" />
|
||||
</resultMap>
|
||||
<resultMap id="ResultStockWarningCount" type="com.jsh.erp.datasource.vo.DepotItemStockWarningCount">
|
||||
<result column="MaterialName" jdbcType="VARCHAR" property="MaterialName" />
|
||||
<result column="MaterialModel" jdbcType="VARCHAR" property="MaterialModel" />
|
||||
<result column="categoryName" jdbcType="VARCHAR" property="categoryName" />
|
||||
<result column="MaterialOther" jdbcType="VARCHAR" property="MaterialOther" />
|
||||
<result column="MaterialUnit" jdbcType="VARCHAR" property="MaterialUnit" />
|
||||
<result column="safetystock" jdbcType="DECIMAL" property="safetystock" />
|
||||
<result column="BasicInNumber" jdbcType="DECIMAL" property="BasicInNumber" />
|
||||
<result column="BasicOutNumber" jdbcType="DECIMAL" property="BasicOutNumber" />
|
||||
<result column="BasicNumber" jdbcType="DECIMAL" property="BasicNumber" />
|
||||
<result column="BasicLinjieNumber" jdbcType="DECIMAL" property="BasicLinjieNumber" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByConditionDepotItem" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap">
|
||||
select *
|
||||
@@ -438,5 +450,95 @@
|
||||
|
||||
|
||||
|
||||
<select id="findStockWarningCount" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultStockWarningCount">
|
||||
SELECT
|
||||
m. NAME MaterialName,
|
||||
m.Model MaterialModel,
|
||||
mc.`Name` categoryName,
|
||||
CONCAT(
|
||||
'(',
|
||||
m.Standard,
|
||||
')',
|
||||
'(',
|
||||
m.Color,
|
||||
')'
|
||||
) AS MaterialOther,
|
||||
m.unit MaterialUnit,
|
||||
ifnull(m.safetystock,0) safetystock,
|
||||
IFNULL(intype.BasicInNumber ,0) BasicInNumber,
|
||||
IFNULL(outtype.BasicOutNumber ,0) BasicOutNumber,
|
||||
(
|
||||
IFNULL(intype.BasicInNumber ,0) - IFNULL(outtype.BasicOutNumber ,0)
|
||||
) BasicNumber,
|
||||
(IFNULL(intype.BasicInNumber ,0) - IFNULL(outtype.BasicOutNumber ,0) - ifnull(m.safetystock,0)) BasicLinjieNumber
|
||||
FROM
|
||||
jsh_material m
|
||||
LEFT JOIN jsh_materialcategory mc ON mc.Id = m.CategoryId
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
di.MaterialId,
|
||||
ifnull(sum(BasicNumber), 0) AS BasicInNumber
|
||||
FROM
|
||||
jsh_depothead dh
|
||||
INNER JOIN jsh_depotitem di ON dh.id = di.HeaderId
|
||||
AND ifnull(di.delete_Flag, '0') != '1'
|
||||
WHERE
|
||||
dh.type = '入库'
|
||||
<if test="pid != null">
|
||||
and di.DepotId= ${pid}
|
||||
</if>
|
||||
AND ifnull(dh.delete_Flag, '0') != '1' group by di.MaterialId
|
||||
) intype ON intype.MaterialId = m.id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
di.MaterialId,
|
||||
ifnull(sum(BasicNumber), 0) AS BasicOutNumber
|
||||
FROM
|
||||
jsh_depothead dh
|
||||
INNER JOIN jsh_depotitem di ON dh.id = di.HeaderId
|
||||
AND ifnull(di.delete_Flag, '0') != '1'
|
||||
WHERE
|
||||
dh.type = '出库'
|
||||
AND dh.SubType != '调拨'
|
||||
<if test="pid != null">
|
||||
and di.DepotId= ${pid}
|
||||
</if>
|
||||
AND ifnull(dh.delete_Flag, '0') != '1' group by di.MaterialId
|
||||
) outtype ON outtype.MaterialId = m.id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND ifnull(m.delete_Flag, '0') != '1'
|
||||
AND intype.BasicInNumber > 0
|
||||
ORDER BY
|
||||
(IFNULL(intype.BasicInNumber ,0) - IFNULL(outtype.BasicOutNumber ,0) - ifnull(m.safetystock,0))
|
||||
<if test="offset != null and rows != null">
|
||||
limit #{offset},#{rows}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
<select id="findStockWarningCountTotal" resultType="java.lang.Integer">
|
||||
select count(1) from
|
||||
jsh_material m
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
di.MaterialId,
|
||||
ifnull(sum(BasicNumber), 0) AS BasicInNumber
|
||||
FROM
|
||||
jsh_depothead dh
|
||||
INNER JOIN jsh_depotitem di ON dh.id = di.HeaderId
|
||||
AND ifnull(di.delete_Flag, '0') != '1'
|
||||
WHERE
|
||||
dh.type = '入库'
|
||||
<if test="pid != null">
|
||||
and di.DepotId= ${pid}
|
||||
</if>
|
||||
AND ifnull(dh.delete_Flag, '0') != '1' group by di.MaterialId
|
||||
) intype ON intype.MaterialId = m.id
|
||||
|
||||
WHERE
|
||||
1 = 1
|
||||
AND ifnull(m.delete_Flag, '0') != '1'
|
||||
AND intype.BasicInNumber > 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<result column="principal" jdbcType="BIGINT" property="principal" />
|
||||
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
|
||||
<result column="delete_Flag" jdbcType="VARCHAR" property="deleteFlag" />
|
||||
<result column="is_default" jdbcType="BIT" property="isDefault" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<!--
|
||||
@@ -90,7 +91,7 @@
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
id, name, address, warehousing, truckage, type, sort, remark, principal, tenant_id,
|
||||
delete_Flag
|
||||
delete_Flag, is_default
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotExample" resultMap="BaseResultMap">
|
||||
<!--
|
||||
@@ -146,11 +147,13 @@
|
||||
insert into jsh_depot (id, name, address,
|
||||
warehousing, truckage, type,
|
||||
sort, remark, principal,
|
||||
tenant_id, delete_Flag)
|
||||
tenant_id, delete_Flag, is_default
|
||||
)
|
||||
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
|
||||
#{warehousing,jdbcType=DECIMAL}, #{truckage,jdbcType=DECIMAL}, #{type,jdbcType=INTEGER},
|
||||
#{sort,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{principal,jdbcType=BIGINT},
|
||||
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
|
||||
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}, #{isDefault,jdbcType=BIT}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Depot">
|
||||
<!--
|
||||
@@ -192,6 +195,9 @@
|
||||
<if test="deleteFlag != null">
|
||||
delete_Flag,
|
||||
</if>
|
||||
<if test="isDefault != null">
|
||||
is_default,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
@@ -227,6 +233,9 @@
|
||||
<if test="deleteFlag != null">
|
||||
#{deleteFlag,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isDefault != null">
|
||||
#{isDefault,jdbcType=BIT},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.DepotExample" resultType="java.lang.Integer">
|
||||
@@ -279,6 +288,9 @@
|
||||
<if test="record.deleteFlag != null">
|
||||
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.isDefault != null">
|
||||
is_default = #{record.isDefault,jdbcType=BIT},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
@@ -300,7 +312,8 @@
|
||||
remark = #{record.remark,jdbcType=VARCHAR},
|
||||
principal = #{record.principal,jdbcType=BIGINT},
|
||||
tenant_id = #{record.tenantId,jdbcType=BIGINT},
|
||||
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR}
|
||||
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR},
|
||||
is_default = #{record.isDefault,jdbcType=BIT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
@@ -342,6 +355,9 @@
|
||||
<if test="deleteFlag != null">
|
||||
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="isDefault != null">
|
||||
is_default = #{isDefault,jdbcType=BIT},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
@@ -360,7 +376,8 @@
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
principal = #{principal,jdbcType=BIGINT},
|
||||
tenant_id = #{tenantId,jdbcType=BIGINT},
|
||||
delete_Flag = #{deleteFlag,jdbcType=VARCHAR}
|
||||
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
|
||||
is_default = #{isDefault,jdbcType=BIT}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user