update - 添加库存统计接口

master
yinq 12 months ago
parent a1c31f87a3
commit 8390b3d1b9

@ -1,5 +1,6 @@
package com.aucma.base.controller;
import java.util.LinkedHashMap;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
@ -46,6 +47,17 @@ public class BaseSpaceInfoController extends BaseController {
return getDataTable(list);
}
/**
*
* @param baseSpaceInfo
* @return
*/
@GetMapping("/spaceList" )
public AjaxResult spaceList(BaseSpaceInfo baseSpaceInfo) {
List<BaseSpaceInfo> list = baseSpaceInfoService.selectBaseSpaceInfoList(baseSpaceInfo);
return success(list);
}
/**
*
*/
@ -100,4 +112,16 @@ public class BaseSpaceInfoController extends BaseController {
public AjaxResult remove(@PathVariable Long[] objIds) {
return toAjax(baseSpaceInfoService.deleteBaseSpaceInfoByObjIds(objIds));
}
/**
*
* @param baseSpaceInfo
* @return
*/
@GetMapping("/getInventoryStatistics" )
public AjaxResult getInventoryStatistics(BaseSpaceInfo baseSpaceInfo) {
List<LinkedHashMap<String,String>> list = baseSpaceInfoService.getInventoryStatistics(baseSpaceInfo);
return success(list);
}
}

@ -1,5 +1,6 @@
package com.aucma.base.mapper;
import java.util.LinkedHashMap;
import java.util.List;
import com.aucma.base.domain.BaseSpaceInfo;
@ -58,4 +59,11 @@ public interface BaseSpaceInfoMapper
* @return
*/
public int deleteBaseSpaceInfoByObjIds(Long[] objIds);
/**
*
* @param baseSpaceInfo
* @return
*/
List<LinkedHashMap<String, String>> getInventoryStatistics(BaseSpaceInfo baseSpaceInfo);
}

@ -1,5 +1,6 @@
package com.aucma.base.service;
import java.util.LinkedHashMap;
import java.util.List;
import com.aucma.base.domain.BaseSpaceInfo;
@ -58,4 +59,11 @@ public interface IBaseSpaceInfoService
* @return
*/
public int deleteBaseSpaceInfoByObjId(Long objId);
/**
*
* @param baseSpaceInfo
* @return
*/
List<LinkedHashMap<String,String>> getInventoryStatistics(BaseSpaceInfo baseSpaceInfo);
}

@ -1,5 +1,7 @@
package com.aucma.base.service.impl;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -90,4 +92,17 @@ public class BaseSpaceInfoServiceImpl implements IBaseSpaceInfoService
{
return baseSpaceInfoMapper.deleteBaseSpaceInfoByObjId(objId);
}
/**
*
* @param baseSpaceInfo
* @return
*/
@Override
public List<LinkedHashMap<String,String>> getInventoryStatistics(BaseSpaceInfo baseSpaceInfo) {
return baseSpaceInfoMapper.getInventoryStatistics(baseSpaceInfo);
}
}

@ -62,6 +62,7 @@
<if test="updatedBy != null and updatedBy != ''">and sp.updated_by = #{updatedBy}</if>
<if test="updatedTime != null ">and sp.updated_time = #{updatedTime}</if>
</where>
order by sp.store_code,sp.space_code
</select>
<select id="selectBaseSpaceInfoByObjId" parameterType="Long" resultMap="BaseSpaceInfoResult">
@ -69,6 +70,21 @@
where sp.obj_id = #{objId}
</select>
<select id="getInventoryStatistics" parameterType="BaseSpaceInfo" resultType="java.util.LinkedHashMap">
select si.store_code MATERIALCODE,
si.STORE_NAME MATERIALNAME,
sp.material_type STORECODE,
ml.MATERIAL_NAME STORENAME,
sum(sp.space_stock) SPACESTOCK
from base_spaceinfo sp
left join base_storeinfo si on si.STORE_CODE = sp.STORE_CODE
left join BASE_MATERIALINFO ml on ml.MATERIAL_CODE = sp.MATERIAL_TYPE
where sp.MATERIAL_TYPE is not null
<if test="storeCode != null and storeCode != ''">and sp.store_code = #{storeCode}</if>
group by si.store_code, si.STORE_NAME, sp.material_type, ml.MATERIAL_NAME
order by si.store_code, sp.material_type
</select>
<insert id="insertBaseSpaceInfo" parameterType="BaseSpaceInfo">
<selectKey keyProperty="objId" resultType="long" order="BEFORE">
SELECT seq_base_spaceinfo.NEXTVAL as objId FROM DUAL

Loading…
Cancel
Save