Browse Source

添加设备型号

LuoDLeo 7 months ago
parent
commit
185c169943

+ 112 - 0
src/main/java/org/springblade/modules/business/controller/FacilityModelController.java

@@ -0,0 +1,112 @@
+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.FacilityModel;
+import org.springblade.modules.business.service.IFacilityModelService;
+import org.springblade.modules.business.vo.FacilityModelVO;
+import org.springblade.modules.business.wrapper.FacilityModelWrapper;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+/**
+ * 设备型号表 控制器
+ *
+ * @author BladeX
+ * @since 2024-07-30
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("facility/facilitymodel")
+@Api(value = "设备型号表", tags = "设备型号表接口")
+public class FacilityModelController extends BladeController {
+
+	private final IFacilityModelService facilityModelService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入facilityModel")
+	public R<FacilityModelVO> detail(FacilityModel facilityModel) {
+		FacilityModel detail = facilityModelService.getOne(Condition.getQueryWrapper(facilityModel));
+		return R.data(FacilityModelWrapper.build().entityVO(detail));
+	}
+
+	/**
+	 * 分页 设备型号表
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入facilityModel")
+	public R<IPage<FacilityModelVO>> list(FacilityModel facilityModel, Query query) {
+		IPage<FacilityModel> pages = facilityModelService.page(Condition.getPage(query), Condition.getQueryWrapper(facilityModel));
+		return R.data(FacilityModelWrapper.build().pageVO(pages));
+	}
+
+
+	/**
+	 * 自定义分页 设备型号表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入facilityModel")
+	public R<IPage<FacilityModelVO>> page(FacilityModelVO facilityModel, Query query) {
+		IPage<FacilityModelVO> pages = facilityModelService.selectFacilityModelPage(Condition.getPage(query), facilityModel);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 设备型号表
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入facilityModel")
+	public R save(@Valid @RequestBody FacilityModel facilityModel) {
+		return R.status(facilityModelService.save(facilityModel));
+	}
+
+	/**
+	 * 修改 设备型号表
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入facilityModel")
+	public R update(@Valid @RequestBody FacilityModel facilityModel) {
+		return R.status(facilityModelService.updateById(facilityModel));
+	}
+
+	/**
+	 * 新增或修改 设备型号表
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入facilityModel")
+	public R submit(@Valid @RequestBody FacilityModel facilityModel) {
+		return R.status(facilityModelService.saveOrUpdate(facilityModel));
+	}
+
+	
+	/**
+	 * 删除 设备型号表
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "逻辑删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(facilityModelService.removeByIds(Func.toLongList(ids)));
+	}
+
+	
+}

+ 34 - 0
src/main/java/org/springblade/modules/business/dto/FacilityModelDTO.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.FacilityModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 设备型号表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2024-07-30
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FacilityModelDTO extends FacilityModel {
+	private static final long serialVersionUID = 1L;
+
+}

+ 41 - 0
src/main/java/org/springblade/modules/business/entity/FacilityModel.java

@@ -0,0 +1,41 @@
+package org.springblade.modules.business.entity;
+
+import org.springblade.common.base.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 设备型号表实体类
+ *
+ * @author zzyd
+ * @since 2024-07-30
+ */
+@Data
+@TableName("t_facility_model")
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "FacilityModel对象", description = "设备型号表")
+public class FacilityModel extends BaseEntity {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 设备型号
+	*/
+	@ApiModelProperty(value = "设备型号")
+	private String facilityModel;
+	/**
+	* 货道数量
+	*/
+	@ApiModelProperty(value = "货道数量")
+	private Integer channelQuantity;
+	/**
+	* 货道容量
+	*/
+	@ApiModelProperty(value = "货道容量")
+	private Integer channelCapacity;
+
+
+}

