| | |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.stock.pojo.StockInventory"> |
| | | <result column="id" property="id" /> |
| | | <result column="product_model_id" property="productModelId" /> |
| | | <result column="qualitity" property="qualitity" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="version" property="version" /> |
| | | <result column="locked_quantity" property="lockedQuantity" /> |
| | | <result column="warn_num" property="warnNum" /> |
| | | <result column="id" property="id"/> |
| | | <result column="product_model_id" property="productModelId"/> |
| | | <result column="qualitity" property="qualitity"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="version" property="version"/> |
| | | <result column="locked_quantity" property="lockedQuantity"/> |
| | | <result column="warn_num" property="warnNum"/> |
| | | </resultMap> |
| | | <update id="updateAddStockInventory"> |
| | | update stock_inventory |
| | |
| | | <if test="ew.qualitity != null"> |
| | | qualitity = qualitity + #{ew.qualitity}, |
| | | </if> |
| | | <if test="ew.version != null"> |
| | | version = version + 1, |
| | | <if test="ew.version != null"> |
| | | version = version + 1, |
| | | </if> |
| | | <if test="ew.remark != null and ew.remark !=''"> |
| | | remark = #{ew.remark}, |
| | | </if> |
| | | <if test="ew.warnNum != null and ew.warnNum !=''"> |
| | | warn_num = #{ew.warnNum}, |
| | | </if> |
| | | <if test="ew.lockedQuantity != null and ew.lockedQuantity !=''"> |
| | | locked_quantity = locked_quantity + #{ew.lockedQuantity}, |
| | | </if> |
| | | update_time = now() |
| | | </set> |
| | |
| | | where product_model_id = #{ew.productModelId} and qualitity >= #{ew.qualitity} |
| | | </update> |
| | | <select id="pagestockInventory" resultType="com.ruoyi.stock.dto.StockInventoryDto"> |
| | | select si.*, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name |
| | | select si.id, |
| | | si.qualitity, |
| | | COALESCE(si.locked_quantity, 0) as locked_quantity, |
| | | si.product_model_id, |
| | | si.create_time, |
| | | si.update_time, |
| | | COALESCE(si.warn_num, 0) as warn_num, |
| | | si.version, |
| | | (si.qualitity - COALESCE(si.locked_quantity, 0)) as un_locked_quantity, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name |
| | | from stock_inventory si |
| | | left join product_model pm on si.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join product_model pm on si.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | where 1 = 1 |
| | | <if test="ew.productName != null and ew.productName !=''"> |
| | | and p.product_name like concat('%',#{ew.productName},'%') |
| | |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name, |
| | | coalesce(si.warn_num, 0) as warn_num, |
| | | coalesce(si.locked_quantity, 0) as locked_quantity, |
| | | si.remark, |
| | | si.update_time |
| | | from stock_inventory si |