feat: 智聪记账管理,物价管理-商品信息管理代码提交。
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
package com.intc.invest.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.annotation.Resource;
|
||||
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.intc.common.log.annotation.Log;
|
||||
import com.intc.common.log.enums.BusinessType;
|
||||
import com.intc.common.security.annotation.RequiresPermissions;
|
||||
import com.intc.invest.domain.ProductInfor;
|
||||
import com.intc.invest.domain.vo.ProductInforVo;
|
||||
import com.intc.invest.domain.dto.ProductInforDto;
|
||||
import com.intc.invest.service.IProductInforService;
|
||||
import com.intc.common.core.web.controller.BaseController;
|
||||
import com.intc.common.core.web.domain.AjaxResult;
|
||||
import com.intc.common.core.utils.poi.ExcelUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.intc.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 商品基础信息Controller
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-03-19
|
||||
*/
|
||||
@Api(tags=" 商品基础信息")
|
||||
@RestController
|
||||
@RequestMapping("/productInfor")
|
||||
public class ProductInforController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
private IProductInforService productInforService;
|
||||
|
||||
/**
|
||||
* 查询商品基础信息列表
|
||||
*/
|
||||
@ApiOperation(value="查询商品基础信息列表",response = ProductInforVo.class)
|
||||
@RequiresPermissions("invest:productInfor:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ProductInforDto productInforDto)
|
||||
{
|
||||
startPage();
|
||||
List<ProductInforVo> list = productInforService.selectProductInforList(productInforDto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品基础信息列表
|
||||
*/
|
||||
@ApiOperation(value="导出商品基础信息列表")
|
||||
@RequiresPermissions("invest:productInfor:export")
|
||||
@Log(title = "商品基础信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ProductInforDto productInforDto)
|
||||
{
|
||||
List<ProductInforVo> list = productInforService.selectProductInforList(productInforDto);
|
||||
ExcelUtil<ProductInforVo> util = new ExcelUtil<ProductInforVo>(ProductInforVo.class);
|
||||
util.exportExcel(response, list, "商品基础信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品基础信息详细信息
|
||||
*/
|
||||
@ApiOperation(value="获取商品基础信息详细信息")
|
||||
@RequiresPermissions("invest:productInfor:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(productInforService.selectProductInforById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品基础信息
|
||||
*/
|
||||
@ApiOperation(value="新增商品基础信息")
|
||||
@RequiresPermissions("invest:productInfor:add")
|
||||
@Log(title = "商品基础信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ProductInfor productInfor)
|
||||
{
|
||||
return toAjax(productInforService.insertProductInfor(productInfor));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品基础信息
|
||||
*/
|
||||
@ApiOperation(value="修改商品基础信息")
|
||||
@RequiresPermissions("invest:productInfor:edit")
|
||||
@Log(title = "商品基础信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ProductInfor productInfor)
|
||||
{
|
||||
return toAjax(productInforService.updateProductInfor(productInfor));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品基础信息
|
||||
*/
|
||||
@ApiOperation(value="删除商品基础信息")
|
||||
@RequiresPermissions("invest:productInfor:remove")
|
||||
@Log(title = "商品基础信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(productInforService.deleteProductInforByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.intc.invest.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.intc.common.core.annotation.Excel;
|
||||
import com.intc.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.validation.constraints.*;
|
||||
/**
|
||||
* 商品基础信息对象 product_infor
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-03-19
|
||||
*/
|
||||
@ApiModel("商品基础信息对象")
|
||||
@Data
|
||||
public class ProductInfor extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 商品名称 */
|
||||
@ApiModelProperty(value="商品名称)")
|
||||
@NotNull(message="商品名称不能为空")
|
||||
@Excel(name = "商品名称")
|
||||
private String name;
|
||||
|
||||
/** 类别 */
|
||||
@ApiModelProperty(value="类别)")
|
||||
@NotNull(message="类别不能为空")
|
||||
@Excel(name = "类别")
|
||||
private String category;
|
||||
|
||||
/** 单位 */
|
||||
@ApiModelProperty(value="单位)")
|
||||
@NotNull(message="单位不能为空")
|
||||
@Excel(name = "单位")
|
||||
private String unit;
|
||||
|
||||
/** 更新者 */
|
||||
private String updatedBy;
|
||||
|
||||
/** 删除标志(0代表存在 1代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 预留字段 */
|
||||
private String fields;
|
||||
|
||||
/** 预留字段1 */
|
||||
private int ranking;
|
||||
|
||||
/** 编号 */
|
||||
private String code;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("category", getCategory())
|
||||
.append("unit", getUnit())
|
||||
.append("remark", getRemark())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("updatedBy", getUpdatedBy())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("fields", getFields())
|
||||
.append("ranking", getRanking())
|
||||
.append("code", getCode())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.intc.invest.domain.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
/**
|
||||
* 商品基础信息Dto对象 product_infor
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-03-19
|
||||
*/
|
||||
@ApiModel("商品基础信息Dto对象")
|
||||
@Data
|
||||
public class ProductInforDto implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 商品名称 */
|
||||
@ApiModelProperty(value="商品名称")
|
||||
private String name;
|
||||
|
||||
/** 商品编码 */
|
||||
@ApiModelProperty(value="商品编码")
|
||||
private String code;
|
||||
|
||||
/** 类别 */
|
||||
@ApiModelProperty(value="类别")
|
||||
private String category;
|
||||
|
||||
/** 单位 */
|
||||
@ApiModelProperty(value="单位")
|
||||
private String unit;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.intc.invest.domain.vo;
|
||||
|
||||
import com.intc.invest.domain.ProductInfor;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
/**
|
||||
* 商品基础信息Vo对象 product_infor
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-03-19
|
||||
*/
|
||||
@ApiModel("商品基础信息Vo对象")
|
||||
@Data
|
||||
public class ProductInforVo extends ProductInfor
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.intc.invest.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.intc.invest.domain.ProductInfor;
|
||||
import com.intc.invest.domain.dto.ProductInforDto;
|
||||
import com.intc.invest.domain.vo.ProductInforVo;
|
||||
|
||||
/**
|
||||
* 商品基础信息Mapper接口
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-03-19
|
||||
*/
|
||||
public interface ProductInforMapper
|
||||
{
|
||||
/**
|
||||
* 查询商品基础信息
|
||||
*
|
||||
* @param id 商品基础信息主键
|
||||
* @return 商品基础信息
|
||||
*/
|
||||
public ProductInforVo selectProductInforById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品基础信息列表
|
||||
*
|
||||
* @param productInforDto 商品基础信息
|
||||
* @return 商品基础信息集合
|
||||
*/
|
||||
public List<ProductInforVo> selectProductInforList(ProductInforDto productInforDto);
|
||||
|
||||
/**
|
||||
* 新增商品基础信息
|
||||
*
|
||||
* @param productInfor 商品基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertProductInfor(ProductInfor productInfor);
|
||||
|
||||
/**
|
||||
* 修改商品基础信息
|
||||
*
|
||||
* @param productInfor 商品基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateProductInfor(ProductInfor productInfor);
|
||||
|
||||
/**
|
||||
* 删除商品基础信息
|
||||
*
|
||||
* @param id 商品基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProductInforById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除商品基础信息
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProductInforByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 逻辑删除商品基础信息
|
||||
*
|
||||
* @param id 商品基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int removeProductInforById(Long id);
|
||||
|
||||
/**
|
||||
* 批量逻辑删除商品基础信息
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int removeProductInforByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.intc.invest.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.intc.invest.domain.ProductInfor;
|
||||
import com.intc.invest.domain.dto.ProductInforDto;
|
||||
import com.intc.invest.domain.vo.ProductInforVo;
|
||||
|
||||
/**
|
||||
* 商品基础信息Service接口
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-03-19
|
||||
*/
|
||||
public interface IProductInforService
|
||||
{
|
||||
/**
|
||||
* 查询商品基础信息
|
||||
*
|
||||
* @param id 商品基础信息主键
|
||||
* @return 商品基础信息
|
||||
*/
|
||||
public ProductInforVo selectProductInforById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品基础信息列表
|
||||
*
|
||||
* @param productInforDto 商品基础信息
|
||||
* @return 商品基础信息集合
|
||||
*/
|
||||
public List<ProductInforVo> selectProductInforList(ProductInforDto productInforDto);
|
||||
|
||||
/**
|
||||
* 新增商品基础信息
|
||||
*
|
||||
* @param productInfor 商品基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertProductInfor(ProductInfor productInfor);
|
||||
|
||||
/**
|
||||
* 修改商品基础信息
|
||||
*
|
||||
* @param productInfor 商品基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateProductInfor(ProductInfor productInfor);
|
||||
|
||||
/**
|
||||
* 批量删除商品基础信息
|
||||
*
|
||||
* @param ids 需要删除的商品基础信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProductInforByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除商品基础信息信息
|
||||
*
|
||||
* @param id 商品基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProductInforById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.intc.invest.service.impl;
|
||||
|
||||
import com.intc.common.core.utils.DateUtils;
|
||||
import com.intc.common.core.utils.IdWorker;
|
||||
import com.intc.common.security.utils.SecurityUtils;
|
||||
import com.intc.invest.domain.ProductInfor;
|
||||
import com.intc.invest.domain.dto.ProductInforDto;
|
||||
import com.intc.invest.domain.vo.ProductInforVo;
|
||||
import com.intc.invest.mapper.ProductInforMapper;
|
||||
import com.intc.invest.service.IProductInforService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品基础信息Service业务层处理
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-03-19
|
||||
*/
|
||||
@Service
|
||||
public class ProductInforServiceImpl implements IProductInforService
|
||||
{
|
||||
@Resource
|
||||
private ProductInforMapper productInforMapper;
|
||||
|
||||
/**
|
||||
* 查询商品基础信息
|
||||
*
|
||||
* @param id 商品基础信息主键
|
||||
* @return 商品基础信息
|
||||
*/
|
||||
@Override
|
||||
public ProductInforVo selectProductInforById(Long id)
|
||||
{
|
||||
return productInforMapper.selectProductInforById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品基础信息列表
|
||||
*
|
||||
* @param productInforDto 商品基础信息
|
||||
* @return 商品基础信息
|
||||
*/
|
||||
@Override
|
||||
public List<ProductInforVo> selectProductInforList(ProductInforDto productInforDto)
|
||||
{
|
||||
return productInforMapper.selectProductInforList(productInforDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品基础信息
|
||||
*
|
||||
* @param productInfor 商品基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertProductInfor(ProductInfor productInfor)
|
||||
{
|
||||
productInfor.setCreateTime(DateUtils.getNowDate());
|
||||
productInfor.setCreateBy(SecurityUtils.getUsername());
|
||||
productInfor.setId(IdWorker.getId());
|
||||
return productInforMapper.insertProductInfor(productInfor);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品基础信息
|
||||
*
|
||||
* @param productInfor 商品基础信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateProductInfor(ProductInfor productInfor)
|
||||
{
|
||||
productInfor.setUpdateTime(DateUtils.getNowDate());
|
||||
return productInforMapper.updateProductInfor(productInfor);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商品基础信息
|
||||
*
|
||||
* @param ids 需要删除的商品基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteProductInforByIds(Long[] ids)
|
||||
{
|
||||
return productInforMapper.removeProductInforByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品基础信息信息
|
||||
*
|
||||
* @param id 商品基础信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteProductInforById(Long id)
|
||||
{
|
||||
return productInforMapper.removeProductInforById(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user