1、新增仓库库存功能,还未完全实现

2、删除一些冗余代码
This commit is contained in:
xjs 2022-03-23 21:41:55 +08:00
parent 1c66e38246
commit 28b064ba8e
24 changed files with 402 additions and 585 deletions

View File

@ -0,0 +1,45 @@
import request from '@/utils/request'
//获取仓库库存列表
export function getWareSkuList(parms) {
return request({
url: '/mall-ware/ware/waresku/list',
method: 'get',
params: parms
})
}
//删除仓库库存
export function delWareSku(ids) {
return request({
url: '/mall-ware/ware/waresku/delete',
method: 'delete',
data: ids
})
}
//获取仓库库存详情
export function getWareSku(id) {
return request({
url: `/mall-ware/ware/waresku/info/${id}`,
method: 'get',
})
}
//保存仓库库存
export function saveWareSku(data) {
return request({
url: `/mall-ware/ware/waresku/save`,
method: 'post',
data: data,
})
}
//修改仓库库存
export function editWareSku(data) {
return request({
url: `/mall-ware/ware/waresku/update`,
method: 'put',
data: data,
})
}

View File

@ -161,7 +161,7 @@ export default {
//
handleCommand(row, command) {
if ("stockSettings" === command) {
this.$router.push({path: "/ware-sku", query: {skuId: row.skuId}});
this.$router.push({path: "/mall/ware/ware-sku", query: {skuId: row.skuId}});
}
},

View File

@ -0,0 +1,140 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible"
>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="120px"
>
<el-form-item label="sku_id" prop="skuId">
<el-input v-model="dataForm.skuId" placeholder="sku_id"></el-input>
</el-form-item>
<el-form-item label="仓库" prop="wareId">
<el-select v-model="dataForm.wareId" placeholder="请选择仓库" clearable>
<el-option :label="w.name" :value="w.id" v-for="w in wareList" :key="w.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="库存数" prop="stock">
<el-input v-model="dataForm.stock" placeholder="库存数"></el-input>
</el-form-item>
<el-form-item label="sku_name" prop="skuName">
<el-input v-model="dataForm.skuName" placeholder="sku_name"></el-input>
</el-form-item>
<el-form-item label="锁定库存" prop="stockLocked">
<el-input v-model="dataForm.stockLocked" placeholder="锁定库存"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data() {
return {
visible: false,
wareList: [],
dataForm: {
id: 0,
skuId: "",
wareId: "",
stock: 0,
skuName: "",
stockLocked: 0
},
dataRule: {
skuId: [{ required: true, message: "sku_id不能为空", trigger: "blur" }],
wareId: [
{ required: true, message: "仓库id不能为空", trigger: "blur" }
],
stock: [{ required: true, message: "库存数不能为空", trigger: "blur" }],
skuName: [
{ required: true, message: "sku_name不能为空", trigger: "blur" }
]
}
};
},
created(){
this.getWares();
},
methods: {
getWares() {
this.$http({
url: this.$http.adornUrl("/ware/wareinfo/list"),
method: "get",
params: this.$http.adornParams({
page: 1,
limit: 500
})
}).then(({ data }) => {
this.wareList = data.page.list;
});
},
init(id) {
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/ware/waresku/info/${this.dataForm.id}`),
method: "get",
params: this.$http.adornParams()
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataForm.skuId = data.wareSku.skuId;
this.dataForm.wareId = data.wareSku.wareId;
this.dataForm.stock = data.wareSku.stock;
this.dataForm.skuName = data.wareSku.skuName;
this.dataForm.stockLocked = data.wareSku.stockLocked;
}
});
}
});
},
//
dataFormSubmit() {
this.$refs["dataForm"].validate(valid => {
if (valid) {
this.$http({
url: this.$http.adornUrl(
`/ware/waresku/${!this.dataForm.id ? "save" : "update"}`
),
method: "post",
data: this.$http.adornData({
id: this.dataForm.id || undefined,
skuId: this.dataForm.skuId,
wareId: this.dataForm.wareId,
stock: this.dataForm.stock,
skuName: this.dataForm.skuName,
stockLocked: this.dataForm.stockLocked
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.visible = false;
this.$emit("refreshDataList");
}
});
} else {
this.$message.error(data.msg);
}
});
}
});
}
}
};
</script>

View File

@ -0,0 +1,186 @@
<template>
<div class="app-container">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="仓库">
<el-select style="width:160px;" v-model="dataForm.wareId" placeholder="请选择仓库" clearable>
<el-option :label="w.name" :value="w.id" v-for="w in wareList" :key="w.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="skuId">
<el-input v-model="dataForm.skuId" placeholder="skuId" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button-group>
<el-button @click="getDataList()" size="mini">查询</el-button>
<el-button type="primary" @click="addOrUpdateHandle()" size="mini">新增</el-button>
<el-button
size="mini"
type="danger"
@click="deleteHandle()"
:disabled="dataListSelections.length <= 0"
>批量删除</el-button>
</el-button-group>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;"
>
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column prop="skuId" header-align="center" align="center" label="sku_id"></el-table-column>
<el-table-column prop="wareId" header-align="center" align="center" label="仓库id"></el-table-column>
<el-table-column prop="stock" header-align="center" align="center" label="库存数"></el-table-column>
<el-table-column prop="skuName" header-align="center" align="center" label="商品名称"></el-table-column>
<el-table-column prop="stockLocked" header-align="center" align="center" label="锁定库存"></el-table-column>
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from "./waresku-add-or-update";
export default {
name:"WareSku",
data() {
return {
wareList: [],
dataForm: {
wareId: "",
skuId: ""
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
};
},
components: {
AddOrUpdate
},
created() {
console.log("接收到", this.$route.query.skuId);
if (this.$route.query.skuId) {
this.dataForm.skuId = this.$route.query.skuId;
}
this.getWares();
this.getDataList();
},
methods: {
getWares() {
this.$http({
url: this.$http.adornUrl("/ware/wareinfo/list"),
method: "get",
params: this.$http.adornParams({
page: 1,
limit: 500
})
}).then(({ data }) => {
this.wareList = data.page.list;
});
},
//
getDataList() {
this.dataListLoading = true;
this.$http({
url: this.$http.adornUrl("/ware/waresku/list"),
method: "get",
params: this.$http.adornParams({
page: this.pageIndex,
limit: this.pageSize,
skuId: this.dataForm.skuId,
wareId: this.dataForm.wareId
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.page.list;
this.totalPage = data.page.totalCount;
} else {
this.dataList = [];
this.totalPage = 0;
}
this.dataListLoading = false;
});
},
//
sizeChangeHandle(val) {
this.pageSize = val;
this.pageIndex = 1;
this.getDataList();
},
//
currentChangeHandle(val) {
this.pageIndex = val;
this.getDataList();
},
//
selectionChangeHandle(val) {
this.dataListSelections = val;
},
// /
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
//
deleteHandle(id) {
var ids = id
? [id]
: this.dataListSelections.map(item => {
return item.id;
});
this.$confirm(
`确定对[id=${ids.join(",")}]进行[${id ? "删除" : "批量删除"}]操作?`,
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
).then(() => {
this.$http({
url: this.$http.adornUrl("/ware/waresku/delete"),
method: "post",
data: this.$http.adornData(ids, false)
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
}
});
} else {
this.$message.error(data.msg);
}
});
});
}
}
};
</script>

View File

@ -1,84 +0,0 @@
package com.xjs.mall.product.controller;
import java.util.Arrays;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.xjs.mall.product.entity.ProductAttrValueEntity;
import com.xjs.mall.product.service.ProductAttrValueService;
import com.xjs.utils.PageUtils;
import com.xjs.mall.other.R;
/**
* spu属性值
*
* @author xiejs
* @email 1294405880@qq.com
* @date 2022-03-15 10:16:53
*/
@RestController
@RequestMapping("product/productattrvalue")
public class ProductAttrValueController {
@Autowired
private ProductAttrValueService productAttrValueService;
/**
* 列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = productAttrValueService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
ProductAttrValueEntity productAttrValue = productAttrValueService.getById(id);
return R.ok().put("productAttrValue", productAttrValue);
}
/**
* 保存
*/
@RequestMapping("/save")
public R save(@RequestBody ProductAttrValueEntity productAttrValue){
productAttrValueService.save(productAttrValue);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody ProductAttrValueEntity productAttrValue){
productAttrValueService.updateById(productAttrValue);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
productAttrValueService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}

View File

@ -1,84 +0,0 @@
package com.xjs.mall.product.controller;
import java.util.Arrays;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.xjs.mall.product.entity.SkuImagesEntity;
import com.xjs.mall.product.service.SkuImagesService;
import com.xjs.utils.PageUtils;
import com.xjs.mall.other.R;
/**
* sku图片
*
* @author xiejs
* @email 1294405880@qq.com
* @date 2022-03-15 10:16:53
*/
@RestController
@RequestMapping("product/skuimages")
public class SkuImagesController {
@Autowired
private SkuImagesService skuImagesService;
/**
* 列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = skuImagesService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
SkuImagesEntity skuImages = skuImagesService.getById(id);
return R.ok().put("skuImages", skuImages);
}
/**
* 保存
*/
@RequestMapping("/save")
public R save(@RequestBody SkuImagesEntity skuImages){
skuImagesService.save(skuImages);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody SkuImagesEntity skuImages){
skuImagesService.updateById(skuImages);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
skuImagesService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}

View File

@ -32,7 +32,7 @@ public class SkuInfoController extends MyBaseController<SkuInfoEntity> {
/**
* 列表
*/
@RequestMapping("/list")
@GetMapping("/list")
@ApiOperation("列表")
public R list(@RequestParam Map<String, Object> params){
super.checkParams(params);
@ -41,45 +41,4 @@ public class SkuInfoController extends MyBaseController<SkuInfoEntity> {
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{skuId}")
public R info(@PathVariable("skuId") Long skuId){
SkuInfoEntity skuInfo = skuInfoService.getById(skuId);
return R.ok().put("skuInfo", skuInfo);
}
/**
* 保存
*/
@RequestMapping("/save")
public R save(@RequestBody SkuInfoEntity skuInfo){
skuInfoService.save(skuInfo);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody SkuInfoEntity skuInfo){
skuInfoService.updateById(skuInfo);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] skuIds){
skuInfoService.removeByIds(Arrays.asList(skuIds));
return R.ok();
}
}

View File

@ -1,84 +0,0 @@
package com.xjs.mall.product.controller;
import java.util.Arrays;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.xjs.mall.product.entity.SkuSaleAttrValueEntity;
import com.xjs.mall.product.service.SkuSaleAttrValueService;
import com.xjs.utils.PageUtils;
import com.xjs.mall.other.R;
/**
* sku销售属性&
*
* @author xiejs
* @email 1294405880@qq.com
* @date 2022-03-15 10:16:53
*/
@RestController
@RequestMapping("product/skusaleattrvalue")
public class SkuSaleAttrValueController {
@Autowired
private SkuSaleAttrValueService skuSaleAttrValueService;
/**
* 列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = skuSaleAttrValueService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
SkuSaleAttrValueEntity skuSaleAttrValue = skuSaleAttrValueService.getById(id);
return R.ok().put("skuSaleAttrValue", skuSaleAttrValue);
}
/**
* 保存
*/
@RequestMapping("/save")
public R save(@RequestBody SkuSaleAttrValueEntity skuSaleAttrValue){
skuSaleAttrValueService.save(skuSaleAttrValue);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody SkuSaleAttrValueEntity skuSaleAttrValue){
skuSaleAttrValueService.updateById(skuSaleAttrValue);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
skuSaleAttrValueService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}

View File

@ -1,84 +0,0 @@
package com.xjs.mall.product.controller;
import java.util.Arrays;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.xjs.mall.product.entity.SpuImagesEntity;
import com.xjs.mall.product.service.SpuImagesService;
import com.xjs.utils.PageUtils;
import com.xjs.mall.other.R;
/**
* spu图片
*
* @author xiejs
* @email 1294405880@qq.com
* @date 2022-03-15 10:16:53
*/
@RestController
@RequestMapping("product/spuimages")
public class SpuImagesController {
@Autowired
private SpuImagesService spuImagesService;
/**
* 列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = spuImagesService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
SpuImagesEntity spuImages = spuImagesService.getById(id);
return R.ok().put("spuImages", spuImages);
}
/**
* 保存
*/
@RequestMapping("/save")
public R save(@RequestBody SpuImagesEntity spuImages){
spuImagesService.save(spuImages);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody SpuImagesEntity spuImages){
spuImagesService.updateById(spuImages);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
spuImagesService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}

View File

@ -13,7 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.Map;
@ -34,7 +33,7 @@ public class SpuInfoController extends MyBaseController<SpuInfoEntity> {
/**
* 列表
*/
@RequestMapping("/list")
@GetMapping("/list")
@ApiOperation("列表")
public R list(@RequestParam Map<String, Object> params) {
super.checkParams(params);
@ -44,16 +43,6 @@ public class SpuInfoController extends MyBaseController<SpuInfoEntity> {
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id) {
SpuInfoEntity spuInfo = spuInfoService.getById(id);
return R.ok().put("spuInfo", spuInfo);
}
/**
* 保存(保存spu关联的所有信息)
*/
@ -64,25 +53,4 @@ public class SpuInfoController extends MyBaseController<SpuInfoEntity> {
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody SpuInfoEntity spuInfo) {
spuInfoService.updateById(spuInfo);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids) {
spuInfoService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}

View File

@ -1,84 +0,0 @@
package com.xjs.mall.product.controller;
import java.util.Arrays;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.xjs.mall.product.entity.SpuInfoDescEntity;
import com.xjs.mall.product.service.SpuInfoDescService;
import com.xjs.utils.PageUtils;
import com.xjs.mall.other.R;
/**
* spu信息介绍
*
* @author xiejs
* @email 1294405880@qq.com
* @date 2022-03-15 10:16:53
*/
@RestController
@RequestMapping("product/spuinfodesc")
public class SpuInfoDescController {
@Autowired
private SpuInfoDescService spuInfoDescService;
/**
* 列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = spuInfoDescService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{spuId}")
public R info(@PathVariable("spuId") Long spuId){
SpuInfoDescEntity spuInfoDesc = spuInfoDescService.getById(spuId);
return R.ok().put("spuInfoDesc", spuInfoDesc);
}
/**
* 保存
*/
@RequestMapping("/save")
public R save(@RequestBody SpuInfoDescEntity spuInfoDesc){
spuInfoDescService.save(spuInfoDesc);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody SpuInfoDescEntity spuInfoDesc){
spuInfoDescService.updateById(spuInfoDesc);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] spuIds){
spuInfoDescService.removeByIds(Arrays.asList(spuIds));
return R.ok();
}
}

View File

@ -1,12 +1,10 @@
package com.xjs.mall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xjs.mall.product.vo.spu.BaseAttrs;
import com.xjs.utils.PageUtils;
import com.xjs.mall.product.entity.ProductAttrValueEntity;
import com.xjs.mall.product.vo.spu.BaseAttrs;
import java.util.List;
import java.util.Map;
/**
* spu属性值
@ -17,7 +15,6 @@ import java.util.Map;
*/
public interface ProductAttrValueService extends IService<ProductAttrValueEntity> {
PageUtils queryPage(Map<String, Object> params);
/**
* 保存spu的规格参数

View File

@ -1,11 +1,8 @@
package com.xjs.mall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xjs.utils.PageUtils;
import com.xjs.mall.product.entity.SkuImagesEntity;
import java.util.Map;
/**
* sku图片
*
@ -15,6 +12,5 @@ import java.util.Map;
*/
public interface SkuImagesService extends IService<SkuImagesEntity> {
PageUtils queryPage(Map<String, Object> params);
}

View File

@ -1,11 +1,8 @@
package com.xjs.mall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xjs.utils.PageUtils;
import com.xjs.mall.product.entity.SkuSaleAttrValueEntity;
import java.util.Map;
/**
* sku销售属性&
*
@ -15,6 +12,5 @@ import java.util.Map;
*/
public interface SkuSaleAttrValueService extends IService<SkuSaleAttrValueEntity> {
PageUtils queryPage(Map<String, Object> params);
}

View File

@ -1,11 +1,9 @@
package com.xjs.mall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xjs.utils.PageUtils;
import com.xjs.mall.product.entity.SpuImagesEntity;
import java.util.List;
import java.util.Map;
/**
* spu图片
@ -16,8 +14,6 @@ import java.util.Map;
*/
public interface SpuImagesService extends IService<SpuImagesEntity> {
PageUtils queryPage(Map<String, Object> params);
/**
* 保存spu图片信息
* @param id spuId

View File

@ -1,11 +1,8 @@
package com.xjs.mall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xjs.utils.PageUtils;
import com.xjs.mall.product.entity.SpuInfoDescEntity;
import java.util.Map;
/**
* spu信息介绍
*
@ -15,8 +12,6 @@ import java.util.Map;
*/
public interface SpuInfoDescService extends IService<SpuInfoDescEntity> {
PageUtils queryPage(Map<String, Object> params);
/**
* 保存spu描述信息
* @param descEntity spu描述实体类

View File

@ -1,7 +1,5 @@
package com.xjs.mall.product.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xjs.mall.product.dao.ProductAttrValueDao;
import com.xjs.mall.product.entity.AttrEntity;
@ -9,13 +7,10 @@ import com.xjs.mall.product.entity.ProductAttrValueEntity;
import com.xjs.mall.product.service.AttrService;
import com.xjs.mall.product.service.ProductAttrValueService;
import com.xjs.mall.product.vo.spu.BaseAttrs;
import com.xjs.utils.PageUtils;
import com.xjs.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -25,16 +20,6 @@ public class ProductAttrValueServiceImpl extends ServiceImpl<ProductAttrValueDao
@Autowired
private AttrService attrService;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<ProductAttrValueEntity> page = this.page(
new Query<ProductAttrValueEntity>().getPage(params),
new QueryWrapper<ProductAttrValueEntity>()
);
return new PageUtils(page);
}
@Override
public void saveProductAttr(List<BaseAttrs> baseAttrs,Long spuId) {
List<ProductAttrValueEntity> productAttrValueEntityList = baseAttrs.stream().map(attr -> {

View File

@ -1,29 +1,15 @@
package com.xjs.mall.product.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xjs.utils.PageUtils;
import com.xjs.utils.Query;
import com.xjs.mall.product.dao.SkuImagesDao;
import com.xjs.mall.product.entity.SkuImagesEntity;
import com.xjs.mall.product.service.SkuImagesService;
import org.springframework.stereotype.Service;
@Service("skuImagesService")
public class SkuImagesServiceImpl extends ServiceImpl<SkuImagesDao, SkuImagesEntity> implements SkuImagesService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SkuImagesEntity> page = this.page(
new Query<SkuImagesEntity>().getPage(params),
new QueryWrapper<SkuImagesEntity>()
);
return new PageUtils(page);
}
}
}

View File

@ -16,14 +16,5 @@ import com.xjs.mall.product.service.SkuSaleAttrValueService;
@Service("skuSaleAttrValueService")
public class SkuSaleAttrValueServiceImpl extends ServiceImpl<SkuSaleAttrValueDao, SkuSaleAttrValueEntity> implements SkuSaleAttrValueService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SkuSaleAttrValueEntity> page = this.page(
new Query<SkuSaleAttrValueEntity>().getPage(params),
new QueryWrapper<SkuSaleAttrValueEntity>()
);
return new PageUtils(page);
}
}
}

View File

@ -19,15 +19,6 @@ import java.util.stream.Collectors;
@Service("spuImagesService")
public class SpuImagesServiceImpl extends ServiceImpl<SpuImagesDao, SpuImagesEntity> implements SpuImagesService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SpuImagesEntity> page = this.page(
new Query<SpuImagesEntity>().getPage(params),
new QueryWrapper<SpuImagesEntity>()
);
return new PageUtils(page);
}
@Override
public void saveImages(Long id, List<String> images) {

View File

@ -16,15 +16,6 @@ import java.util.Map;
@Service("spuInfoDescService")
public class SpuInfoDescServiceImpl extends ServiceImpl<SpuInfoDescDao, SpuInfoDescEntity> implements SpuInfoDescService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SpuInfoDescEntity> page = this.page(
new Query<SpuInfoDescEntity>().getPage(params),
new QueryWrapper<SpuInfoDescEntity>()
);
return new PageUtils(page);
}
@Override
public void saveSpuInfoDesc(SpuInfoDescEntity descEntity) {

View File

@ -4,6 +4,8 @@ import com.xjs.mall.ware.entity.WareSkuEntity;
import com.xjs.mall.ware.service.WareSkuService;
import com.xjs.utils.PageUtils;
import com.xjs.mall.other.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -17,10 +19,11 @@ import java.util.Map;
*
* @author xiejs
* @email 1294405880@qq.com
* @date 2022-03-15 09:56:19
* @since 2022-03-15 09:56:19
*/
@RestController
@RequestMapping("ware/waresku")
@Api(tags = "商城-仓库-商品库存")
public class WareSkuController {
@Autowired
private WareSkuService wareSkuService;
@ -28,7 +31,8 @@ public class WareSkuController {
/**
* 列表
*/
@RequestMapping("/list")
@GetMapping("/list")
@ApiOperation("列表")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = wareSkuService.queryPage(params);
@ -40,6 +44,7 @@ public class WareSkuController {
* 信息
*/
@RequestMapping("/info/{id}")
@ApiOperation("信息")
public R info(@PathVariable("id") Long id){
WareSkuEntity wareSku = wareSkuService.getById(id);
@ -50,6 +55,7 @@ public class WareSkuController {
* 保存
*/
@RequestMapping("/save")
@ApiOperation("保存")
public R save(@RequestBody WareSkuEntity wareSku){
wareSkuService.save(wareSku);
@ -60,6 +66,7 @@ public class WareSkuController {
* 修改
*/
@RequestMapping("/update")
@ApiOperation("修改")
public R update(@RequestBody WareSkuEntity wareSku){
wareSkuService.updateById(wareSku);
@ -70,6 +77,7 @@ public class WareSkuController {
* 删除
*/
@RequestMapping("/delete")
@ApiOperation("删除")
public R delete(@RequestBody Long[] ids){
wareSkuService.removeByIds(Arrays.asList(ids));

View File

@ -11,7 +11,7 @@ import java.util.Map;
*
* @author xiejs
* @email 1294405880@qq.com
* @date 2022-03-15 09:56:19
* @since 2022-03-15 09:56:19
*/
public interface WareSkuService extends IService<WareSkuEntity> {

View File

@ -1,8 +1,9 @@
package com.xjs.mall.ware.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.utils.StringUtils;
import com.xjs.mall.ware.dao.WareSkuDao;
import com.xjs.mall.ware.entity.WareSkuEntity;
import com.xjs.mall.ware.service.WareSkuService;
@ -18,12 +19,18 @@ public class WareSkuServiceImpl extends ServiceImpl<WareSkuDao, WareSkuEntity> i
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<WareSkuEntity> page = this.page(
new Query<WareSkuEntity>().getPage(params),
new QueryWrapper<WareSkuEntity>()
);
LambdaQueryWrapper<WareSkuEntity> wrapper = new LambdaQueryWrapper<>();
String key = (String) params.get(Query.KEY_NAME);
if (StringUtils.isNotEmpty(key)) {
wrapper.eq(WareSkuEntity::getSkuName, key).or()
.eq(WareSkuEntity::getSkuId, key).or()
.eq(WareSkuEntity::getWareId, key);
}
IPage<WareSkuEntity> page = this.page(new Query<WareSkuEntity>().getPage(params),wrapper);
return new PageUtils(page);
}
}
}