商品属性

dev
csy 2024-03-01 17:12:46 +08:00
parent 5e22c230d6
commit 3d2c517729
27 changed files with 441 additions and 36 deletions

View File

@ -19,11 +19,19 @@
</properties>
<dependencies>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-core</artifactId>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-security</artifactId>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>muyu-common-security</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,70 @@
package com.muyu.product.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
/**
* as_attribute_group
*
* @author CuiShiYu
* @date 2024-03-01
*/
public class AsAttributeGroup extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 组id */
@Excel(name = "组id")
private Long groupId;
/** 属性id */
@Excel(name = "属性id")
private Long attributeId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setGroupId(Long groupId)
{
this.groupId = groupId;
}
public Long getGroupId()
{
return groupId;
}
public void setAttributeId(Long attributeId)
{
this.attributeId = attributeId;
}
public Long getAttributeId()
{
return attributeId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("groupId", getGroupId())
.append("attributeId", getAttributeId())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -1,5 +1,6 @@
package com.muyu.product.domain;
import com.muyu.common.security.utils.SecurityUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;
@ -61,7 +62,7 @@ public class AsBrandProject extends BaseEntity
.append("brandId", getBrandId())
.append("projectId", getProjectId())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createBy", SecurityUtils.getUsername())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())

View File

@ -1,5 +1,6 @@
package com.muyu.product.domain;
import com.muyu.common.security.utils.SecurityUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;

View File

@ -1,5 +1,6 @@
package com.muyu.product.domain;
import com.muyu.common.security.utils.SecurityUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;

View File

@ -1,5 +1,6 @@
package com.muyu.product.domain;
import com.muyu.common.security.utils.SecurityUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;

View File

@ -1,5 +1,6 @@
package com.muyu.product.domain;
import com.muyu.common.security.utils.SecurityUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;

View File

@ -1,5 +1,6 @@
package com.muyu.product.domain;
import com.muyu.common.security.utils.SecurityUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;

View File

@ -9,7 +9,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
* attribute_info
*
* @author CuiShiYu
* @date 2024-02-29
* @date 2024-03-01
*/
public class AttributeInfo extends BaseEntity
{
@ -18,14 +18,14 @@ public class AttributeInfo extends BaseEntity
/** 属性编号 */
private Long id;
/** 属性编码 */
@Excel(name = "属性编码")
private String code;
/** 属性名称 */
@Excel(name = "属性名称")
private String name;
/** 分组 */
@Excel(name = "分组")
private Long groupId;
public void setId(Long id)
{
this.id = id;
@ -35,6 +35,15 @@ public class AttributeInfo extends BaseEntity
{
return id;
}
public void setCode(String code)
{
this.code = code;
}
public String getCode()
{
return code;
}
public void setName(String name)
{
this.name = name;
@ -44,27 +53,18 @@ public class AttributeInfo extends BaseEntity
{
return name;
}
public void setGroupId(Long groupId)
{
this.groupId = groupId;
}
public Long getGroupId()
{
return groupId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("groupId", getGroupId())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
.append("id", getId())
.append("code", getCode())
.append("name", getName())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -1,5 +1,6 @@
package com.muyu.product.domain;
import com.muyu.common.security.utils.SecurityUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;

View File

@ -1,5 +1,6 @@
package com.muyu.product.domain;
import com.muyu.common.security.utils.SecurityUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;

View File

@ -1,5 +1,6 @@
package com.muyu.product.domain;
import com.muyu.common.security.utils.SecurityUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;

View File

@ -1,5 +1,6 @@
package com.muyu.product.domain;
import com.muyu.common.security.utils.SecurityUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;

View File

@ -1,6 +1,7 @@
package com.muyu.product.domain;
import java.math.BigDecimal;
import com.muyu.common.security.utils.SecurityUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;

View File

@ -1,6 +1,7 @@
package com.muyu.product.domain;
import java.math.BigDecimal;
import com.muyu.common.security.utils.SecurityUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;

View File

@ -1,5 +1,6 @@
package com.muyu.product.domain;
import com.muyu.common.security.utils.SecurityUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;

View File

@ -1,5 +1,6 @@
package com.muyu.product.domain;
import com.muyu.common.security.utils.SecurityUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.muyu.common.core.annotation.Excel;

View File

@ -0,0 +1,61 @@
package com.muyu.product.mapper;
import java.util.List;
import com.muyu.product.domain.AsAttributeGroup;
/**
* Mapper
*
* @author CuiShiYu
* @date 2024-03-01
*/
public interface AsAttributeGroupMapper
{
/**
*
*
* @param id
* @return
*/
public AsAttributeGroup selectAsAttributeGroupById(Long id);
/**
*
*
* @param asAttributeGroup
* @return
*/
public List<AsAttributeGroup> selectAsAttributeGroupList(AsAttributeGroup asAttributeGroup);
/**
*
*
* @param asAttributeGroup
* @return
*/
public int insertAsAttributeGroup(AsAttributeGroup asAttributeGroup);
/**
*
*
* @param asAttributeGroup
* @return
*/
public int updateAsAttributeGroup(AsAttributeGroup asAttributeGroup);
/**
*
*
* @param id
* @return
*/
public int deleteAsAttributeGroupById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteAsAttributeGroupByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.muyu.product.service;
import java.util.List;
import com.muyu.product.domain.AsAttributeGroup;
/**
* Service
*
* @author CuiShiYu
* @date 2024-03-01
*/
public interface IAsAttributeGroupService
{
/**
*
*
* @param id
* @return
*/
public AsAttributeGroup selectAsAttributeGroupById(Long id);
/**
*
*
* @param asAttributeGroup
* @return
*/
public List<AsAttributeGroup> selectAsAttributeGroupList(AsAttributeGroup asAttributeGroup);
/**
*
*
* @param asAttributeGroup
* @return
*/
public int insertAsAttributeGroup(AsAttributeGroup asAttributeGroup);
/**
*
*
* @param asAttributeGroup
* @return
*/
public int updateAsAttributeGroup(AsAttributeGroup asAttributeGroup);
/**
*
*
* @param ids
* @return
*/
public int deleteAsAttributeGroupByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteAsAttributeGroupById(Long id);
}

View File

@ -0,0 +1,99 @@
package com.muyu.product.service.impl;
import java.util.List;
import com.muyu.common.core.utils.DateUtils;
import com.muyu.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.muyu.product.mapper.AsAttributeGroupMapper;
import com.muyu.product.domain.AsAttributeGroup;
import com.muyu.product.service.IAsAttributeGroupService;
/**
* Service
*
* @author CuiShiYu
* @date 2024-03-01
*/
@Service
public class AsAttributeGroupServiceImpl implements IAsAttributeGroupService
{
@Autowired
private AsAttributeGroupMapper asAttributeGroupMapper;
/**
*
*
* @param id
* @return
*/
@Override
public AsAttributeGroup selectAsAttributeGroupById(Long id)
{
return asAttributeGroupMapper.selectAsAttributeGroupById(id);
}
/**
*
*
* @param asAttributeGroup
* @return
*/
@Override
public List<AsAttributeGroup> selectAsAttributeGroupList(AsAttributeGroup asAttributeGroup)
{
return asAttributeGroupMapper.selectAsAttributeGroupList(asAttributeGroup);
}
/**
*
*
* @param asAttributeGroup
* @return
*/
@Override
public int insertAsAttributeGroup(AsAttributeGroup asAttributeGroup)
{
asAttributeGroup.setCreateTime(DateUtils.getNowDate());
asAttributeGroup.setCreateBy(SecurityUtils.getUsername());
return asAttributeGroupMapper.insertAsAttributeGroup(asAttributeGroup);
}
/**
*
*
* @param asAttributeGroup
* @return
*/
@Override
public int updateAsAttributeGroup(AsAttributeGroup asAttributeGroup)
{
asAttributeGroup.setUpdateTime(DateUtils.getNowDate());
asAttributeGroup.setUpdateBy(SecurityUtils.getUsername());
return asAttributeGroupMapper.updateAsAttributeGroup(asAttributeGroup);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteAsAttributeGroupByIds(Long[] ids)
{
return asAttributeGroupMapper.deleteAsAttributeGroupByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteAsAttributeGroupById(Long id)
{
return asAttributeGroupMapper.deleteAsAttributeGroupById(id);
}
}

View File

@ -2,6 +2,7 @@ package com.muyu.product.service.impl;
import java.util.List;
import com.muyu.common.core.utils.DateUtils;
import com.muyu.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.muyu.product.mapper.AttributeGroupMapper;
@ -54,6 +55,7 @@ public class AttributeGroupServiceImpl implements IAttributeGroupService
public int insertAttributeGroup(AttributeGroup attributeGroup)
{
attributeGroup.setCreateTime(DateUtils.getNowDate());
attributeGroup.setCreateBy(SecurityUtils.getUsername());
return attributeGroupMapper.insertAttributeGroup(attributeGroup);
}
@ -67,6 +69,7 @@ public class AttributeGroupServiceImpl implements IAttributeGroupService
public int updateAttributeGroup(AttributeGroup attributeGroup)
{
attributeGroup.setUpdateTime(DateUtils.getNowDate());
attributeGroup.setUpdateBy(SecurityUtils.getUsername());
return attributeGroupMapper.updateAttributeGroup(attributeGroup);
}

View File

@ -2,6 +2,7 @@ package com.muyu.product.service.impl;
import java.util.List;
import com.muyu.common.core.utils.DateUtils;
import com.muyu.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.muyu.product.mapper.AttributeInfoMapper;
@ -54,6 +55,7 @@ public class AttributeInfoServiceImpl implements IAttributeInfoService
public int insertAttributeInfo(AttributeInfo attributeInfo)
{
attributeInfo.setCreateTime(DateUtils.getNowDate());
attributeInfo.setCreateBy(SecurityUtils.getUsername());
return attributeInfoMapper.insertAttributeInfo(attributeInfo);
}
@ -67,6 +69,7 @@ public class AttributeInfoServiceImpl implements IAttributeInfoService
public int updateAttributeInfo(AttributeInfo attributeInfo)
{
attributeInfo.setUpdateTime(DateUtils.getNowDate());
attributeInfo.setUpdateBy(SecurityUtils.getUsername());
return attributeInfoMapper.updateAttributeInfo(attributeInfo);
}

View File

@ -1,7 +1,9 @@
package com.muyu.product.service.impl;
import java.util.Date;
import java.util.List;
import com.muyu.common.core.utils.DateUtils;
import com.muyu.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.muyu.product.mapper.BrandInfoMapper;
@ -32,6 +34,7 @@ public class BrandInfoServiceImpl implements IBrandInfoService
return brandInfoMapper.selectBrandInfoById(id);
}
/**
*
*
@ -54,6 +57,7 @@ public class BrandInfoServiceImpl implements IBrandInfoService
public int insertBrandInfo(BrandInfo brandInfo)
{
brandInfo.setCreateTime(DateUtils.getNowDate());
brandInfo.setCreateBy(SecurityUtils.getUsername());
return brandInfoMapper.insertBrandInfo(brandInfo);
}
@ -67,6 +71,7 @@ public class BrandInfoServiceImpl implements IBrandInfoService
public int updateBrandInfo(BrandInfo brandInfo)
{
brandInfo.setUpdateTime(DateUtils.getNowDate());
brandInfo.setUpdateBy(SecurityUtils.getUsername());
return brandInfoMapper.updateBrandInfo(brandInfo);
}

View File

@ -0,0 +1,81 @@
<?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>
<select id="selectAsAttributeGroupList" parameterType="com.muyu.product.domain.AsAttributeGroup" resultMap="AsAttributeGroupResult">
<include refid="selectAsAttributeGroupVo"/>
<where>
<if test="groupId != null "> and group_id = #{groupId}</if>
<if test="attributeId != null "> and attribute_id = #{attributeId}</if>
</where>
</select>
<select id="selectAsAttributeGroupById" parameterType="Long" resultMap="AsAttributeGroupResult">
<include refid="selectAsAttributeGroupVo"/>
where id = #{id}
</select>
<insert id="insertAsAttributeGroup" parameterType="com.muyu.product.domain.AsAttributeGroup" useGeneratedKeys="true" keyProperty="id">
insert into as_attribute_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="groupId != null">group_id,</if>
<if test="attributeId != null">attribute_id,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="groupId != null">#{groupId},</if>
<if test="attributeId != null">#{attributeId},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateAsAttributeGroup" parameterType="com.muyu.product.domain.AsAttributeGroup">
update as_attribute_group
<trim prefix="SET" suffixOverrides=",">
<if test="groupId != null">group_id = #{groupId},</if>
<if test="attributeId != null">attribute_id = #{attributeId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteAsAttributeGroupById" parameterType="Long">
delete from as_attribute_group where id = #{id}
</delete>
<delete id="deleteAsAttributeGroupByIds" parameterType="String">
delete from as_attribute_group where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -1,13 +1,13 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.product.mapper.AttributeInfoMapper">
<resultMap type="com.muyu.product.domain.AttributeInfo" id="AttributeInfoResult">
<result property="id" column="id" />
<result property="code" column="code" />
<result property="name" column="name" />
<result property="groupId" column="group_id" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
@ -16,14 +16,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectAttributeInfoVo">
select id, name, group_id, remark, create_by, create_time, update_by, update_time from attribute_info
select id, code, name, remark, create_by, create_time, update_by, update_time from attribute_info
</sql>
<select id="selectAttributeInfoList" parameterType="com.muyu.product.domain.AttributeInfo" resultMap="AttributeInfoResult">
<include refid="selectAttributeInfoVo"/>
<where>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="groupId != null "> and group_id = #{groupId}</if>
</where>
</select>
@ -35,30 +35,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertAttributeInfo" parameterType="com.muyu.product.domain.AttributeInfo" useGeneratedKeys="true" keyProperty="id">
insert into attribute_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null">code,</if>
<if test="name != null">name,</if>
<if test="groupId != null">group_id,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">#{code},</if>
<if test="name != null">#{name},</if>
<if test="groupId != null">#{groupId},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</trim>
</insert>
<update id="updateAttributeInfo" parameterType="com.muyu.product.domain.AttributeInfo">
update attribute_info
<trim prefix="SET" suffixOverrides=",">
<if test="code != null">code = #{code},</if>
<if test="name != null">name = #{name},</if>
<if test="groupId != null">group_id = #{groupId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>

View File

@ -14,6 +14,7 @@
<modules>
<module>muyu-product-remote</module>
<module>muyu-product-server</module>
<module>muyu-product-common </module>
</modules>
<properties>

View File

@ -14,7 +14,6 @@
<module>muyu-job</module>
<module>muyu-file</module>
<module>muyu-product</module>
<module>muyu-product/muyu-product-common</module>
</modules>
<artifactId>muyu-modules</artifactId>