企业列表出来了

master
法外狂徒张三 2024-09-08 11:28:03 +08:00
parent d4268ddf78
commit f6912e938a
4 changed files with 15 additions and 1 deletions

View File

@ -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));

View File

@ -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);
} }

View File

@ -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

View File

@ -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);