This commit is contained in:
梁州 2025-02-23 22:44:01 +08:00
commit 3ffa5181a7
6 changed files with 25 additions and 1 deletions

View File

@ -208,4 +208,10 @@ public class AppLocationController extends BaseController
}
return success("创建成功。");
}
@Anonymous
@GetMapping("/count")
public AjaxResult count() {
return success(appLocationService.countAvailable());
}
}

View File

@ -114,7 +114,7 @@ public class SecurityConfig
requests.antMatchers("/login", "/register", "/captchaImage").permitAll()
// 静态资源可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**","/app/pms/orderIn","/app/task/sendLocation", "/app/task/taskResult","/app/task/kk", "/system/storage/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**","/app/pms/orderIn","/app/task/sendLocation", "/app/task/taskResult","/app/task/kk", "/system/storage/**", "/app/location/count").permitAll()
// 除上面外的所有请求全部需要鉴权认证
.anyRequest().authenticated();
})

View File

@ -3,6 +3,7 @@ package com.ruoyi.app.mapper;
import com.ruoyi.app.domain.AppLocation;
import java.util.List;
import java.util.Map;
/**
* 请填写功能名称Mapper接口
@ -66,4 +67,6 @@ public interface AppLocationMapper
* @return 结果
*/
int deleteAppLocationByLocationIds(String[] locationIds);
Map<String, Integer> countAvailableStock();
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.app.service;
import com.ruoyi.app.domain.AppLocation;
import java.util.List;
import java.util.Map;
/**
* 请填写功能名称Service接口
@ -75,4 +76,6 @@ public interface IAppLocationService
AppLocation requestLocation(int equipmentId);
String sendLocation();
Map<String, Integer> countAvailable();
}

View File

@ -2,6 +2,7 @@ package com.ruoyi.app.service.impl;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@ -217,4 +218,8 @@ public class AppLocationServiceImpl implements IAppLocationService {
}
return result;
}
public Map<String, Integer> countAvailable() {
return appLocationMapper.countAvailableStock();
}
}

View File

@ -65,6 +65,13 @@
where location_id = #{locationId}
</select>
<select id="countAvailableStock" resultType="java.util.Map">
SELECT
(SELECT COUNT(*) FROM app_location) AS total_count,
(SELECT COUNT(*) FROM app_location WHERE location_status = 0) AS available_count
</select>
<insert id="insertAppLocation" parameterType="AppLocation">
insert into app_location
<trim prefix="(" suffix=")" suffixOverrides=",">