收银台 后台接口 油品列表 商品列表

This commit is contained in:
zhaotianfeng 2024-09-14 10:12:04 +08:00
parent 5c77701eca
commit 50d71f8e5a
11 changed files with 635 additions and 49 deletions

View File

@ -0,0 +1,119 @@
package com.fuint.business.cashierGoods.entity;
import com.fuint.framework.entity.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.io.Serializable;
/**
* 商品表(MtGoods)实体类
*
* @author makejava
* @since 2024-09-13 11:10:23
*/
@Data
public class MtGoods extends BaseEntity {
private static final long serialVersionUID = 253041736189731537L;
/**
* 自增ID
*/
private Integer id;
/**
* 所属店铺ID
*/
private Integer storeId;
/**
* 商品名称
*/
private String name;
/**
* 商品分类ID
*/
private Integer cvsGoodId;
/**
* 商品编码条码
*/
private String goodsNo;
/**
* 商品拼音码
*/
private String pinyinCode;
/**
* 货架号
*/
private String shelfNumber;
/**
* 进货价
*/
private BigDecimal buyingPrice;
/**
* 零售价
*/
private BigDecimal retailPrice;
/**
* 会员价
*/
private Double memberPrice;
/**
* 库存
*/
private Long stock;
/**
* 单位
*/
private String unit;
/**
* 供应商id
*/
private String supplierId;
/**
* 可否使用积分抵扣
*/
private String canUsePoint;
/**
* 排序
*/
private Integer sort;
/**
* 是否在回收站0不在回收站1在回收站
*/
private Integer isRecovery;
/**
* 商品描述
*/
private String description;
/**
* 状态启用禁用
*/
private String status;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建人
*/
private String createBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 更新人
*/
private String updateBy;
/**
* 0未删除 1 删除
*/
private String ifDelete;
/**
* 可否使用兑换券兑换0可以1不可以
*/
private String canUseExchange;
}

View File

@ -0,0 +1,14 @@
package com.fuint.business.cashierGoods.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.cashierGoods.entity.MtGoods;
import org.apache.ibatis.annotations.Param;
import java.util.List;
// 如何集成mybatis plus 通用mapper
public interface CashRegisterGoodsMapper extends BaseMapper<MtGoods> {
}

View File

