提交修改
This commit is contained in:
parent
26e35e3311
commit
63eb63451d
@ -0,0 +1,50 @@
|
||||
package com.heyu.api.data.dao.vv;
|
||||
/**
|
||||
* <p>
|
||||
* 类目表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-08-24
|
||||
*/
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.heyu.api.data.entity.vv.VvAdminCategoryEntity;
|
||||
import com.lz.mybatis.plugin.annotations.IN;
|
||||
import com.lz.mybatis.plugin.annotations.OrderBy;
|
||||
import com.lz.mybatis.plugin.annotations.OrderType;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface VvAdminCategoryDao extends BaseMapper<VvAdminCategoryEntity> {
|
||||
|
||||
|
||||
VvAdminCategoryEntity selectVvAdminCategoryById(@Param("id")Long id);
|
||||
|
||||
|
||||
Long insertVvAdminCategory(VvAdminCategoryEntity vvAdminCategory);
|
||||
|
||||
|
||||
Long insertOrUpdateVvAdminCategory(VvAdminCategoryEntity vvAdminCategory);
|
||||
|
||||
|
||||
int updateVvAdminCategoryById(VvAdminCategoryEntity vvAdminCategory);
|
||||
|
||||
|
||||
int updateCoverVvAdminCategoryById(VvAdminCategoryEntity vvAdminCategory);
|
||||
|
||||
|
||||
int deleteVvAdminCategoryById(@Param("id")Long id);
|
||||
|
||||
|
||||
List<VvAdminCategoryEntity> selectVvCategoryAll();
|
||||
|
||||
|
||||
@OrderBy(value={VvAdminCategoryEntity.default_sort},type={OrderType.ASC})
|
||||
List<VvAdminCategoryEntity> selectVvCategoryByParentId(Integer parentId);
|
||||
|
||||
List<VvAdminCategoryEntity> selectVvCategoryByIds(@IN List<Long> id);
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package com.heyu.api.data.dao.vv;
|
||||
/**
|
||||
* <p>
|
||||
* 类目表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-08-24
|
||||
*/
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.heyu.api.data.entity.vv.VvAppCategoryEntity;
|
||||
import com.lz.mybatis.plugin.annotations.IN;
|
||||
import com.lz.mybatis.plugin.annotations.OrderBy;
|
||||
import com.lz.mybatis.plugin.annotations.OrderType;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface VvAppCategoryDao extends BaseMapper<VvAppCategoryEntity> {
|
||||
|
||||
|
||||
VvAppCategoryEntity selectVvAppCategoryById(@Param("id")Long id);
|
||||
|
||||
|
||||
Long insertVvAppCategory(VvAppCategoryEntity vvAppCategory);
|
||||
|
||||
|
||||
Long insertOrUpdateVvAppCategory(VvAppCategoryEntity vvAppCategory);
|
||||
|
||||
|
||||
int updateVvAppCategoryById(VvAppCategoryEntity vvAppCategory);
|
||||
|
||||
|
||||
int updateCoverVvAppCategoryById(VvAppCategoryEntity vvAppCategory);
|
||||
|
||||
|
||||
int deleteVvAppCategoryById(@Param("id")Long id);
|
||||
|
||||
|
||||
|
||||
List<VvAppCategoryEntity> selectVvCategoryAll();
|
||||
|
||||
|
||||
|
||||
|
||||
@OrderBy(value={VvAppCategoryEntity.default_sort},type={OrderType.ASC})
|
||||
List<VvAppCategoryEntity> selectVvCategoryByParentId(Integer parentId);
|
||||
|
||||
List<VvAppCategoryEntity> selectVvCategoryByIds(@IN List<Long> id);
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
package com.heyu.api.data.dao.vv;
|
||||
/**
|
||||
* <p>
|
||||
* 类目表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-08-20
|
||||
*/
|
||||
import com.heyu.api.data.entity.vv.VvCategoryEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.mybatis.plugin.annotations.IN;
|
||||
import com.lz.mybatis.plugin.annotations.OrderBy;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface VvCategoryDao extends BaseMapper<VvCategoryEntity> {
|
||||
|
||||
|
||||
VvCategoryEntity selectVvCategoryById(@Param("id") Long id);
|
||||
|
||||
|
||||
Long insertVvCategory(VvCategoryEntity vvCategory);
|
||||
|
||||
|
||||
Long insertOrUpdateVvCategory(VvCategoryEntity vvCategory);
|
||||
|
||||
|
||||
int updateVvCategoryById(VvCategoryEntity vvCategory);
|
||||
|
||||
|
||||
int updateCoverVvCategoryById(VvCategoryEntity vvCategory);
|
||||
|
||||
|
||||
int deleteVvCategoryById(@Param("id") Long id);
|
||||
|
||||
List<VvCategoryEntity> selectVvCategoryAll();
|
||||
|
||||
@OrderBy(VvCategoryEntity.default_sort)
|
||||
List<VvCategoryEntity> selectVvCategoryByParentId(Integer parentId);
|
||||
|
||||
|
||||
|
||||
List<VvCategoryEntity> selectVvCategoryByIds(@IN List<Long> id);
|
||||
}
|
||||
@ -7,12 +7,11 @@ package com.heyu.api.data.dao.vv;
|
||||
* @author quyixiao
|
||||
* @since 2025-08-20
|
||||
*/
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.heyu.api.data.entity.vv.VvCategoryPropertyEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.mybatis.plugin.annotations.IF;
|
||||
import com.lz.mybatis.plugin.annotations.IN;
|
||||
import com.lz.mybatis.plugin.annotations.OrderBy;
|
||||
import com.lz.mybatis.plugin.annotations.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -42,13 +41,15 @@ public interface VvCategoryPropertyDao extends BaseMapper<VvCategoryPropertyEnti
|
||||
int deleteVvCategoryPropertyById(@Param("id") Long id);
|
||||
|
||||
|
||||
|
||||
@OrderBy(value={VvCategoryPropertyEntity.default_sort}, type={OrderType.ASC})
|
||||
List<VvCategoryPropertyEntity> selectVvProperByCondition(IPage page,
|
||||
@IF String propertyName,
|
||||
@IF String categoryName,
|
||||
@IF @LIKE String propertyName,
|
||||
@IF @LIKE String categoryName,
|
||||
@IF Long categoryId);
|
||||
|
||||
|
||||
|
||||
@OrderBy(VvCategoryPropertyEntity.default_sort)
|
||||
@OrderBy(value={VvCategoryPropertyEntity.default_sort}, type={OrderType.ASC})
|
||||
List<VvCategoryPropertyEntity> selectVvPropertyByIds(@IN List<Long> id);
|
||||
}
|
||||
@ -11,6 +11,7 @@ import com.heyu.api.data.entity.vv.VvCategoryPropertyValueEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.mybatis.plugin.annotations.IN;
|
||||
import com.lz.mybatis.plugin.annotations.OrderBy;
|
||||
import com.lz.mybatis.plugin.annotations.OrderType;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -38,9 +39,10 @@ public interface VvCategoryPropertyValueDao extends BaseMapper<VvCategoryPropert
|
||||
int deleteVvCategoryPropertyValueById(@Param("id")Long id);
|
||||
|
||||
|
||||
@OrderBy(value={VvCategoryPropertyValueEntity.default_sort},type={OrderType.ASC})
|
||||
List<VvCategoryPropertyValueEntity> selectVvPropertyValueByPropertyId(Long categoryPropertyId);
|
||||
|
||||
|
||||
@OrderBy(VvCategoryPropertyValueEntity.default_sort)
|
||||
@OrderBy(value={VvCategoryPropertyValueEntity.default_sort},type={OrderType.ASC})
|
||||
List<VvCategoryPropertyValueEntity> selectVvPropertyValueByIds(@IN List<Long> id);
|
||||
}
|
||||
@ -39,7 +39,7 @@ public interface VvProductDao extends BaseMapper<VvProductEntity> {
|
||||
|
||||
int deleteVvProductById(@Param("id") Long id);
|
||||
|
||||
@OrderBy(VvProductEntity.default_sort)
|
||||
@OrderBy(value={VvProductEntity.default_sort},type={OrderType.ASC})
|
||||
List<VvProductEntity> selectVvProductByFrontPage(Integer frontPage);
|
||||
|
||||
|
||||
|
||||
@ -1,15 +1,17 @@
|
||||
package com.heyu.api.data.dao.vv;
|
||||
/**
|
||||
* <p>
|
||||
* 商品详描 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-08-20
|
||||
*/
|
||||
* <p>
|
||||
* 商品详描 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-08-20
|
||||
*/
|
||||
|
||||
import com.heyu.api.data.entity.vv.VvProductDetailEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.mybatis.plugin.annotations.OrderBy;
|
||||
import com.lz.mybatis.plugin.annotations.OrderType;
|
||||
import com.lz.mybatis.plugin.annotations.Realy;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -20,33 +22,30 @@ import java.util.List;
|
||||
public interface VvProductDetailDao extends BaseMapper<VvProductDetailEntity> {
|
||||
|
||||
|
||||
VvProductDetailEntity selectVvProductDetailById(@Param("id")Long id);
|
||||
VvProductDetailEntity selectVvProductDetailById(@Param("id") Long id);
|
||||
|
||||
|
||||
Long insertVvProductDetail(VvProductDetailEntity vvProductDetail);
|
||||
Long insertVvProductDetail(VvProductDetailEntity vvProductDetail);
|
||||
|
||||
|
||||
Long insertOrUpdateVvProductDetail(VvProductDetailEntity vvProductDetail);
|
||||
Long insertOrUpdateVvProductDetail(VvProductDetailEntity vvProductDetail);
|
||||
|
||||
|
||||
int updateVvProductDetailById(VvProductDetailEntity vvProductDetail);
|
||||
int updateVvProductDetailById(VvProductDetailEntity vvProductDetail);
|
||||
|
||||
|
||||
int updateCoverVvProductDetailById(VvProductDetailEntity vvProductDetail);
|
||||
int updateCoverVvProductDetailById(VvProductDetailEntity vvProductDetail);
|
||||
|
||||
|
||||
int deleteVvProductDetailById(@Param("id")Long id);
|
||||
int deleteVvProductDetailById(@Param("id") Long id);
|
||||
|
||||
|
||||
@OrderBy(value = {VvProductDetailEntity.default_sort}, type = {OrderType.ASC})
|
||||
List<VvProductDetailEntity> selectVvProductDetailByProductId(Long productId);
|
||||
|
||||
|
||||
@OrderBy(VvProductDetailEntity.default_sort)
|
||||
List<VvProductDetailEntity> selectVvProductDetailByProductId(Long productId);
|
||||
|
||||
|
||||
|
||||
@Realy
|
||||
int deleteVvProductDetailRealById(@Param("id")Long id);
|
||||
@Realy
|
||||
int deleteVvProductDetailRealById(@Param("id") Long id);
|
||||
|
||||
|
||||
}
|
||||
@ -1,11 +1,11 @@
|
||||
package com.heyu.api.data.dto.vv;
|
||||
|
||||
import com.heyu.api.data.entity.vv.VvCategoryEntity;
|
||||
import com.heyu.api.data.entity.vv.VvAdminCategoryEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class
|
||||
VvCategoryDTO extends VvCategoryEntity {
|
||||
VvAdminCategoryCategoryDTO extends VvAdminCategoryEntity {
|
||||
/***
|
||||
* 是否有child
|
||||
*/
|
||||
@ -0,0 +1,201 @@
|
||||
package com.heyu.api.data.entity.vv;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.lz.mybatis.plugin.annotations.AS;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;import java.util.Date;
|
||||
/**
|
||||
*类目表
|
||||
* @author quyixiao
|
||||
* @since 2025-08-24
|
||||
*/
|
||||
|
||||
@Data
|
||||
@TableName("vv_admin_category")
|
||||
public class VvAdminCategoryEntity implements java.io.Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public final static String CLASS_NAME ="com.heyu.api.data.entity.vv.VvAdminCategoryEntity:";
|
||||
|
||||
public final static String all = CLASS_NAME + "*";
|
||||
public final static String id_ = CLASS_NAME + "id"; //
|
||||
public final static String is_delete = CLASS_NAME + "is_delete"; // 是否删除:0 否 1 删除
|
||||
public final static String create_time = CLASS_NAME + "create_time"; // 创建时间
|
||||
public final static String modify_time = CLASS_NAME + "modify_time"; // 修改时间
|
||||
public final static String parent_id = CLASS_NAME + "parent_id"; // 父亲类目id
|
||||
public final static String image_url = CLASS_NAME + "image_url"; // 图片url
|
||||
public final static String name_ = CLASS_NAME + "name"; // 名称
|
||||
public final static String level_ = CLASS_NAME + "level"; // 层级
|
||||
public final static String default_sort = CLASS_NAME + "default_sort"; // 排序
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
//是否删除:0 否 1 删除
|
||||
private Integer isDelete;
|
||||
//创建时间
|
||||
private Date createTime;
|
||||
//修改时间
|
||||
private Date modifyTime;
|
||||
//父亲类目id
|
||||
private Long parentId;
|
||||
//图片url
|
||||
private String imageUrl;
|
||||
//名称
|
||||
private String name;
|
||||
//层级
|
||||
private Integer level;
|
||||
//排序
|
||||
private Integer defaultSort;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否删除:0 否 1 删除
|
||||
* @return
|
||||
*/
|
||||
public Integer getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
/**
|
||||
* 是否删除:0 否 1 删除
|
||||
* @param isDelete
|
||||
*/
|
||||
public void setIsDelete(Integer isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
* @return
|
||||
*/
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
/**
|
||||
* 创建时间
|
||||
* @param createTime
|
||||
*/
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
* @return
|
||||
*/
|
||||
public Date getModifyTime() {
|
||||
return modifyTime;
|
||||
}
|
||||
/**
|
||||
* 修改时间
|
||||
* @param modifyTime
|
||||
*/
|
||||
public void setModifyTime(Date modifyTime) {
|
||||
this.modifyTime = modifyTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 父亲类目id
|
||||
* @return
|
||||
*/
|
||||
public Long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
/**
|
||||
* 父亲类目id
|
||||
* @param parentId
|
||||
*/
|
||||
public void setParentId(Long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片url
|
||||
* @return
|
||||
*/
|
||||
public String getImageUrl() {
|
||||
return imageUrl;
|
||||
}
|
||||
/**
|
||||
* 图片url
|
||||
* @param imageUrl
|
||||
*/
|
||||
public void setImageUrl(String imageUrl) {
|
||||
this.imageUrl = imageUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 名称
|
||||
* @return
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* 名称
|
||||
* @param name
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 层级
|
||||
* @return
|
||||
*/
|
||||
public Integer getLevel() {
|
||||
return level;
|
||||
}
|
||||
/**
|
||||
* 层级
|
||||
* @param level
|
||||
*/
|
||||
public void setLevel(Integer level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序
|
||||
* @return
|
||||
*/
|
||||
public Integer getDefaultSort() {
|
||||
return defaultSort;
|
||||
}
|
||||
/**
|
||||
* 排序
|
||||
* @param defaultSort
|
||||
*/
|
||||
public void setDefaultSort(Integer defaultSort) {
|
||||
this.defaultSort = defaultSort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VvAdminCategoryEntity{" +
|
||||
",id=" + id +
|
||||
",isDelete=" + isDelete +
|
||||
",createTime=" + createTime +
|
||||
",modifyTime=" + modifyTime +
|
||||
",parentId=" + parentId +
|
||||
",imageUrl=" + imageUrl +
|
||||
",name=" + name +
|
||||
",level=" + level +
|
||||
",defaultSort=" + defaultSort +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -10,15 +10,15 @@ import java.util.Date;import java.util.Date;
|
||||
/**
|
||||
*类目表
|
||||
* @author quyixiao
|
||||
* @since 2025-08-20
|
||||
* @since 2025-08-24
|
||||
*/
|
||||
|
||||
@Data
|
||||
@TableName("vv_category")
|
||||
public class VvCategoryEntity implements java.io.Serializable {
|
||||
@TableName("vv_app_category")
|
||||
public class VvAppCategoryEntity implements java.io.Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public final static String CLASS_NAME ="com.heyu.api.data.entity.vv.VvCategoryEntity:";
|
||||
public final static String CLASS_NAME ="com.heyu.api.data.entity.vv.VvAppCategoryEntity:";
|
||||
|
||||
public final static String all = CLASS_NAME + "*";
|
||||
public final static String id_ = CLASS_NAME + "id"; //
|
||||
@ -186,7 +186,7 @@ private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VvCategoryEntity{" +
|
||||
return "VvAppCategoryEntity{" +
|
||||
",id=" + id +
|
||||
",isDelete=" + isDelete +
|
||||
",createTime=" + createTime +
|
||||
@ -0,0 +1,68 @@
|
||||
package com.heyu.api.data.service.impl.vv;
|
||||
/**
|
||||
* <p>
|
||||
* 类目表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-08-24
|
||||
*/
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.heyu.api.data.dao.vv.VvAdminCategoryDao;
|
||||
import com.heyu.api.data.entity.vv.VvAdminCategoryEntity;
|
||||
import com.heyu.api.data.service.vv.VvAdminCategoryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class VvAdminCategoryServiceImpl extends ServiceImpl<VvAdminCategoryDao, VvAdminCategoryEntity> implements VvAdminCategoryService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private VvAdminCategoryDao vvAdminCategoryDao;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public VvAdminCategoryEntity selectVvAdminCategoryById(Long id){
|
||||
return vvAdminCategoryDao.selectVvAdminCategoryById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Long insertVvAdminCategory(VvAdminCategoryEntity vvAdminCategory){
|
||||
return vvAdminCategoryDao.insertVvAdminCategory(vvAdminCategory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Long insertOrUpdateVvAdminCategory(VvAdminCategoryEntity vvAdminCategory){
|
||||
return vvAdminCategoryDao.insertOrUpdateVvAdminCategory(vvAdminCategory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int updateVvAdminCategoryById(VvAdminCategoryEntity vvAdminCategory){
|
||||
return vvAdminCategoryDao.updateVvAdminCategoryById(vvAdminCategory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int updateCoverVvAdminCategoryById(VvAdminCategoryEntity vvAdminCategory){
|
||||
return vvAdminCategoryDao.updateCoverVvAdminCategoryById(vvAdminCategory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteVvAdminCategoryById(Long id){
|
||||
return vvAdminCategoryDao.deleteVvAdminCategoryById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package com.heyu.api.data.service.impl.vv;
|
||||
/**
|
||||
* <p>
|
||||
* 类目表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-08-24
|
||||
*/
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.heyu.api.data.dao.vv.VvAppCategoryDao;
|
||||
import com.heyu.api.data.entity.vv.VvAppCategoryEntity;
|
||||
import com.heyu.api.data.service.vv.VvAppCategoryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class VvAppCategoryServiceImpl extends ServiceImpl<VvAppCategoryDao, VvAppCategoryEntity> implements VvAppCategoryService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private VvAppCategoryDao vvAppCategoryDao;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public VvAppCategoryEntity selectVvAppCategoryById(Long id){
|
||||
return vvAppCategoryDao.selectVvAppCategoryById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Long insertVvAppCategory(VvAppCategoryEntity vvAppCategory){
|
||||
return vvAppCategoryDao.insertVvAppCategory(vvAppCategory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Long insertOrUpdateVvAppCategory(VvAppCategoryEntity vvAppCategory){
|
||||
return vvAppCategoryDao.insertOrUpdateVvAppCategory(vvAppCategory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int updateVvAppCategoryById(VvAppCategoryEntity vvAppCategory){
|
||||
return vvAppCategoryDao.updateVvAppCategoryById(vvAppCategory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int updateCoverVvAppCategoryById(VvAppCategoryEntity vvAppCategory){
|
||||
return vvAppCategoryDao.updateCoverVvAppCategoryById(vvAppCategory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteVvAppCategoryById(Long id){
|
||||
return vvAppCategoryDao.deleteVvAppCategoryById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,75 +0,0 @@
|
||||
package com.heyu.api.data.service.impl.vv;
|
||||
/**
|
||||
* <p>
|
||||
* 类目表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-08-20
|
||||
*/
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.heyu.api.data.dao.vv.VvCategoryDao;
|
||||
import com.heyu.api.data.entity.vv.VvCategoryEntity;
|
||||
import com.heyu.api.data.service.vv.VvCategoryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class VvCategoryServiceImpl extends ServiceImpl<VvCategoryDao, VvCategoryEntity> implements VvCategoryService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private VvCategoryDao vvCategoryDao;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public VvCategoryEntity selectVvCategoryById(Long id){
|
||||
return vvCategoryDao.selectVvCategoryById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Long insertVvCategory(VvCategoryEntity vvCategory){
|
||||
return vvCategoryDao.insertVvCategory(vvCategory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Long insertOrUpdateVvCategory(VvCategoryEntity vvCategory){
|
||||
return vvCategoryDao.insertOrUpdateVvCategory(vvCategory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int updateVvCategoryById(VvCategoryEntity vvCategory){
|
||||
return vvCategoryDao.updateVvCategoryById(vvCategory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int updateCoverVvCategoryById(VvCategoryEntity vvCategory){
|
||||
return vvCategoryDao.updateCoverVvCategoryById(vvCategory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteVvCategoryById(Long id){
|
||||
return vvCategoryDao.deleteVvCategoryById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VvCategoryEntity> selectVvCategoryAll() {
|
||||
return vvCategoryDao.selectVvCategoryAll();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.heyu.api.data.service.vv;
|
||||
/**
|
||||
* <p>
|
||||
* 类目表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-08-24
|
||||
*/
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.heyu.api.data.entity.vv.VvAdminCategoryEntity;
|
||||
public interface VvAdminCategoryService extends IService<VvAdminCategoryEntity> {
|
||||
|
||||
|
||||
|
||||
VvAdminCategoryEntity selectVvAdminCategoryById(Long id);
|
||||
|
||||
|
||||
Long insertVvAdminCategory(VvAdminCategoryEntity vvAdminCategory);
|
||||
|
||||
|
||||
Long insertOrUpdateVvAdminCategory(VvAdminCategoryEntity vvAdminCategory);
|
||||
|
||||
|
||||
int updateVvAdminCategoryById(VvAdminCategoryEntity vvAdminCategory);
|
||||
|
||||
|
||||
int updateCoverVvAdminCategoryById(VvAdminCategoryEntity vvAdminCategory);
|
||||
|
||||
|
||||
int deleteVvAdminCategoryById(Long id);
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.heyu.api.data.service.vv;
|
||||
/**
|
||||
* <p>
|
||||
* 类目表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-08-24
|
||||
*/
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.heyu.api.data.entity.vv.VvAppCategoryEntity;
|
||||
public interface VvAppCategoryService extends IService<VvAppCategoryEntity> {
|
||||
|
||||
|
||||
|
||||
VvAppCategoryEntity selectVvAppCategoryById(Long id);
|
||||
|
||||
|
||||
Long insertVvAppCategory(VvAppCategoryEntity vvAppCategory);
|
||||
|
||||
|
||||
Long insertOrUpdateVvAppCategory(VvAppCategoryEntity vvAppCategory);
|
||||
|
||||
|
||||
int updateVvAppCategoryById(VvAppCategoryEntity vvAppCategory);
|
||||
|
||||
|
||||
int updateCoverVvAppCategoryById(VvAppCategoryEntity vvAppCategory);
|
||||
|
||||
|
||||
int deleteVvAppCategoryById(Long id);
|
||||
|
||||
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
package com.heyu.api.data.service.vv;
|
||||
/**
|
||||
* <p>
|
||||
* 类目表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-08-20
|
||||
*/
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.heyu.api.data.entity.vv.VvCategoryEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface VvCategoryService extends IService<VvCategoryEntity> {
|
||||
|
||||
|
||||
|
||||
VvCategoryEntity selectVvCategoryById(Long id);
|
||||
|
||||
|
||||
Long insertVvCategory(VvCategoryEntity vvCategory);
|
||||
|
||||
|
||||
Long insertOrUpdateVvCategory(VvCategoryEntity vvCategory);
|
||||
|
||||
|
||||
int updateVvCategoryById(VvCategoryEntity vvCategory);
|
||||
|
||||
|
||||
int updateCoverVvCategoryById(VvCategoryEntity vvCategory);
|
||||
|
||||
|
||||
int deleteVvCategoryById(Long id);
|
||||
|
||||
|
||||
List<VvCategoryEntity> selectVvCategoryAll();
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
<?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.heyu.api.data.dao.vv.VvAdminCategoryDao">
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?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.heyu.api.data.dao.vv.VvCategoryDao">
|
||||
<mapper namespace="com.heyu.api.data.dao.vv.VvAppCategoryDao">
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -94,7 +94,8 @@ public class MysqlMain_insert {
|
||||
|
||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||
|
||||
list.add(new TablesBean("vv_category_property_value"));
|
||||
list.add(new TablesBean("vv_app_category"));
|
||||
list.add(new TablesBean("vv_admin_category"));
|
||||
|
||||
|
||||
List<TablesBean> list2 = new ArrayList<TablesBean>();
|
||||
|
||||
@ -5,13 +5,13 @@ package com.heyu.api.alibaba.request.mm;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class VvCategoryIndexSortRequest {
|
||||
public class VvAdminCategoryIndexSortRequest {
|
||||
|
||||
|
||||
/**
|
||||
* 类目id
|
||||
*/
|
||||
private Long categoryId;
|
||||
private Long adminCategoryId;
|
||||
|
||||
|
||||
/**
|
||||
@ -0,0 +1,15 @@
|
||||
package com.heyu.api.alibaba.request.mm;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class VvAdminCategoryRequest {
|
||||
|
||||
/***
|
||||
* 父亲id
|
||||
*/
|
||||
private Integer parentId = 0 ;
|
||||
|
||||
|
||||
}
|
||||
@ -7,10 +7,10 @@ import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class VvCategorySortRequest {
|
||||
public class VvAdminCategorySortRequest {
|
||||
|
||||
|
||||
|
||||
private List<Long> categoryIds;
|
||||
private List<Long> adminCategoryIds;
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
|
||||
package com.heyu.api.alibaba.request.mm;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class VvAppCategoryIndexSortRequest {
|
||||
|
||||
|
||||
/**
|
||||
* app 类目id
|
||||
*/
|
||||
private Long appCategoryId;
|
||||
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private int defaultSort;
|
||||
|
||||
}
|
||||
@ -4,7 +4,7 @@ package com.heyu.api.alibaba.request.mm;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class VvCategoryRequest {
|
||||
public class VvAppCategoryRequest {
|
||||
|
||||
/***
|
||||
* 父亲id
|
||||
@ -0,0 +1,18 @@
|
||||
|
||||
package com.heyu.api.alibaba.request.mm;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class VvAppCategorySortRequest {
|
||||
|
||||
|
||||
/***
|
||||
* app 类目id
|
||||
*/
|
||||
private List<Long> appCategoryIds;
|
||||
|
||||
}
|
||||
@ -6,16 +6,26 @@ import lombok.Data;
|
||||
@Data
|
||||
public class VvCategoryPropertyRequest {
|
||||
|
||||
private Integer pageNum;
|
||||
private Integer pageNum = 1 ;
|
||||
|
||||
private Integer pageSize;
|
||||
private Integer pageSize = 10;
|
||||
|
||||
|
||||
private String propertyName;
|
||||
/***
|
||||
* 属性名称
|
||||
*/
|
||||
private String categoryPropertyName;
|
||||
|
||||
|
||||
/**
|
||||
* 类目名称
|
||||
*/
|
||||
private String categoryName;
|
||||
|
||||
|
||||
/***
|
||||
* 类目id
|
||||
*/
|
||||
private Long categoryId;
|
||||
|
||||
|
||||
|
||||
@ -8,15 +8,9 @@ import java.util.List;
|
||||
|
||||
@Data
|
||||
public class VvPropertyInsertOrUpdateRequest extends VvCategoryPropertyEntity {
|
||||
|
||||
|
||||
/***
|
||||
* 属性值列表
|
||||
*/
|
||||
private List<VvCategoryPropertyValueEntity> vvCategoryPropertyValueEntities;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,99 @@
|
||||
package com.heyu.api.controller.mm;
|
||||
|
||||
|
||||
import com.heyu.api.alibaba.request.mm.VvAdminCategoryIndexSortRequest;
|
||||
import com.heyu.api.alibaba.request.mm.VvAdminCategoryRequest;
|
||||
import com.heyu.api.alibaba.request.mm.VvAdminCategorySortRequest;
|
||||
import com.heyu.api.data.dao.vv.VvAdminCategoryDao;
|
||||
import com.heyu.api.data.dto.vv.VvAdminCategoryCategoryDTO;
|
||||
import com.heyu.api.data.entity.vv.VvAdminCategoryEntity;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/mm/admin/category")
|
||||
public class AdminCategoryController {
|
||||
|
||||
@Autowired
|
||||
private VvAdminCategoryDao vvAdminCategoryDao;
|
||||
|
||||
/***
|
||||
* 列表
|
||||
*
|
||||
*
|
||||
* http://localhost:8888/mm/category/list
|
||||
*
|
||||
*
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public R list(@RequestBody VvAdminCategoryRequest vvCategoryRequest) {
|
||||
List<VvAdminCategoryEntity> vvCategoryEntities = vvAdminCategoryDao.selectVvCategoryAll();
|
||||
List<VvAdminCategoryEntity> list = vvAdminCategoryDao.selectVvCategoryByParentId(vvCategoryRequest.getParentId());
|
||||
List<VvAdminCategoryCategoryDTO> vvCategoryDTOS = new ArrayList<>();
|
||||
for (VvAdminCategoryEntity vvCategoryEntity : list) {
|
||||
VvAdminCategoryCategoryDTO vvCategoryDTO = new VvAdminCategoryCategoryDTO();
|
||||
BeanUtils.copyProperties(vvCategoryEntity, vvCategoryDTO);
|
||||
boolean has = hasChild(vvCategoryEntity, vvCategoryEntities);
|
||||
vvCategoryDTO.setHasChild(has ? 1 : 0);
|
||||
vvCategoryDTOS.add(vvCategoryDTO);
|
||||
}
|
||||
return R.ok().setData(vvCategoryDTOS);
|
||||
}
|
||||
|
||||
/***
|
||||
* 插入或更新
|
||||
* @param vvCategoryEntity
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/insertOrUpdate")
|
||||
public R insert(@RequestBody VvAdminCategoryEntity vvCategoryEntity) {
|
||||
vvAdminCategoryDao.insertOrUpdateVvAdminCategory(vvCategoryEntity);
|
||||
return R.ok().setData("保存成功");
|
||||
}
|
||||
|
||||
/***
|
||||
* 排序
|
||||
*/
|
||||
@RequestMapping("/sort")
|
||||
public R sort(@RequestBody VvAdminCategorySortRequest vvCategorySortRequest) {
|
||||
List<VvAdminCategoryEntity> list = vvAdminCategoryDao.selectVvCategoryByIds(vvCategorySortRequest.getAdminCategoryIds());
|
||||
List<Long> categoryIds = vvCategorySortRequest.getAdminCategoryIds();
|
||||
for (VvAdminCategoryEntity vvCategoryEntity : list) {
|
||||
int index = categoryIds.indexOf(vvCategoryEntity.getId()) + 1;
|
||||
vvCategoryEntity.setDefaultSort(index);
|
||||
vvAdminCategoryDao.insertOrUpdateVvAdminCategory(vvCategoryEntity);
|
||||
}
|
||||
return R.ok().setData("保存成功");
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 排序
|
||||
*/
|
||||
@RequestMapping("/update/sort/index")
|
||||
public R updateSortIndex(@RequestBody VvAdminCategoryIndexSortRequest vvCategorySortRequest) {
|
||||
VvAdminCategoryEntity vvCategory = vvAdminCategoryDao.selectVvAdminCategoryById(vvCategorySortRequest.getAdminCategoryId());
|
||||
vvCategory.setDefaultSort(vvCategorySortRequest.getDefaultSort());
|
||||
vvAdminCategoryDao.insertOrUpdateVvAdminCategory(vvCategory);
|
||||
return R.ok().setData("保存成功");
|
||||
}
|
||||
|
||||
public boolean hasChild(VvAdminCategoryEntity vvCategoryEntity, List<VvAdminCategoryEntity> vvCategoryEntities) {
|
||||
for (VvAdminCategoryEntity categoryEntity : vvCategoryEntities) {
|
||||
if (vvCategoryEntity.getId().equals(categoryEntity.getParentId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,100 @@
|
||||
package com.heyu.api.controller.mm;
|
||||
|
||||
|
||||
import com.heyu.api.alibaba.request.mm.VvAppCategoryIndexSortRequest;
|
||||
import com.heyu.api.alibaba.request.mm.VvAppCategoryRequest;
|
||||
import com.heyu.api.alibaba.request.mm.VvAppCategorySortRequest;
|
||||
import com.heyu.api.data.dao.vv.VvAppCategoryDao;
|
||||
import com.heyu.api.data.dto.vv.VvAdminCategoryCategoryDTO;
|
||||
import com.heyu.api.data.entity.vv.VvAppCategoryEntity;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/mm/app/category")
|
||||
public class AppCategoryController {
|
||||
|
||||
@Autowired
|
||||
private VvAppCategoryDao vvAppCategoryDao;
|
||||
|
||||
/***
|
||||
* 列表
|
||||
*
|
||||
*
|
||||
* http://localhost:8888/mm/category/list
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public R list(@RequestBody VvAppCategoryRequest vvCategoryRequest) {
|
||||
List<VvAppCategoryEntity> vvCategoryEntities = vvAppCategoryDao.selectVvCategoryAll();
|
||||
List<VvAppCategoryEntity> list = vvAppCategoryDao.selectVvCategoryByParentId(vvCategoryRequest.getParentId());
|
||||
List<VvAdminCategoryCategoryDTO> vvCategoryDTOS = new ArrayList<>();
|
||||
for (VvAppCategoryEntity vvCategoryEntity : list) {
|
||||
VvAdminCategoryCategoryDTO vvCategoryDTO = new VvAdminCategoryCategoryDTO();
|
||||
BeanUtils.copyProperties(vvCategoryEntity, vvCategoryDTO);
|
||||
boolean has = hasChild(vvCategoryEntity, vvCategoryEntities);
|
||||
vvCategoryDTO.setHasChild(has ? 1 : 0);
|
||||
vvCategoryDTOS.add(vvCategoryDTO);
|
||||
}
|
||||
return R.ok().setData(vvCategoryDTOS);
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 插入或更新
|
||||
* @param vvCategoryEntity
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/insertOrUpdate")
|
||||
public R insert(@RequestBody VvAppCategoryEntity vvCategoryEntity) {
|
||||
vvAppCategoryDao.insertOrUpdateVvAppCategory(vvCategoryEntity);
|
||||
return R.ok().setData("保存成功");
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 排序
|
||||
*/
|
||||
@RequestMapping("/sort")
|
||||
public R sort(@RequestBody VvAppCategorySortRequest vvCategorySortRequest) {
|
||||
List<VvAppCategoryEntity> list = vvAppCategoryDao.selectVvCategoryByIds(vvCategorySortRequest.getAppCategoryIds());
|
||||
List<Long> categoryIds = vvCategorySortRequest.getAppCategoryIds();
|
||||
for (VvAppCategoryEntity vvCategoryEntity : list) {
|
||||
int index = categoryIds.indexOf(vvCategoryEntity.getId()) + 1;
|
||||
vvCategoryEntity.setDefaultSort(index);
|
||||
vvAppCategoryDao.insertOrUpdateVvAppCategory(vvCategoryEntity);
|
||||
}
|
||||
return R.ok().setData("保存成功");
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 排序
|
||||
*/
|
||||
@RequestMapping("/update/sort/index")
|
||||
public R updateSortIndex(@RequestBody VvAppCategoryIndexSortRequest vvCategorySortRequest) {
|
||||
VvAppCategoryEntity vvCategory = vvAppCategoryDao.selectVvAppCategoryById(vvCategorySortRequest.getAppCategoryId());
|
||||
vvCategory.setDefaultSort(vvCategorySortRequest.getDefaultSort());
|
||||
vvAppCategoryDao.insertOrUpdateVvAppCategory(vvCategory);
|
||||
return R.ok().setData("保存成功");
|
||||
}
|
||||
|
||||
|
||||
public boolean hasChild(VvAppCategoryEntity vvCategoryEntity, List<VvAppCategoryEntity> vvCategoryEntities) {
|
||||
for (VvAppCategoryEntity categoryEntity : vvCategoryEntities) {
|
||||
if (vvCategoryEntity.getId().equals(categoryEntity.getParentId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,102 +0,0 @@
|
||||
package com.heyu.api.controller.mm;
|
||||
|
||||
|
||||
import com.heyu.api.alibaba.request.mm.VvCategoryIndexSortRequest;
|
||||
import com.heyu.api.alibaba.request.mm.VvCategoryRequest;
|
||||
import com.heyu.api.alibaba.request.mm.VvCategorySortRequest;
|
||||
import com.heyu.api.data.dao.vv.VvCategoryDao;
|
||||
import com.heyu.api.data.dto.vv.VvCategoryDTO;
|
||||
import com.heyu.api.data.entity.vv.VvCategoryEntity;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/mm/category")
|
||||
public class CategoryController {
|
||||
|
||||
@Autowired
|
||||
private VvCategoryDao vvCategoryDao;
|
||||
|
||||
/***
|
||||
* 列表
|
||||
*
|
||||
*
|
||||
* http://localhost:8888/mm/category/list
|
||||
*
|
||||
*
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public R list(@RequestBody VvCategoryRequest vvCategoryRequest) {
|
||||
List<VvCategoryEntity> vvCategoryEntities = vvCategoryDao.selectVvCategoryAll();
|
||||
List<VvCategoryEntity> list = vvCategoryDao.selectVvCategoryByParentId(vvCategoryRequest.getParentId());
|
||||
List<VvCategoryDTO> vvCategoryDTOS = new ArrayList<>();
|
||||
for (VvCategoryEntity vvCategoryEntity : list) {
|
||||
VvCategoryDTO vvCategoryDTO = new VvCategoryDTO();
|
||||
BeanUtils.copyProperties(vvCategoryEntity, vvCategoryDTO);
|
||||
boolean has = hasChild(vvCategoryEntity, vvCategoryEntities);
|
||||
vvCategoryDTO.setHasChild(has ? 1 : 0);
|
||||
vvCategoryDTOS.add(vvCategoryDTO);
|
||||
}
|
||||
return R.ok().setData(vvCategoryDTOS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* 插入或更新
|
||||
* @param vvCategoryEntity
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/insertOrUpdate")
|
||||
public R insert(@RequestBody VvCategoryEntity vvCategoryEntity) {
|
||||
vvCategoryDao.insertOrUpdateVvCategory(vvCategoryEntity);
|
||||
return R.ok().setData("保存成功");
|
||||
}
|
||||
|
||||
/***
|
||||
* 排序
|
||||
*/
|
||||
@RequestMapping("/sort")
|
||||
public R sort(@RequestBody VvCategorySortRequest vvCategorySortRequest) {
|
||||
List<VvCategoryEntity> list = vvCategoryDao.selectVvCategoryByIds(vvCategorySortRequest.getCategoryIds());
|
||||
List<Long> categoryIds = vvCategorySortRequest.getCategoryIds();
|
||||
for (VvCategoryEntity vvCategoryEntity : list) {
|
||||
int index = categoryIds.indexOf(vvCategoryEntity.getId()) + 1;
|
||||
vvCategoryEntity.setDefaultSort(index);
|
||||
vvCategoryDao.updateVvCategoryById(vvCategoryEntity);
|
||||
}
|
||||
return R.ok().setData("保存成功");
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 排序
|
||||
*/
|
||||
@RequestMapping("/update/sort/index")
|
||||
public R updateSortIndex(@RequestBody VvCategoryIndexSortRequest vvCategorySortRequest) {
|
||||
VvCategoryEntity vvCategory = vvCategoryDao.selectVvCategoryById(vvCategorySortRequest.getCategoryId());
|
||||
vvCategory.setDefaultSort(vvCategorySortRequest.getDefaultSort());
|
||||
vvCategoryDao.updateVvCategoryById(vvCategory);
|
||||
return R.ok().setData("保存成功");
|
||||
}
|
||||
|
||||
public boolean hasChild(VvCategoryEntity vvCategoryEntity, List<VvCategoryEntity> vvCategoryEntities) {
|
||||
for (VvCategoryEntity categoryEntity : vvCategoryEntities) {
|
||||
if (vvCategoryEntity.getId().equals(categoryEntity.getParentId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.heyu.api.controller.mm;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.heyu.api.alibaba.request.mm.*;
|
||||
import com.heyu.api.data.dao.vv.VvCategoryPropertyDao;
|
||||
@ -15,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@ -23,8 +25,8 @@ import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/mm/property")
|
||||
public class PropertyController {
|
||||
@RequestMapping("/mm/category/property")
|
||||
public class CategoryPropertyController {
|
||||
|
||||
@Autowired
|
||||
private VvCategoryPropertyDao vvCategoryPropertyDao;
|
||||
@ -38,12 +40,15 @@ public class PropertyController {
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public R list(VvCategoryPropertyRequest vvPropertyRequest) {
|
||||
public R list(@RequestBody VvCategoryPropertyRequest vvPropertyRequest) {
|
||||
|
||||
PPageUtils pageUtils = PPageUtils.startPage(vvPropertyRequest.getPageNum(), vvPropertyRequest.getPageSize()).doSelect(new ISelect() {
|
||||
@Override
|
||||
public List doSelect(IPage page) {
|
||||
return vvCategoryPropertyDao.selectVvProperByCondition(page, vvPropertyRequest.getPropertyName(), vvPropertyRequest.getCategoryName(), vvPropertyRequest.getCategoryId());
|
||||
return vvCategoryPropertyDao.selectVvProperByCondition(page,
|
||||
vvPropertyRequest.getCategoryPropertyName(),
|
||||
vvPropertyRequest.getCategoryName(),
|
||||
vvPropertyRequest.getCategoryId());
|
||||
|
||||
}
|
||||
});
|
||||
@ -70,26 +75,82 @@ public class PropertyController {
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/insertOrUpdate")
|
||||
public R insert(VvPropertyInsertOrUpdateRequest vvPropertyInsertOrUpdateRequest) {
|
||||
public R insert(@RequestBody List<VvPropertyInsertOrUpdateRequest> vvPropertyInsertOrUpdateRequestList) {
|
||||
|
||||
VvCategoryPropertyEntity vvPropertyEntity = new VvCategoryPropertyEntity();
|
||||
for(VvPropertyInsertOrUpdateRequest vvPropertyInsertOrUpdateRequest : vvPropertyInsertOrUpdateRequestList){
|
||||
VvCategoryPropertyEntity vvPropertyEntity = new VvCategoryPropertyEntity();
|
||||
BeanUtils.copyProperties(vvPropertyInsertOrUpdateRequest, vvPropertyEntity);
|
||||
vvCategoryPropertyDao.insertOrUpdateVvCategoryProperty(vvPropertyEntity);
|
||||
|
||||
BeanUtils.copyProperties(vvPropertyInsertOrUpdateRequest, vvPropertyEntity);
|
||||
vvCategoryPropertyDao.insertOrUpdateVvCategoryProperty(vvPropertyEntity);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(vvPropertyInsertOrUpdateRequest.getVvCategoryPropertyValueEntities())) {
|
||||
for (VvCategoryPropertyValueEntity vvPropertyValueEntity : vvPropertyInsertOrUpdateRequest.getVvCategoryPropertyValueEntities()) {
|
||||
vvCategoryPropertyValueDao.insertOrUpdateVvCategoryPropertyValue(vvPropertyValueEntity);
|
||||
if (CollectionUtils.isNotEmpty(vvPropertyInsertOrUpdateRequest.getVvCategoryPropertyValueEntities())) {
|
||||
for (VvCategoryPropertyValueEntity vvPropertyValueEntity : vvPropertyInsertOrUpdateRequest.getVvCategoryPropertyValueEntities()) {
|
||||
vvCategoryPropertyValueDao.insertOrUpdateVvCategoryPropertyValue(vvPropertyValueEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok().setData("保存成功");
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
VvPropertyInsertOrUpdateRequest vvCategoryPropertyEntity1 = new VvPropertyInsertOrUpdateRequest();
|
||||
|
||||
vvCategoryPropertyEntity1.setCategoryId(17L);
|
||||
vvCategoryPropertyEntity1.setCategoryName("项圈");
|
||||
vvCategoryPropertyEntity1.setCategoryPropertyName("珍珠直径");
|
||||
vvCategoryPropertyEntity1.setDefaultSort(1);
|
||||
|
||||
|
||||
VvCategoryPropertyValueEntity vvCategoryPropertyValueEntity11 = new VvCategoryPropertyValueEntity();
|
||||
vvCategoryPropertyValueEntity11.setCategoryPropertyValue("5-5.5mm");
|
||||
|
||||
VvCategoryPropertyValueEntity vvCategoryPropertyValueEntity12 = new VvCategoryPropertyValueEntity();
|
||||
vvCategoryPropertyValueEntity12.setCategoryPropertyValue("5.5-6mm");
|
||||
|
||||
|
||||
List<VvCategoryPropertyValueEntity> vvCategoryPropertyValueEntities1 = new ArrayList<>();
|
||||
vvCategoryPropertyValueEntities1.add(vvCategoryPropertyValueEntity11);
|
||||
vvCategoryPropertyValueEntities1.add(vvCategoryPropertyValueEntity12);
|
||||
vvCategoryPropertyEntity1.setVvCategoryPropertyValueEntities(vvCategoryPropertyValueEntities1);
|
||||
|
||||
|
||||
|
||||
|
||||
VvPropertyInsertOrUpdateRequest vvCategoryPropertyEntity2 = new VvPropertyInsertOrUpdateRequest();
|
||||
vvCategoryPropertyEntity2.setCategoryId(17L);
|
||||
vvCategoryPropertyEntity2.setCategoryName("项圈");
|
||||
vvCategoryPropertyEntity2.setCategoryPropertyName("颜色分类");
|
||||
vvCategoryPropertyEntity2.setDefaultSort(2);
|
||||
|
||||
|
||||
|
||||
VvCategoryPropertyValueEntity vvCategoryPropertyValueEntity21 = new VvCategoryPropertyValueEntity();
|
||||
vvCategoryPropertyValueEntity21.setCategoryPropertyValue("【臻藏】极光镜面AKOYA/ S925银扣");
|
||||
|
||||
VvCategoryPropertyValueEntity vvCategoryPropertyValueEntity22 = new VvCategoryPropertyValueEntity();
|
||||
vvCategoryPropertyValueEntity22.setCategoryPropertyValue("【臻品】GUILD极光大证 / 18K金扣");
|
||||
|
||||
List<VvCategoryPropertyValueEntity> vvCategoryPropertyValueEntities2 = new ArrayList<>();
|
||||
vvCategoryPropertyValueEntities2.add(vvCategoryPropertyValueEntity21);
|
||||
vvCategoryPropertyValueEntities2.add(vvCategoryPropertyValueEntity22);
|
||||
|
||||
vvCategoryPropertyEntity2.setVvCategoryPropertyValueEntities(vvCategoryPropertyValueEntities2);
|
||||
|
||||
|
||||
List<VvPropertyInsertOrUpdateRequest> vvPropertyInsertOrUpdateRequestList = new ArrayList<>();
|
||||
vvPropertyInsertOrUpdateRequestList.add(vvCategoryPropertyEntity1);
|
||||
vvPropertyInsertOrUpdateRequestList.add(vvCategoryPropertyEntity2);
|
||||
|
||||
System.out.println(JSON.toJSONString(vvPropertyInsertOrUpdateRequestList));
|
||||
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
* 排序
|
||||
*/
|
||||
@RequestMapping("/sort")
|
||||
public R sort(VvCategoryPropertySortRequest vvPropertySortRequest) {
|
||||
public R sort(@RequestBody VvCategoryPropertySortRequest vvPropertySortRequest) {
|
||||
List<VvCategoryPropertyEntity> propertyEntities = vvCategoryPropertyDao.selectVvPropertyByIds(vvPropertySortRequest.getCategoryPropertyIds());
|
||||
for (VvCategoryPropertyEntity propertyEntity : propertyEntities) {
|
||||
propertyEntity.setDefaultSort(vvPropertySortRequest.getCategoryPropertyIds().indexOf(propertyEntity.getId()) + 1);
|
||||
@ -103,7 +164,7 @@ public class PropertyController {
|
||||
* 排序
|
||||
*/
|
||||
@RequestMapping("/value/sort")
|
||||
public R sortValue(VvCategoryPropertyValueSortRequest vvPropertyValueSortRequest) {
|
||||
public R sortValue(@RequestBody VvCategoryPropertyValueSortRequest vvPropertyValueSortRequest) {
|
||||
List<VvCategoryPropertyValueEntity> propertyEntities = vvCategoryPropertyValueDao.selectVvPropertyValueByIds(vvPropertyValueSortRequest.getCategoryPropertyValueIds());
|
||||
for (VvCategoryPropertyValueEntity propertyEntity : propertyEntities) {
|
||||
propertyEntity.setDefaultSort(vvPropertyValueSortRequest.getCategoryPropertyValueIds().indexOf(propertyEntity.getId()) + 1);
|
||||
@ -116,7 +177,7 @@ public class PropertyController {
|
||||
* 排序
|
||||
*/
|
||||
@RequestMapping("/update/sort/index")
|
||||
public R updateSortIndex(VvCategoryPropertyIndexSortRequest vvCategorySortRequest) {
|
||||
public R updateSortIndex(@RequestBody VvCategoryPropertyIndexSortRequest vvCategorySortRequest) {
|
||||
VvCategoryPropertyEntity vvPropertyEntity = vvCategoryPropertyDao.selectVvCategoryPropertyById(vvCategorySortRequest.getCategoryPropertyId());
|
||||
vvPropertyEntity.setDefaultSort(vvCategorySortRequest.getDefaultSort());
|
||||
vvCategoryPropertyDao.insertOrUpdateVvCategoryProperty(vvPropertyEntity);
|
||||
@ -128,7 +189,7 @@ public class PropertyController {
|
||||
* 排序
|
||||
*/
|
||||
@RequestMapping("/update/value/sort/index")
|
||||
public R updateSortIndex(VvCategoryPropertyIndexValueSortRequest vvCategorySortRequest) {
|
||||
public R updateSortIndex(@RequestBody VvCategoryPropertyIndexValueSortRequest vvCategorySortRequest) {
|
||||
VvCategoryPropertyValueEntity vvPropertyValue = vvCategoryPropertyValueDao.selectVvCategoryPropertyValueById(vvCategorySortRequest.getCategoryPropertyValueId());
|
||||
vvPropertyValue.setDefaultSort(vvCategorySortRequest.getDefaultSort());
|
||||
vvCategoryPropertyValueDao.insertOrUpdateVvCategoryPropertyValue(vvPropertyValue);
|
||||
@ -324,7 +324,7 @@ public class ProductController {
|
||||
|
||||
@RequestMapping("/test/save")
|
||||
public R save(@RequestBody VvProductDTO vvProductDTO) {
|
||||
VvProductEntity vvProduct = vvProductDao.selectVvProductById(3L);
|
||||
VvProductEntity vvProduct = vvProductDao.selectVvProductById(4L);
|
||||
|
||||
VvProductPropertyEntity vvProductPropertyEntity1 = vvProductPropertyDao.selectVvProductPropertyById(1L);
|
||||
|
||||
|
||||
@ -226,8 +226,8 @@ public class AppOrderController {
|
||||
for (VvSkuPropertyValueEntity vvSkuPropertyValueEntity : vvSkuPropertyValueEntities) {
|
||||
|
||||
PropertyNameValue propertyNameValue = new PropertyNameValue();
|
||||
propertyNameValue.setPropertyName(vvSkuPropertyValueEntity.getPropertyName());
|
||||
propertyNameValue.setPropertyValue(vvSkuPropertyValueEntity.getPropertyValue());
|
||||
propertyNameValue.setPropertyName(vvSkuPropertyValueEntity.getProductPropertyName());
|
||||
propertyNameValue.setPropertyValue(vvSkuPropertyValueEntity.getProductPropertyValue());
|
||||
propertyNameValues.add(propertyNameValue);
|
||||
}
|
||||
|
||||
|
||||
@ -84,8 +84,8 @@ public class AppShoppingCartController {
|
||||
for (VvSkuPropertyValueEntity vvSkuPropertyValueEntity : vvSkuPropertyValueEntities) {
|
||||
|
||||
PropertyNameValue propertyNameValue = new PropertyNameValue();
|
||||
propertyNameValue.setPropertyName(vvSkuPropertyValueEntity.getPropertyName());
|
||||
propertyNameValue.setPropertyValue(vvSkuPropertyValueEntity.getPropertyValue());
|
||||
propertyNameValue.setPropertyName(vvSkuPropertyValueEntity.getProductPropertyName());
|
||||
propertyNameValue.setPropertyValue(vvSkuPropertyValueEntity.getProductPropertyValue());
|
||||
propertyNameValues.add(propertyNameValue);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user