feat(oa): 添加库存管理相关实体和接口
- 新增 GearStock、GearStockBo、GearStockIo、GearStockIoBo、GearStockIoDetail、GearStockIoDetailBo 等实体类 - 新增 GearStockController、GearStockIoController、GearStockIoDetailController 等控制器 - 新增 GearStockIoDetailMapper 及其 XML 文件 - 优化 GearAttendanceSummaryServiceImpl 中的代码格式
This commit is contained in:
107
gear-oa/src/main/resources/mapper/oa/GearStockIoDetailMapper.xml
Normal file
107
gear-oa/src/main/resources/mapper/oa/GearStockIoDetailMapper.xml
Normal file
@@ -0,0 +1,107 @@
|
||||
<?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.gear.oa.mapper.GearStockIoDetailMapper">
|
||||
|
||||
<resultMap type="com.gear.oa.domain.GearStockIoDetail" id="GearStockIoDetailResult">
|
||||
<result property="detailId" column="detail_id"/>
|
||||
<result property="stockIoId" column="stock_io_id"/>
|
||||
<result property="warehouseId" column="warehouse_id"/>
|
||||
<result property="itemType" column="item_type"/>
|
||||
<result property="itemId" column="item_id"/>
|
||||
<result property="quantity" column="quantity"/>
|
||||
<result property="unit" column="unit"/>
|
||||
<result property="batchNo" column="batch_no"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="fromWarehouseId" column="from_warehouse_id"/>
|
||||
<result property="recordType" column="record_type"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 联查库区/库位名称的明细列表SQL,直接返回Map -->
|
||||
<select id="selectDetailWithWarehouseName" resultType="map">
|
||||
SELECT
|
||||
d.detail_id,
|
||||
d.stock_io_id,
|
||||
d.warehouse_id,
|
||||
d.item_type,
|
||||
d.item_id,
|
||||
d.quantity,
|
||||
d.unit,
|
||||
d.batch_no,
|
||||
d.remark,
|
||||
d.del_flag,
|
||||
d.create_time,
|
||||
d.create_by,
|
||||
d.update_time,
|
||||
d.update_by,
|
||||
d.from_warehouse_id,
|
||||
d.record_type,
|
||||
w1.warehouse_name AS warehouseName,
|
||||
w2.warehouse_name AS fromWarehouseName
|
||||
FROM gear_stock_io_detail d
|
||||
LEFT JOIN gear_warehouse w1 ON d.warehouse_id = w1.warehouse_id and w1.del_flag = 0
|
||||
LEFT JOIN gear_warehouse w2 ON d.from_warehouse_id = w2.warehouse_id and w2.del_flag = 0
|
||||
<where>
|
||||
<if test="stockIoId != null">d.stock_io_id = #{stockIoId}</if>
|
||||
<!-- 其他条件可补充 -->
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 分页联查库区/库位名称的明细列表SQL,支持Wrapper动态条件,返回Page<GearStockIoDetailVo> -->
|
||||
<select id="selectVoPagePlus" resultType="com.gear.oa.domain.vo.GearStockIoDetailVo">
|
||||
SELECT
|
||||
d.detail_id,
|
||||
d.stock_io_id,
|
||||
d.warehouse_id,
|
||||
d.item_type,
|
||||
d.item_id,
|
||||
d.quantity,
|
||||
d.unit,
|
||||
d.batch_no,
|
||||
d.remark,
|
||||
d.del_flag,
|
||||
d.create_time,
|
||||
d.create_by,
|
||||
d.update_time,
|
||||
d.update_by,
|
||||
d.from_warehouse_id,
|
||||
d.record_type,
|
||||
w1.warehouse_name AS warehouseName,
|
||||
w2.warehouse_name AS fromWarehouseName
|
||||
FROM gear_stock_io_detail d
|
||||
LEFT JOIN gear_warehouse w1 ON d.warehouse_id = w1.warehouse_id and w1.del_flag = 0
|
||||
LEFT JOIN gear_warehouse w2 ON d.from_warehouse_id = w2.warehouse_id and w2.del_flag = 0
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
<select id="batchQuery" resultType="com.gear.oa.domain.vo.GearStockIoDetailVo">
|
||||
SELECT
|
||||
d.detail_id,
|
||||
d.stock_io_id,
|
||||
d.warehouse_id,
|
||||
d.item_type,
|
||||
d.item_id,
|
||||
d.quantity,
|
||||
d.unit,
|
||||
d.batch_no,
|
||||
d.remark,
|
||||
d.del_flag,
|
||||
d.create_time,
|
||||
d.create_by,
|
||||
d.update_time,
|
||||
d.update_by,
|
||||
d.from_warehouse_id,
|
||||
d.record_type,
|
||||
io.stock_io_code AS stockIoCode,
|
||||
io.io_type AS ioType,
|
||||
io.biz_type AS bizType
|
||||
FROM gear_stock_io_detail d
|
||||
LEFT JOIN gear_stock_io io ON d.stock_io_id = io.stock_io_id and io.del_flag = 0
|
||||
WHERE d.batch_no = #{batchNo}
|
||||
</select>
|
||||
</mapper>
|
||||
23
gear-oa/src/main/resources/mapper/oa/GearStockIoMapper.xml
Normal file
23
gear-oa/src/main/resources/mapper/oa/GearStockIoMapper.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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.gear.oa.mapper.GearStockIoMapper">
|
||||
|
||||
<resultMap type="com.gear.oa.domain.GearStockIo" id="GearStockIoResult">
|
||||
<result property="stockIoId" column="stock_io_id"/>
|
||||
<result property="stockIoCode" column="stock_io_code"/>
|
||||
<result property="ioType" column="io_type"/>
|
||||
<result property="bizType" column="biz_type"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
33
gear-oa/src/main/resources/mapper/oa/GearStockLogMapper.xml
Normal file
33
gear-oa/src/main/resources/mapper/oa/GearStockLogMapper.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?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.gear.oa.mapper.GearStockLogMapper">
|
||||
|
||||
<resultMap type="com.gear.oa.domain.GearStockLog" id="GearStockLogResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="warehouseId" column="warehouse_id"/>
|
||||
<result property="itemId" column="item_id"/>
|
||||
<result property="itemType" column="item_type"/>
|
||||
<result property="changeQty" column="change_qty"/>
|
||||
<result property="afterQty" column="after_qty"/>
|
||||
<result property="changeType" column="change_type"/>
|
||||
<result property="changeTime" column="change_time"/>
|
||||
<result property="batchNo" column="batch_no"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectVoPagePlus" resultType="com.gear.oa.domain.vo.GearStockLogVo">
|
||||
select sl.*, w.warehouse_name
|
||||
from gear_stock_log sl
|
||||
left join gear_warehouse w on sl.warehouse_id = w.warehouse_id and w.del_flag = 0
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
41
gear-oa/src/main/resources/mapper/oa/GearStockMapper.xml
Normal file
41
gear-oa/src/main/resources/mapper/oa/GearStockMapper.xml
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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.gear.oa.mapper.GearStockMapper">
|
||||
|
||||
<resultMap type="com.gear.oa.domain.GearStock" id="GearStockResult">
|
||||
<result property="stockId" column="stock_id"/>
|
||||
<result property="warehouseId" column="warehouse_id"/>
|
||||
<result property="itemType" column="item_type"/>
|
||||
<result property="itemId" column="item_id"/>
|
||||
<result property="quantity" column="quantity"/>
|
||||
<result property="unit" column="unit"/>
|
||||
<result property="batchNo" column="batch_no"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getStockByItemId" resultType="java.math.BigDecimal">
|
||||
select sum(quantity) as quantity from gear_stock
|
||||
where item_id = #{rawMaterialId} and item_type = 'raw_material' and del_flag = 0
|
||||
</select>
|
||||
|
||||
<!-- 分页联查物品名称和编码,支持Wrapper动态条件,返回Page<GearStockVo> -->
|
||||
<select id="selectVoPagePlus" resultType="com.gear.oa.domain.vo.GearStockVo">
|
||||
SELECT
|
||||
s.*,
|
||||
w.warehouse_name,
|
||||
p.product_name AS itemName,
|
||||
p.product_code AS itemCode
|
||||
FROM gear_stock s
|
||||
LEFT JOIN gear_product p ON s.item_type = 'product' AND s.item_id = p.product_id and p.del_flag = 0
|
||||
left join gear_warehouse w on s.warehouse_id = w.warehouse_id and w.del_flag = 0
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
24
gear-oa/src/main/resources/mapper/oa/GearWarehouseMapper.xml
Normal file
24
gear-oa/src/main/resources/mapper/oa/GearWarehouseMapper.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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.gear.oa.mapper.GearWarehouseMapper">
|
||||
|
||||
<resultMap type="com.gear.oa.domain.GearWarehouse" id="GearWarehouseResult">
|
||||
<result property="warehouseId" column="warehouse_id"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<result property="warehouseCode" column="warehouse_code"/>
|
||||
<result property="warehouseName" column="warehouse_name"/>
|
||||
<result property="warehouseType" column="warehouse_type"/>
|
||||
<result property="sortNo" column="sort_no"/>
|
||||
<result property="isEnabled" column="is_enabled"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user