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