|
@@ -4,12 +4,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
import edu.travel.country.entity.ShopCurrency;
|
|
|
import edu.travel.country.mapper.ShopCurrencyMapper;
|
|
|
import edu.travel.country.service.ShopCurrencyService;
|
|
|
import edu.travel.dto.ShopCurrencyDto;
|
|
|
+import edu.travel.dto.ShopCurrencyStatusDto;
|
|
|
import edu.travel.rpc.RPCBaseResponse;
|
|
|
import edu.travel.service.SysServiceImpl;
|
|
|
+import edu.travel.vo.ShopCurrencyStatusVo;
|
|
|
import edu.travel.vo.ShopCurrencyVo;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -20,6 +23,8 @@ public class ShopCurrencyServiceImpl extends SysServiceImpl<ShopCurrencyMapper,
|
|
|
|
|
|
@Autowired
|
|
|
private ShopCurrencyMapper shopCurrencyMapper;
|
|
|
+ @Autowired
|
|
|
+ private ShopCurrencyService shopCurrencyService;
|
|
|
@Override
|
|
|
public RPCBaseResponse<IPage<ShopCurrencyVo>> getCurrencyPage(ShopCurrencyDto dto) {
|
|
|
Page<ShopCurrency> baseCountryServePage = new Page<>(dto.getCurrentPage(), dto.getPageSize());
|
|
@@ -28,4 +33,33 @@ public class ShopCurrencyServiceImpl extends SysServiceImpl<ShopCurrencyMapper,
|
|
|
BeanUtils.copyProperties(pageLink, result);
|
|
|
return new RPCBaseResponse<>(200,"SUCCESS",result);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public RPCBaseResponse<ShopCurrencyStatusVo> updateCurrencyStatus(ShopCurrencyStatusDto shopCurrencyStatusDto) {
|
|
|
+ // 检查参数是否合法
|
|
|
+ if (shopCurrencyStatusDto.getId() == null) {
|
|
|
+ return new RPCBaseResponse<>(400, "Currency id is not null", null);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 创建一个 ShopCurrency 对象,用于更新
|
|
|
+ ShopCurrency shopCurrency = new ShopCurrency();
|
|
|
+ shopCurrency.setId(shopCurrencyStatusDto.getId());
|
|
|
+ shopCurrency.setStatus(shopCurrencyStatusDto.getStatus());
|
|
|
+
|
|
|
+ // 执行更新操作
|
|
|
+ boolean success = shopCurrencyService.updateById(shopCurrency);
|
|
|
+
|
|
|
+ // 检查更新是否成功
|
|
|
+ if (!success) {
|
|
|
+ return new RPCBaseResponse<>(500, "FAIL", null);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 创建返回的结果对象
|
|
|
+ ShopCurrencyStatusVo shopCurrencyStatusVo = new ShopCurrencyStatusVo();
|
|
|
+ BeanUtils.copyProperties(shopCurrency, shopCurrencyStatusVo);
|
|
|
+
|
|
|
+ // 返回成功的响应
|
|
|
+ return new RPCBaseResponse<>(200, "SUCCESS", shopCurrencyStatusVo);
|
|
|
+ }
|
|
|
+
|
|
|
}
|