dev798
wxy 2024-03-29 10:26:08 +08:00
parent 135b8ca24a
commit 1a96156512
21 changed files with 576 additions and 0 deletions

View File

@ -0,0 +1,219 @@
package com.muyu.common.core.domain;
import com.muyu.common.core.constant.HttpStatus;
import com.muyu.common.core.utils.StringUtils;
import java.util.HashMap;
import java.util.Objects;
/**
*
*
* @author ruoyi
*/
public class AjaxResult extends HashMap<String, Object>
{
private static final long serialVersionUID = 1L;
/** 状态码 */
public static final String CODE_TAG = "code";
/** 返回内容 */
public static final String MSG_TAG = "msg";
/** 数据对象 */
public static final String DATA_TAG = "data";
/**
* AjaxResult 使
*/
public AjaxResult()
{
}
/**
* AjaxResult
*
* @param code
* @param msg
*/
public AjaxResult(int code, String msg)
{
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
}
/**
* AjaxResult
*
* @param code
* @param msg
* @param data
*/
public AjaxResult(int code, String msg, Object data)
{
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
if (StringUtils.isNotNull(data))
{
super.put(DATA_TAG, data);
}
}
/**
*
*
* @return
*/
public static AjaxResult success()
{
return AjaxResult.success("操作成功");
}
/**
*
*
* @return
*/
public static AjaxResult success(Object data)
{
return AjaxResult.success("操作成功", data);
}
/**
*
*
* @param msg
* @return
*/
public static AjaxResult success(String msg)
{
return AjaxResult.success(msg, null);
}
/**
*
*
* @param msg
* @param data
* @return
*/
public static AjaxResult success(String msg, Object data)
{
return new AjaxResult(HttpStatus.SUCCESS, msg, data);
}
/**
*
*
* @param msg
* @return
*/
public static AjaxResult warn(String msg)
{
return AjaxResult.warn(msg, null);
}
/**
*
*
* @param msg
* @param data
* @return
*/
public static AjaxResult warn(String msg, Object data)
{
return new AjaxResult(HttpStatus.WARN, msg, data);
}
/**
*
*
* @return
*/
public static AjaxResult error()
{
return AjaxResult.error("操作失败");
}
/**
*
*
* @param msg
* @return
*/
public static AjaxResult error(String msg)
{
return AjaxResult.error(msg, null);
}
/**
*
*
* @param msg
* @param data
* @return
*/
public static AjaxResult error(String msg, Object data)
{
return new AjaxResult(HttpStatus.ERROR, msg, data);
}
/**
*
*
* @param code
* @param msg
* @return
*/
public static AjaxResult error(int code, String msg)
{
return new AjaxResult(code, msg, null);
}
/**
*
*
* @return
*/
public boolean isSuccess()
{
return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
}
/**
*
*
* @return
*/
public boolean isWarn()
{
return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG));
}
/**
*
*
* @return
*/
public boolean isError()
{
return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG));
}
/**
* 便
*
* @param key
* @param value
* @return
*/
@Override
public AjaxResult put(String key, Object value)
{
super.put(key, value);
return this;
}
}

View File

