parent
d17f9a619d
commit
398a5396b7
@ -0,0 +1,86 @@
|
|||||||
|
package com.ruoyi.web.controller.mall;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.mall.domain.Brand;
|
||||||
|
import com.ruoyi.mall.domain.query.BrandQuery;
|
||||||
|
import com.ruoyi.mall.service.BrandService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.PageImpl;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品牌管理Controller
|
||||||
|
*/
|
||||||
|
@Api(description ="品牌管理接口列表")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/pms/brand")
|
||||||
|
public class BrandController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private BrandService service;
|
||||||
|
|
||||||
|
@ApiOperation("查询品牌管理列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:brand:list')")
|
||||||
|
@PostMapping("/list")
|
||||||
|
public ResponseEntity<Page<Brand>> list(@RequestBody BrandQuery query, Pageable page) {
|
||||||
|
List<Brand> list = service.selectList(query, page);
|
||||||
|
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
|
||||||
|
}
|
||||||
|
@ApiOperation("所有品牌管理列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:brand:list')")
|
||||||
|
@PostMapping("/all")
|
||||||
|
public ResponseEntity<List<Brand>> all(@RequestBody BrandQuery query) {
|
||||||
|
return ResponseEntity.ok(service.selectList(query, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("导出品牌管理列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:brand:export')")
|
||||||
|
@Log(title = "品牌管理", businessType = BusinessType.EXPORT)
|
||||||
|
@GetMapping("/export")
|
||||||
|
public ResponseEntity<String> export(BrandQuery query) {
|
||||||
|
// List<Brand> list = service.selectList(query, null);
|
||||||
|
// ExcelUtil<BrandVO> util = new ExcelUtil<>(BrandVO.class);
|
||||||
|
// return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "品牌管理数据"));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取品牌管理详细信息")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:brand:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public ResponseEntity<Brand> getInfo(@PathVariable("id") Long id) {
|
||||||
|
return ResponseEntity.ok(service.selectById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("新增品牌管理")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:brand:add')")
|
||||||
|
@Log(title = "品牌管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public ResponseEntity<Integer> add(@RequestBody Brand brand) {
|
||||||
|
return ResponseEntity.ok(service.insert(brand));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改品牌管理")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:brand:edit')")
|
||||||
|
@Log(title = "品牌管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public ResponseEntity<Integer> edit(@RequestBody Brand brand) {
|
||||||
|
return ResponseEntity.ok(service.update(brand));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除品牌管理")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:brand:remove')")
|
||||||
|
@Log(title = "品牌管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ResponseEntity<Integer> remove(@PathVariable Long id) {
|
||||||
|
return ResponseEntity.ok(service.deleteById(id));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
package com.ruoyi.web.controller.mall;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.mall.domain.ProductCategory;
|
||||||
|
import com.ruoyi.mall.domain.query.ProductCategoryQuery;
|
||||||
|
import com.ruoyi.mall.domain.vo.ProductCategoryVO;
|
||||||
|
import com.ruoyi.mall.service.ProductCategoryService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品分类Controller
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
* @date 2022-11-28
|
||||||
|
*/
|
||||||
|
@Api(description ="商品分类接口列表")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/pms/productCategory")
|
||||||
|
public class ProductCategoryController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ProductCategoryService service;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("查询商品分类列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:productCategory:list')")
|
||||||
|
@PostMapping("/list")
|
||||||
|
public ResponseEntity<List<ProductCategoryVO>> list(@RequestBody ProductCategoryQuery query) {
|
||||||
|
List<ProductCategoryVO> list = service.selectList(query, null);
|
||||||
|
return ResponseEntity.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取商品分类详细信息")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:productCategory:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public ResponseEntity<ProductCategory> getInfo(@PathVariable("id") Long id) {
|
||||||
|
return ResponseEntity.ok(service.selectById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("新增商品分类")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:productCategory:add')")
|
||||||
|
@Log(title = "商品分类", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public ResponseEntity<Integer> add(@RequestBody ProductCategory productCategory) {
|
||||||
|
return ResponseEntity.ok(service.insert(productCategory));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改商品分类")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:productCategory:edit')")
|
||||||
|
@Log(title = "商品分类", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public ResponseEntity<Integer> edit(@RequestBody ProductCategory productCategory) {
|
||||||
|
return ResponseEntity.ok(service.update(productCategory));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除商品分类")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:productCategory:remove')")
|
||||||
|
@Log(title = "商品分类", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ResponseEntity<Integer> remove(@PathVariable Long id) {
|
||||||
|
return ResponseEntity.ok(service.deleteById(id));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,96 @@
|
|||||||
|
package com.ruoyi.web.controller.mall;
|
||||||
|
|
||||||
|
import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourse;
|
||||||
|
import cn.xluobo.business.sc.course.domain.resp.course.RespSearchCourse;
|
||||||
|
import cn.xluobo.business.sc.course.service.IScCourseService;
|
||||||
|
import cn.xluobo.core.page.RespPage;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.mall.domain.Product;
|
||||||
|
import com.ruoyi.mall.domain.query.ProductQuery;
|
||||||
|
import com.ruoyi.mall.domain.vo.ProductVO;
|
||||||
|
import com.ruoyi.mall.service.ProductService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.PageImpl;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品信息Controller
|
||||||
|
*
|
||||||
|
* @author zcc
|
||||||
|
* @date 2022-11-28
|
||||||
|
*/
|
||||||
|
@Api(description ="商品信息接口列表")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/pms/product")
|
||||||
|
public class ProductController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private ProductService service;
|
||||||
|
@Autowired
|
||||||
|
private IScCourseService courseService;
|
||||||
|
|
||||||
|
@ApiOperation("查询商品信息列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:product:list')")
|
||||||
|
@PostMapping("/list")
|
||||||
|
public ResponseEntity<Page<Product>> list(@RequestBody ProductQuery query, Pageable page) {
|
||||||
|
// service.getIds(query);
|
||||||
|
List<Product> list = service.selectList(query, page);
|
||||||
|
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("导出商品信息列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:product:export')")
|
||||||
|
@Log(title = "商品信息", businessType = BusinessType.EXPORT)
|
||||||
|
@GetMapping("/export")
|
||||||
|
public ResponseEntity<String> export(ProductQuery query) {
|
||||||
|
// List<Product> list = service.selectList(query, null);
|
||||||
|
// ExcelUtil<ProductVO> util = new ExcelUtil<>(ProductVO.class);
|
||||||
|
// return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "商品信息数据"));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取商品信息详细信息")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:product:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public ResponseEntity<ProductVO> getInfo(@PathVariable("id") Long id) {
|
||||||
|
return ResponseEntity.ok(service.selectById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("新增商品信息")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:product:add')")
|
||||||
|
@Log(title = "商品信息", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public ResponseEntity<Integer> add(@RequestBody ProductVO product) {
|
||||||
|
return ResponseEntity.ok(service.insert(product));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改商品信息")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:product:edit')")
|
||||||
|
@Log(title = "商品信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public ResponseEntity<Integer> edit(@RequestBody ProductVO product) {
|
||||||
|
return ResponseEntity.ok(service.update(product));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除商品信息")
|
||||||
|
@PreAuthorize("@ss.hasPermi('pms:product:remove')")
|
||||||
|
@Log(title = "商品信息", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ResponseEntity<Integer> remove(@PathVariable Long id) {
|
||||||
|
return ResponseEntity.ok(service.deleteById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/courseList")
|
||||||
|
public ResponseEntity<RespPage<RespSearchCourse>> listCourseForProduct(@RequestBody ReqSearchScCourse query){
|
||||||
|
return ResponseEntity.ok(courseService.searchCourse(query));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
package com.ruoyi.mall.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.domain.BaseAudit;
|
||||||
|
import lombok.Data;
|
||||||
|
/**
|
||||||
|
* 品牌管理对象 mall_brand
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("mall_brand")
|
||||||
|
public class Brand extends BaseAudit {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
@Excel(name = "NAME")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
|
||||||
|
@Excel(name = "SORT")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
|
||||||
|
@Excel(name = "SHOW_STATUS")
|
||||||
|
private Integer showStatus;
|
||||||
|
|
||||||
|
|
||||||
|
@Excel(name = "品牌logo")
|
||||||
|
private String logo;
|
||||||
|
|
||||||
|
private Long storeId;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.ruoyi.mall.domain.query;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品牌管理 查询 对象
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BrandQuery {
|
||||||
|
|
||||||
|
private String nameLike;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer showStatus;
|
||||||
|
|
||||||
|
|
||||||
|
private String logo;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
package com.ruoyi.mall.domain.vo;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.domain.BaseAudit;
|
||||||
|
import lombok.Data;
|
||||||
|
/**
|
||||||
|
* 品牌管理 数据视图对象
|
||||||
|
*
|
||||||
|
* @author zcc
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BrandVO extends BaseAudit {
|
||||||
|
/** ID */
|
||||||
|
private Long id;
|
||||||
|
/** NAME */
|
||||||
|
@Excel(name = "NAME")
|
||||||
|
private String name;
|
||||||
|
/** SORT */
|
||||||
|
@Excel(name = "SORT")
|
||||||
|
private Integer sort;
|
||||||
|
/** SHOW_STATUS */
|
||||||
|
@Excel(name = "SHOW_STATUS")
|
||||||
|
private Integer showStatus;
|
||||||
|
/** 品牌logo */
|
||||||
|
@Excel(name = "品牌logo")
|
||||||
|
private String logo;
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.ruoyi.mall.domain.vo;
|
||||||
|
|
||||||
|
import com.ruoyi.mall.domain.Brand;
|
||||||
|
import com.ruoyi.mall.domain.Product;
|
||||||
|
import com.ruoyi.mall.domain.Sku;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ProductDetailVO {
|
||||||
|
private Product product;
|
||||||
|
private List<Sku> skus;
|
||||||
|
private Brand brand;
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.ruoyi.mall.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.mall.domain.Brand;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品牌管理Mapper接口
|
||||||
|
*
|
||||||
|
* @author zcc
|
||||||
|
*/
|
||||||
|
public interface BrandMapper extends BaseMapper<Brand> {
|
||||||
|
/**
|
||||||
|
* 查询品牌管理列表
|
||||||
|
*
|
||||||
|
* @param brand 品牌管理
|
||||||
|
* @return 品牌管理集合
|
||||||
|
*/
|
||||||
|
List<Brand> selectByEntity(Brand brand);
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.ruoyi.mall.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.mall.domain.ProductCategory;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品分类Mapper接口
|
||||||
|
*
|
||||||
|
* @author zcc
|
||||||
|
*/
|
||||||
|
public interface ProductCategoryMapper extends BaseMapper<ProductCategory> {
|
||||||
|
/**
|
||||||
|
* 查询商品分类列表
|
||||||
|
*
|
||||||
|
* @param productCategory 商品分类
|
||||||
|
* @return 商品分类集合
|
||||||
|
*/
|
||||||
|
List<ProductCategory> selectByEntity(ProductCategory productCategory);
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.ruoyi.mall.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.mall.domain.Product;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品信息Mapper接口
|
||||||
|
*
|
||||||
|
* @author zcc
|
||||||
|
*/
|
||||||
|
public interface ProductMapper extends BaseMapper<Product> {
|
||||||
|
/**
|
||||||
|
* 查询商品信息列表
|
||||||
|
*
|
||||||
|
* @param product 商品信息
|
||||||
|
* @return 商品信息集合
|
||||||
|
*/
|
||||||
|
List<Product> selectByEntity(Product product);
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.ruoyi.mall.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.mall.domain.Sku;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sku信息Mapper接口
|
||||||
|
*
|
||||||
|
* @author zcc
|
||||||
|
*/
|
||||||
|
public interface SkuMapper extends BaseMapper<Sku> {
|
||||||
|
/**
|
||||||
|
* 查询sku信息列表
|
||||||
|
*
|
||||||
|
* @param sku sku信息
|
||||||
|
* @return sku信息集合
|
||||||
|
*/
|
||||||
|
List<Sku> selectByEntity(Sku sku);
|
||||||
|
|
||||||
|
int updateStockById(@Param("skuId")Long skuId, @Param("optDate")LocalDateTime optDate, @Param("quantity")Integer quantity);
|
||||||
|
}
|
||||||
@ -0,0 +1,103 @@
|
|||||||
|
package com.ruoyi.mall.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.mall.domain.Brand;
|
||||||
|
import com.ruoyi.mall.domain.query.BrandQuery;
|
||||||
|
import com.ruoyi.mall.mapper.BrandMapper;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品牌管理Service业务层处理
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author zcc
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BrandService {
|
||||||
|
@Autowired
|
||||||
|
private BrandMapper brandMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询品牌管理
|
||||||
|
*
|
||||||
|
* @param id 品牌管理主键
|
||||||
|
* @return 品牌管理
|
||||||
|
*/
|
||||||
|
public Brand selectById(Long id) {
|
||||||
|
return brandMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询品牌管理列表
|
||||||
|
*
|
||||||
|
* @param query 查询条件
|
||||||
|
* @param page 分页条件
|
||||||
|
* @return 品牌管理
|
||||||
|
*/
|
||||||
|
public List<Brand> selectList(BrandQuery query, Pageable page) {
|
||||||
|
if (page != null) {
|
||||||
|
PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize());
|
||||||
|
}
|
||||||
|
QueryWrapper<Brand> qw = new QueryWrapper<>();
|
||||||
|
String nameLike = query.getNameLike();
|
||||||
|
if (!StringUtils.isEmpty(nameLike)) {
|
||||||
|
qw.like("name", nameLike);
|
||||||
|
}
|
||||||
|
Integer sort = query.getSort();
|
||||||
|
if (sort != null) {
|
||||||
|
qw.eq("sort", sort);
|
||||||
|
}
|
||||||
|
Integer showStatus = query.getShowStatus();
|
||||||
|
if (showStatus != null) {
|
||||||
|
qw.eq("show_status", showStatus);
|
||||||
|
}
|
||||||
|
String logo = query.getLogo();
|
||||||
|
if (!StringUtils.isEmpty(logo)) {
|
||||||
|
qw.eq("logo", logo);
|
||||||
|
}
|
||||||
|
qw.eq("store_id", SecurityUtils.getDeptId());
|
||||||
|
qw.orderByAsc("sort");
|
||||||
|
|
||||||
|
return brandMapper.selectList(qw);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增品牌管理
|
||||||
|
*
|
||||||
|
* @param brand 品牌管理
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insert(Brand brand) {
|
||||||
|
brand.setCreateTime(LocalDateTime.now());
|
||||||
|
brand.setStoreId(SecurityUtils.getDeptId());
|
||||||
|
return brandMapper.insert(brand);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改品牌管理
|
||||||
|
*
|
||||||
|
* @param brand 品牌管理
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int update(Brand brand) {
|
||||||
|
return brandMapper.updateById(brand);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除品牌管理信息
|
||||||
|
*
|
||||||
|
* @param id 品牌管理主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteById(Long id) {
|
||||||
|
return brandMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.mall.mapper.BrandMapper">
|
||||||
|
|
||||||
|
<resultMap type="Brand" id="BrandResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="name" column="name"/>
|
||||||
|
<result property="sort" column="sort"/>
|
||||||
|
<result property="showStatus" column="show_status"/>
|
||||||
|
<result property="logo" column="logo"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectBrandVo">
|
||||||
|
select id, name, sort, show_status, logo, create_by, create_time, update_by, update_time from pms_brand
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectByEntity" parameterType="Brand" resultMap="BrandResult">
|
||||||
|
<include refid="selectBrandVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||||
|
<if test="sort != null "> and sort = #{sort}</if>
|
||||||
|
<if test="showStatus != null "> and show_status = #{showStatus}</if>
|
||||||
|
<if test="logo != null and logo != ''"> and logo = #{logo}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.mall.mapper.ProductCategoryMapper">
|
||||||
|
|
||||||
|
<resultMap type="ProductCategory" id="ProductCategoryResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="parentId" column="parent_id"/>
|
||||||
|
<result property="name" column="name"/>
|
||||||
|
<result property="level" column="level"/>
|
||||||
|
<result property="showStatus" column="show_status"/>
|
||||||
|
<result property="sort" column="sort"/>
|
||||||
|
<result property="icon" column="icon"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="storeId" column="store_id" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectProductCategoryVo">
|
||||||
|
select id, parent_id, name, level, show_status, sort, icon, create_by, create_time, update_by, update_time from pms_product_category
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectByEntity" parameterType="ProductCategory" resultMap="ProductCategoryResult">
|
||||||
|
<include refid="selectProductCategoryVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
||||||
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||||
|
<if test="level != null "> and level = #{level}</if>
|
||||||
|
<if test="showStatus != null "> and show_status = #{showStatus}</if>
|
||||||
|
<if test="sort != null "> and sort = #{sort}</if>
|
||||||
|
<if test="icon != null and icon != ''"> and icon = #{icon}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.mall.mapper.ProductMapper">
|
||||||
|
|
||||||
|
<resultMap type="Product" id="ProductResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="brandId" column="brand_id"/>
|
||||||
|
<result property="categoryId" column="category_id"/>
|
||||||
|
<result property="outProductId" column="out_product_id"/>
|
||||||
|
<result property="name" column="name"/>
|
||||||
|
<result property="pic" column="pic"/>
|
||||||
|
<result property="albumPics" column="album_pics"/>
|
||||||
|
<result property="publishStatus" column="publish_status"/>
|
||||||
|
<result property="sort" column="sort"/>
|
||||||
|
<result property="price" column="price"/>
|
||||||
|
<result property="unit" column="unit"/>
|
||||||
|
<result property="weight" column="weight"/>
|
||||||
|
<result property="detailHtml" column="detail_html"/>
|
||||||
|
<result property="detailMobileHtml" column="detail_mobile_html"/>
|
||||||
|
<result property="brandName" column="brand_name"/>
|
||||||
|
<result property="productCategoryName" column="product_category_name"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectProductVo">
|
||||||
|
select id, brand_id, category_id, out_product_id, name, pic, album_pics, publish_status, sort, price, unit, weight, detail_html, detail_mobile_html, brand_name, product_category_name, create_by, create_time, update_by, update_time from pms_product
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectByEntity" parameterType="Product" resultMap="ProductResult">
|
||||||
|
<include refid="selectProductVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="brandId != null "> and brand_id = #{brandId}</if>
|
||||||
|
<if test="categoryId != null "> and category_id = #{categoryId}</if>
|
||||||
|
<if test="outProductId != null and outProductId != ''"> and out_product_id = #{outProductId}</if>
|
||||||
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||||
|
<if test="pic != null and pic != ''"> and pic = #{pic}</if>
|
||||||
|
<if test="albumPics != null and albumPics != ''"> and album_pics = #{albumPics}</if>
|
||||||
|
<if test="publishStatus != null "> and publish_status = #{publishStatus}</if>
|
||||||
|
<if test="sort != null "> and sort = #{sort}</if>
|
||||||
|
<if test="price != null "> and price = #{price}</if>
|
||||||
|
<if test="unit != null and unit != ''"> and unit = #{unit}</if>
|
||||||
|
<if test="weight != null "> and weight = #{weight}</if>
|
||||||
|
<if test="detailHtml != null and detailHtml != ''"> and detail_html = #{detailHtml}</if>
|
||||||
|
<if test="detailMobileHtml != null and detailMobileHtml != ''"> and detail_mobile_html = #{detailMobileHtml}</if>
|
||||||
|
<if test="brandName != null and brandName != ''"> and brand_name like concat('%', #{brandName}, '%')</if>
|
||||||
|
<if test="productCategoryName != null and productCategoryName != ''"> and product_category_name like concat('%', #{productCategoryName}, '%')</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.mall.mapper.SkuMapper">
|
||||||
|
|
||||||
|
<resultMap type="Sku" id="SkuResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="productId" column="product_id"/>
|
||||||
|
<result property="outSkuId" column="out_sku_id"/>
|
||||||
|
<result property="price" column="price"/>
|
||||||
|
<result property="pic" column="pic"/>
|
||||||
|
<result property="spData" column="sp_data"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectSkuVo">
|
||||||
|
select id, product_id, out_sku_id, price, pic, sp_data, create_by, create_time, update_by, update_time from pms_sku
|
||||||
|
</sql>
|
||||||
|
<update id="updateStockById">
|
||||||
|
update
|
||||||
|
pms_sku
|
||||||
|
set
|
||||||
|
stock = stock - #{quantity},
|
||||||
|
update_time = #{optDate}
|
||||||
|
where id = #{skuId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="selectByEntity" parameterType="Sku" resultMap="SkuResult">
|
||||||
|
<include refid="selectSkuVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="productId != null "> and product_id = #{productId}</if>
|
||||||
|
<if test="outSkuId != null and outSkuId != ''"> and out_sku_id = #{outSkuId}</if>
|
||||||
|
<if test="price != null "> and price = #{price}</if>
|
||||||
|
<if test="pic != null and pic != ''"> and pic = #{pic}</if>
|
||||||
|
<if test="spData != null and spData != ''"> and sp_data = #{spData}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in new issue