商品规格
parent
a76e987cb4
commit
3e688b8fb4
|
@ -0,0 +1,97 @@
|
|||
package com.nuyu.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;
|
||||
|
||||
/**
|
||||
* 商品规格对象 mall_product_rule_info
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-29
|
||||
*/
|
||||
public class MallProductRuleInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
private Long id;
|
||||
|
||||
/** 规格名称 */
|
||||
@Excel(name = "规格名称")
|
||||
private String name;
|
||||
|
||||
/** 规格详情 */
|
||||
@Excel(name = "规格详情")
|
||||
private String ruleAttr;
|
||||
|
||||
/** 规格状态 */
|
||||
@Excel(name = "规格状态")
|
||||
private String status;
|
||||
|
||||
/** 乐观锁 */
|
||||
@Excel(name = "乐观锁")
|
||||
private Long revision;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setRuleAttr(String ruleAttr)
|
||||
{
|
||||
this.ruleAttr = ruleAttr;
|
||||
}
|
||||
|
||||
public String getRuleAttr()
|
||||
{
|
||||
return ruleAttr;
|
||||
}
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setRevision(Long revision)
|
||||
{
|
||||
this.revision = revision;
|
||||
}
|
||||
|
||||
public Long getRevision()
|
||||
{
|
||||
return revision;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("ruleAttr", getRuleAttr())
|
||||
.append("status", getStatus())
|
||||
.append("revision", getRevision())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -15,6 +15,9 @@ import lombok.NoArgsConstructor;
|
|||
@NoArgsConstructor
|
||||
public class BookReq {
|
||||
|
||||
|
||||
private String id;
|
||||
|
||||
/** 分类id */
|
||||
private Long catId;
|
||||
|
||||
|
@ -54,6 +57,14 @@ public class BookReq {
|
|||
@Excel(name = "乐观锁")
|
||||
private Long revision;
|
||||
|
||||
/** 规格详情 */
|
||||
@Excel(name = "规格详情")
|
||||
private String ruleAttr;
|
||||
|
||||
/** 规格状态 */
|
||||
@Excel(name = "规格状态")
|
||||
private String status;
|
||||
|
||||
|
||||
private Integer pageSize=10;
|
||||
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
package com.muyu.product.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.muyu.common.core.web.domain.AjaxResult;
|
||||
|
||||
import com.muyu.product.service.MallProductRuleInfoService;
|
||||
import com.nuyu.product.domain.MallProductRuleInfo;
|
||||
|
||||
import com.nuyu.product.req.BookReq;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
|
||||
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
|
||||
|
||||
/**
|
||||
* 商品规格Controller
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rule")
|
||||
public class MallProductRuleInfoController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private MallProductRuleInfoService mallProductRuleInfoService;
|
||||
|
||||
/**
|
||||
* 查询商品规格列表
|
||||
*/
|
||||
@RequiresPermissions("product:rule:list")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(BookReq bookReq){
|
||||
PageInfo<MallProductRuleInfo> info=mallProductRuleInfoService.list(bookReq);
|
||||
return AjaxResult.success(info);
|
||||
}
|
||||
/**
|
||||
* 导出商品规格列表
|
||||
*/
|
||||
@RequiresPermissions("product:rule:export")
|
||||
@Log(title = "商品规格", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MallProductRuleInfo mallProductRuleInfo)
|
||||
{
|
||||
List<MallProductRuleInfo> list = mallProductRuleInfoService.selectMallProductRuleInfoList(mallProductRuleInfo);
|
||||
ExcelUtil<MallProductRuleInfo> util = new ExcelUtil<MallProductRuleInfo>(MallProductRuleInfo.class);
|
||||
util.exportExcel(response, list, "商品规格数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品规格详细信息
|
||||
*/
|
||||
@RequiresPermissions("product:rule:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(mallProductRuleInfoService.selectMallProductRuleInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品规格
|
||||
*/
|
||||
@RequiresPermissions("product:rule:add")
|
||||
@Log(title = "商品规格", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody MallProductRuleInfo mallProductRuleInfo)
|
||||
{
|
||||
return toAjax(mallProductRuleInfoService.insertMallProductRuleInfo(mallProductRuleInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品规格
|
||||
*/
|
||||
@RequiresPermissions("product:rule:edit")
|
||||
@Log(title = "商品规格", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody MallProductRuleInfo mallProductRuleInfo)
|
||||
{
|
||||
return toAjax(mallProductRuleInfoService.updateMallProductRuleInfo(mallProductRuleInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品规格
|
||||
*/
|
||||
@RequiresPermissions("product:rule:remove")
|
||||
@Log(title = "商品规格", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(mallProductRuleInfoService.deleteMallProductRuleInfoByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package com.muyu.product.mapper;
|
||||
|
||||
import com.nuyu.product.domain.MallProductRuleInfo;
|
||||
import com.nuyu.product.req.BookReq;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 商品规格Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-29
|
||||
*/
|
||||
@Mapper
|
||||
public interface MallProductRuleInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询商品规格
|
||||
*
|
||||
* @param id 商品规格主键
|
||||
* @return 商品规格
|
||||
*/
|
||||
public MallProductRuleInfo selectMallProductRuleInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品规格列表
|
||||
*
|
||||
* @param mallProductRuleInfo 商品规格
|
||||
* @return 商品规格集合
|
||||
*/
|
||||
public List<MallProductRuleInfo> selectMallProductRuleInfoList(MallProductRuleInfo mallProductRuleInfo);
|
||||
|
||||
/**
|
||||
* 新增商品规格
|
||||
*
|
||||
* @param mallProductRuleInfo 商品规格
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductRuleInfo(MallProductRuleInfo mallProductRuleInfo);
|
||||
|
||||
/**
|
||||
* 修改商品规格
|
||||
*
|
||||
* @param mallProductRuleInfo 商品规格
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductRuleInfo(MallProductRuleInfo mallProductRuleInfo);
|
||||
|
||||
/**
|
||||
* 删除商品规格
|
||||
*
|
||||
* @param id 商品规格主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductRuleInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除商品规格
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductRuleInfoByIds(Long[] ids);
|
||||
|
||||
List<MallProductRuleInfo> list(BookReq bookReq);
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
package com.muyu.product.service.Impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.product.service.MallProductRuleInfoService;
|
||||
import com.nuyu.product.domain.MallProductRuleInfo;
|
||||
import com.nuyu.product.domain.MallProductTypeInfo;
|
||||
import com.nuyu.product.req.BookReq;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.product.mapper.MallProductRuleInfoMapper;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 商品规格Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-29
|
||||
*/
|
||||
@Service
|
||||
public class MallProductRuleInfoServiceImpl implements MallProductRuleInfoService
|
||||
{
|
||||
@Autowired
|
||||
private MallProductRuleInfoMapper mallProductRuleInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询商品规格
|
||||
*
|
||||
* @param id 商品规格主键
|
||||
* @return 商品规格
|
||||
*/
|
||||
@Override
|
||||
public MallProductRuleInfo selectMallProductRuleInfoById(Long id)
|
||||
{
|
||||
return mallProductRuleInfoMapper.selectMallProductRuleInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品规格列表
|
||||
*
|
||||
* @param mallProductRuleInfo 商品规格
|
||||
* @return 商品规格
|
||||
*/
|
||||
@Override
|
||||
public List<MallProductRuleInfo> selectMallProductRuleInfoList(MallProductRuleInfo mallProductRuleInfo)
|
||||
{
|
||||
return mallProductRuleInfoMapper.selectMallProductRuleInfoList(mallProductRuleInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品规格
|
||||
*
|
||||
* @param mallProductRuleInfo 商品规格
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMallProductRuleInfo(MallProductRuleInfo mallProductRuleInfo)
|
||||
{
|
||||
mallProductRuleInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return mallProductRuleInfoMapper.insertMallProductRuleInfo(mallProductRuleInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品规格
|
||||
*
|
||||
* @param mallProductRuleInfo 商品规格
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMallProductRuleInfo(MallProductRuleInfo mallProductRuleInfo)
|
||||
{
|
||||
mallProductRuleInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return mallProductRuleInfoMapper.updateMallProductRuleInfo(mallProductRuleInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商品规格
|
||||
*
|
||||
* @param ids 需要删除的商品规格主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductRuleInfoByIds(Long[] ids)
|
||||
{
|
||||
return mallProductRuleInfoMapper.deleteMallProductRuleInfoByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品规格信息
|
||||
*
|
||||
* @param id 商品规格主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMallProductRuleInfoById(Long id)
|
||||
{
|
||||
return mallProductRuleInfoMapper.deleteMallProductRuleInfoById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<MallProductRuleInfo> list(BookReq bookReq) {
|
||||
PageHelper.startPage(bookReq.getPageNum(),bookReq.getPageSize());
|
||||
List<MallProductRuleInfo> products = mallProductRuleInfoMapper.list(bookReq);
|
||||
PageInfo<MallProductRuleInfo> pageInfo = new PageInfo<>(products);
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package com.muyu.product.service;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.nuyu.product.domain.MallProductRuleInfo;
|
||||
import com.nuyu.product.domain.MallProductTypeInfo;
|
||||
import com.nuyu.product.req.BookReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 商品规格Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-04-29
|
||||
*/
|
||||
public interface MallProductRuleInfoService
|
||||
{
|
||||
/**
|
||||
* 查询商品规格
|
||||
*
|
||||
* @param id 商品规格主键
|
||||
* @return 商品规格
|
||||
*/
|
||||
public MallProductRuleInfo selectMallProductRuleInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品规格列表
|
||||
*
|
||||
* @param mallProductRuleInfo 商品规格
|
||||
* @return 商品规格集合
|
||||
*/
|
||||
public List<MallProductRuleInfo> selectMallProductRuleInfoList(MallProductRuleInfo mallProductRuleInfo);
|
||||
|
||||
/**
|
||||
* 新增商品规格
|
||||
*
|
||||
* @param mallProductRuleInfo 商品规格
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMallProductRuleInfo(MallProductRuleInfo mallProductRuleInfo);
|
||||
|
||||
/**
|
||||
* 修改商品规格
|
||||
*
|
||||
* @param mallProductRuleInfo 商品规格
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMallProductRuleInfo(MallProductRuleInfo mallProductRuleInfo);
|
||||
|
||||
/**
|
||||
* 批量删除商品规格
|
||||
*
|
||||
* @param ids 需要删除的商品规格主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductRuleInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除商品规格信息
|
||||
*
|
||||
* @param id 商品规格主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMallProductRuleInfoById(Long id);
|
||||
|
||||
|
||||
PageInfo<MallProductRuleInfo> list(BookReq bookReq);
|
||||
}
|
|
@ -85,9 +85,9 @@
|
|||
<if test="logo != null">logo = #{logo},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="revision != null">revision = #{revision},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createBy != null">create_by = 1,</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateBy != null">update_by = 1,</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
<?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.MallProductRuleInfoMapper">
|
||||
|
||||
<resultMap type="com.nuyu.product.domain.MallProductRuleInfo" id="MallProductRuleInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="ruleAttr" column="rule_attr" />
|
||||
<result property="status" column="status" />
|
||||
<result property="revision" column="revision" />
|
||||
<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="selectMallProductRuleInfoVo">
|
||||
select id, name, rule_attr, status, revision, create_by, create_time, update_by, update_time from mall_product_rule_info
|
||||
</sql>
|
||||
|
||||
<select id="selectMallProductRuleInfoList" parameterType="com.nuyu.product.domain.MallProductRuleInfo" resultMap="MallProductRuleInfoResult">
|
||||
<include refid="selectMallProductRuleInfoVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="ruleAttr != null and ruleAttr != ''"> and rule_attr = #{ruleAttr}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="revision != null "> and revision = #{revision}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMallProductRuleInfoById" parameterType="Long" resultMap="MallProductRuleInfoResult">
|
||||
<include refid="selectMallProductRuleInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.nuyu.product.domain.MallProductRuleInfo">
|
||||
<include refid="selectMallProductRuleInfoVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="ruleAttr != null and ruleAttr != ''"> and rule_attr = #{ruleAttr}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="revision != null "> and revision = #{revision}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertMallProductRuleInfo" parameterType="com.nuyu.product.domain.MallProductRuleInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into mall_product_rule_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="ruleAttr != null and ruleAttr != ''">rule_attr,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="revision != null">revision,</if>
|
||||
<if test="createBy != null">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="name != null and name != ''">#{name},</if>
|
||||
<if test="ruleAttr != null and ruleAttr != ''">#{ruleAttr},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="revision != null">#{revision},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateMallProductRuleInfo" parameterType="com.nuyu.product.domain.MallProductRuleInfo">
|
||||
update mall_product_rule_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="ruleAttr != null and ruleAttr != ''">rule_attr = #{ruleAttr},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="revision != null">revision = #{revision},</if>
|
||||
<if test="createBy != null">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="deleteMallProductRuleInfoById" parameterType="Long">
|
||||
delete from mall_product_rule_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteMallProductRuleInfoByIds" parameterType="String">
|
||||
delete from mall_product_rule_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue