店铺管理-店铺配置:打印机设置相关接口
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package com.chaozhanggui.system.cashierservice.service;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ShopPrinterDTO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 打印机配置
|
||||
* @author tankaikai
|
||||
* @since 2024-09-24 17:15
|
||||
*/
|
||||
public interface ShopPrinterService {
|
||||
|
||||
PageInfo<ShopPrinterDTO> page(Map<String, Object> params);
|
||||
|
||||
List<ShopPrinterDTO> list(Map<String, Object> params);
|
||||
|
||||
ShopPrinterDTO get(Integer id);
|
||||
|
||||
void save(ShopPrinterDTO dto);
|
||||
|
||||
void update(ShopPrinterDTO dto);
|
||||
|
||||
void delete(Integer id);
|
||||
|
||||
void updateStatus(Integer id,Integer status);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.chaozhanggui.system.cashierservice.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.map.MapProxy;
|
||||
import com.chaozhanggui.system.cashierservice.dao.ShopPrinterServiceMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbPrintMachineMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbPrintMachineWithBLOBs;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.ShopPrinterDTO;
|
||||
import com.chaozhanggui.system.cashierservice.service.ShopPrinterService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 店铺打印配置
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2024-09-24 17:23
|
||||
*/
|
||||
@Service
|
||||
public class ShopPrinterServiceImpl implements ShopPrinterService {
|
||||
|
||||
@Resource
|
||||
private ShopPrinterServiceMapper shopPrinterServiceMapper;
|
||||
|
||||
@Resource
|
||||
private TbPrintMachineMapper tbPrintMachineMapper;
|
||||
|
||||
@Override
|
||||
public PageInfo<ShopPrinterDTO> page(Map<String, Object> params) {
|
||||
MapProxy mapProxy = MapProxy.create(params);
|
||||
Integer pageNum = mapProxy.getInt("pageNum");
|
||||
Integer pageSize = mapProxy.getInt("pageSize");
|
||||
PageInfo<ShopPrinterDTO> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> shopPrinterServiceMapper.getList(params));
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ShopPrinterDTO> list(Map<String, Object> params) {
|
||||
return shopPrinterServiceMapper.getList(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShopPrinterDTO get(Integer id) {
|
||||
TbPrintMachineWithBLOBs entity = tbPrintMachineMapper.selectByPrimaryKey(id);
|
||||
return BeanUtil.toBean(entity, ShopPrinterDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(ShopPrinterDTO dto) {
|
||||
TbPrintMachineWithBLOBs entity = new TbPrintMachineWithBLOBs();
|
||||
BeanUtil.copyProperties(dto, entity, "createdAt", "updatedAt");
|
||||
entity.setCreatedAt(System.currentTimeMillis());
|
||||
entity.setUpdatedAt(System.currentTimeMillis());
|
||||
tbPrintMachineMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(ShopPrinterDTO dto) {
|
||||
TbPrintMachineWithBLOBs entity = tbPrintMachineMapper.selectByPrimaryKey(dto.getId());
|
||||
BeanUtil.copyProperties(dto, entity, "createdAt", "updatedAt");
|
||||
entity.setUpdatedAt(System.currentTimeMillis());
|
||||
tbPrintMachineMapper.updateByPrimaryKeyWithBLOBs(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Integer id) {
|
||||
tbPrintMachineMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(Integer id, Integer status) {
|
||||
shopPrinterServiceMapper.updateStatus(id, status);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user