Browse Source

货道管理基础业务

LuoDLeo 7 months ago
parent
commit
a692b6fc50

+ 128 - 0
src/main/java/org/springblade/modules/business/controller/FacilityCargoWayController.java

@@ -0,0 +1,128 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.business.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.business.entity.FacilityCargoWay;
+import org.springblade.modules.business.service.IFacilityCargoWayService;
+import org.springblade.modules.business.vo.FacilityCargoWayVO;
+import org.springblade.modules.business.wrapper.FacilityCargoWayWrapper;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+/**
+ * 售货机货表 控制器
+ *
+ * @author BladeX
+ * @since 2024-07-16
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("blade-demo/facilitycargoway")
+@Api(value = "售货机货表", tags = "售货机货表接口")
+public class FacilityCargoWayController extends BladeController {
+
+	private final IFacilityCargoWayService facilityCargoWayService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入facilityCargoWay")
+	public R<FacilityCargoWayVO> detail(FacilityCargoWay facilityCargoWay) {
+		FacilityCargoWay detail = facilityCargoWayService.getOne(Condition.getQueryWrapper(facilityCargoWay));
+		return R.data(FacilityCargoWayWrapper.build().entityVO(detail));
+	}
+
+	/**
+	 * 分页 售货机货表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入facilityCargoWay")
+	public R<IPage<FacilityCargoWayVO>> list(FacilityCargoWay facilityCargoWay, Query query) {
+		IPage<FacilityCargoWay> pages = facilityCargoWayService.page(Condition.getPage(query), Condition.getQueryWrapper(facilityCargoWay));
+		return R.data(FacilityCargoWayWrapper.build().pageVO(pages));
+	}
+
+
+	/**
+	 * 自定义分页 售货机货表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入facilityCargoWay")
+	public R<IPage<FacilityCargoWayVO>> page(FacilityCargoWayVO facilityCargoWay, Query query) {
+		IPage<FacilityCargoWayVO> pages = facilityCargoWayService.selectFacilityCargoWayPage(Condition.getPage(query), facilityCargoWay);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 售货机货表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入facilityCargoWay")
+	public R save(@Valid @RequestBody FacilityCargoWay facilityCargoWay) {
+		return R.status(facilityCargoWayService.save(facilityCargoWay));
+	}
+
+	/**
+	 * 修改 售货机货表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入facilityCargoWay")
+	public R update(@Valid @RequestBody FacilityCargoWay facilityCargoWay) {
+		return R.status(facilityCargoWayService.updateById(facilityCargoWay));
+	}
+
+	/**
+	 * 新增或修改 售货机货表
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入facilityCargoWay")
+	public R submit(@Valid @RequestBody FacilityCargoWay facilityCargoWay) {
+		return R.status(facilityCargoWayService.saveOrUpdate(facilityCargoWay));
+	}
+
+	
+	/**
+	 * 删除 售货机货表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "逻辑删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(facilityCargoWayService.removeByIds(Func.toLongList(ids)));
+	}
+
+	
+}

+ 34 - 0
src/main/java/org/springblade/modules/business/dto/FacilityCargoWayDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.business.dto;
+
+import org.springblade.modules.business.entity.FacilityCargoWay;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 售货机货表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2024-07-16
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FacilityCargoWayDTO extends FacilityCargoWay {
+	private static final long serialVersionUID = 1L;
+
+}

+ 35 - 4
src/main/java/org/springblade/modules/business/entity/FacilityCargoWay.java

@@ -1,20 +1,51 @@
 package org.springblade.modules.business.entity;
 
+import org.springblade.common.base.BaseEntity;
 import com.baomidou.mybatisplus.annotation.TableName;
-import io.swagger.annotations.ApiModel;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
-import org.springblade.common.base.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 
 /**
- * 货道表
+ * 售货机货表实体类
+ *
+ * @author zzyd
+ * @since 2024-07-16
  */
 @Data
 @TableName("t_facility_cargo_way")
 @EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "货道", description = "货道表")
+@ApiModel(value = "FacilityCargoWay对象", description = "售货机货表")
 public class FacilityCargoWay extends BaseEntity {
 
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 设备id
+	*/
+	@ApiModelProperty(value = "设备id")
+	private Long facilityId;
+	/**
+	* 货道状态
+	*/
+	@ApiModelProperty(value = "货道状态")
+	private Integer cargoStatus;
+	/**
+	* 货道容量
+	*/
+	@ApiModelProperty(value = "货道容量")
+	private Integer volume;
+	/**
+	* 货道启用状态
+	*/
+	@ApiModelProperty(value = "货道启用状态")
+	private Integer enable;
+	/**
+	* 货道编号
+	*/
+	@ApiModelProperty(value = "货道编号")
+	private String cargoNo;
 
 
 }

+ 42 - 0
src/main/java/org/springblade/modules/business/mapper/FacilityCargoWayMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.business.mapper;
+
+import org.springblade.modules.business.entity.FacilityCargoWay;
+import org.springblade.modules.business.vo.FacilityCargoWayVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 售货机货表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2024-07-16
+ */
+public interface FacilityCargoWayMapper extends BaseMapper<FacilityCargoWay> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param facilityCargoWay
+	 * @return
+	 */
+	List<FacilityCargoWayVO> selectFacilityCargoWayPage(IPage page, FacilityCargoWayVO facilityCargoWay);
+
+}

