Authored by Lixiaodi

闪购

... ... @@ -45,4 +45,6 @@ public interface StorageDepositMapper {
List<StorageDeposit> getDepositOffs(@Param("uid") Integer uid, @Param("storageId") Integer storageId, @Param("count") Integer count);
int updateStorageStatus(@Param("depositCode")String depositCode, @Param("status")int status);
int getUserDepositCount(@Param("uid") Integer uid);
}
\ No newline at end of file
... ...
... ... @@ -324,6 +324,10 @@
select count(*) from storage_deposit
where owner_uid = #{uid} and status=1 and order_status=0 and del_status=0 and storage_id = #{storageId}
</select>
<select id="getUserDepositCount" resultType="java.lang.Integer">
select count(*) from storage_deposit
where owner_uid = #{uid} and status=1 and del_status=0
</select>
<select id="getDepositOffs" resultMap="BaseResultMap">
select * from storage_deposit
... ...
... ... @@ -99,4 +99,17 @@ public class DepositController {
LOG.info("queryUserStorageOffCount result: {}", count);
return new ApiResponse.ApiResponseBuilder().code(200).data(count).build();
}
@RequestMapping(params = "method=ufo.deposit.queryUserStorageCount")
@Cachable(expire = 180)
public ApiResponse queryUserStorageCount(@RequestParam("uid") Integer uid) {
if (uid == null || uid < 1) {
LOG.warn("queryUserStorageCount failed, invalid uid: {}", uid);
return new ApiResponse.ApiResponseBuilder().code(500).message("查询失败").build();
}
int count = depositService.getUserDepositCount(uid);
LOG.info("queryUserStorageCount result: {}", count);
return new ApiResponse.ApiResponseBuilder().code(200).data(count).build();
}
}
... ...
... ... @@ -36,6 +36,8 @@ public interface DepositService {
boolean changeOwner(Integer uid, Integer skup, long buyOrderCode, Integer newUid);
// 可上架数量
int getDepositOffShelvesCount(Integer uid, Integer storageId);
// 可上架数量
int getUserDepositCount(Integer uid);
// 剩余存储天数
int getRemainDay(Integer uid, String depositCode);
... ...
... ... @@ -263,7 +263,11 @@ public class DepositServiceImpl implements DepositService {
public int getDepositOffShelvesCount(Integer uid, Integer storageId) {
return storageDepositMapper.getDepositOffShelvesCount(uid, storageId);
}
// 用户存储总数(在库)
@Override
public int getUserDepositCount(Integer uid) {
return storageDepositMapper.getUserDepositCount(uid);
}
// 剩余存储天数
@Override
public int getRemainDay(Integer uid, String depositCode) {
... ...