feat: 智聪记账管理,物价管理-物价记录代码提交。
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
package com.intc.invest.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
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.ProductPriceRecord;
|
||||
import com.intc.invest.domain.vo.ProductPriceRecordVo;
|
||||
import com.intc.invest.domain.dto.ProductPriceRecordDto;
|
||||
import com.intc.invest.service.IProductPriceRecordService;
|
||||
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("/productPriceRecord")
|
||||
public class ProductPriceRecordController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
private IProductPriceRecordService productPriceRecordService;
|
||||
|
||||
/**
|
||||
* 查询物价记录列表
|
||||
*/
|
||||
@ApiOperation(value="查询物价记录列表",response = ProductPriceRecordVo.class)
|
||||
@RequiresPermissions("invest:productPriceRecord:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ProductPriceRecordDto productPriceRecordDto)
|
||||
{
|
||||
startPage();
|
||||
List<ProductPriceRecordVo> list = productPriceRecordService.selectProductPriceRecordList(productPriceRecordDto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出物价记录列表
|
||||
*/
|
||||
@ApiOperation(value="导出物价记录列表")
|
||||
@RequiresPermissions("invest:productPriceRecord:export")
|
||||
@Log(title = "物价记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, ProductPriceRecordDto productPriceRecordDto)
|
||||
{
|
||||
List<ProductPriceRecordVo> list = productPriceRecordService.selectProductPriceRecordList(productPriceRecordDto);
|
||||
ExcelUtil<ProductPriceRecordVo> util = new ExcelUtil<ProductPriceRecordVo>(ProductPriceRecordVo.class);
|
||||
util.exportExcel(response, list, "物价记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物价记录详细信息
|
||||
*/
|
||||
@ApiOperation(value="获取物价记录详细信息")
|
||||
@RequiresPermissions("invest:productPriceRecord:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(productPriceRecordService.selectProductPriceRecordById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增物价记录
|
||||
*/
|
||||
@ApiOperation(value="新增物价记录")
|
||||
@RequiresPermissions("invest:productPriceRecord:add")
|
||||
@Log(title = "物价记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ProductPriceRecord productPriceRecord)
|
||||
{
|
||||
return toAjax(productPriceRecordService.insertProductPriceRecord(productPriceRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改物价记录
|
||||
*/
|
||||
@ApiOperation(value="修改物价记录")
|
||||
@RequiresPermissions("invest:productPriceRecord:edit")
|
||||
@Log(title = "物价记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ProductPriceRecord productPriceRecord)
|
||||
{
|
||||
return toAjax(productPriceRecordService.updateProductPriceRecord(productPriceRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除物价记录
|
||||
*/
|
||||
@ApiOperation(value="删除物价记录")
|
||||
@RequiresPermissions("invest:productPriceRecord:remove")
|
||||
@Log(title = "物价记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(productPriceRecordService.deleteProductPriceRecordByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.intc.invest.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.intc.common.core.annotation.Excel;
|
||||
import com.intc.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
/**
|
||||
* 物价记录对象 product_price_record
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-03-19
|
||||
*/
|
||||
@ApiModel("物价记录对象")
|
||||
@Data
|
||||
public class ProductPriceRecord extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 商品ID */
|
||||
@ApiModelProperty(value="商品ID)")
|
||||
@NotNull(message="商品ID不能为空")
|
||||
@Excel(name = "商品ID")
|
||||
private Long productId;
|
||||
|
||||
/** 价格 */
|
||||
@ApiModelProperty(value="价格)")
|
||||
@NotNull(message="价格不能为空")
|
||||
@Excel(name = "价格")
|
||||
private Double price;
|
||||
|
||||
/** 记录时间 */
|
||||
@ApiModelProperty(value="记录时间)")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "记录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date recordTime;
|
||||
|
||||
/** 更新者 */
|
||||
@ApiModelProperty(value="更新者")
|
||||
@Excel(name = "更新者")
|
||||
private String updatedBy;
|
||||
|
||||
/** 地点 */
|
||||
@ApiModelProperty(value="地点)")
|
||||
@NotNull(message="地点不能为空")
|
||||
@Excel(name = "地点")
|
||||
private String address;
|
||||
|
||||
/** 删除标志(0代表存在 1代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 商家 */
|
||||
@ApiModelProperty(value="商家")
|
||||
@Excel(name = "商家")
|
||||
private String merchant;
|
||||
|
||||
/** 预留字段 */
|
||||
@ApiModelProperty(value="预留字段")
|
||||
@Excel(name = "预留字段")
|
||||
private String fields;
|
||||
|
||||
/** 单位 */
|
||||
@ApiModelProperty(value="单位")
|
||||
@Excel(name = "单位")
|
||||
private String unit;
|
||||
|
||||
/** 子类别 */
|
||||
@ApiModelProperty(value="子类别)")
|
||||
@NotNull(message="子类别不能为空")
|
||||
@Excel(name = "子类别")
|
||||
private String kind;
|
||||
|
||||
/** 类别 */
|
||||
@ApiModelProperty(value="类别)")
|
||||
@NotNull(message="类别不能为空")
|
||||
@Excel(name = "类别")
|
||||
private String category;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("productId", getProductId())
|
||||
.append("price", getPrice())
|
||||
.append("recordTime", getRecordTime())
|
||||
.append("remark", getRemark())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("updatedBy", getUpdatedBy())
|
||||
.append("address", getAddress())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("merchant", getMerchant())
|
||||
.append("fields", getFields())
|
||||
.append("unit", getUnit())
|
||||
.append("kind", getKind())
|
||||
.append("category", getCategory())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.intc.invest.domain.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
/**
|
||||
* 物价记录Dto对象 product_price_record
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-03-19
|
||||
*/
|
||||
@ApiModel("物价记录Dto对象")
|
||||
@Data
|
||||
public class ProductPriceRecordDto implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 商品ID */
|
||||
@ApiModelProperty(value="商品ID")
|
||||
private Long productId;
|
||||
|
||||
/** 价格 */
|
||||
@ApiModelProperty(value="价格")
|
||||
private Double price;
|
||||
|
||||
/** 记录时间 */
|
||||
@ApiModelProperty(value="记录时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date recordTime;
|
||||
|
||||
/** 地点 */
|
||||
@ApiModelProperty(value="地点")
|
||||
private String address;
|
||||
|
||||
/** 商家 */
|
||||
@ApiModelProperty(value="商家")
|
||||
private String merchant;
|
||||
|
||||
/** 子类别 */
|
||||
@ApiModelProperty(value="子类别")
|
||||
private String kind;
|
||||
|
||||
/** 类别 */
|
||||
@ApiModelProperty(value="类别")
|
||||
private String category;
|
||||
|
||||
/** 开始日期 */
|
||||
@ApiModelProperty(value="开始日期")
|
||||
private String startTime;
|
||||
|
||||
/** 结束日期 */
|
||||
@ApiModelProperty(value="结束日期")
|
||||
private String endTime;
|
||||
|
||||
/** 开始时间*/
|
||||
@ApiModelProperty(value="开始时间")
|
||||
private Date startDateTime;
|
||||
|
||||
/** 结束时间*/
|
||||
@ApiModelProperty(value="结束时间")
|
||||
private Date endDateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.intc.invest.domain.vo;
|
||||
|
||||
import com.intc.invest.domain.ProductPriceRecord;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
/**
|
||||
* 物价记录Vo对象 product_price_record
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-03-19
|
||||
*/
|
||||
@ApiModel("物价记录Vo对象")
|
||||
@Data
|
||||
public class ProductPriceRecordVo extends ProductPriceRecord
|
||||
{
|
||||
|
||||
/** 名称 */
|
||||
private String productName;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.intc.invest.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.intc.invest.domain.ProductPriceRecord;
|
||||
import com.intc.invest.domain.dto.ProductPriceRecordDto;
|
||||
import com.intc.invest.domain.vo.ProductPriceRecordVo;
|
||||
|
||||
/**
|
||||
* 物价记录Mapper接口
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-03-19
|
||||
*/
|
||||
public interface ProductPriceRecordMapper
|
||||
{
|
||||
/**
|
||||
* 查询物价记录
|
||||
*
|
||||
* @param id 物价记录主键
|
||||
* @return 物价记录
|
||||
*/
|
||||
public ProductPriceRecordVo selectProductPriceRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 查询物价记录列表
|
||||
*
|
||||
* @param productPriceRecordDto 物价记录
|
||||
* @return 物价记录集合
|
||||
*/
|
||||
public List<ProductPriceRecordVo> selectProductPriceRecordList(ProductPriceRecordDto productPriceRecordDto);
|
||||
|
||||
/**
|
||||
* 新增物价记录
|
||||
*
|
||||
* @param productPriceRecord 物价记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertProductPriceRecord(ProductPriceRecord productPriceRecord);
|
||||
|
||||
/**
|
||||
* 修改物价记录
|
||||
*
|
||||
* @param productPriceRecord 物价记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateProductPriceRecord(ProductPriceRecord productPriceRecord);
|
||||
|
||||
/**
|
||||
* 删除物价记录
|
||||
*
|
||||
* @param id 物价记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProductPriceRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除物价记录
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProductPriceRecordByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 逻辑删除物价记录
|
||||
*
|
||||
* @param id 物价记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int removeProductPriceRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 批量逻辑删除物价记录
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int removeProductPriceRecordByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.intc.invest.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.intc.invest.domain.ProductPriceRecord;
|
||||
import com.intc.invest.domain.dto.ProductPriceRecordDto;
|
||||
import com.intc.invest.domain.vo.ProductPriceRecordVo;
|
||||
|
||||
/**
|
||||
* 物价记录Service接口
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-03-19
|
||||
*/
|
||||
public interface IProductPriceRecordService
|
||||
{
|
||||
/**
|
||||
* 查询物价记录
|
||||
*
|
||||
* @param id 物价记录主键
|
||||
* @return 物价记录
|
||||
*/
|
||||
public ProductPriceRecordVo selectProductPriceRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 查询物价记录列表
|
||||
*
|
||||
* @param productPriceRecordDto 物价记录
|
||||
* @return 物价记录集合
|
||||
*/
|
||||
public List<ProductPriceRecordVo> selectProductPriceRecordList(ProductPriceRecordDto productPriceRecordDto);
|
||||
|
||||
/**
|
||||
* 新增物价记录
|
||||
*
|
||||
* @param productPriceRecord 物价记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertProductPriceRecord(ProductPriceRecord productPriceRecord);
|
||||
|
||||
/**
|
||||
* 修改物价记录
|
||||
*
|
||||
* @param productPriceRecord 物价记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateProductPriceRecord(ProductPriceRecord productPriceRecord);
|
||||
|
||||
/**
|
||||
* 批量删除物价记录
|
||||
*
|
||||
* @param ids 需要删除的物价记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProductPriceRecordByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除物价记录信息
|
||||
*
|
||||
* @param id 物价记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteProductPriceRecordById(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.ProductPriceRecord;
|
||||
import com.intc.invest.domain.dto.ProductPriceRecordDto;
|
||||
import com.intc.invest.domain.vo.ProductPriceRecordVo;
|
||||
import com.intc.invest.mapper.ProductPriceRecordMapper;
|
||||
import com.intc.invest.service.IProductPriceRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物价记录Service业务层处理
|
||||
*
|
||||
* @author tianyongbao
|
||||
* @date 2025-03-19
|
||||
*/
|
||||
@Service
|
||||
public class ProductPriceRecordServiceImpl implements IProductPriceRecordService
|
||||
{
|
||||
@Resource
|
||||
private ProductPriceRecordMapper productPriceRecordMapper;
|
||||
|
||||
/**
|
||||
* 查询物价记录
|
||||
*
|
||||
* @param id 物价记录主键
|
||||
* @return 物价记录
|
||||
*/
|
||||
@Override
|
||||
public ProductPriceRecordVo selectProductPriceRecordById(Long id)
|
||||
{
|
||||
return productPriceRecordMapper.selectProductPriceRecordById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询物价记录列表
|
||||
*
|
||||
* @param productPriceRecordDto 物价记录
|
||||
* @return 物价记录
|
||||
*/
|
||||
@Override
|
||||
public List<ProductPriceRecordVo> selectProductPriceRecordList(ProductPriceRecordDto productPriceRecordDto)
|
||||
{
|
||||
return productPriceRecordMapper.selectProductPriceRecordList(productPriceRecordDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增物价记录
|
||||
*
|
||||
* @param productPriceRecord 物价记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertProductPriceRecord(ProductPriceRecord productPriceRecord)
|
||||
{
|
||||
productPriceRecord.setCreateTime(DateUtils.getNowDate());
|
||||
productPriceRecord.setCreateBy(SecurityUtils.getUsername());
|
||||
productPriceRecord.setId(IdWorker.getId());
|
||||
return productPriceRecordMapper.insertProductPriceRecord(productPriceRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改物价记录
|
||||
*
|
||||
* @param productPriceRecord 物价记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateProductPriceRecord(ProductPriceRecord productPriceRecord)
|
||||
{
|
||||
productPriceRecord.setUpdateTime(DateUtils.getNowDate());
|
||||
return productPriceRecordMapper.updateProductPriceRecord(productPriceRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除物价记录
|
||||
*
|
||||
* @param ids 需要删除的物价记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteProductPriceRecordByIds(Long[] ids)
|
||||
{
|
||||
return productPriceRecordMapper.removeProductPriceRecordByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除物价记录信息
|
||||
*
|
||||
* @param id 物价记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteProductPriceRecordById(Long id)
|
||||
{
|
||||
return productPriceRecordMapper.removeProductPriceRecordById(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user