更改了系统字段的不匹配问题

增加了属性和属性组的概念
master
DongZeLiang 2024-02-27 16:27:59 +08:00
parent b94816191f
commit 75b24524ae
20 changed files with 207 additions and 168 deletions

View File

@ -77,4 +77,8 @@ public class BaseEntity implements Serializable {
public void setParams (Map<String, Object> params) { public void setParams (Map<String, Object> params) {
this.params = params; this.params = params;
} }
public void setRemark(String remark) {
this.remark = remark;
}
} }

View File

@ -0,0 +1,48 @@
package com.muyu.product.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder;
import io.swagger.annotations.*;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
/**
* as_attribute_group
*
* @author DongZeLiang
* @date 2024-02-27
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName("as_attribute_group")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "AsAttributeGroup", description = "属性与组中间")
public class AsAttributeGroup extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键 */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(name = "主键", value = "主键")
private Long id;
/** 组ID */
@Excel(name = "组ID")
@ApiModelProperty(name = "组ID", value = "组ID", required = true)
private Long groupId;
/** 属性id */
@Excel(name = "属性id")
@ApiModelProperty(name = "属性id", value = "属性id", required = true)
private Long attributeId;
}

View File

@ -51,15 +51,4 @@ public class AsProductAttributeInfo extends BaseEntity {
@ApiModelProperty(name = "属性值", value = "属性值", required = true) @ApiModelProperty(name = "属性值", value = "属性值", required = true)
private String value; private String value;
/** 更新人 */
@Excel(name = "更新人")
@ApiModelProperty(name = "更新人", value = "更新人")
private String updataBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(name = "更新时间", value = "更新时间")
private Date updataTime;
} }

View File

