拖动排序
This commit is contained in:
@@ -71,7 +71,7 @@ public class ShopPayTypeController {
|
|||||||
* @param id 拖动的支付类型ID
|
* @param id 拖动的支付类型ID
|
||||||
* @param targetSort 目标位置排序号
|
* @param targetSort 目标位置排序号
|
||||||
*/
|
*/
|
||||||
@PostMapping("/sort")
|
@GetMapping("/sort")
|
||||||
public CzgResult<Void> sort(@RequestParam Long shopId, @RequestParam Integer id, @RequestParam Integer targetSort) {
|
public CzgResult<Void> sort(@RequestParam Long shopId, @RequestParam Integer id, @RequestParam Integer targetSort) {
|
||||||
shopPayTypeService.updateSort(shopId, id, targetSort);
|
shopPayTypeService.updateSort(shopId, id, targetSort);
|
||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ import java.util.List;
|
|||||||
* @since 2025-02-26
|
* @since 2025-02-26
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ShopPayTypeServiceImpl extends ServiceImpl<ShopPayTypeMapper, ShopPayType> implements ShopPayTypeService{
|
public class ShopPayTypeServiceImpl extends ServiceImpl<ShopPayTypeMapper, ShopPayType> implements ShopPayTypeService {
|
||||||
private final ArrayList<ShopPayType> payTypeArrayList = new ArrayList<>(){{
|
private final ArrayList<ShopPayType> payTypeArrayList = new ArrayList<>() {{
|
||||||
add(new ShopPayType().setPayType("cash").setPayName("现金").setIcon("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/319005ffef734aa6a88d432459fa59d8.png").setSorts(1));
|
add(new ShopPayType().setPayType("cash").setPayName("现金").setIcon("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/319005ffef734aa6a88d432459fa59d8.png").setSorts(1));
|
||||||
add(new ShopPayType().setPayType("bank").setPayName("银行卡").setIcon("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/98e6199cc61a480b9c63617600b2f2fe.png").setSorts(2));
|
add(new ShopPayType().setPayType("bank").setPayName("银行卡").setIcon("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/98e6199cc61a480b9c63617600b2f2fe.png").setSorts(2));
|
||||||
add(new ShopPayType().setPayType("scanCode").setPayName("扫码支付").setIcon("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/3a344b46638547df81d5857a3c8cac66.png").setSorts(3));
|
add(new ShopPayType().setPayType("scanCode").setPayName("扫码支付").setIcon("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/3a344b46638547df81d5857a3c8cac66.png").setSorts(3));
|
||||||
add(new ShopPayType().setPayType("deposit").setPayName("储值卡").setIcon("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/6f778df10ea74142a6cba310c2a19063.png").setSorts(4));
|
add(new ShopPayType().setPayType("deposit").setPayName("储值卡").setIcon("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/6f778df10ea74142a6cba310c2a19063.png").setSorts(4));
|
||||||
add(new ShopPayType().setPayType("virtual").setPayName("挂账支付").setIcon("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/6f778df10ea74142a6cba310c2a19063.png").setIsShowShortcut(0).setSorts(5));
|
add(new ShopPayType().setPayType("virtual").setPayName("挂账支付").setIcon("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/3/6f778df10ea74142a6cba310c2a19063.png").setIsShowShortcut(0).setSorts(5));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -91,10 +91,10 @@ public class ShopPayTypeServiceImpl extends ServiceImpl<ShopPayTypeMapper, ShopP
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ShopPayType> getList(Long shopId) {
|
public List<ShopPayType> getList(Long shopId) {
|
||||||
List<ShopPayType> list = list(new QueryWrapper().eq(ShopPayType::getShopId, StpKit.USER.getShopId()));
|
List<ShopPayType> list = list(new QueryWrapper().eq(ShopPayType::getShopId, StpKit.USER.getShopId()).orderBy(ShopPayType::getSorts, true));
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
addInfo(shopId);
|
addInfo(shopId);
|
||||||
list = list(new QueryWrapper().eq(ShopPayType::getShopId, StpKit.USER.getShopId()));
|
list = list(new QueryWrapper().eq(ShopPayType::getShopId, StpKit.USER.getShopId()).orderBy(ShopPayType::getSorts, true));
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user