forked from angelo/java-retail-app
## Opt - 商品自定义排序
This commit is contained in:
parent
121dbc52ba
commit
972d18549e
|
@ -327,7 +327,7 @@ public class BdWaresController extends BaseController {
|
|||
if (!isPutOn) {
|
||||
return AjaxResult.error("产品规格至少有一个上架");
|
||||
}
|
||||
wares.setSort(0);
|
||||
// wares.setSort(0);
|
||||
waresService.saveWares(wares, userTokenService.getLoginUser());
|
||||
return AjaxResult.success(wares.getWaresCode());
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ public class BdWaresController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
waresParams.setSort(0);
|
||||
// waresParams.setSort(0);
|
||||
waresService.updateWares(waresParams, userTokenService.getLoginUser());
|
||||
return AjaxResult.success(waresParams.getWaresCode());
|
||||
}
|
||||
|
@ -825,6 +825,10 @@ public class BdWaresController extends BaseController {
|
|||
String waresCode = CreateNormsCodeUtils.createWaresCode(waresService.getLastWaresCode());
|
||||
return AjaxResult.success(waresCode);
|
||||
}
|
||||
@GetMapping("/getMaxSortNum")
|
||||
public AjaxResult getMaxSortNum() {
|
||||
return AjaxResult.success("请求成功!", iBdWaresService.getMaxSortNum());
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品序号创建
|
||||
|
|
|
@ -23,6 +23,11 @@ import java.util.Map;
|
|||
*/
|
||||
public interface IBdWaresService extends IService<BdWares> {
|
||||
|
||||
/**
|
||||
* 获取最大排序值
|
||||
* @return
|
||||
*/
|
||||
int getMaxSortNum();
|
||||
/**
|
||||
* 新增商品基础信息
|
||||
*
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.hzs.sale.wares.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
@ -95,6 +96,15 @@ public class BdWaresServiceImpl extends ServiceImpl<BdWaresMapper, BdWares> impl
|
|||
@DubboReference
|
||||
ITransactionServiceApi transactionServiceApi;
|
||||
|
||||
@Override
|
||||
public int getMaxSortNum() {
|
||||
Integer maxSort = this.getMaxSort(SecurityUtils.getPkCountry());
|
||||
if(ObjectUtil.isNotEmpty(maxSort)){
|
||||
return maxSort + 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BdWares saveWares(WaresParams waresParams, LoginUser user) {
|
||||
|
|
|
@ -228,7 +228,7 @@
|
|||
<if test="waresStatus != null">
|
||||
and bw.WARES_STATUS <= #{waresStatus}
|
||||
</if>
|
||||
order by bw.SORT_STATUS desc , bw.WARES_PRICE ,bw.CREATION_TIME desc
|
||||
order by bw.sort desc, bw.CREATION_TIME desc
|
||||
</select>
|
||||
|
||||
<select id="selectByMoveUpSort" resultType="integer">
|
||||
|
@ -437,7 +437,7 @@
|
|||
<if test="param.systemType">
|
||||
and bw.system_type = #{param.systemType}
|
||||
</if>
|
||||
order by bw.SORT_STATUS desc , bw.WARES_PRICE ,bw.CREATION_TIME desc
|
||||
order by bw.SORT desc, bw.CREATION_TIME desc
|
||||
</select>
|
||||
|
||||
<!-- 查询盒数商品对应产品列表 -->
|
||||
|
|
Loading…
Reference in New Issue