@ -49,16 +49,6 @@ public class AttributeGroup extends BaseEntity {
@ApiModelProperty(name = "状态", value = "状态", required = true) @ApiModelProperty(name = "状态", value = "状态", required = true)
private String states; private String states;
/** 更新人 */
@Excel(name = "更新人")
@ApiModelProperty(name = "更新人", value = "更新人")
private String updataBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(name = "更新时间", value = "更新时间")
private Date updataTime;
/** /**
* *
@ -67,8 +57,6 @@ public class AttributeGroup extends BaseEntity {
return AttributeGroup.builder() return AttributeGroup.builder()
.name(attributeGroupQueryReq.getName()) .name(attributeGroupQueryReq.getName())
.states(attributeGroupQueryReq.getStates()) .states(attributeGroupQueryReq.getStates())
.updataBy(attributeGroupQueryReq.getUpdataBy())
.updataTime(attributeGroupQueryReq.getUpdataTime())
.build(); .build();
} }
@ -79,8 +67,6 @@ public class AttributeGroup extends BaseEntity {
return AttributeGroup.builder() return AttributeGroup.builder()
.name(attributeGroupSaveReq.getName()) .name(attributeGroupSaveReq.getName())
.states(attributeGroupSaveReq.getStates()) .states(attributeGroupSaveReq.getStates())
.updataBy(attributeGroupSaveReq.getUpdataBy())
.updataTime(attributeGroupSaveReq.getUpdataTime())
.build(); .build();
} }
@ -92,8 +78,6 @@ public class AttributeGroup extends BaseEntity {
.id(id) .id(id)
.name(attributeGroupEditReq.getName()) .name(attributeGroupEditReq.getName())
.states(attributeGroupEditReq.getStates()) .states(attributeGroupEditReq.getStates())
.updataBy(attributeGroupEditReq.getUpdataBy())
.updataTime(attributeGroupEditReq.getUpdataTime())
.build(); .build();
} }

View File

@ -44,21 +44,6 @@ public class AttributeInfo extends BaseEntity {
@ApiModelProperty(name = "属性名", value = "属性名", required = true) @ApiModelProperty(name = "属性名", value = "属性名", required = true)
private String name; private String name;
/** 分组 */
@Excel(name = "分组")
@ApiModelProperty(name = "分组", value = "分组")
private Long groupId;
/** 更新人 */
@Excel(name = "更新人")
@ApiModelProperty(name = "更新人", value = "更新人")
private String updataBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty(name = "更新时间", value = "更新时间")
private Date updataTime;
/** /**
* *
@ -66,9 +51,6 @@ public class AttributeInfo extends BaseEntity {
public static AttributeInfo queryBuild( AttributeInfoQueryReq attributeInfoQueryReq){ public static AttributeInfo queryBuild( AttributeInfoQueryReq attributeInfoQueryReq){
return AttributeInfo.builder() return AttributeInfo.builder()
.name(attributeInfoQueryReq.getName()) .name(attributeInfoQueryReq.getName())
.groupId(attributeInfoQueryReq.getGroupId())
.updataBy(attributeInfoQueryReq.getUpdataBy())
.updataTime(attributeInfoQueryReq.getUpdataTime())
.build(); .build();
} }
@ -78,9 +60,6 @@ public class AttributeInfo extends BaseEntity {
public static AttributeInfo saveBuild(AttributeInfoSaveReq attributeInfoSaveReq){ public static AttributeInfo saveBuild(AttributeInfoSaveReq attributeInfoSaveReq){
return AttributeInfo.builder() return AttributeInfo.builder()
.name(attributeInfoSaveReq.getName()) .name(attributeInfoSaveReq.getName())
.groupId(attributeInfoSaveReq.getGroupId())
.updataBy(attributeInfoSaveReq.getUpdataBy())
.updataTime(attributeInfoSaveReq.getUpdataTime())
.build(); .build();
} }
@ -91,9 +70,6 @@ public class AttributeInfo extends BaseEntity {
return AttributeInfo.builder() return AttributeInfo.builder()
.id(id) .id(id)
.name(attributeInfoEditReq.getName()) .name(attributeInfoEditReq.getName())
.groupId(attributeInfoEditReq.getGroupId())
.updataBy(attributeInfoEditReq.getUpdataBy())
.updataTime(attributeInfoEditReq.getUpdataTime())
.build(); .build();
} }

View File

@ -32,27 +32,37 @@ public class BrandInfo extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 主键 */ /**
*
*/
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(name = "主键", value = "主键") @ApiModelProperty(name = "主键", value = "主键")
private Long id; private Long id;
/** 品牌名称 */ /**
*
*/
@Excel(name = "品牌名称") @Excel(name = "品牌名称")
@ApiModelProperty(name = "品牌名称", value = "品牌名称", required = true) @ApiModelProperty(name = "品牌名称", value = "品牌名称", required = true)
private String nam; private String nam;
/** LOGO */ /**
* LOGO
*/
@Excel(name = "LOGO") @Excel(name = "LOGO")
@ApiModelProperty(name = "LOGO", value = "LOGO", required = true) @ApiModelProperty(name = "LOGO", value = "LOGO", required = true)
private String logo; private String logo;
/** 是否启用 */ /**
*
*/
@Excel(name = "是否启用") @Excel(name = "是否启用")
@ApiModelProperty(name = "是否启用", value = "是否启用", required = true) @ApiModelProperty(name = "是否启用", value = "是否启用", required = true)
private String start; private String start;
/** 介绍 */ /**
*
*/
@Excel(name = "介绍") @Excel(name = "介绍")
@ApiModelProperty(name = "介绍", value = "介绍") @ApiModelProperty(name = "介绍", value = "介绍")
private String introduction; private String introduction;
@ -78,6 +88,7 @@ public class BrandInfo extends BaseEntity {
.logo(brandInfoSaveReq.getLogo()) .logo(brandInfoSaveReq.getLogo())
.start(brandInfoSaveReq.getStart()) .start(brandInfoSaveReq.getStart())
.introduction(brandInfoSaveReq.getIntroduction()) .introduction(brandInfoSaveReq.getIntroduction())
.remark(brandInfoSaveReq.getRemark())
.build(); .build();
} }
@ -91,6 +102,11 @@ public class BrandInfo extends BaseEntity {
.logo(brandInfoEditReq.getLogo()) .logo(brandInfoEditReq.getLogo())
.start(brandInfoEditReq.getStart()) .start(brandInfoEditReq.getStart())
.introduction(brandInfoEditReq.getIntroduction()) .introduction(brandInfoEditReq.getIntroduction())
.createBy(brandInfoEditReq.getCreateBy())
.createTime(brandInfoEditReq.getCreateTime())
.updateBy(brandInfoEditReq.getUpdateBy())
.createTime(brandInfoEditReq.getCreateTime())
.remark(brandInfoEditReq.getRemark())
.build(); .build();
} }

View File

@ -33,13 +33,5 @@ public class AttributeGroupEditReq extends BaseEntity {
@ApiModelProperty(name = "状态", value = "状态", required = true) @ApiModelProperty(name = "状态", value = "状态", required = true)
private String states; private String states;
/** 更新人 */
@ApiModelProperty(name = "更新人", value = "更新人")
private String updataBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(name = "更新时间", value = "更新时间")
private Date updataTime;
} }