+ 25 - 0
src/main/java/org/springblade/modules/business/mapper/FacilityCargoWayMapper.xml

@@ -0,0 +1,25 @@
+<?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.springblade.modules.business.mapper.FacilityCargoWayMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="facilityCargoWayResultMap" type="org.springblade.modules.business.entity.FacilityCargoWay">
+        <result column="id" property="id"/>
+        <result column="is_delete" property="isDelete"/>
+        <result column="create_user_id" property="createUserId"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user_id" property="updateUserId"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="facility_id" property="facilityId"/>
+        <result column="cargo_status" property="cargoStatus"/>
+        <result column="volume" property="volume"/>
+        <result column="enable" property="enable"/>
+        <result column="cargo_no" property="cargoNo"/>
+    </resultMap>
+
+
+    <select id="selectFacilityCargoWayPage" resultMap="facilityCargoWayResultMap">
+        select * from t_facility_cargo_way where is_delete = 0
+    </select>
+
+</mapper>

+ 41 - 0
src/main/java/org/springblade/modules/business/service/IFacilityCargoWayService.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.business.service;
+
+import org.springblade.modules.business.entity.FacilityCargoWay;
+import org.springblade.modules.business.vo.FacilityCargoWayVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 售货机货表 服务类
+ *
+ * @author BladeX
+ * @since 2024-07-16
+ */
+public interface IFacilityCargoWayService extends IService<FacilityCargoWay> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param facilityCargoWay
+	 * @return
+	 */
+	IPage<FacilityCargoWayVO> selectFacilityCargoWayPage(IPage<FacilityCargoWayVO> page, FacilityCargoWayVO facilityCargoWay);
+
+}

+ 41 - 0
src/main/java/org/springblade/modules/business/service/impl/FacilityCargoWayServiceImpl.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.business.service.impl;
+
+import org.springblade.modules.business.entity.FacilityCargoWay;
+import org.springblade.modules.business.vo.FacilityCargoWayVO;
+import org.springblade.modules.business.mapper.FacilityCargoWayMapper;
+import org.springblade.modules.business.service.IFacilityCargoWayService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 售货机货表 服务实现类
+ *
+ * @author BladeX
+ * @since 2024-07-16
+ */
+@Service
+public class FacilityCargoWayServiceImpl extends ServiceImpl<FacilityCargoWayMapper, FacilityCargoWay> implements IFacilityCargoWayService {
+
+	@Override
+	public IPage<FacilityCargoWayVO> selectFacilityCargoWayPage(IPage<FacilityCargoWayVO> page, FacilityCargoWayVO facilityCargoWay) {
+		return page.setRecords(baseMapper.selectFacilityCargoWayPage(page, facilityCargoWay));
+	}
+
+}

+ 4 - 4
src/main/java/org/springblade/modules/business/vo/FacilityVO.java → src/main/java/org/springblade/modules/business/vo/FacilityCargoWayVO.java

@@ -16,21 +16,21 @@
  */
 package org.springblade.modules.business.vo;
 
-import org.springblade.modules.business.entity.Facility;
+import org.springblade.modules.business.entity.FacilityCargoWay;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import io.swagger.annotations.ApiModel;
 
 /**
- * 售货设备表视图实体类
+ * 售货机货表视图实体类
  *
  * @author BladeX
  * @since 2024-07-16
  */
 @Data
 @EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "FacilityVO对象", description = "售货设备表")
-public class FacilityVO extends Facility {
+@ApiModel(value = "FacilityCargoWayVO对象", description = "售货机货表")
+public class FacilityCargoWayVO extends FacilityCargoWay {
 	private static final long serialVersionUID = 1L;
 
 }

+ 49 - 0
src/main/java/org/springblade/modules/business/wrapper/FacilityCargoWayWrapper.java

@@ -0,0 +1,49 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.modules.business.wrapper;
+
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.modules.business.entity.FacilityCargoWay;
+import org.springblade.modules.business.vo.FacilityCargoWayVO;
+import java.util.Objects;
+
+/**
+ * 售货机货表包装类,返回视图层所需的字段
+ *
+ * @author BladeX
+ * @since 2024-07-16
+ */
+public class FacilityCargoWayWrapper extends BaseEntityWrapper<FacilityCargoWay, FacilityCargoWayVO>  {
+
+	public static FacilityCargoWayWrapper build() {
+		return new FacilityCargoWayWrapper();
+ 	}
+
+	@Override
+	public FacilityCargoWayVO entityVO(FacilityCargoWay facilityCargoWay) {
+		FacilityCargoWayVO facilityCargoWayVO = Objects.requireNonNull(BeanUtil.copy(facilityCargoWay, FacilityCargoWayVO.class));
+
+		//User createUser = UserCache.getUser(facilityCargoWay.getCreateUser());
+		//User updateUser = UserCache.getUser(facilityCargoWay.getUpdateUser());
+		//facilityCargoWayVO.setCreateUserName(createUser.getName());
+		//facilityCargoWayVO.setUpdateUserName(updateUser.getName());
+
+		return facilityCargoWayVO;
+	}
+
+}