企业列表出来了
parent
d4268ddf78
commit
f6912e938a
|
@ -132,7 +132,7 @@ public class MyApiController extends BaseController
|
|||
{
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
myApi.setUserId(userId);
|
||||
MyApi myApi1 = myApiService.selectMyApiByMyId(myApi.getMyId());
|
||||
MyApi myApi1 = myApiService.selectMyApiByUserIdAndApiId(userId, myApi.getApiId());
|
||||
if (myApi1!=null) {
|
||||
myApi.setMyNum(myApi1.getMyNum()+myApi.getMyNum());
|
||||
return toAjax(myApiService.updateById(myApi));
|
||||
|
|
|
@ -14,4 +14,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
@Mapper
|
||||
public interface MyApiMapper extends BaseMapper<MyApi>{
|
||||
Integer updByUserIdAndApiId(MyApi myApi);
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
*/
|
||||
public interface IMyApiService extends IService<MyApi> {
|
||||
|
||||
public MyApi selectMyApiByUserIdAndApiId(Long userId,Long apiId);
|
||||
|
||||
public Integer updByUserIdAndApiId(MyApi myApi);
|
||||
/**
|
||||
* 精确查询我的api
|
||||
|
|
|
@ -26,6 +26,17 @@ public class MyApiServiceImpl
|
|||
|
||||
@Autowired
|
||||
private MyApiMapper mapper;
|
||||
|
||||
@Override
|
||||
public MyApi selectMyApiByUserIdAndApiId(Long userId, Long apiId) {
|
||||
LambdaQueryWrapper<MyApi> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Assert.notNull(userId, "userId不可为空");
|
||||
queryWrapper.eq(MyApi::getUserId, userId);
|
||||
Assert.notNull(apiId, "apiId不可为空");
|
||||
queryWrapper.eq(MyApi::getApiId, apiId);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updByUserIdAndApiId(MyApi myApi) {
|
||||
return mapper.updByUserIdAndApiId(myApi);
|
||||
|
|
Loading…
Reference in New Issue