add countAvailable
This commit is contained in:
parent
2b6062b51c
commit
081467c514
|
|
@ -208,4 +208,10 @@ public class AppLocationController extends BaseController
|
|||
}
|
||||
return success("创建成功。");
|
||||
}
|
||||
|
||||
@Anonymous
|
||||
@GetMapping("/count")
|
||||
public AjaxResult count() {
|
||||
return success(appLocationService.countAvailable());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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=",">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user