@ -0,0 +1,316 @@
<?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="com.fuint.business.cashierGoods.mapper.CashRegisterGoodsMapper">
<!-- &lt;!&ndash;查询单个&ndash;&gt;-->
<!-- <select id="queryById" resultMap="MtGoodsMap">-->
<!-- select-->
<!-- id, store_id, name, cvs_good_id, goods_no, pinyin_code, shelf_number, buying_price, retail_price, member_price, stock, unit, supplier_id, can_use_point, sort, is_recovery, description, status, create_time, create_by, update_time, update_by, if_delete, can_use_exchange-->
<!-- from mt_goods-->
<!-- where id = #{id}-->
<!-- </select>-->
<!-- &lt;!&ndash;查询指定行数据&ndash;&gt;-->
<!-- <select id="queryAllByLimit" resultMap="MtGoodsMap">-->
<!-- select-->
<!-- id, store_id, name, cvs_good_id, goods_no, pinyin_code, shelf_number, buying_price, retail_price, member_price, stock, unit, supplier_id, can_use_point, sort, is_recovery, description, status, create_time, create_by, update_time, update_by, if_delete, can_use_exchange-->
<!-- from mt_goods-->
<!-- <where>-->
<!-- <if test="id != null">-->
<!-- and id = #{id}-->
<!-- </if>-->
<!-- <if test="storeId != null">-->
<!-- and store_id = #{storeId}-->
<!-- </if>-->
<!-- <if test="name != null and name != ''">-->
<!-- and name = #{name}-->
<!-- </if>-->
<!-- <if test="cvsGoodId != null">-->
<!-- and cvs_good_id = #{cvsGoodId}-->
<!-- </if>-->
<!-- <if test="goodsNo != null and goodsNo != ''">-->
<!-- and goods_no = #{goodsNo}-->
<!-- </if>-->
<!-- <if test="pinyinCode != null and pinyinCode != ''">-->
<!-- and pinyin_code = #{pinyinCode}-->
<!-- </if>-->
<!-- <if test="shelfNumber != null and shelfNumber != ''">-->
<!-- and shelf_number = #{shelfNumber}-->
<!-- </if>-->
<!-- <if test="buyingPrice != null">-->
<!-- and buying_price = #{buyingPrice}-->
<!-- </if>-->
<!-- <if test="retailPrice != null">-->
<!-- and retail_price = #{retailPrice}-->
<!-- </if>-->
<!-- <if test="memberPrice != null">-->
<!-- and member_price = #{memberPrice}-->
<!-- </if>-->
<!-- <if test="stock != null">-->
<!-- and stock = #{stock}-->
<!-- </if>-->
<!-- <if test="unit != null and unit != ''">-->
<!-- and unit = #{unit}-->
<!-- </if>-->
<!-- <if test="supplierId != null and supplierId != ''">-->
<!-- and supplier_id = #{supplierId}-->
<!-- </if>-->
<!-- <if test="canUsePoint != null and canUsePoint != ''">-->
<!-- and can_use_point = #{canUsePoint}-->
<!-- </if>-->
<!-- <if test="sort != null">-->
<!-- and sort = #{sort}-->
<!-- </if>-->
<!-- <if test="isRecovery != null">-->
<!-- and is_recovery = #{isRecovery}-->
<!-- </if>-->
<!-- <if test="description != null and description != ''">-->
<!-- and description = #{description}-->
<!-- </if>-->
<!-- <if test="status != null and status != ''">-->
<!-- and status = #{status}-->
<!-- </if>-->
<!-- <if test="createTime != null">-->
<!-- and create_time = #{createTime}-->
<!-- </if>-->
<!-- <if test="createBy != null and createBy != ''">-->
<!-- and create_by = #{createBy}-->
<!-- </if>-->
<!-- <if test="updateTime != null">-->
<!-- and update_time = #{updateTime}-->
<!-- </if>-->
<!-- <if test="updateBy != null and updateBy != ''">-->
<!-- and update_by = #{updateBy}-->
<!-- </if>-->
<!-- <if test="ifDelete != null and ifDelete != ''">-->
<!-- and if_delete = #{ifDelete}-->
<!-- </if>-->
<!-- <if test="canUseExchange != null and canUseExchange != ''">-->
<!-- and can_use_exchange = #{canUseExchange}-->
<!-- </if>-->
<!-- </where>-->
<!-- limit #{pageable.offset}, #{pageable.pageSize}-->
<!-- </select>-->
<!-- &lt;!&ndash;统计总行数&ndash;&gt;-->
<!-- <select id="count" resultType="java.lang.Long">-->
<!-- select count(1)-->
<!-- from mt_goods-->
<!-- <where>-->
<!-- <if test="id != null">-->
<!-- and id = #{id}-->
<!-- </if>-->
<!-- <if test="storeId != null">-->
<!-- and store_id = #{storeId}-->
<!-- </if>-->
<!-- <if test="name != null and name != ''">-->
<!-- and name = #{name}-->
<!-- </if>-->
<!-- <if test="cvsGoodId != null">-->
<!-- and cvs_good_id = #{cvsGoodId}-->
<!-- </if>-->
<!-- <if test="goodsNo != null and goodsNo != ''">-->
<!-- and goods_no = #{goodsNo}-->
<!-- </if>-->
<!-- <if test="pinyinCode != null and pinyinCode != ''">-->
<!-- and pinyin_code = #{pinyinCode}-->
<!-- </if>-->
<!-- <if test="shelfNumber != null and shelfNumber != ''">-->
<!-- and shelf_number = #{shelfNumber}-->
<!-- </if>-->
<!-- <if test="buyingPrice != null">-->
<!-- and buying_price = #{buyingPrice}-->
<!-- </if>-->
<!-- <if test="retailPrice != null">-->
<!-- and retail_price = #{retailPrice}-->
<!-- </if>-->
<!-- <if test="memberPrice != null">-->
<!-- and member_price = #{memberPrice}-->
<!-- </if>-->
<!-- <if test="stock != null">-->
<!-- and stock = #{stock}-->
<!-- </if>-->
<!-- <if test="unit != null and unit != ''">-->
<!-- and unit = #{unit}-->
<!-- </if>-->
<!-- <if test="supplierId != null and supplierId != ''">-->
<!-- and supplier_id = #{supplierId}-->
<!-- </if>-->
<!-- <if test="canUsePoint != null and canUsePoint != ''">-->
<!-- and can_use_point = #{canUsePoint}-->
<!-- </if>-->
<!-- <if test="sort != null">-->
<!-- and sort = #{sort}-->
<!-- </if>-->
<!-- <if test="isRecovery != null">-->
<!-- and is_recovery = #{isRecovery}-->
<!-- </if>-->
<!-- <if test="description != null and description != ''">-->
<!-- and description = #{description}-->
<!-- </if>-->
<!-- <if test="status != null and status != ''">-->
<!-- and status = #{status}-->
<!-- </if>-->
<!-- <if test="createTime != null">-->
<!-- and create_time = #{createTime}-->
<!-- </if>-->
<!-- <if test="createBy != null and createBy != ''">-->
<!-- and create_by = #{createBy}-->
<!-- </if>-->
<!-- <if test="updateTime != null">-->
<!-- and update_time = #{updateTime}-->
<!-- </if>-->
<!-- <if test="updateBy != null and updateBy != ''">-->
<!-- and update_by = #{updateBy}-->
<!-- </if>-->
<!-- <if test="ifDelete != null and ifDelete != ''">-->
<!-- and if_delete = #{ifDelete}-->
<!-- </if>-->
<!-- <if test="canUseExchange != null and canUseExchange != ''">-->
<!-- and can_use_exchange = #{canUseExchange}-->
<!-- </if>-->
<!-- </where>-->
<!-- </select>-->
<!-- &lt;!&ndash;新增所有列&ndash;&gt;-->
<!-- <insert id="insert" keyProperty="id" useGeneratedKeys="true">-->
<!-- insert into mt_goods(store_id, name, cvs_good_id, goods_no, pinyin_code, shelf_number, buying_price, retail_price, member_price, stock, unit, supplier_id, can_use_point, sort, is_recovery, description, status, create_time, create_by, update_time, update_by, if_delete, can_use_exchange)-->
<!-- values (#{storeId}, #{name}, #{cvsGoodId}, #{goodsNo}, #{pinyinCode}, #{shelfNumber}, #{buyingPrice}, #{retailPrice}, #{memberPrice}, #{stock}, #{unit}, #{supplierId}, #{canUsePoint}, #{sort}, #{isRecovery}, #{description}, #{status}, #{createTime}, #{createBy}, #{updateTime}, #{updateBy}, #{ifDelete}, #{canUseExchange})-->
<!-- </insert>-->
<!-- <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">-->
<!-- insert into mt_goods(store_id, name, cvs_good_id, goods_no, pinyin_code, shelf_number, buying_price, retail_price, member_price, stock, unit, supplier_id, can_use_point, sort, is_recovery, description, status, create_time, create_by, update_time, update_by, if_delete, can_use_exchange)-->
<!-- values-->
<!-- <foreach collection="entities" item="entity" separator=",">-->
<!-- (#{entity.storeId}, #{entity.name}, #{entity.cvsGoodId}, #{entity.goodsNo}, #{entity.pinyinCode}, #{entity.shelfNumber}, #{entity.buyingPrice}, #{entity.retailPrice}, #{entity.memberPrice}, #{entity.stock}, #{entity.unit}, #{entity.supplierId}, #{entity.canUsePoint}, #{entity.sort}, #{entity.isRecovery}, #{entity.description}, #{entity.status}, #{entity.createTime}, #{entity.createBy}, #{entity.updateTime}, #{entity.updateBy}, #{entity.ifDelete}, #{entity.canUseExchange})-->
<!-- </foreach>-->
<!-- </insert>-->
<!-- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">-->
<!-- insert into mt_goods(store_id, name, cvs_good_id, goods_no, pinyin_code, shelf_number, buying_price, retail_price, member_price, stock, unit, supplier_id, can_use_point, sort, is_recovery, description, status, create_time, create_by, update_time, update_by, if_delete, can_use_exchange)-->
<!-- values-->
<!-- <foreach collection="entities" item="entity" separator=",">-->
<!-- (#{entity.storeId}, #{entity.name}, #{entity.cvsGoodId}, #{entity.goodsNo}, #{entity.pinyinCode}, #{entity.shelfNumber}, #{entity.buyingPrice}, #{entity.retailPrice}, #{entity.memberPrice}, #{entity.stock}, #{entity.unit}, #{entity.supplierId}, #{entity.canUsePoint}, #{entity.sort}, #{entity.isRecovery}, #{entity.description}, #{entity.status}, #{entity.createTime}, #{entity.createBy}, #{entity.updateTime}, #{entity.updateBy}, #{entity.ifDelete}, #{entity.canUseExchange})-->
<!-- </foreach>-->
<!-- on duplicate key update-->
<!-- store_id = values(store_id),-->
<!-- name = values(name),-->
<!-- cvs_good_id = values(cvs_good_id),-->
<!-- goods_no = values(goods_no),-->
<!-- pinyin_code = values(pinyin_code),-->
<!-- shelf_number = values(shelf_number),-->
<!-- buying_price = values(buying_price),-->
<!-- retail_price = values(retail_price),-->
<!-- member_price = values(member_price),-->
<!-- stock = values(stock),-->
<!-- unit = values(unit),-->
<!-- supplier_id = values(supplier_id),-->
<!-- can_use_point = values(can_use_point),-->
<!-- sort = values(sort),-->
<!-- is_recovery = values(is_recovery),-->
<!-- description = values(description),-->
<!-- status = values(status),-->
<!-- create_time = values(create_time),-->
<!-- create_by = values(create_by),-->
<!-- update_time = values(update_time),-->
<!-- update_by = values(update_by),-->
<!-- if_delete = values(if_delete),-->
<!-- can_use_exchange = values(can_use_exchange)-->
<!-- </insert>-->
<!-- &lt;!&ndash;通过主键修改数据&ndash;&gt;-->
<!-- <update id="update">-->
<!-- update mt_goods-->
<!-- <set>-->
<!-- <if test="storeId != null">-->
<!-- store_id = #{storeId},-->
<!-- </if>-->
<!-- <if test="name != null and name != ''">-->
<!-- name = #{name},-->
<!-- </if>-->
<!-- <if test="cvsGoodId != null">-->
<!-- cvs_good_id = #{cvsGoodId},-->
<!-- </if>-->
<!-- <if test="goodsNo != null and goodsNo != ''">-->
<!-- goods_no = #{goodsNo},-->
<!-- </if>-->
<!-- <if test="pinyinCode != null and pinyinCode != ''">-->
<!-- pinyin_code = #{pinyinCode},-->
<!-- </if>-->
<!-- <if test="shelfNumber != null and shelfNumber != ''">-->
<!-- shelf_number = #{shelfNumber},-->
<!-- </if>-->
<!-- <if test="buyingPrice != null">-->
<!-- buying_price = #{buyingPrice},-->
<!-- </if>-->
<!-- <if test="retailPrice != null">-->
<!-- retail_price = #{retailPrice},-->
<!-- </if>-->
<!-- <if test="memberPrice != null">-->
<!-- member_price = #{memberPrice},-->
<!-- </if>-->
<!-- <if test="stock != null">-->
<!-- stock = #{stock},-->
<!-- </if>-->
<!-- <if test="unit != null and unit != ''">-->
<!-- unit = #{unit},-->
<!-- </if>-->
<!-- <if test="supplierId != null and supplierId != ''">-->
<!-- supplier_id = #{supplierId},-->
<!-- </if>-->
<!-- <if test="canUsePoint != null and canUsePoint != ''">-->
<!-- can_use_point = #{canUsePoint},-->
<!-- </if>-->
<!-- <if test="sort != null">-->
<!-- sort = #{sort},-->
<!-- </if>-->
<!-- <if test="isRecovery != null">-->
<!-- is_recovery = #{isRecovery},-->
<!-- </if>-->
<!-- <if test="description != null and description != ''">-->
<!-- description = #{description},-->
<!-- </if>-->
<!-- <if test="status != null and status != ''">-->
<!-- status = #{status},-->
<!-- </if>-->
<!-- <if test="createTime != null">-->
<!-- create_time = #{createTime},-->
<!-- </if>-->
<!-- <if test="createBy != null and createBy != ''">-->
<!-- create_by = #{createBy},-->
<!-- </if>-->
<!-- <if test="updateTime != null">-->
<!-- update_time = #{updateTime},-->
<!-- </if>-->
<!-- <if test="updateBy != null and updateBy != ''">-->
<!-- update_by = #{updateBy},-->
<!-- </if>-->
<!-- <if test="ifDelete != null and ifDelete != ''">-->
<!-- if_delete = #{ifDelete},-->
<!-- </if>-->
<!-- <if test="canUseExchange != null and canUseExchange != ''">-->
<!-- can_use_exchange = #{canUseExchange},-->
<!-- </if>-->
<!-- </set>-->
<!-- where id = #{id}-->
<!-- </update>-->
<!-- &lt;!&ndash;通过主键删除&ndash;&gt;-->
<!-- <delete id="deleteById">-->
<!-- delete from mt_goods where id = #{id}-->
<!-- </delete>-->
<select id="selectListByStoreId" resultType="com.fuint.business.cashierGoods.entity.MtGoods">
SELECT
*
FROM
mt_goods
where
store_id = #{storeId}
</select>
</mapper>

View File

@ -0,0 +1,17 @@
package com.fuint.business.cashierGoods.service;
import com.fuint.business.cashierGoods.entity.MtGoods;
import java.util.List;
import java.util.Map;
public interface CashRegisterGoodsService {
// 通用mapper条件查询
List<MtGoods> selectListByMap(Map<String, Object> columnMap);
}

View File

@ -0,0 +1,23 @@
package com.fuint.business.cashierGoods.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.cashierGoods.entity.MtGoods;
import com.fuint.business.cashierGoods.mapper.CashRegisterGoodsMapper;
import com.fuint.business.cashierGoods.service.CashRegisterGoodsService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class CashRegisterGoodsServiceImpl extends ServiceImpl<CashRegisterGoodsMapper, MtGoods> implements CashRegisterGoodsService {
@Override
public List<MtGoods> selectListByMap(Map<String, Object> columnMap) {
List<MtGoods> mtGoods = super.baseMapper.selectByMap(columnMap);
return mtGoods;
}
}

View File

@ -4,12 +4,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.petrolStationManagement.entity.OilGun;
import com.fuint.business.petrolStationManagement.service.OilGunService;
import com.fuint.business.petrolStationManagement.vo.OilCashRegisterVo;
import com.fuint.business.petrolStationManagement.vo.OilGunVO;
import com.fuint.business.setting.entity.SysLog;
import com.fuint.business.setting.service.SysLogService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import io.swagger.annotations.Authorization;
import org.apache.ibatis.annotations.Param;
import org.aspectj.lang.annotation.AdviceName;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
@ -17,6 +20,8 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 油枪表(OilGun)表控制层
@ -64,6 +69,15 @@ public class OilGunController extends BaseController {
}
//根据当前店铺 获取油枪 分组油号
@GetMapping("/cashRegisterList")
public ResponseObject cashRegisterList() {
Map<String, List<OilCashRegisterVo>> integerSetMap = this.oilGunService.cashRegisterList();
return getSuccessResult(integerSetMap);
}
/**
* 通过主键查询单条数据
@ -86,15 +100,16 @@ public class OilGunController extends BaseController {
public ResponseObject add(@RequestBody OilGun oilGun) {
if (this.oilGunService.insert(oilGun)) {
try {
SysLog sysLog =new SysLog();
SysLog sysLog = new SysLog();
sysLog.setSystemName("2");
sysLog.setMoudle("油枪管理");
sysLog.setContent("新增名称为"+oilGun.getGunName()+"的油枪信息");
sysLog.setContent("新增名称为" + oilGun.getGunName() + "的油枪信息");
sysLogService.saveVo(sysLog);
}catch (Exception ignored){}
} catch (Exception ignored) {
}
return getSuccessResult(true);
}else {
return getSuccessResult(201,"存在重复的油枪名称,请修改",null);
} else {
return getSuccessResult(201, "存在重复的油枪名称,请修改", null);
}
}
@ -106,17 +121,18 @@ public class OilGunController extends BaseController {
*/
@PutMapping
public ResponseObject edit(@RequestBody OilGun oilGun) {
if (this.oilGunService.update(oilGun)){
if (this.oilGunService.update(oilGun)) {
try {
SysLog sysLog =new SysLog();
SysLog sysLog = new SysLog();
sysLog.setSystemName("2");
sysLog.setMoudle("油枪管理");
sysLog.setContent("更新名称为"+oilGun.getGunName()+"的油枪信息");
sysLog.setContent("更新名称为" + oilGun.getGunName() + "的油枪信息");
sysLogService.saveVo(sysLog);
}catch (Exception ignored){}
} catch (Exception ignored) {
}
return getSuccessResult(this.oilGunService.update(oilGun));
}else {
return getSuccessResult(201,"存在重复的油枪名称,请修改",null);
} else {
return getSuccessResult(201, "存在重复的油枪名称,请修改", null);
}
}
@ -129,31 +145,34 @@ public class OilGunController extends BaseController {
@DeleteMapping
public ResponseObject deleteById(Integer id) {
try {
SysLog sysLog =new SysLog();
SysLog sysLog = new SysLog();
sysLog.setSystemName("2");
sysLog.setMoudle("油枪管理");
sysLog.setContent("删除编号为"+id+"的油枪信息");
sysLog.setContent("删除编号为" + id + "的油枪信息");
sysLogService.saveVo(sysLog);
}catch (Exception ignored){}
} catch (Exception ignored) {
}
return getSuccessResult(this.oilGunService.deleteById(id));
}
/**
* 根据油号id查询油枪列表信息
*
* @param numberId
* @return
*/
@GetMapping("/queryGunList/{numberId}")
public ResponseObject queryGunList(@PathVariable Integer numberId){
public ResponseObject queryGunList(@PathVariable Integer numberId) {
return getSuccessResult(oilGunService.selectOilGunByNumberId(numberId));
}
/**
* 查询当前店铺所有油枪列表信息
*
* @return
*/
@GetMapping("/queryOilGunList")
public ResponseObject selectGunList(){
public ResponseObject selectGunList() {
return getSuccessResult(oilGunService.selectOilGuns());
}
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.petrolStationManagement.entity.OilGun;
import com.fuint.business.petrolStationManagement.vo.OilCashRegisterVo;
import com.fuint.business.petrolStationManagement.vo.OilGunVO;
import org.apache.ibatis.annotations.Param;
@ -17,6 +18,9 @@ import java.util.List;
*/
public interface OilGunMapper extends BaseMapper<OilGun> {
List<OilCashRegisterVo> cashRegisterList(@Param("storeId") Integer storeId);
/**
* 通过ID查询单条数据
*

View File

@ -20,8 +20,15 @@
<!--查询单个-->
<select id="queryById" resultMap="OilGunMap">
select
id, gun_name, tank_id, status, store_id, create_time, update_time, create_by, update_by
select id,
gun_name,
tank_id,
status,
store_id,
create_time,
update_time,
create_by,
update_by
from oil_gun
where id = #{id}
</select>
@ -46,7 +53,8 @@
<select id="queryAllByLimit2" resultMap="OilGunMap">
select
og.id, og.gun_name, og.tank_id, og.status, og.store_id, og.create_time,og.update_time, og.create_by,
og.update_by, ot.oil_number, ot.number_id, ot.tank_name,og.staff_status,og.staff_list,og.device_id,og.device_name
og.update_by, ot.oil_number, ot.number_id,
ot.tank_name,og.staff_status,og.staff_list,og.device_id,og.device_name
from oil_gun og
left join oil_tank ot on og.tank_id = ot.id
<where>
@ -94,8 +102,9 @@
</select>
<select id="getAllList" resultMap="OilGunMap">
select
og.id, og.gun_name, og.tank_id, og.status, og.store_id, og.create_time, og.update_time, og.create_by, og.update_by, og.number_id, ot.tank_name,
og.oil_machine_gun_number
og.id, og.gun_name, og.tank_id, og.status, og.store_id, og.create_time, og.update_time, og.create_by,
og.update_by, og.number_id, ot.tank_name,
og.oil_machine_gun_number
from oil_gun og left join oil_tank ot on og.tank_id = ot.id
<where>
<if test="oilGun.id != null">
@ -119,32 +128,47 @@
</where>
</select>
<select id="getOilName" resultType="com.fuint.business.petrolStationManagement.vo.OilGunVO">
select onm.number_id numberId,name.oil_name oilName, name.oil_type oilType,onm.oil_price oilPrice ,onm.gb_price gbPrice,
name.oil_density oilDensity,onm.unit unit,name.id oilNameId
select onm.number_id numberId,name.oil_name oilName, name.oil_type oilType,onm.oil_price oilPrice ,onm.gb_price
gbPrice,
name.oil_density oilDensity,onm.unit unit,name.id oilNameId
from oil_number onm
left join oil_name name on onm.oil_name = name.id
<where>
onm.state = '启用'
<if test="storeId != null">
and onm.store_id = #{storeId}
and onm.store_id = #{storeId}
</if>
</where>
</select>
<select id="checkData" resultType="com.fuint.business.petrolStationManagement.entity.OilGun">
select id
from oil_gun
where
gun_name = #{oilGun.gunName}
and store_id = #{oilGun.storeId}
where gun_name = #{oilGun.gunName}
and store_id = #{oilGun.storeId}
</select>
<select id="selectListByStoreId" resultType="com.fuint.business.petrolStationManagement.vo.OilGunVO">
SELECT og.*,onu.oil_name,onu.oil_Price FROM oil_gun og
LEFT JOIN oil_number onu on og.number_id = onu.number_id
LEFT JOIN oil_number onu on og.number_id = onu.number_id
where og.status = '启用'
<if test="storeId != null">
and og.store_id = #{storeId}
</if>
</select>
<select id="cashRegisterList" resultType="com.fuint.business.petrolStationManagement.vo.OilCashRegisterVo">
select zong.*, o2.oil_name
FROM (SELECT o1.*,
o2.oil_name as oil_name_id,
o2.oil_type as oilType,
o2.oil_price as oilPrice
FROM oil_gun o1
LEFT JOIN oil_number o2 ON o1.number_id = o2.number_id
WHERE o1.store_id = #{storeId} and o1.status = '启用' ) as zong
LEFT JOIN oil_name as o2 on zong.oil_name_id = o2.id
</select>
<!-- &#45;&#45; and tank_id = #{oilGun.tankId}-->
@ -155,26 +179,24 @@
create_by, update_by, number_id,
oil_machine_gun_number,
staff_status,
staff_list,
device_id,
device_name
)
staff_list,
device_id,
device_name)
values (#{gunName}, #{tankId}, #{status}, #{storeId},
#{createTime}, #{createTime}, #{createBy},
#{updateBy}, #{numberId}, #{oilMachineGunNumber},
#{staffStatus}
#{staffList}
#{deviceId}
#{deviceName}
)
#{deviceName})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into oil_gun(gun_name, tank_id, status, store_id, create_time, update_time, create_by, update_by)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.gunName}, #{entity.tankId}, #{entity.status}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
(#{entity.gunName}, #{entity.tankId}, #{entity.status}, #{entity.storeId}, #{entity.createTime},
#{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
</foreach>
</insert>
@ -182,7 +204,8 @@ device_name
insert into oil_gun(gun_name, tank_id, status, store_id, create_time, update_time, create_by, update_by)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.gunName}, #{entity.tankId}, #{entity.status}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
(#{entity.gunName}, #{entity.tankId}, #{entity.status}, #{entity.storeId}, #{entity.createTime},
#{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
</foreach>
on duplicate key update
gun_name = values(gun_name),
@ -251,7 +274,9 @@ device_name
<!--通过主键删除-->
<delete id="deleteById">
delete from oil_gun where id = #{id}
delete
from oil_gun
where id = #{id}
</delete>
</mapper>

View File

@ -4,11 +4,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.petrolStationManagement.entity.OilGun;
import com.fuint.business.petrolStationManagement.entity.OilTank;
import com.fuint.business.petrolStationManagement.vo.OilCashRegisterVo;
import com.fuint.business.petrolStationManagement.vo.OilGunVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.PageRequest;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 油枪表(OilGun)表服务接口
@ -48,6 +51,8 @@ public interface OilGunService {
*/
boolean insert(OilGun oilGun);
Map<String, List<OilCashRegisterVo>> cashRegisterList();
/**
* 修改数据
*

View File

@ -9,17 +9,22 @@ import com.fuint.business.petrolStationManagement.entity.OilNumber;
import com.fuint.business.petrolStationManagement.mapper.OilGunMapper;
import com.fuint.business.petrolStationManagement.mapper.OilNumberMapper;
import com.fuint.business.petrolStationManagement.service.OilGunService;
import com.fuint.business.petrolStationManagement.vo.OilCashRegisterVo;
import com.fuint.business.petrolStationManagement.vo.OilGunVO;
import com.fuint.business.petrolStationManagement.vo.OilNumberVO;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import com.fuint.quartz.util.BeanUtils;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 油枪表(OilGun)表服务实现类
@ -60,7 +65,9 @@ public class OilGunServiceImpl implements OilGunService {
// IPage<OilGunVO> oilGunIPage = oilGunDao.queryAllByLimit(page, oilGun);
return oilGunDao.queryAllByLimit(page, oilGun);
} @Override
}
@Override
public IPage<OilGunVO> queryByPage2(@Param("page") Page page, @Param("oilGun") OilGun oilGun) {
if (ObjectUtil.isEmpty(oilGun.getStoreId())) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
@ -80,7 +87,7 @@ public class OilGunServiceImpl implements OilGunService {
List<OilGunVO> oilName = oilGunDao.getOilName(nowAccountInfo.getStoreId());
// 根据店铺id查询所有油枪
List<OilGun> allList = oilGunDao.getAllList(oilGun);
if (oilName.size() <= 0 || allList.size() <= 0){
if (oilName.size() <= 0 || allList.size() <= 0) {
return oilName;
}
for (OilGunVO oilNumber : oilName) {
@ -104,7 +111,7 @@ public class OilGunServiceImpl implements OilGunService {
oilGun.setStatus("启用");
// 根据店铺id查询所有油枪
List<OilGun> allList = oilGunDao.getAllList(oilGun);
if (oilName.size() <= 0 || allList.size() <= 0){
if (oilName.size() <= 0 || allList.size() <= 0) {
return oilName;
}
for (OilGunVO oilNumber : oilName) {
@ -131,12 +138,25 @@ public class OilGunServiceImpl implements OilGunService {
oilGun.setStoreId(accountInfo.getStoreId());
oilGun.setCreateBy(accountInfo.getStaffId().toString());
int i = checkData(oilGun);
if (i>0) {
if (i > 0) {
return false;
}
oilGun.setCreateBy(accountInfo.getId().toString());
return oilGunDao.insert(oilGun)>0;
return oilGunDao.insert(oilGun) > 0;
}
@Override
public Map<String, List<OilCashRegisterVo>> cashRegisterList() {
AccountInfo accountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = accountInfo.getStoreId();
List<OilCashRegisterVo> oilCashRegisterVos = oilGunDao.cashRegisterList(storeId);
Map<String, List<OilCashRegisterVo>> groupedByOilName = oilCashRegisterVos.stream()
.collect(Collectors.groupingBy(OilCashRegisterVo::getOilName));
return groupedByOilName;
}
// 判断是否有同一名称的数据
@ -162,7 +182,7 @@ public class OilGunServiceImpl implements OilGunService {
oilGun.setStoreId(accountInfo.getStoreId());
List<OilGun> oilGuns = checkData2(oilGun);
if (ObjectUtil.isNotEmpty(oilGuns)) {
if (oilGuns.size()>1) {
if (oilGuns.size() > 1) {
return false;
}
if (!oilGuns.get(0).getId().equals(oilGun.getId())) {
@ -171,7 +191,7 @@ public class OilGunServiceImpl implements OilGunService {
}
oilGun.setUpdateBy(accountInfo.getId().toString());
return this.oilGunDao.update(oilGun)>0;
return this.oilGunDao.update(oilGun) > 0;
}
/**
@ -188,8 +208,8 @@ public class OilGunServiceImpl implements OilGunService {
@Override
public List<OilGun> selectOilGunByNumberId(Integer numberId) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("number_id",numberId);
queryWrapper.eq("status","启用");
queryWrapper.eq("number_id", numberId);
queryWrapper.eq("status", "启用");
List<OilGun> list = oilGunDao.selectList(queryWrapper);
return list;
}
@ -197,8 +217,8 @@ public class OilGunServiceImpl implements OilGunService {
@Override
public List<OilGun> selectOilGunByTankId(Integer tankId) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("tank_id",tankId);
queryWrapper.eq("status","启用");
queryWrapper.eq("tank_id", tankId);
queryWrapper.eq("status", "启用");
List<OilGun> list = oilGunDao.selectList(queryWrapper);
return list;
}

View File

@ -0,0 +1,24 @@
package com.fuint.business.petrolStationManagement.vo;
import com.fuint.business.petrolStationManagement.entity.OilGun;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class OilCashRegisterVo extends OilGun {
/**
* 关联表 油号名称
*/
private String oilName;
/**
* 关联表 油品类型
*/
private String oilType;
/**
* 关联表 挂牌价
*/
private BigDecimal oilPrice;
}