| | |
| | | } |
| | | |
| | | /** |
| | | * 新增修改 |
| | | * 客户新增修改 |
| | | */ |
| | | @PostMapping("/addOrEditCustomer") |
| | | public R addOrEditSupply(@RequestBody CustomerDto customerDto) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 供应商 |
| | | * 供应商list |
| | | */ |
| | | @GetMapping("/supplyList") |
| | | public R<List<Supply>> list() { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 新增修改 |
| | | * 供应商新增修改 |
| | | */ |
| | | @PostMapping("/addOrEditSupply") |
| | | public R addOrEditSupply(@RequestBody SupplyDto supplyDto) { |
| | |
| | | c_district_id BIGINT NOT NULL DEFAULT 0, -- 联系地址区id |
| | | deleted int4 NOT NULL DEFAULT 0, -- 是否删除(软删除标志) |
| | | create_by VARCHAR(255), -- 创建人 |
| | | create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 创建时间,默认当前时间 |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, -- 创建时间,默认当前时间 |
| | | update_by VARCHAR(255), -- 最后更新人 |
| | | update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 最后更新时间,默认当前时间 |
| | | update_time TIMESTAMP WITHOUT TIME ZONE, -- 最后更新时间,默认当前时间 |
| | | contact_phone VARCHAR(255) -- 联系人电话 |
| | | ); |
| | | |
| | |
| | | |
| | | deleted INT NOT NULL DEFAULT 0, -- 软删除标志:0=未删除,1=已删除 |
| | | create_by VARCHAR(255), -- 创建人用户名 |
| | | create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 创建时间,默认当前时间 |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, -- 创建时间,默认当前时间 |
| | | update_by VARCHAR(255), -- 最后更新人用户名 |
| | | update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 最后更新时间,默认当前时间 |
| | | update_time TIMESTAMP WITHOUT TIME ZONE -- 最后更新时间,默认当前时间 |
| | | ); |
| | | |
| | | COMMENT ON COLUMN customer.id IS '客户唯一标识,主键'; |
| | |
| | | -- 新增字段 |
| | | deleted int4 NOT NULL DEFAULT 0, -- 是否删除(软删除标志) |
| | | create_by VARCHAR(255), -- 创建人 |
| | | create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 创建时间,默认当前时间 |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, -- 创建时间,默认当前时间 |
| | | update_by VARCHAR(255), -- 最后更新人 |
| | | update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 最后更新时间,默认当前时间 |
| | | update_time TIMESTAMP WITHOUT TIME ZONE -- 最后更新时间,默认当前时间 |
| | | ); |
| | | |
| | | -- 为表添加注释 |
| | |
| | | |
| | | deleted INT NOT NULL DEFAULT 0, -- 软删除标志:0=未删除,1=已删除 |
| | | create_by VARCHAR(255), -- 创建人用户名 |
| | | create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 创建时间,默认当前时间 |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, -- 创建时间,默认当前时间 |
| | | update_by VARCHAR(255), -- 最后更新人用户名 |
| | | update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 最后更新时间,默认当前时间 |
| | | update_time TIMESTAMP WITHOUT TIME ZONE -- 最后更新时间,默认当前时间 |
| | | ); |
| | | |
| | | -- 表注释 |
| | |
| | | id BIGSERIAL PRIMARY KEY, -- 主键ID,自动递增 |
| | | |
| | | plan VARCHAR(255) NOT NULL, --煤质方案 |
| | | field_ids VARCHAR(255) NOT NULL, --煤质方案字段id |
| | | coal_fields BIGINT NOT NULL, -- 煤质方案字段 |
| | | |
| | | deleted INT NOT NULL DEFAULT 0, -- 软删除标志:0=未删除,1=已删除 |
| | | create_by VARCHAR(255), -- 创建人用户名 |
| | | create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 创建时间,默认当前时间 |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, -- 创建时间,默认当前时间 |
| | | update_by VARCHAR(255), -- 最后更新人用户名 |
| | | update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 最后更新时间,默认当前时间 |
| | | update_time TIMESTAMP WITHOUT TIME ZONE -- 最后更新时间,默认当前时间 |
| | | ); |
| | | |
| | | -- 表注释 |
| | |
| | | COMMENT ON COLUMN coal_plan.id IS '主键ID'; |
| | | COMMENT ON COLUMN coal_plan.plan IS '煤质方案'; |
| | | COMMENT ON COLUMN coal_plan.coal_fields IS '煤质方案字段'; |
| | | COMMENT ON COLUMN coal_plan.field_ids IS '煤质方案字段id'; |
| | | COMMENT ON COLUMN coal_plan.deleted IS '软删除标志,0=未删除,1=已删除'; |
| | | COMMENT ON COLUMN coal_plan.create_by IS '创建该记录的用户'; |
| | | COMMENT ON COLUMN coal_plan.create_time IS '记录创建时间'; |
| | |
| | | coal_value VARCHAR(255) NOT NULL, -- 字段值 |
| | | fields VARCHAR(255) NOT NULL, -- 字段 |
| | | field_name VARCHAR(255) NOT NULL, -- 字段名 |
| | | type VARCHAR(255) NOT NULL, -- 1 采购/ 2 正式 入库 |
| | | |
| | | deleted INT NOT NULL DEFAULT 0, -- 软删除标志:0=未删除,1=已删除 |
| | | create_by VARCHAR(255), -- 创建人用户名 |
| | | create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 创建时间,默认当前时间 |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, -- 创建时间,默认当前时间 |
| | | update_by VARCHAR(255), -- 最后更新人用户名 |
| | | update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 最后更新时间,默认当前时间 |
| | | update_time TIMESTAMP WITHOUT TIME ZONE -- 最后更新时间,默认当前时间 |
| | | ); |
| | | |
| | | -- 表注释 |
| | |
| | | COMMENT ON COLUMN coal_value.coal_value IS '字段值'; |
| | | COMMENT ON COLUMN coal_value.fields IS '字段'; |
| | | COMMENT ON COLUMN coal_value.field_name IS '字段名'; |
| | | COMMENT ON COLUMN coal_value.type IS '1 采购/ 2 正式 入库'; |
| | | COMMENT ON COLUMN coal_value.deleted IS '软删除标志,0=未删除,1=已删除'; |
| | | COMMENT ON COLUMN coal_value.create_by IS '创建该记录的用户'; |
| | | COMMENT ON COLUMN coal_value.create_time IS '记录创建时间'; |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.business.dto.OfficialInventoryDto; |
| | | import com.ruoyi.business.entity.OfficialInventory; |
| | | import com.ruoyi.business.service.OfficialInventoryService; |
| | | import com.ruoyi.business.vo.OfficialInventoryVo; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | /** |
| | | * 正式库煤种部分信息list |
| | | */ |
| | | @GetMapping("/OfficialList") |
| | | @GetMapping("/officialList") |
| | | public R<List<OfficialInventoryVo>> officialList(OfficialInventoryVo officialInventoryVo) { |
| | | return R.ok(officialInventoryService.selectOfficialList(officialInventoryVo)); |
| | | } |
| | | |
| | | /** |
| | | * 正式库煤种生产加工选择list |
| | | */ |
| | | @GetMapping("/officialAll") |
| | | public R<List<OfficialInventory>> officialAll() { |
| | | return R.ok(officialInventoryService.selectOfficialAll()); |
| | | } |
| | | |
| | | /** |
| | | * 正式库修改 |
| | | */ |
| | | @PostMapping("/editOfficial") |
| | |
| | | import com.ruoyi.business.entity.Production; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ProductionDto extends Production { |
| | | |
| | | private List officialList; |
| | | |
| | | |
| | | } |
| | |
| | | * 煤种id |
| | | */ |
| | | @TableField(value = "coal_id") |
| | | private String coalId; |
| | | private Long coalId; |
| | | /** |
| | | * 煤种 |
| | | */ |
| | |
| | | * 库存数量 |
| | | */ |
| | | @TableField(value = "inventory_quantity") |
| | | private Long inventoryQuantity; |
| | | private BigDecimal inventoryQuantity; |
| | | /** |
| | | * 单位 |
| | | */ |
| | |
| | | @TableField(value = "net_profit") |
| | | private BigDecimal netProfit; |
| | | /** |
| | | * 运费 |
| | | */ |
| | | @TableField(value = "freight") |
| | | private BigDecimal freight; |
| | | /** |
| | | * 登记人id |
| | | */ |
| | | @TableField(value = "registrant_id") |
| | |
| | | int editOfficial(OfficialInventoryDto officialInventoryDto); |
| | | |
| | | List<OfficialInventoryVo> selectOfficialList(OfficialInventoryVo officialInventoryVo); |
| | | |
| | | List<OfficialInventory> selectOfficialAll(); |
| | | } |
| | |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | | public List<OfficialInventory> selectOfficialAll() { |
| | | return officialInventoryMapper.selectList(null); |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public int mergeAll(OfficialInventoryDto officialInventoryDto) { |
| | |
| | | import com.ruoyi.basic.entity.Customer; |
| | | import com.ruoyi.basic.mapper.CustomerMapper; |
| | | import com.ruoyi.business.dto.SalesRecordDto; |
| | | import com.ruoyi.business.entity.OfficialInventory; |
| | | import com.ruoyi.business.entity.SalesRecord; |
| | | import com.ruoyi.business.mapper.OfficialInventoryMapper; |
| | | import com.ruoyi.business.mapper.SalesRecordMapper; |
| | | import com.ruoyi.business.service.SalesRecordService; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | |
| | | |
| | | private final CustomerMapper customerMapper; |
| | | |
| | | private final OfficialInventoryMapper officialInventoryMapper; |
| | | |
| | | @Override |
| | | public IPage<SalesRecord> selectSalesRecordList(Page page, SalesRecordDto salesRecordDto) { |
| | | LambdaQueryWrapper<SalesRecord> queryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | // 参数校验 |
| | | validateSalesRecordDto(salesRecordDto); |
| | | |
| | | // 更新正式库待补库数量 |
| | | OfficialInventory officialInventory = officialInventoryMapper.selectById(salesRecordDto.getCoalId()); |
| | | if (officialInventory == null) { |
| | | throw new BaseException("正式库煤种信息不存在"); |
| | | } |
| | | if (salesRecordDto.getSaleQuantity().compareTo(officialInventory.getInventoryQuantity()) > 0){ |
| | | throw new BaseException("销售数量不能大于库存数量"); |
| | | } |
| | | officialInventory.setInventoryQuantity(officialInventory.getInventoryQuantity().subtract(salesRecordDto.getSaleQuantity())); |
| | | officialInventory.setPendingReplenishment(salesRecordDto.getSaleQuantity()); |
| | | officialInventoryMapper.updateById(officialInventory); |
| | | |
| | | // 构建销售记录实体 |
| | | SalesRecord salesRecord = buildSalesRecord(salesRecordDto); |
| | | SalesRecord salesRecord = buildSalesRecord(salesRecordDto,officialInventory.getCoal()); |
| | | |
| | | // 处理新增/更新逻辑 |
| | | if (salesRecordDto.getId() == null) { |
| | |
| | | if (dto.getCustomerId() == null) { |
| | | throw new BaseException("客户ID不能为空"); |
| | | } |
| | | if (dto.getCoalId() == null) { |
| | | throw new BaseException("请选择一条煤种信息"); |
| | | } |
| | | } |
| | | |
| | | private SalesRecord buildSalesRecord(SalesRecordDto dto) { |
| | | private SalesRecord buildSalesRecord(SalesRecordDto dto,String coal) { |
| | | SalesRecord record = new SalesRecord(); |
| | | BeanUtils.copyProperties(dto, record); |
| | | |
| | |
| | | record.setRegistrationDate(existing.getRegistrationDate()); |
| | | } |
| | | |
| | | // 煤种 |
| | | record.setCoal(coal); |
| | | |
| | | return record; |
| | | } |
| | | |
| | |
| | | |
| | | deleted INT NOT NULL DEFAULT 0, -- 软删除标志:0=未删除,1=已删除 |
| | | create_by VARCHAR(255), -- 创建人用户名 |
| | | create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 创建时间,默认当前时间 |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, -- 创建时间,默认当前时间 |
| | | update_by VARCHAR(255), -- 最后更新人用户名 |
| | | update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 最后更新时间,默认当前时间 |
| | | update_time TIMESTAMP WITHOUT TIME ZONE -- 最后更新时间,默认当前时间 |
| | | ); |
| | | |
| | | -- 为表添加注释 |
| | |
| | | |
| | | deleted INT NOT NULL DEFAULT 0, -- 软删除标志:0=未删除,1=已删除 |
| | | create_by VARCHAR(255), -- 创建人用户名 |
| | | create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 创建时间,默认当前时间 |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, -- 创建时间,默认当前时间 |
| | | update_by VARCHAR(255), -- 最后更新人用户名 |
| | | update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 最后更新时间,默认当前时间 |
| | | update_time TIMESTAMP WITHOUT TIME ZONE -- 最后更新时间,默认当前时间 |
| | | ); |
| | | |
| | | -- 添加表注释 |
| | |
| | | ( |
| | | id BIGSERIAL PRIMARY KEY, -- 主键ID |
| | | supplier_name VARCHAR(255) NOT NULL, -- 供货商名称 |
| | | coal_type VARCHAR(50) NOT NULL, -- 煤种 |
| | | coal VARCHAR(50) NOT NULL, -- 煤种 |
| | | unit VARCHAR(50) NOT NULL, -- 单位 |
| | | inventory_quantity DECIMAL(10, 2) NOT NULL, -- 库存数量 |
| | | price_including_tax DECIMAL(10, 2) NOT NULL, -- 单价(含税) |
| | | total_price_including_tax DECIMAL(10, 2) NOT NULL, -- 总价(含税) |
| | | cost_per_unit DECIMAL(10, 2) NOT NULL, -- 成本单价 |
| | | registrant VARCHAR(50) NOT NULL, -- 登记人 |
| | | registration_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 登记时间 |
| | | |
| | | deleted INT NOT NULL DEFAULT 0, -- 软删除标志:0=未删除,1=已删除 |
| | | create_by VARCHAR(255), -- 创建人用户名 |
| | | create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 创建时间,默认当前时间 |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, -- 创建时间,默认当前时间 |
| | | update_by VARCHAR(255), -- 最后更新人用户名 |
| | | update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 最后更新时间,默认当前时间 |
| | | update_time TIMESTAMP WITHOUT TIME ZONE -- 最后更新时间,默认当前时间 |
| | | ); |
| | | |
| | | -- 添加表注释 |
| | |
| | | -- 添加字段注释 |
| | | COMMENT ON COLUMN pending_inventory.id IS '主键ID'; |
| | | COMMENT ON COLUMN pending_inventory.supplier_name IS '供货商名称'; |
| | | COMMENT ON COLUMN pending_inventory.coal_type IS '煤种'; |
| | | COMMENT ON COLUMN pending_inventory.coal IS '煤种'; |
| | | COMMENT ON COLUMN pending_inventory.unit IS '单位'; |
| | | COMMENT ON COLUMN pending_inventory.inventory_quantity IS '库存数量'; |
| | | COMMENT ON COLUMN pending_inventory.price_including_tax IS '单价(含税)'; |
| | | COMMENT ON COLUMN pending_inventory.total_price_including_tax IS '总价(含税)'; |
| | | COMMENT ON COLUMN pending_inventory.cost_per_unit IS '成本单价'; |
| | | COMMENT ON COLUMN pending_inventory.registrant IS '登记人'; |
| | | COMMENT ON COLUMN pending_inventory.registration_time IS '登记时间'; |
| | | |
| | |
| | | ( |
| | | id BIGSERIAL PRIMARY KEY, -- 主键ID |
| | | supplier_name VARCHAR(255) NOT NULL, -- 供货商名称 |
| | | coal_type VARCHAR(50) NOT NULL, -- 煤种 |
| | | coal VARCHAR(50) NOT NULL, -- 煤种 |
| | | unit VARCHAR(50) NOT NULL, -- 单位 |
| | | inventory_quantity DECIMAL(10, 2) NOT NULL, -- 库存数量 |
| | | price_including_tax DECIMAL(10, 2) NOT NULL, -- 单价(含税) |
| | | total_price_including_tax DECIMAL(10, 2) NOT NULL, -- 总价(含税) |
| | | cost_per_unit DECIMAL(10, 2) NOT NULL, -- 成本单价 |
| | | price_excluding_tax DECIMAL(10, 2) NOT NULL, -- 不含税单价 |
| | | total_price_excluding_tax DECIMAL(10, 2) NOT NULL, -- 不含税总价 |
| | | pending_replenishment DECIMAL(10, 2) NOT NULL, -- 待补库 |
| | | registrant_id VARCHAR(50) NOT NULL, -- 登记人id |
| | | registration_date TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, |
| | | type VARCHAR(50) NOT NULL, -- 登记人id |
| | | pending_id BIGINT, -- 待入库id |
| | | registration_date TIMESTAMP WITHOUT TIME ZONE, |
| | | |
| | | deleted INT NOT NULL DEFAULT 0, -- 软删除标志:0=未删除,1=已删除 |
| | | create_by VARCHAR(255), -- 创建人用户名 |
| | | create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 创建时间,默认当前时间 |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, -- 创建时间,默认当前时间 |
| | | update_by VARCHAR(255), -- 最后更新人用户名 |
| | | update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 最后更新时间,默认当前时间-- 登记日期 |
| | | update_time TIMESTAMP WITHOUT TIME ZONE -- 最后更新时间,默认当前时间-- 登记日期 |
| | | ); |
| | | |
| | | -- 添加表注释 |
| | |
| | | -- 添加字段注释 |
| | | COMMENT ON COLUMN official_inventory.id IS '主键ID'; |
| | | COMMENT ON COLUMN official_inventory.supplier_name IS '供货商名称'; |
| | | COMMENT ON COLUMN official_inventory.coal_type IS '煤种'; |
| | | COMMENT ON COLUMN official_inventory.coal IS '煤种'; |
| | | COMMENT ON COLUMN official_inventory.unit IS '单位'; |
| | | COMMENT ON COLUMN official_inventory.inventory_quantity IS '库存数量'; |
| | | COMMENT ON COLUMN official_inventory.price_including_tax IS '单价(含税)'; |
| | | COMMENT ON COLUMN official_inventory.total_price_including_tax IS '总价(含税)'; |
| | | COMMENT ON COLUMN official_inventory.cost_per_unit IS '成本单价'; |
| | | COMMENT ON COLUMN official_inventory.pending_replenishment IS '待补库'; |
| | | COMMENT ON COLUMN official_inventory.registrant_id IS '登记人id'; |
| | | COMMENT ON COLUMN official_inventory.registration_date IS '登记日期'; |
| | |
| | | |
| | | deleted INT NOT NULL DEFAULT 0, -- 软删除标志:0=未删除,1=已删除 |
| | | create_by VARCHAR(255), -- 创建人用户名 |
| | | create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 创建时间,默认当前时间 |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, -- 创建时间,默认当前时间 |
| | | update_by VARCHAR(255), -- 最后更新人用户名 |
| | | update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 最后更新时间,默认当前时间-- 登记日期 |
| | | update_time TIMESTAMP WITHOUT TIME ZONE -- 最后更新时间,默认当前时间-- 登记日期 |
| | | ); |
| | | |
| | | -- 表注释 |
| | |
| | | |
| | | deleted INT NOT NULL DEFAULT 0, -- 软删除标志:0=未删除,1=已删除 |
| | | create_by VARCHAR(255), -- 创建人用户名 |
| | | create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 创建时间,默认当前时间 |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, -- 创建时间,默认当前时间 |
| | | update_by VARCHAR(255), -- 最后更新人用户名 |
| | | update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP -- 最后更新时间,默认当前时间-- 登记日期 |
| | | update_time TIMESTAMP WITHOUT TIME ZONE -- 最后更新时间,默认当前时间-- 登记日期 |
| | | ); |
| | | |
| | | -- 表注释 |
| | |
| | | file_type VARCHAR(50), -- 文件类型(如:image/png, application/pdf) |
| | | file_size VARCHAR(50), -- 文件大小(单位:字节) |
| | | |
| | | create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 上传时间,默认当前时间 |
| | | update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 最后更新时间,默认当前时间 |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, -- 上传时间,默认当前时间 |
| | | update_time TIMESTAMP WITHOUT TIME ZONE, -- 最后更新时间,默认当前时间 |
| | | create_by VARCHAR(255), -- 上传人用户名 |
| | | update_by VARCHAR(255), -- 最后修改人用户名 |
| | | deleted INT NOT NULL DEFAULT 0 -- 软删除标志:0=未删除,1=已删除 |
| | |
| | | sale_quantity DECIMAL(10, 2) NOT NULL, -- 销售数量 |
| | | sale_price DECIMAL(10, 2) NOT NULL, -- 销售单价 (含税) |
| | | total_amount DECIMAL(10, 2) NOT NULL, -- 销售总价 (含税) |
| | | freight DECIMAL(10, 2) NOT NULL, -- 运费 |
| | | tax_coal VARCHAR(36), -- 购销煤税率13% |
| | | tax_trans VARCHAR(36), -- 运输税率9% |
| | | gross_profit DECIMAL(10, 2), -- 毛利润 |
| | |
| | | registrant VARCHAR(255) NOT NULL, -- 登记人 |
| | | registration_date DATE NOT NULL, -- 登记日期 |
| | | |
| | | create_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 上传时间,默认当前时间 |
| | | update_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 最后更新时间,默认当前时间 |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, -- 上传时间,默认当前时间 |
| | | update_time TIMESTAMP WITHOUT TIME ZONE, -- 最后更新时间,默认当前时间 |
| | | create_by VARCHAR(255), -- 上传人用户名 |
| | | update_by VARCHAR(255), -- 最后修改人用户名 |
| | | deleted INT NOT NULL DEFAULT 0 -- 软删除标志:0=未删除,1=已删除 |
| | |
| | | create_time, |
| | | update_by, |
| | | update_time, |
| | | id, supplier_name, coal_type, unit, inventory_quantity, price_including_tax, total_price_including_tax, pending_replenishment, registrant_id, registration_date |
| | | id, supplier_name, coal, unit, inventory_quantity, price_including_tax, total_price_including_tax, pending_replenishment, registrant_id, registration_date |
| | | </sql> |
| | | |
| | | </mapper> |
| | |
| | | create_time, |
| | | update_by, |
| | | update_time, |
| | | id, supplier_name, coal_type, unit, inventory_quantity, price_including_tax, total_price_including_tax, registrant, registration_time |
| | | id, supplier_name, coal, unit, inventory_quantity, price_including_tax, total_price_including_tax, registrant, registration_time |
| | | </sql> |
| | | |
| | | </mapper> |
| | |
| | | status CHAR(1) DEFAULT '0', -- 部门状态(0正常 1停用) |
| | | del_flag CHAR(1) DEFAULT '0', -- 删除标志(0代表存在 2代表删除) |
| | | create_by VARCHAR(64) DEFAULT '', -- 创建者 |
| | | create_time TIMESTAMP, -- 创建时间 |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, -- 创建时间 |
| | | update_by VARCHAR(64) DEFAULT '', -- 更新者 |
| | | update_time TIMESTAMP -- 更新时间 |
| | | update_time TIMESTAMP WITHOUT TIME ZONE -- 更新时间 |
| | | ); |
| | | |
| | | COMMENT ON TABLE sys_dept IS '部门表'; |
| | |
| | | login_ip VARCHAR(128) DEFAULT '', -- 最后登录IP |
| | | login_date TIMESTAMP, -- 最后登录时间 |
| | | create_by VARCHAR(64) DEFAULT '', -- 创建者 |
| | | create_time TIMESTAMP, -- 创建时间 |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, -- 创建时间 |
| | | update_by VARCHAR(64) DEFAULT '', -- 更新者 |
| | | update_time TIMESTAMP, -- 更新时间 |
| | | update_time TIMESTAMP WITHOUT TIME ZONE, -- 更新时间 |
| | | remark VARCHAR(500) DEFAULT NULL -- 备注 |
| | | ); |
| | | |
| | |
| | | package com.ruoyi.common.core.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.FieldStrategy; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.OffsetDateTime; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class MyBaseEntity implements Serializable { |
| | |
| | | |
| | | /** 创建时间 */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private OffsetDateTime createTime; |
| | | @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NEVER) |
| | | private LocalDateTime createTime; |
| | | |
| | | /** 更新者 */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | |
| | | /** 更新时间 */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private OffsetDateTime updateTime; |
| | | private LocalDateTime updateTime; |
| | | } |
| | |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.time.OffsetDateTime; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Component |
| | | public class MyMetaObjectHandler implements MetaObjectHandler { |
| | | |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | // 判断字段是否存在,存在才填充 |
| | | if (metaObject.hasSetter("createBy")) { |
| | | Long userId; |
| | | try { |
| | | if (SecurityUtils.getLoginUser() != null) { |
| | | userId = SecurityUtils.getLoginUser().getUserId(); |
| | | this.strictInsertFill(metaObject, "createBy", String.class, userId.toString()); |
| | | public void insertFill(MetaObject meta) { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | Long uid = SecurityUtils.getLoginUser().getUserId(); |
| | | if (uid != null) { |
| | | strictInsertFill(meta, "createBy", String.class, uid.toString()); |
| | | strictInsertFill(meta, "updateBy", String.class, uid.toString()); |
| | | } |
| | | } catch (Exception ignored) { |
| | | } |
| | | } |
| | | |
| | | if (metaObject.hasSetter("createTime")) { |
| | | this.strictInsertFill(metaObject, "createTime", OffsetDateTime.class, OffsetDateTime.now()); |
| | | } |
| | | |
| | | if (metaObject.hasSetter("updateTime")) { |
| | | this.strictUpdateFill(metaObject, "updateTime", OffsetDateTime.class, OffsetDateTime.now()); |
| | | } |
| | | strictInsertFill(meta, "createTime", LocalDateTime.class, now); |
| | | strictInsertFill(meta, "updateTime", LocalDateTime.class, now); |
| | | } |
| | | |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | // 判断字段是否存在,存在才填充 |
| | | if (metaObject.hasSetter("updateBy")) { |
| | | Long userId = SecurityUtils.getLoginUser().getUserId(); |
| | | this.strictUpdateFill(metaObject, "updateBy", String.class, userId.toString()); |
| | | public void updateFill(MetaObject meta) { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | Long uid = SecurityUtils.getLoginUser().getUserId(); |
| | | if (uid != null) { |
| | | strictUpdateFill(meta, "updateBy", String.class, uid.toString()); |
| | | } |
| | | // 强制覆盖 updateTime |
| | | setFieldValByName("updateTime", now, meta); |
| | | } |
| | | |
| | | if (metaObject.hasSetter("updateTime")) { |
| | | this.strictUpdateFill(metaObject, "updateTime", OffsetDateTime.class, OffsetDateTime.now()); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.time.OffsetDateTime; |
| | | |
| | | /** |
| | | * 城市表 实体类 |
| | |
| | | /** 创建时间 */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private OffsetDateTime createTime; |
| | | private LocalDateTime createTime; |
| | | |
| | | /** 更新时间 */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private OffsetDateTime updateTime; |
| | | private LocalDateTime updateTime; |
| | | } |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.time.OffsetDateTime; |
| | | |
| | | /** |
| | | * 区表 实体类 |
| | |
| | | /** 创建时间 */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private OffsetDateTime createTime; |
| | | private LocalDateTime createTime; |
| | | |
| | | /** 更新时间 */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private OffsetDateTime updateTime; |
| | | private LocalDateTime updateTime; |
| | | } |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.time.OffsetDateTime; |
| | | |
| | | /** |
| | | * 省表 实体类 |
| | |
| | | /** 创建时间 */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private OffsetDateTime createTime; |
| | | private LocalDateTime createTime; |
| | | |
| | | /** 更新时间 */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private OffsetDateTime updateTime; |
| | | private LocalDateTime updateTime; |
| | | } |
| | |
| | | CREATE TABLE province |
| | | ( |
| | | id bigserial PRIMARY KEY, |
| | | create_time timestamp with time zone NOT NULL, |
| | | update_time timestamp with time zone NOT NULL, |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, |
| | | update_time TIMESTAMP WITHOUT TIME ZONE, |
| | | name varchar(100) DEFAULT '' NOT NULL |
| | | ); |
| | | |
| | |
| | | CREATE TABLE city |
| | | ( |
| | | id bigserial PRIMARY KEY, |
| | | create_time timestamp with time zone NOT NULL, |
| | | update_time timestamp with time zone NOT NULL, |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, |
| | | update_time TIMESTAMP WITHOUT TIME ZONE, |
| | | name varchar(100) DEFAULT '' NOT NULL, |
| | | province_id bigint DEFAULT 0 NOT NULL |
| | | ); |
| | |
| | | CREATE TABLE district |
| | | ( |
| | | id bigserial PRIMARY KEY, |
| | | create_time timestamp with time zone NOT NULL, |
| | | update_time timestamp with time zone NOT NULL, |
| | | create_time TIMESTAMP WITHOUT TIME ZONE, |
| | | update_time TIMESTAMP WITHOUT TIME ZONE, |
| | | name varchar(100) DEFAULT '' NOT NULL, |
| | | city_id bigint DEFAULT 0 NOT NULL |
| | | ); |