View File

@ -33,13 +33,4 @@ public class AttributeGroupQueryReq extends BaseEntity {
@ApiModelProperty(name = "状态", value = "状态") @ApiModelProperty(name = "状态", value = "状态")
private String states; private String states;
/** 更新人 */
@ApiModelProperty(name = "更新人", value = "更新人")
private String updataBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(name = "更新时间", value = "更新时间")
private Date updataTime;
} }

View File

@ -40,15 +40,5 @@ public class AttributeGroupSaveReq extends BaseEntity {
@ApiModelProperty(name = "状态", value = "状态", required = true) @ApiModelProperty(name = "状态", value = "状态", required = true)
private String states; private String states;
/** 更新人 */
@ApiModelProperty(name = "更新人", value = "更新人")
private String updataBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(name = "更新时间", value = "更新时间")
private Date updataTime;
} }

View File

@ -33,13 +33,5 @@ public class AttributeInfoEditReq extends BaseEntity {
@ApiModelProperty(name = "分组", value = "分组") @ApiModelProperty(name = "分组", value = "分组")
private Long groupId; private Long groupId;
/** 更新人 */
@ApiModelProperty(name = "更新人", value = "更新人")
private String updataBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(name = "更新时间", value = "更新时间")
private Date updataTime;
} }

View File

@ -29,17 +29,5 @@ public class AttributeInfoQueryReq extends BaseEntity {
@ApiModelProperty(name = "属性名", value = "属性名") @ApiModelProperty(name = "属性名", value = "属性名")
private String name; private String name;
/** 分组 */
@ApiModelProperty(name = "分组", value = "分组")
private Long groupId;
/** 更新人 */
@ApiModelProperty(name = "更新人", value = "更新人")
private String updataBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(name = "更新时间", value = "更新时间")
private Date updataTime;
} }

View File

@ -35,20 +35,4 @@ public class AttributeInfoSaveReq extends BaseEntity {
@ApiModelProperty(name = "属性名", value = "属性名", required = true) @ApiModelProperty(name = "属性名", value = "属性名", required = true)
private String name; private String name;
/** 分组 */
@ApiModelProperty(name = "分组", value = "分组")
private Long groupId;
/** 更新人 */
@ApiModelProperty(name = "更新人", value = "更新人")
private String updataBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(name = "更新时间", value = "更新时间")
private Date updataTime;
} }

View File

@ -0,0 +1,15 @@
package com.muyu.product.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.AsAttributeGroup;
/**
* Mapper
*
* @author DongZeLiang
* @date 2024-02-27
*/
public interface AsAttributeGroupMapper extends BaseMapper<AsAttributeGroup> {
}

View File

@ -0,0 +1,22 @@
package com.muyu.product.service;
import java.util.List;
import com.muyu.product.domain.AsAttributeGroup;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* Service
*
* @author DongZeLiang
* @date 2024-02-27
*/
public interface AsAttributeGroupService extends IService<AsAttributeGroup> {
/**
*
*
* @param asAttributeGroup
* @return
*/
public List<AsAttributeGroup> list(AsAttributeGroup asAttributeGroup);
}

View File

@ -0,0 +1,49 @@
package com.muyu.product.service.impl;
import java.util.List;
import com.muyu.common.core.utils.ObjUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.muyu.product.mapper.AsAttributeGroupMapper;
import com.muyu.product.domain.AsAttributeGroup;
import com.muyu.product.service.AsAttributeGroupService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
/**
* Service
*
* @author DongZeLiang
* @date 2024-02-27
*/
@Slf4j
@Service
public class AsAttributeGroupServiceImpl extends ServiceImpl<AsAttributeGroupMapper, AsAttributeGroup> implements AsAttributeGroupService {
/**
*
*
* @param asAttributeGroup
* @return
*/
@Override
public List<AsAttributeGroup> list(AsAttributeGroup asAttributeGroup) {
LambdaQueryWrapper<AsAttributeGroup> queryWrapper = new LambdaQueryWrapper<>();
if (ObjUtils.notNull(asAttributeGroup.getGroupId())){
queryWrapper.eq(AsAttributeGroup::getGroupId, asAttributeGroup.getGroupId());
}
if (ObjUtils.notNull(asAttributeGroup.getAttributeId())){
queryWrapper.eq(AsAttributeGroup::getAttributeId, asAttributeGroup.getAttributeId());
}
return list(queryWrapper);
}
}

