forked from angelo/java-retail-app
## Opt - 商品自定义排序
This commit is contained in:
parent
1e0d0989c7
commit
18def4fffc
|
@ -327,7 +327,7 @@ public class BdWaresController extends BaseController {
|
||||||
if (!isPutOn) {
|
if (!isPutOn) {
|
||||||
return AjaxResult.error("产品规格至少有一个上架");
|
return AjaxResult.error("产品规格至少有一个上架");
|
||||||
}
|
}
|
||||||
wares.setSort(0);
|
// wares.setSort(0);
|
||||||
waresService.saveWares(wares, userTokenService.getLoginUser());
|
waresService.saveWares(wares, userTokenService.getLoginUser());
|
||||||
return AjaxResult.success(wares.getWaresCode());
|
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());
|
waresService.updateWares(waresParams, userTokenService.getLoginUser());
|
||||||
return AjaxResult.success(waresParams.getWaresCode());
|
return AjaxResult.success(waresParams.getWaresCode());
|
||||||
}
|
}
|
||||||
|
@ -825,6 +825,10 @@ public class BdWaresController extends BaseController {
|
||||||
String waresCode = CreateNormsCodeUtils.createWaresCode(waresService.getLastWaresCode());
|
String waresCode = CreateNormsCodeUtils.createWaresCode(waresService.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;
|
||||||
|
@ -95,6 +96,15 @@ public class BdWaresServiceImpl extends ServiceImpl<BdWaresMapper, BdWares> impl
|
||||||
@DubboReference
|
@DubboReference
|
||||||
ITransactionServiceApi transactionServiceApi;
|
ITransactionServiceApi transactionServiceApi;
|
||||||
|
|
||||||
|
@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) {
|
||||||
|
|
|
@ -228,7 +228,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">
|
||||||
|
@ -437,7 +437,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