客户库存盘点明细-查询

This commit is contained in:
mzr 2024-10-31 14:18:38 +08:00
parent 0e0174bac3
commit 5a28d8beb9
2 changed files with 99 additions and 2 deletions

View File

@ -135,6 +135,8 @@ public class StockReportController extends BaseController {
@ApiParam(required = true, value = "开始日期") @RequestParam(required = true) String startDate, @ApiParam(required = true, value = "开始日期") @RequestParam(required = true) String startDate,
@ApiParam(required = true, value = "结束日期") @RequestParam(required = true) String endDate, @ApiParam(required = true, value = "结束日期") @RequestParam(required = true) String endDate,
@ApiParam(required = false, value = "客户id") @RequestParam(required = false) String clientId, @ApiParam(required = false, value = "客户id") @RequestParam(required = false) String clientId,
@ApiParam(required = false, value = "客户编码U8") @RequestParam(required = false) String uecode,
@ApiParam(required = false, value = "客户名称") @RequestParam(required = false) String clientName,
@ApiParam(required = false, value = "业务员名称") @RequestParam(required = false) String staffName, @ApiParam(required = false, value = "业务员名称") @RequestParam(required = false) String staffName,
@ApiParam(required = false, value = "部门名称") @RequestParam(required = false) String areaName, @ApiParam(required = false, value = "部门名称") @RequestParam(required = false) String areaName,
@ApiParam(required = true, value = "页码", defaultValue = "1") @RequestParam(value = "page") Integer pageNum, @ApiParam(required = true, value = "页码", defaultValue = "1") @RequestParam(value = "page") Integer pageNum,
@ -146,11 +148,15 @@ public class StockReportController extends BaseController {
if (!redisService.isKey(token)) { if (!redisService.isKey(token)) {
return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录"); return AjaxResult.error(ErrorUtils.IS_NOT_LOGIN_ERROR, "用户未登录");
} }
Map<String, String> tokenMap = redisService.hmget(token); params = roleDateUtils.roleUtiles(token, "", "", "");
params.put("companyId", tokenMap.get("companyId")); if ("0".equals(params.get("code"))) {
return AjaxResult.error(ErrorUtils.USERNAME_POWER_ERROR, "无权查看");
}
params.put("startDate", startDate); params.put("startDate", startDate);
params.put("endDate", endDate); params.put("endDate", endDate);
params.put("clientId", clientId); params.put("clientId", clientId);
params.put("uecode", uecode);
params.put("clientName", clientName);
params.put("staffName", staffName); params.put("staffName", staffName);
params.put("areaName", areaName); params.put("areaName", areaName);
params.put("page", pageNum); params.put("page", pageNum);

View File

@ -70,12 +70,103 @@
<if test="clientId !=null and clientId !=''"> <if test="clientId !=null and clientId !=''">
AND t0.id = #{clientId} AND t0.id = #{clientId}
</if> </if>
<if test="uecode !=null and uecode !=''">
AND t0.uecode = #{uecode}
</if>
<if test="clientName !=null and clientName !=''">
AND t0.distributor_name = #{clientName}
</if>
<if test="staffName !=null and staffName !=''"> <if test="staffName !=null and staffName !=''">
AND csui.name = #{staffName} AND csui.name = #{staffName}
</if> </if>
<if test="areaName !=null and areaName !=''"> <if test="areaName !=null and areaName !=''">
AND cmai.area_name = #{areaName} AND cmai.area_name = #{areaName}
</if> </if>
<if test="flag !=null and flag !=''">
<!-- 前端传营销区域 -->
<if test="flag == 1">
<if test="areaId1 !=null and areaId1 !=''">
and (t0.ancestors LIKE '%' || #{areaId1} || '%'
or
t0.marketing_area_id = #{areaId1}
)
</if>
<if test="areaId2 !=null and areaId2 !=''">
and t0.marketing_area_id = #{areaId2}
</if>
<if test="areaId3 !=null and areaId3 !=''">
and t0.marketing_area_id in
<foreach collection="areaId3" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</if>
<!-- 不传参数 包含本区域及下属区域和自定义 -->
<if test="flag == 2">
<if test="areaId1 !=null and areaId1 !=''">
and (t0.ancestors LIKE '%' || #{areaId1} || '%'
or
t0.marketing_area_id = #{areaId1}
<if test="areaId3 !=null and areaId3 !=''">
or t0.marketing_area_id in
<foreach collection="areaId3" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
)
</if>
</if>
<!-- 不传参数 包含本区域及下属区域和自定义 -->
<if test="flag ==3">
<if test="areaId2 !=null and areaId2 !=''">
and (t0.marketing_area_id = #{areaId2}
<if test="areaId3 !=null and areaId3 !=''">
or t0.marketing_area_id in
<foreach collection="areaId3" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
)
</if>
</if>
<if test="flag ==4">
<if test="regions !=null and regions !=''">
and (
t0.region in
<foreach collection="regions" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="areaId3 !=null and areaId3 !=''">
or t0.marketing_area_id in
<foreach collection="areaId3" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
)
</if>
</if>
<if test="flag ==5">
<if test="region !=null and region !=''">
and t0.region = #{region}
</if>
<if test="adcodes !=null and adcodes !=''">
and t0.region in
<foreach collection="adcodes" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="areaId !=null and areaId !=''">
and t0.marketing_area_id = #{areaId}
</if>
</if>
</if>
<if test="userId != null and userId != ''">
AND (
t0.id LIKE '%' || #{userId} || '%'
OR
t0.service_id LIKE '%' || #{userId} || '%'
)
</if>
</select> </select>
</mapper> </mapper>