Commit 1f0a8c82 authored by 罗林杰's avatar 罗林杰

增加数据管理

parent c28a0417
package org.rcisoft.bus.wmsgoodsprice.controller;
/*固定导入*/
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.core.anno.CyOpeLogAnno;
import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
import org.rcisoft.core.util.CyEpExcelUtil;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.exception.CyServiceException;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.rcisoft.bus.wmsgoodsprice.entity.WmsGoodsPrice;
import org.rcisoft.bus.wmsgoodsprice.service.WmsGoodsPriceService;
import java.util.List;
/**
* Created by cy on 2024年12月12日 下午4:27:44.
*/
@RestController
@RequestMapping("/wmsgoodsprice")
public class WmsGoodsPriceController extends CyPaginationController<WmsGoodsPrice> {
@Autowired
private WmsGoodsPriceService wmsGoodsPriceServiceImpl;
//@PreAuthorize("@cyPerm.hasPerm('sys:goodsPrice:add')")
@CyOpeLogAnno(title = "system-价格管理表管理-新增价格管理表", businessType = CyLogTypeEnum.INSERT)
@ApiOperation(value="添加价格管理表", notes="添加价格管理表")
@PostMapping(value = "/add")
public CyResult add(@Valid WmsGoodsPrice wmsGoodsPrice, BindingResult bindingResult) {
CyPersistModel data = wmsGoodsPriceServiceImpl.persist(wmsGoodsPrice);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
wmsGoodsPrice);
}
//@PreAuthorize("@cyPerm.hasPerm('sys:goodsPrice:delete')")
@CyOpeLogAnno(title = "system-价格管理表管理-删除价格管理表", businessType = CyLogTypeEnum.DELETE)
@ApiOperation(value="逻辑删除价格管理表", notes="逻辑删除价格管理表")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@DeleteMapping("/deleteLogical/{businessId:\\w+}")
public CyResult deleteLogical(@PathVariable int businessId,WmsGoodsPrice wmsGoodsPrice) {
wmsGoodsPrice.setBusinessId(businessId);
CyPersistModel data = wmsGoodsPriceServiceImpl.removeLogical(wmsGoodsPrice);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
//@PreAuthorize("@cyPerm.hasPerm('sys:goodsPrice:delete')")
@CyOpeLogAnno(title = "system-价格管理表管理-删除价格管理表", businessType = CyLogTypeEnum.DELETE)
@ApiOperation(value="删除价格管理表", notes="删除价格管理表")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@DeleteMapping("/delete/{businessId:\\w+}")
public CyResult delete(@PathVariable int businessId,WmsGoodsPrice wmsGoodsPrice) {
wmsGoodsPrice.setBusinessId(businessId);
CyPersistModel data = wmsGoodsPriceServiceImpl.remove(wmsGoodsPrice);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
businessId);
}
//@PreAuthorize("@cyPerm.hasPerm('sys:goodsPrice:update')")
@CyOpeLogAnno(title = "system-价格管理表管理-修改价格管理表", businessType = CyLogTypeEnum.UPDATE)
@ApiOperation(value="修改价格管理表", notes="修改价格管理表")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PutMapping("/update/{businessId:\\w+}")
public CyResult update(@PathVariable int businessId, @Valid WmsGoodsPrice wmsGoodsPrice, BindingResult bindingResult) {
wmsGoodsPrice.setBusinessId(businessId);
CyPersistModel data = wmsGoodsPriceServiceImpl.merge(wmsGoodsPrice);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
wmsGoodsPrice);
}
//@PreAuthorize("@cyPerm.hasPerm('sys:goodsPrice:query')")
@CyOpeLogAnno(title = "system-价格管理表管理-查询价格管理表", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value="查询单一价格管理表", notes="查询单一价格管理表")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@GetMapping("/detail/{businessId:\\w+}")
public CyResult detail(@PathVariable int businessId) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
wmsGoodsPriceServiceImpl.findById(businessId));
}
//@PreAuthorize("@cyPerm.hasPerm('sys:goodsPrice:list')")
@CyOpeLogAnno(title = "system-价格管理表管理-查询价格管理表", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value="查询价格管理表集合", notes="查询价格管理表集合")
@GetMapping(value = "/listAll")
public CyResult listAll(WmsGoodsPrice wmsGoodsPrice) {
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
wmsGoodsPriceServiceImpl.findAll(wmsGoodsPrice));
}
//@PreAuthorize("@cyPerm.hasPerm('sys:goodsPrice:list')")
@CyOpeLogAnno(title = "system-价格管理表管理-查询价格管理表", businessType = CyLogTypeEnum.QUERY)
@ApiOperation(value="分页查询价格管理表集合", notes="分页查询价格管理表集合")
@GetMapping(value = "/list")
public CyGridModel listByPagination(WmsGoodsPrice wmsGoodsPrice) {
wmsGoodsPriceServiceImpl.findAllByPagination(getPaginationUtility(), wmsGoodsPrice);
return getGridModelResponse();
}
@CyOpeLogAnno(title = "system-价格管理表管理-查询价格管理表", businessType = CyLogTypeEnum.EXPORT)
@ApiOperation(value = "导出价格管理表信息", notes = "导出价格管理表信息")
@GetMapping(value = "/export")
public void outWmsGoodsPrice(HttpServletResponse response,WmsGoodsPrice wmsGoodsPrice,@PathVariable @RequestParam(defaultValue = "0") String excelId) {
String excelName="";
switch(excelId){
case "0": excelName="价格管理表信息.xls";break;
case "1": excelName="价格管理表信息.xlsx";break;
case "2": excelName="价格管理表信息.csv";break;
}
List<WmsGoodsPrice> wmsGoodsPriceList = wmsGoodsPriceServiceImpl.export(wmsGoodsPrice);
CyEpExcelUtil.exportExcel(wmsGoodsPriceList, "价格管理表信息", "价格管理表信息", WmsGoodsPrice.class, excelName, response);
}
}
package org.rcisoft.bus.wmsgoodsprice.dao;
import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.bus.wmsgoodsprice.entity.WmsGoodsPrice;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.rcisoft.core.model.CyPageInfo;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
* Created with cy on 2024年12月12日 下午4:27:44.
*/
public interface WmsGoodsPriceRepository extends CyBaseMapper<WmsGoodsPrice> {
List<WmsGoodsPrice> queryWmsGoodsPrices(@Param("entity") WmsGoodsPrice wmsGoodsPrice);
/**
* 分页查询 wmsGoodsPrice
*
*/
IPage<WmsGoodsPrice> queryWmsGoodsPricesPaged(CyPageInfo cyPageInfo,@Param("entity") WmsGoodsPrice wmsGoodsPrice);
}
package org.rcisoft.bus.wmsgoodsprice.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.*;
import org.rcisoft.core.entity.CyIdIncreEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created with cy on 2024年12月12日 下午4:27:44.
*/
@Data
@TableName("wms_goods_price")
public class WmsGoodsPrice extends CyIdIncreEntity<WmsGoodsPrice> {
/**
* @desc 货号
* @column goods_art_number
* @default
*/
@Excel(name = "货号", orderNum = "0", width = 20)
private String goodsArtNumber;
/**
* @desc 原价
* @column original_price
* @default
*/
@Excel(name = "原价", orderNum = "1", width = 20)
private BigDecimal originalPrice;
/**
* @desc 折扣价
* @column discount_price
* @default
*/
@Excel(name = "折扣价", orderNum = "2", width = 20)
private BigDecimal discountPrice;
/**
* @desc 门店价
* @column store_price
* @default
*/
@Excel(name = "门店价", orderNum = "3", width = 20)
private BigDecimal storePrice;
/**
* 开始时间
*/
@JsonIgnore
@TableField(exist = false)
private String beginTime;
/**
* 结束时间
*/
@JsonIgnore
@TableField(exist = false)
private String endTime;
}
package org.rcisoft.bus.wmsgoodsprice.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.rcisoft.bus.wmsgoodsprice.entity.WmsGoodsPrice;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPageInfo;
import java.util.List;
/**
* Created by cy on 2024年12月12日 下午4:27:44.
*/
public interface WmsGoodsPriceService {
/**
* 保存 价格管理表
* @param wmsGoodsPrice
* @return
*/
CyPersistModel persist(WmsGoodsPrice wmsGoodsPrice);
/**
* 删除 价格管理表
* @param wmsGoodsPrice
* @return
*/
CyPersistModel remove(WmsGoodsPrice wmsGoodsPrice);
/**
* 逻辑删除 价格管理表
* @param wmsGoodsPrice
* @return
*/
CyPersistModel removeLogical(WmsGoodsPrice wmsGoodsPrice);
/**
* 修改 价格管理表
* @param wmsGoodsPrice
* @return
*/
CyPersistModel merge(WmsGoodsPrice wmsGoodsPrice);
/**
* 根据id查询 价格管理表
* @param id
* @return
*/
WmsGoodsPrice findById(int id);
/**
* 分页查询 价格管理表
* @param wmsGoodsPrice
* @return
*/
IPage<WmsGoodsPrice> findAllByPagination(CyPageInfo<WmsGoodsPrice> paginationUtility,
WmsGoodsPrice wmsGoodsPrice);
/**
* 查询list 价格管理表
* @param wmsGoodsPrice
* @return
*/
List<WmsGoodsPrice> findAll(WmsGoodsPrice wmsGoodsPrice);
/**
* 导出价格管理表
* @return
*/
List<WmsGoodsPrice> export(WmsGoodsPrice wmsGoodsPrice);
}
package org.rcisoft.bus.wmsgoodsprice.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.aop.CyPageUtilAsp;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.util.CyEpExcelUtil;
import org.rcisoft.bus.wmsgoodsprice.dao.WmsGoodsPriceRepository;
import org.rcisoft.bus.wmsgoodsprice.entity.WmsGoodsPrice;
import org.rcisoft.bus.wmsgoodsprice.service.WmsGoodsPriceService;
import org.rcisoft.core.service.CyBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.rcisoft.core.model.CyPageInfo;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* Created by cy on 2024年12月12日 下午4:27:44.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class WmsGoodsPriceServiceImpl extends ServiceImpl<WmsGoodsPriceRepository,WmsGoodsPrice> implements WmsGoodsPriceService {
/**
* 保存 价格管理表
* @param wmsGoodsPrice
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel persist(WmsGoodsPrice wmsGoodsPrice){
//增加操作
int line = baseMapper.insert(wmsGoodsPrice);
log.debug(CyUserUtil.getAuthenUsername()+"新增了ID为"+
wmsGoodsPrice.getBusinessId()+"的价格管理表信息");
return new CyPersistModel(line);
}
/**
* 删除 价格管理表
* @param wmsGoodsPrice
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel remove(WmsGoodsPrice wmsGoodsPrice){
int line = baseMapper.realDelete(wmsGoodsPrice);
log.debug(CyUserUtil.getAuthenUsername()+"删除了ID为"+
wmsGoodsPrice.getBusinessId()+"的价格管理表信息");
return new CyPersistModel(line);
}
/**
* 逻辑删除 价格管理表
* @param wmsGoodsPrice
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel removeLogical(WmsGoodsPrice wmsGoodsPrice){
wmsGoodsPrice.setDeleted();
int line = baseMapper.deleteById(wmsGoodsPrice);
log.debug(CyUserUtil.getAuthenUsername()+"逻辑删除了ID为"+
wmsGoodsPrice.getBusinessId()+"的价格管理表信息");
return new CyPersistModel(line);
}
/**
* 修改 价格管理表
* @param wmsGoodsPrice
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel merge(WmsGoodsPrice wmsGoodsPrice){
int line = baseMapper.updateById(wmsGoodsPrice);
log.debug(CyUserUtil.getAuthenUsername()+"修改了ID为"+ wmsGoodsPrice.getBusinessId()+"的价格管理表信息");
return new CyPersistModel(line);
}
/**
* 根据id查询 价格管理表
* @param id
* @return
*/
@Override
public WmsGoodsPrice findById(int id){
return baseMapper.selectById(id);
}
/**
* 分页查询 价格管理表
* @param wmsGoodsPrice
* @return
*/
@Override
public IPage<WmsGoodsPrice> findAllByPagination(CyPageInfo<WmsGoodsPrice> paginationUtility,
WmsGoodsPrice wmsGoodsPrice){
return baseMapper.queryWmsGoodsPricesPaged(paginationUtility,wmsGoodsPrice);
}
/**
* 查询list 价格管理表
* @param wmsGoodsPrice
* @return
*/
@Override
public List<WmsGoodsPrice> findAll(WmsGoodsPrice wmsGoodsPrice){
return baseMapper.queryWmsGoodsPrices(wmsGoodsPrice);
}
/**
* 导出价格管理表
* @return
*/
@Override
public List<WmsGoodsPrice> export(WmsGoodsPrice wmsGoodsPrice) {
List<WmsGoodsPrice> wmsGoodsPriceList = baseMapper.queryWmsGoodsPrices(wmsGoodsPrice);
return wmsGoodsPriceList;
}
}
......@@ -123,7 +123,7 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/wms_db?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&serverTimezone=GMT%2B8
username: root
password: mosheng
password: 123456
#----------5.2 POSTGRES------------
......
......@@ -28,10 +28,10 @@ cy_mq:
# db: wms_db
cy_db:
ip: localhost
port: 8080
ip: 127.0.0.1
port: 3306
username: root
password: mosheng
password: 123456
db: wms_db
#cy_db:
# ip: 127.0.0.1
......
<?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="org.rcisoft.bus.wmsgoodsprice.dao.WmsGoodsPriceRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.bus.wmsgoodsprice.entity.WmsGoodsPrice">
<id column="business_id" jdbcType="INTEGER" property="businessId"/>
<result column="goods_art_number" jdbcType="VARCHAR" property="goodsArtNumber"/>
<result column="original_price" jdbcType="DECIMAL" property="originalPrice"/>
<result column="discount_price" jdbcType="DECIMAL" property="discountPrice"/>
<result column="store_price" jdbcType="DECIMAL" property="storePrice"/>
<result column="flag" jdbcType="CHAR" property="flag"/>
<result column="del_flag" jdbcType="CHAR" property="delFlag"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
<select id="queryWmsGoodsPrices" resultMap="BaseResultMap">
select * from wms_goods_price
where 1=1
and del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' ">
and flag = #{entity.flag}
</if>
<if test="entity.goodsArtNumber !=null and entity.goodsArtNumber != '' ">
and goods_art_number like concat('%',#{entity.goodsArtNumber},'%')
</if>
<if test="entity.originalPrice !=null and entity.originalPrice != '' ">
and original_price = #{entity.originalPrice}
</if>
<if test="entity.discountPrice !=null and entity.discountPrice != '' ">
and discount_price = #{entity.discountPrice}
</if>
<if test="entity.storePrice !=null and entity.storePrice != '' ">
and store_price = #{entity.storePrice}
</if>
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and update_date >= #{entity.beginTime}
</if>
<if test="entity.endTime !=null and entity.endTime != '' ">
and update_date &lt;= #{entity.endTime}
</if>
ORDER BY business_id DESC
</select>
<select id="queryWmsGoodsPricesPaged" resultMap="BaseResultMap">
select * from wms_goods_price
where 1=1
and del_flag = '0'
<if test="entity.flag !=null and entity.flag != '' ">
and flag = #{entity.flag}
</if>
<if test="entity.goodsArtNumber !=null and entity.goodsArtNumber != '' ">
and goods_art_number like concat('%',#{entity.goodsArtNumber},'%')
</if>
<if test="entity.originalPrice !=null and entity.originalPrice != '' ">
and original_price = #{entity.originalPrice}
</if>
<if test="entity.discountPrice !=null and entity.discountPrice != '' ">
and discount_price = #{entity.discountPrice}
</if>
<if test="entity.storePrice !=null and entity.storePrice != '' ">
and store_price = #{entity.storePrice}
</if>
<if test="entity.beginTime !=null and entity.beginTime != '' ">
and update_date >= #{entity.beginTime}
</if>
<if test="entity.endTime !=null and entity.endTime != '' ">
and update_date &lt;= #{entity.endTime}
</if>
ORDER BY business_id DESC
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment