## Opt - 商品自定义排序
This commit is contained in:
parent
c06b96e98a
commit
5eb2720abc
|
@ -297,7 +297,7 @@ public class BdWaresController extends BaseController {
|
||||||
if (!isPutOn) {
|
if (!isPutOn) {
|
||||||
return AjaxResult.error("产品规格至少有一个上架");
|
return AjaxResult.error("产品规格至少有一个上架");
|
||||||
}
|
}
|
||||||
wares.setSort(0);
|
// wares.setSort(0);
|
||||||
iBdWaresService.saveWares(wares, userTokenService.getLoginUser());
|
iBdWaresService.saveWares(wares, userTokenService.getLoginUser());
|
||||||
return AjaxResult.success(wares.getWaresCode());
|
return AjaxResult.success(wares.getWaresCode());
|
||||||
}
|
}
|
||||||
|
@ -429,7 +429,7 @@ public class BdWaresController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
waresParams.setSort(0);
|
// waresParams.setSort(0);
|
||||||
iBdWaresService.updateWares(waresParams, userTokenService.getLoginUser());
|
iBdWaresService.updateWares(waresParams, userTokenService.getLoginUser());
|
||||||
return AjaxResult.success(waresParams.getWaresCode());
|
return AjaxResult.success(waresParams.getWaresCode());
|
||||||
}
|
}
|
||||||
|
@ -794,6 +794,10 @@ public class BdWaresController extends BaseController {
|
||||||
String waresCode = CreateNormsCodeUtils.createWaresCode(iBdWaresService.getLastWaresCode());
|
String waresCode = CreateNormsCodeUtils.createWaresCode(iBdWaresService.getLastWaresCode());
|
||||||
return AjaxResult.success(waresCode);
|
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> {
|
public interface IBdWaresService extends IService<BdWares> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取最大排序值
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int getMaxSortNum();
|
||||||
/**
|
/**
|
||||||
* 新增商品基础信息
|
* 新增商品基础信息
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.hzs.sale.wares.service.impl;
|
package com.hzs.sale.wares.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
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.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
@ -88,6 +89,15 @@ public class BdWaresServiceImpl extends ServiceImpl<BdWaresMapper, BdWares> impl
|
||||||
@DubboReference
|
@DubboReference
|
||||||
IRangeServiceApi iRangeServiceApi;
|
IRangeServiceApi iRangeServiceApi;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxSortNum() {
|
||||||
|
Integer maxSort = this.getMaxSort(SecurityUtils.getPkCountry());
|
||||||
|
if(ObjectUtil.isNotEmpty(maxSort)){
|
||||||
|
return maxSort + 1;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public BdWares saveWares(WaresParams waresParams, LoginUser user) {
|
public BdWares saveWares(WaresParams waresParams, LoginUser user) {
|
||||||
|
|
|
@ -232,7 +232,7 @@
|
||||||
<if test="waresStatus != null">
|
<if test="waresStatus != null">
|
||||||
and bw.WARES_STATUS <= #{waresStatus}
|
and bw.WARES_STATUS <= #{waresStatus}
|
||||||
</if>
|
</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>
|
||||||
|
|
||||||
<select id="selectByMoveUpSort" resultType="integer">
|
<select id="selectByMoveUpSort" resultType="integer">
|
||||||
|
@ -448,7 +448,7 @@
|
||||||
<if test="param.systemType">
|
<if test="param.systemType">
|
||||||
and bw.system_type = #{param.systemType}
|
and bw.system_type = #{param.systemType}
|
||||||
</if>
|
</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>
|
||||||
|
|
||||||
<!-- 查询盒数商品对应产品列表 -->
|
<!-- 查询盒数商品对应产品列表 -->
|
||||||
|
|
Loading…
Reference in New Issue