@ -0,0 +1,79 @@
package com.muyu.common.core.domain;
import com.muyu.common.core.web.domain.BaseEntity;
import org.w3c.dom.stylesheets.LinkStyle;
import java.util.ArrayList;
import java.util.List;
/**
* @Author: wangxinyuan
* @Date: 2024/3/28 15:33
*/
public class TreeEntity extends BaseEntity {
private static final long serialVersionUID= 1L ;
private String parentName;
private Long parentId;
private Integer orderNum;
private String ancestors;
private List<?> children = new ArrayList<>();
@Override
public String toString() {
return "TreeEntity{" +
"parentName='" + parentName + '\'' +
", parentId=" + parentId +
", orderNum=" + orderNum +
", ancestors='" + ancestors + '\'' +
", children=" + children +
'}';
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
public String getAncestors() {
return ancestors;
}
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
public List<?> getChildren() {
return children;
}
public void setChildren(List<?> children) {
this.children = children;
}
}

View File

@ -0,0 +1,14 @@
package com.muyu.product.domain.req;
import java.util.List;
/**
* @Author: wangxinyuan
* @Date: 2024/3/29 10:23
*/
public class ProductInfoReq {
public List<ProductInfoReq> getSkuList(ProductInfoReq productInfoReq) {
return null;
}
}

View File

@ -0,0 +1,39 @@
package com.muyu.product.controller;
import com.muyu.common.core.domain.AjaxResult;
import com.muyu.product.domain.ProductBrand;
import com.muyu.product.service.ArgumentService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Author: wangxinyuan
* @Date: 2024/3/28 15:10
*/
@RestController
@RequestMapping("/argument")
@Api(value = "下拉框管理")
public class ArgumentController {
@Autowired
private ArgumentService argumentService;
/*品牌下拉框*/
@GetMapping("queryBrand")
public AjaxResult queryBrand(){
List<ProductBrand>list=argumentService.queryBrand();
return AjaxResult.success(list);
}
@GetMapping("/queryService")
public AjaxResult queryService(){
return null;
}
}

View File

@ -1,5 +1,13 @@
package com.muyu.product.controller;
import com.github.pagehelper.PageInfo;
import com.muyu.common.core.domain.AjaxResult;
import com.muyu.product.domain.ProductBrand;
import com.muyu.product.service.ProductBrandService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -13,4 +21,18 @@ import org.springframework.web.bind.annotation.RestController;
public class ProductBrandController {
@Autowired
private ProductBrandService productBrandService;
@ApiOperation("查询商品品牌")
@GetMapping("queryProductBrand")
public AjaxResult queryProductBrand(@RequestBody ProductBrand productBrand){
PageInfo<ProductBrand>list=productBrandService.queryProductBrand(productBrand);
return AjaxResult.success(list);
}
}

View File

@ -1,6 +1,10 @@
package com.muyu.product.controller;
import com.github.pagehelper.PageInfo;
import com.muyu.common.core.domain.AjaxResult;
import com.muyu.product.domain.Product;
import com.muyu.product.domain.ProductSkuAttr;
import com.muyu.product.domain.req.ProductInfoReq;
import com.muyu.product.domain.req.ProductReq;
import com.muyu.product.domain.util.R;
import com.muyu.product.service.ProductService;
@ -10,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
/**
* Controller
@ -35,6 +41,23 @@ public class ProductController {
return R.ok();
}
@ApiOperation("查询商品信息")
@GetMapping("queryProduct")
public AjaxResult queryProduct(@RequestBody ProductReq req){
PageInfo<Product>list=productService.queryProduct(req);
return AjaxResult.success(list);
}
private void saveSku(ProductInfoReq productInfoReq){
List<ProductInfoReq>productSkuList=productInfoReq.getSkuList(productInfoReq);
ArrayList<ProductSkuAttr> attrs = new ArrayList<>();
}
}

View File

@ -0,0 +1,17 @@
package com.muyu.product.mapper;
import com.muyu.product.domain.ProductBrand;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Author: wangxinyuan
* @Date: 2024/3/28 15:16
*/
@Mapper
public interface ArgumentMapper {
List<ProductBrand> queryBrand();
}

View File

@ -1,8 +1,11 @@
package com.muyu.product.mapper;
import com.muyu.product.domain.Product;
import com.muyu.product.domain.req.ProductReq;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Author: wangxinyuan
* @Date: 2024/3/26 19:49
@ -15,4 +18,6 @@ public interface ProductMapper {
Integer findProductNumber(Product product);
void insertProcuduct(Product product);
List<Product> queryProduct(ProductReq req);
}

View File

@ -0,0 +1,14 @@
package com.muyu.product.mapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Author: wangxinyuan
* @Date: 2024/3/28 15:28
*/
@Mapper
public interface ServiceMapper {
int insertProductService(Integer productId, List<Integer> serviceIds);
}

View File

@ -0,0 +1,14 @@
package com.muyu.product.service;
import com.muyu.product.domain.ProductBrand;
import java.util.List;
/**
* @Author: wangxinyuan
* @Date: 2024/3/28 15:11
*/
public interface ArgumentService {
List<ProductBrand> queryBrand();
}

View File

@ -1,9 +1,14 @@
package com.muyu.product.service;
import com.github.pagehelper.PageInfo;
import com.muyu.product.domain.ProductBrand;
/**
* @Author: wangxinyuan
* @Date: 2024/3/26 20:31
*/
public interface ProductBrandService {
PageInfo<ProductBrand> queryProductBrand(ProductBrand productBrand);
}

View File

@ -1,5 +1,7 @@
package com.muyu.product.service;
import com.github.pagehelper.PageInfo;
import com.muyu.product.domain.Product;
import com.muyu.product.domain.req.ProductReq;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
@ -13,4 +15,6 @@ public interface ProductService {
void productInsert(ProductReq productReq);
PageInfo<Product> queryProduct(ProductReq req);
}

View File

@ -5,4 +5,7 @@ package com.muyu.product.service;
* @Date: 2024/3/26 20:35
*/
public interface ProductSkuAttrService {
}

View File

@ -0,0 +1,12 @@
package com.muyu.product.service;
import java.util.List;
/**
* @Author: wangxinyuan
* @Date: 2024/3/28 15:25
*/
public interface ServiceService {
int insertProductService(Integer productId, List<Integer> serviceIds);
}

View File

@ -0,0 +1,26 @@
package com.muyu.product.service.impl;
import com.muyu.product.domain.ProductBrand;
import com.muyu.product.mapper.ArgumentMapper;
import com.muyu.product.service.ArgumentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author: wangxinyuan
* @Date: 2024/3/28 15:11
*/
@Service
public class ArgumentServiceImpl implements ArgumentService {
@Autowired
private ArgumentMapper argumentMapper;
@Override
public List<ProductBrand> queryBrand() {
return argumentMapper.queryBrand();
}
}

View File

@ -1,6 +1,11 @@
package com.muyu.product.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.muyu.product.domain.ProductBrand;
import com.muyu.product.mapper.ProductBrandMapper;
import com.muyu.product.service.ProductBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@ -9,4 +14,12 @@ import org.springframework.stereotype.Service;
*/
@Service
public class ProductBrandServiceImpl implements ProductBrandService {
@Autowired
private ProductBrandMapper productBrandMapper;
@Override
public PageInfo<ProductBrand> queryProductBrand(ProductBrand productBrand) {
PageHelper.startPage();
return null;
}
}

View File

@ -1,5 +1,7 @@
package com.muyu.product.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.muyu.product.domain.Product;
import com.muyu.product.domain.req.ProductReq;
import com.muyu.product.handel.ValidationResult;
@ -10,6 +12,7 @@ import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.concurrent.CompletableFuture;
/**
@ -100,6 +103,14 @@ public class ProductServiceImpl implements ProductService {
}
@Override
public PageInfo<Product> queryProduct(ProductReq req) {
PageHelper.startPage(req.getPageNum(), req.getPageSize());
List<Product>products=productMapper.queryProduct(req);
PageInfo<Product> pageInfo = new PageInfo<>(products);
return pageInfo;
}
private void insertProductSku(ProductReq productReq) {
}

View File

@ -0,0 +1,24 @@
package com.muyu.product.service.impl;
import com.muyu.product.mapper.ServiceMapper;
import com.muyu.product.service.ServiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author: wangxinyuan
* @Date: 2024/3/28 15:26
*/
@Service
public class ServiceServiceImpl implements ServiceService {
@Autowired
private ServiceMapper serviceMapper;
@Override
public int insertProductService(Integer productId, List<Integer> serviceIds) {
return serviceMapper.insertProductService(productId,serviceIds);
}
}

View File

@ -0,0 +1,8 @@
<?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.muyu.product.mapper.ArgumentMapper">
<select id="queryBrand" resultType="com.bwie.pinxixiproduct.domain.DTO.Brand">select id,brand_name from t_brand</select>
<select id="queryService" resultType="com.bwie.pinxixiproduct.domain.DTO.Services">select id,service_name from t_service</select>
</mapper>

View File

@ -68,6 +68,16 @@
WHERE id = #{id}
</select>
<select id="queryProduct" resultType="com.muyu.product.domain.Product">
SELECT id, product_name, product_number, product_examine, brand_id, type_id, product_subheading,
product_information, product_unit, product_weight, product_sort, promotion_id, product_points,
product_growth, product_max_points, product_foreknow, product_status, product_new, product_recommended,
details_title, details_information, details_key_word, details_remark, method_type, method_id,
move_information, pc_information
FROM t_product
WHERE id = #{id}
</select>
<!-- 添加其他操作方法如插入、更新、删除等 -->
</mapper>

View File

@ -0,0 +1,14 @@
<?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.muyu.product.mapper.ServiceMapper">
<insert id="insertProductService">
insert t_product_service(product_id,service_id)
values
<foreach collection="serviceIds" item="id" separator=",">
(#{productId},#{id})
</foreach>
</insert>
</mapper>