+ 42 - 0
src/main/java/org/springblade/modules/business/mapper/FacilityModelMapper.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.FacilityModel;
+import org.springblade.modules.business.vo.FacilityModelVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 设备型号表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2024-07-30
+ */
+public interface FacilityModelMapper extends BaseMapper<FacilityModel> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param facilityModel
+	 * @return
+	 */
+	List<FacilityModelVO> selectFacilityModelPage(IPage page, FacilityModelVO facilityModel);
+
+}

+ 23 - 0
src/main/java/org/springblade/modules/business/mapper/FacilityModelMapper.xml

@@ -0,0 +1,23 @@
+<?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.FacilityModelMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="facilityModelResultMap" type="org.springblade.modules.business.entity.FacilityModel">
+        <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_model" property="facilityModel"/>
+        <result column="channel_quantity" property="channelQuantity"/>
+        <result column="channel_capacity" property="channelCapacity"/>
+    </resultMap>
+
+
+    <select id="selectFacilityModelPage" resultMap="facilityModelResultMap">
+        select * from t_facility_model where is_delete = 0
+    </select>
+
+</mapper>

+ 41 - 0
src/main/java/org/springblade/modules/business/service/IFacilityModelService.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.FacilityModel;
+import org.springblade.modules.business.vo.FacilityModelVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 设备型号表 服务类
+ *
+ * @author BladeX
+ * @since 2024-07-30
+ */
+public interface IFacilityModelService extends IService<FacilityModel> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param facilityModel
+	 * @return
+	 */
+	IPage<FacilityModelVO> selectFacilityModelPage(IPage<FacilityModelVO> page, FacilityModelVO facilityModel);
+
+}

+ 41 - 0
src/main/java/org/springblade/modules/business/service/impl/FacilityModelServiceImpl.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.FacilityModel;
+import org.springblade.modules.business.vo.FacilityModelVO;
+import org.springblade.modules.business.mapper.FacilityModelMapper;
+import org.springblade.modules.business.service.IFacilityModelService;
+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-30
+ */
+@Service
+public class FacilityModelServiceImpl extends ServiceImpl<FacilityModelMapper, FacilityModel> implements IFacilityModelService {
+
+	@Override
+	public IPage<FacilityModelVO> selectFacilityModelPage(IPage<FacilityModelVO> page, FacilityModelVO facilityModel) {
+		return page.setRecords(baseMapper.selectFacilityModelPage(page, facilityModel));
+	}
+
+}

+ 36 - 0
src/main/java/org/springblade/modules/business/vo/FacilityModelVO.java

@@ -0,0 +1,36 @@
+/*
+ *      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.vo;
+
+import org.springblade.modules.business.entity.FacilityModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 设备型号表视图实体类
+ *
+ * @author BladeX
+ * @since 2024-07-30
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "FacilityModelVO对象", description = "设备型号表")
+public class FacilityModelVO extends FacilityModel {
+	private static final long serialVersionUID = 1L;
+
+}

+ 49 - 0
src/main/java/org/springblade/modules/business/wrapper/FacilityModelWrapper.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.FacilityModel;
+import org.springblade.modules.business.vo.FacilityModelVO;
+import java.util.Objects;
+
+/**
+ * 设备型号表包装类,返回视图层所需的字段
+ *
+ * @author BladeX
+ * @since 2024-07-30
+ */
+public class FacilityModelWrapper extends BaseEntityWrapper<FacilityModel, FacilityModelVO>  {
+
+	public static FacilityModelWrapper build() {
+		return new FacilityModelWrapper();
+ 	}
+
+	@Override
+	public FacilityModelVO entityVO(FacilityModel facilityModel) {
+		FacilityModelVO facilityModelVO = Objects.requireNonNull(BeanUtil.copy(facilityModel, FacilityModelVO.class));
+
+		//User createUser = UserCache.getUser(facilityModel.getCreateUser());
+		//User updateUser = UserCache.getUser(facilityModel.getUpdateUser());
+		//facilityModelVO.setCreateUserName(createUser.getName());
+		//facilityModelVO.setUpdateUserName(updateUser.getName());
+
+		return facilityModelVO;
+	}
+
+}