diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/controller/ProjectInfoController.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/controller/ProjectInfoController.java new file mode 100644 index 0000000..3fd297c --- /dev/null +++ b/muyu-modules/muyu-system/src/main/java/com/muyu/system/controller/ProjectInfoController.java @@ -0,0 +1,104 @@ +package com.muyu.system.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +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.system.domain.ProjectInfo; +import com.muyu.system.service.IProjectInfoService; +import com.muyu.common.core.web.controller.BaseController; +import com.muyu.common.core.domain.Result; +import com.muyu.common.core.utils.poi.ExcelUtil; +import com.muyu.common.core.web.page.TableDataInfo; + +/** + * 商品信息Controller + * + * @author muyu + * @date 2024-02-27 + */ +@RestController +@RequestMapping("/info") +public class ProjectInfoController extends BaseController +{ + @Autowired + private IProjectInfoService projectInfoService; + + /** + * 查询商品信息列表 + */ + @RequiresPermissions("system:info:list") + @GetMapping("/list") + public Result> list(ProjectInfo projectInfo) + { + startPage(); + List list = projectInfoService.selectProjectInfoList(projectInfo); + return getDataTable(list); + } + + /** + * 导出商品信息列表 + */ + @RequiresPermissions("system:info:export") + @Log(title = "商品信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ProjectInfo projectInfo) + { + List list = projectInfoService.selectProjectInfoList(projectInfo); + ExcelUtil util = new ExcelUtil(ProjectInfo.class); + util.exportExcel(response, list, "商品信息数据"); + } + + /** + * 获取商品信息详细信息 + */ + @RequiresPermissions("system:info:query") + @GetMapping(value = "/{id}") + public Result getInfo(@PathVariable("id") Long id) + { + return success(projectInfoService.selectProjectInfoById(id)); + } + + /** + * 新增商品信息 + */ + @RequiresPermissions("system:info:add") + @Log(title = "商品信息", businessType = BusinessType.INSERT) + @PostMapping + public Result add(@RequestBody ProjectInfo projectInfo) + { + return toAjax(projectInfoService.insertProjectInfo(projectInfo)); + } + + /** + * 修改商品信息 + */ + @RequiresPermissions("system:info:edit") + @Log(title = "商品信息", businessType = BusinessType.UPDATE) + @PutMapping + public Result edit(@RequestBody ProjectInfo projectInfo) + { + return toAjax(projectInfoService.updateProjectInfo(projectInfo)); + } + + /** + * 删除商品信息 + */ + @RequiresPermissions("system:info:remove") + @Log(title = "商品信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public Result remove(@PathVariable Long[] ids) + { + return toAjax(projectInfoService.deleteProjectInfoByIds(ids)); + } +} diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/ProjectInfo.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/ProjectInfo.java new file mode 100644 index 0000000..bbb576c --- /dev/null +++ b/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/ProjectInfo.java @@ -0,0 +1,197 @@ +package com.muyu.system.domain; + +import java.math.BigDecimal; +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; + +/** + * 商品信息对象 project_info + * + * @author muyu + * @date 2024-02-27 + */ +public class ProjectInfo extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long id; + + /** 商品名称 */ + @Excel(name = "商品名称") + private String name; + + /** 商品图片 */ + @Excel(name = "商品图片") + private String image; + + /** 主类型 */ + @Excel(name = "主类型") + private String mianType; + + /** 父类型 */ + @Excel(name = "父类型") + private String parentType; + + /** 商品类型 */ + @Excel(name = "商品类型") + private String type; + + /** 商品价格 */ + @Excel(name = "商品价格") + private BigDecimal price; + + /** 商品数量 */ + @Excel(name = "商品数量") + private Long num; + + /** 商品介绍 */ + @Excel(name = "商品介绍") + private String introduction; + + /** 商品状态 */ + @Excel(name = "商品状态") + private String status; + + /** 品牌 */ + @Excel(name = "品牌") + private Long brandId; + + /** 规格 */ + @Excel(name = "规格") + private Long ruleId; + + 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 setImage(String image) + { + this.image = image; + } + + public String getImage() + { + return image; + } + public void setMianType(String mianType) + { + this.mianType = mianType; + } + + public String getMianType() + { + return mianType; + } + public void setParentType(String parentType) + { + this.parentType = parentType; + } + + public String getParentType() + { + return parentType; + } + public void setType(String type) + { + this.type = type; + } + + public String getType() + { + return type; + } + public void setPrice(BigDecimal price) + { + this.price = price; + } + + public BigDecimal getPrice() + { + return price; + } + public void setNum(Long num) + { + this.num = num; + } + + public Long getNum() + { + return num; + } + public void setIntroduction(String introduction) + { + this.introduction = introduction; + } + + public String getIntroduction() + { + return introduction; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setBrandId(Long brandId) + { + this.brandId = brandId; + } + + public Long getBrandId() + { + return brandId; + } + public void setRuleId(Long ruleId) + { + this.ruleId = ruleId; + } + + public Long getRuleId() + { + return ruleId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("name", getName()) + .append("image", getImage()) + .append("mianType", getMianType()) + .append("parentType", getParentType()) + .append("type", getType()) + .append("price", getPrice()) + .append("num", getNum()) + .append("introduction", getIntroduction()) + .append("status", getStatus()) + .append("brandId", getBrandId()) + .append("ruleId", getRuleId()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/mapper/ProjectInfoMapper.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/mapper/ProjectInfoMapper.java new file mode 100644 index 0000000..b047ae3 --- /dev/null +++ b/muyu-modules/muyu-system/src/main/java/com/muyu/system/mapper/ProjectInfoMapper.java @@ -0,0 +1,61 @@ +package com.muyu.system.mapper; + +import java.util.List; +import com.muyu.system.domain.ProjectInfo; + +/** + * 商品信息Mapper接口 + * + * @author muyu + * @date 2024-02-27 + */ +public interface ProjectInfoMapper +{ + /** + * 查询商品信息 + * + * @param id 商品信息主键 + * @return 商品信息 + */ + public ProjectInfo selectProjectInfoById(Long id); + + /** + * 查询商品信息列表 + * + * @param projectInfo 商品信息 + * @return 商品信息集合 + */ + public List selectProjectInfoList(ProjectInfo projectInfo); + + /** + * 新增商品信息 + * + * @param projectInfo 商品信息 + * @return 结果 + */ + public int insertProjectInfo(ProjectInfo projectInfo); + + /** + * 修改商品信息 + * + * @param projectInfo 商品信息 + * @return 结果 + */ + public int updateProjectInfo(ProjectInfo projectInfo); + + /** + * 删除商品信息 + * + * @param id 商品信息主键 + * @return 结果 + */ + public int deleteProjectInfoById(Long id); + + /** + * 批量删除商品信息 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProjectInfoByIds(Long[] ids); +} diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/IProjectInfoService.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/IProjectInfoService.java new file mode 100644 index 0000000..3e2a3f1 --- /dev/null +++ b/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/IProjectInfoService.java @@ -0,0 +1,61 @@ +package com.muyu.system.service; + +import java.util.List; +import com.muyu.system.domain.ProjectInfo; + +/** + * 商品信息Service接口 + * + * @author muyu + * @date 2024-02-27 + */ +public interface IProjectInfoService +{ + /** + * 查询商品信息 + * + * @param id 商品信息主键 + * @return 商品信息 + */ + public ProjectInfo selectProjectInfoById(Long id); + + /** + * 查询商品信息列表 + * + * @param projectInfo 商品信息 + * @return 商品信息集合 + */ + public List selectProjectInfoList(ProjectInfo projectInfo); + + /** + * 新增商品信息 + * + * @param projectInfo 商品信息 + * @return 结果 + */ + public int insertProjectInfo(ProjectInfo projectInfo); + + /** + * 修改商品信息 + * + * @param projectInfo 商品信息 + * @return 结果 + */ + public int updateProjectInfo(ProjectInfo projectInfo); + + /** + * 批量删除商品信息 + * + * @param ids 需要删除的商品信息主键集合 + * @return 结果 + */ + public int deleteProjectInfoByIds(Long[] ids); + + /** + * 删除商品信息信息 + * + * @param id 商品信息主键 + * @return 结果 + */ + public int deleteProjectInfoById(Long id); +} diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/impl/ProjectInfoServiceImpl.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/impl/ProjectInfoServiceImpl.java new file mode 100644 index 0000000..82d11ee --- /dev/null +++ b/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/impl/ProjectInfoServiceImpl.java @@ -0,0 +1,96 @@ +package com.muyu.system.service.impl; + +import java.util.List; +import com.muyu.common.core.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.muyu.system.mapper.ProjectInfoMapper; +import com.muyu.system.domain.ProjectInfo; +import com.muyu.system.service.IProjectInfoService; + +/** + * 商品信息Service业务层处理 + * + * @author muyu + * @date 2024-02-27 + */ +@Service +public class ProjectInfoServiceImpl implements IProjectInfoService +{ + @Autowired + private ProjectInfoMapper projectInfoMapper; + + /** + * 查询商品信息 + * + * @param id 商品信息主键 + * @return 商品信息 + */ + @Override + public ProjectInfo selectProjectInfoById(Long id) + { + return projectInfoMapper.selectProjectInfoById(id); + } + + /** + * 查询商品信息列表 + * + * @param projectInfo 商品信息 + * @return 商品信息 + */ + @Override + public List selectProjectInfoList(ProjectInfo projectInfo) + { + return projectInfoMapper.selectProjectInfoList(projectInfo); + } + + /** + * 新增商品信息 + * + * @param projectInfo 商品信息 + * @return 结果 + */ + @Override + public int insertProjectInfo(ProjectInfo projectInfo) + { + projectInfo.setCreateTime(DateUtils.getNowDate()); + return projectInfoMapper.insertProjectInfo(projectInfo); + } + + /** + * 修改商品信息 + * + * @param projectInfo 商品信息 + * @return 结果 + */ + @Override + public int updateProjectInfo(ProjectInfo projectInfo) + { + projectInfo.setUpdateTime(DateUtils.getNowDate()); + return projectInfoMapper.updateProjectInfo(projectInfo); + } + + /** + * 批量删除商品信息 + * + * @param ids 需要删除的商品信息主键 + * @return 结果 + */ + @Override + public int deleteProjectInfoByIds(Long[] ids) + { + return projectInfoMapper.deleteProjectInfoByIds(ids); + } + + /** + * 删除商品信息信息 + * + * @param id 商品信息主键 + * @return 结果 + */ + @Override + public int deleteProjectInfoById(Long id) + { + return projectInfoMapper.deleteProjectInfoById(id); + } +} diff --git a/muyu-modules/muyu-system/src/main/resources/mapper/system/ProjectInfoMapper.xml b/muyu-modules/muyu-system/src/main/resources/mapper/system/ProjectInfoMapper.xml new file mode 100644 index 0000000..bd23a11 --- /dev/null +++ b/muyu-modules/muyu-system/src/main/resources/mapper/system/ProjectInfoMapper.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + select id, name, image, mian_type, parent_type, type, price, num, introduction, status, brand_id, rule_id, remark, create_by, create_time, update_by, update_time from project_info + + + + + + + + insert into project_info + + name, + image, + mian_type, + parent_type, + type, + price, + num, + introduction, + status, + brand_id, + rule_id, + remark, + create_by, + create_time, + update_by, + update_time, + + + #{name}, + #{image}, + #{mianType}, + #{parentType}, + #{type}, + #{price}, + #{num}, + #{introduction}, + #{status}, + #{brandId}, + #{ruleId}, + #{remark}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update project_info + + name = #{name}, + image = #{image}, + mian_type = #{mianType}, + parent_type = #{parentType}, + type = #{type}, + price = #{price}, + num = #{num}, + introduction = #{introduction}, + status = #{status}, + brand_id = #{brandId}, + rule_id = #{ruleId}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from project_info where id = #{id} + + + + delete from project_info where id in + + #{id} + + +