View File

@ -44,16 +44,6 @@ public class AsProductAttributeInfoServiceImpl extends ServiceImpl<AsProductAttr
queryWrapper.eq(AsProductAttributeInfo::getValue, asProductAttributeInfo.getValue()); queryWrapper.eq(AsProductAttributeInfo::getValue, asProductAttributeInfo.getValue());
} }
if (ObjUtils.notNull(asProductAttributeInfo.getUpdataBy())){
queryWrapper.eq(AsProductAttributeInfo::getUpdataBy, asProductAttributeInfo.getUpdataBy());
}
if (ObjUtils.notNull(asProductAttributeInfo.getUpdataTime())){
queryWrapper.eq(AsProductAttributeInfo::getUpdataTime, asProductAttributeInfo.getUpdataTime());
}
return list(queryWrapper); return list(queryWrapper);
} }
} }

View File

@ -40,16 +40,6 @@ public class AttributeGroupServiceImpl extends ServiceImpl<AttributeGroupMapper,
queryWrapper.eq(AttributeGroup::getStates, attributeGroup.getStates()); queryWrapper.eq(AttributeGroup::getStates, attributeGroup.getStates());
} }
if (ObjUtils.notNull(attributeGroup.getUpdataBy())){
queryWrapper.eq(AttributeGroup::getUpdataBy, attributeGroup.getUpdataBy());
}
if (ObjUtils.notNull(attributeGroup.getUpdataTime())){
queryWrapper.eq(AttributeGroup::getUpdataTime, attributeGroup.getUpdataTime());
}
return list(queryWrapper); return list(queryWrapper);
} }
} }

View File

@ -36,20 +36,6 @@ public class AttributeInfoServiceImpl extends ServiceImpl<AttributeInfoMapper, A
queryWrapper.like(AttributeInfo::getName, attributeInfo.getName()); queryWrapper.like(AttributeInfo::getName, attributeInfo.getName());
} }
if (ObjUtils.notNull(attributeInfo.getGroupId())){
queryWrapper.eq(AttributeInfo::getGroupId, attributeInfo.getGroupId());
}
if (ObjUtils.notNull(attributeInfo.getUpdataBy())){
queryWrapper.eq(AttributeInfo::getUpdataBy, attributeInfo.getUpdataBy());
}
if (ObjUtils.notNull(attributeInfo.getUpdataTime())){
queryWrapper.eq(AttributeInfo::getUpdataTime, attributeInfo.getUpdataTime());
}
return list(queryWrapper); return list(queryWrapper);
} }
} }

View File

@ -1,8 +1,10 @@
package com.muyu.product.service.impl; package com.muyu.product.service.impl;
import java.util.Date;
import java.util.List; import java.util.List;
import com.muyu.common.core.utils.ObjUtils; import com.muyu.common.core.utils.ObjUtils;
import com.muyu.common.security.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.muyu.product.mapper.BrandInfoMapper; import com.muyu.product.mapper.BrandInfoMapper;
@ -48,10 +50,20 @@ public class BrandInfoServiceImpl extends ServiceImpl<BrandInfoMapper, BrandInfo
queryWrapper.eq(BrandInfo::getIntroduction, brandInfo.getIntroduction()); queryWrapper.eq(BrandInfo::getIntroduction, brandInfo.getIntroduction());
} }
return list(queryWrapper); return list(queryWrapper);
} }
@Override
public boolean save(BrandInfo entity) {
entity.setCreateBy(SecurityUtils.getUsername());
entity.setCreateTime(new Date());
return super.save(entity);
}
@Override
public boolean updateById(BrandInfo entity) {
entity.setUpdateBy(SecurityUtils.getUsername());
entity.setUpdateTime(new Date());
return super.updateById(entity);
}
} }

View File

@ -0,0 +1,21 @@
<?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.AsAttributeGroupMapper">
<resultMap type="com.muyu.product.domain.AsAttributeGroup" id="AsAttributeGroupResult">
<result property="id" column="id" />
<result property="groupId" column="group_id" />
<result property="attributeId" column="attribute_id" />
<result property="remark" column="remark" />
<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="selectAsAttributeGroupVo">
select id, group_id, attribute_id, remark, create_by, create_time, update_by, update_time from as_attribute_group
</sql>
</mapper>