From 4513fe9ac75323b9e7feb93eb4f8f7581e28c663 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Wed, 07 Jul 2021 11:04:22 +0800
Subject: [PATCH] 1.派遣记录

---
 src/main/java/org/springblade/modules/dispatcher/controller/DispatcherController.java    |  126 +++++++++++++++
 src/main/java/org/springblade/modules/dispatcher/entity/Dispatcher.java                  |   80 ++++++++++
 src/main/java/org/springblade/modules/dispatcher/service/IDispatcherService.java         |   41 +++++
 src/main/java/org/springblade/modules/dispatcher/vo/DispatcherVO.java                    |   36 ++++
 src/main/java/org/springblade/modules/dispatcher/dto/DispatcherDTO.java                  |   34 ++++
 src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherMapper.java            |   42 +++++
 src/main/java/org/springblade/modules/dispatcher/service/impl/DispatcherServiceImpl.java |   41 +++++
 src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherMapper.xml             |   21 ++
 8 files changed, 421 insertions(+), 0 deletions(-)

diff --git a/src/main/java/org/springblade/modules/dispatcher/controller/DispatcherController.java b/src/main/java/org/springblade/modules/dispatcher/controller/DispatcherController.java
new file mode 100644
index 0000000..3bcb510
--- /dev/null
+++ b/src/main/java/org/springblade/modules/dispatcher/controller/DispatcherController.java
@@ -0,0 +1,126 @@
+/*
+ *      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.dispatcher.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+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.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.dispatcher.entity.Dispatcher;
+import org.springblade.modules.dispatcher.vo.DispatcherVO;
+import org.springblade.modules.dispatcher.service.IDispatcherService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ *  控制器
+ *
+ * @author BladeX
+ * @since 2021-07-07
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/dispatcher")
+@Api(value = "", tags = "接口")
+public class DispatcherController extends BladeController {
+
+	private final IDispatcherService dispatcherService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入dispatcher")
+	public R<Dispatcher> detail(Dispatcher dispatcher) {
+		Dispatcher detail = dispatcherService.getOne(Condition.getQueryWrapper(dispatcher));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入dispatcher")
+	public R<IPage<Dispatcher>> list(Dispatcher dispatcher, Query query) {
+		IPage<Dispatcher> pages = dispatcherService.page(Condition.getPage(query), Condition.getQueryWrapper(dispatcher));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入dispatcher")
+	public R<IPage<DispatcherVO>> page(DispatcherVO dispatcher, Query query) {
+		IPage<DispatcherVO> pages = dispatcherService.selectDispatcherPage(Condition.getPage(query), dispatcher);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入dispatcher")
+	public R save(@Valid @RequestBody Dispatcher dispatcher) {
+		return R.status(dispatcherService.save(dispatcher));
+	}
+
+	/**
+	 * 修改
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入dispatcher")
+	public R update(@Valid @RequestBody Dispatcher dispatcher) {
+		return R.status(dispatcherService.updateById(dispatcher));
+	}
+
+	/**
+	 * 新增或修改
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入dispatcher")
+	public R submit(@Valid @RequestBody Dispatcher dispatcher) {
+		return R.status(dispatcherService.saveOrUpdate(dispatcher));
+	}
+
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(dispatcherService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+}
diff --git a/src/main/java/org/springblade/modules/dispatcher/dto/DispatcherDTO.java b/src/main/java/org/springblade/modules/dispatcher/dto/DispatcherDTO.java
new file mode 100644
index 0000000..dc6c750
--- /dev/null
+++ b/src/main/java/org/springblade/modules/dispatcher/dto/DispatcherDTO.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.dispatcher.dto;
+
+import org.springblade.modules.dispatcher.entity.Dispatcher;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-07-07
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class DispatcherDTO extends Dispatcher {
+	private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/dispatcher/entity/Dispatcher.java b/src/main/java/org/springblade/modules/dispatcher/entity/Dispatcher.java
new file mode 100644
index 0000000..2499d69
--- /dev/null
+++ b/src/main/java/org/springblade/modules/dispatcher/entity/Dispatcher.java
@@ -0,0 +1,80 @@
+/*
+ *      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.dispatcher.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2021-07-07
+ */
+@Data
+@TableName("sys_dispatcher")
+@ApiModel(value = "Dispatcher对象", description = "Dispatcher对象")
+public class Dispatcher implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	@TableId(value = "id", type = IdType.AUTO)
+	private Integer id;
+	/**
+	* 身份证
+	*/
+		@ApiModelProperty(value = "身份证")
+		private String cardid;
+	/**
+	* 保安人名称
+	*/
+		@ApiModelProperty(value = "保安人名称")
+		private String name;
+	/**
+	* 派遣人
+	*/
+		@ApiModelProperty(value = "派遣人")
+		private String dispatcher;
+	/**
+	* 派遣时间
+	*/
+		@ApiModelProperty(value = "派遣时间")
+		@TableField("dispatcherTime")
+	private LocalDateTime dispatchertime;
+	/**
+	* 派遣地址
+	*/
+		@ApiModelProperty(value = "派遣地址")
+		@TableField("dispatcherAddress")
+	private String dispatcheraddress;
+	/**
+	 * 派遣地址
+	 */
+	@ApiModelProperty(value = "派遣单位")
+	@TableField("dispatcherCompany")
+	private String dispatchercompany;
+
+
+}
diff --git a/src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherMapper.java b/src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherMapper.java
new file mode 100644
index 0000000..38e65db
--- /dev/null
+++ b/src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherMapper.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.dispatcher.mapper;
+
+import org.springblade.modules.dispatcher.entity.Dispatcher;
+import org.springblade.modules.dispatcher.vo.DispatcherVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-07-07
+ */
+public interface DispatcherMapper extends BaseMapper<Dispatcher> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param dispatcher
+	 * @return
+	 */
+	List<DispatcherVO> selectDispatcherPage(IPage page, DispatcherVO dispatcher);
+
+}
diff --git a/src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherMapper.xml b/src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherMapper.xml
new file mode 100644
index 0000000..68238ba
--- /dev/null
+++ b/src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherMapper.xml
@@ -0,0 +1,21 @@
+<?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.dispatcher.mapper.DispatcherMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="dispatcherResultMap" type="org.springblade.modules.dispatcher.entity.Dispatcher">
+        <id column="id" property="id"/>
+        <result column="cardid" property="cardid"/>
+        <result column="name" property="name"/>
+        <result column="dispatcher" property="dispatcher"/>
+        <result column="dispatcherTime" property="dispatchertime"/>
+        <result column="dispatcherAddress" property="dispatcheraddress"/>
+        <result column="dispatchercompany" property="dispatchercompany"/>
+    </resultMap>
+
+
+    <select id="selectDispatcherPage" resultMap="dispatcherResultMap">
+        select * from sys_dispatcher where is_deleted = 0
+    </select>
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/dispatcher/service/IDispatcherService.java b/src/main/java/org/springblade/modules/dispatcher/service/IDispatcherService.java
new file mode 100644
index 0000000..2ad7516
--- /dev/null
+++ b/src/main/java/org/springblade/modules/dispatcher/service/IDispatcherService.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.dispatcher.service;
+
+import org.springblade.modules.dispatcher.entity.Dispatcher;
+import org.springblade.modules.dispatcher.vo.DispatcherVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2021-07-07
+ */
+public interface IDispatcherService extends IService<Dispatcher> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param dispatcher
+	 * @return
+	 */
+	IPage<DispatcherVO> selectDispatcherPage(IPage<DispatcherVO> page, DispatcherVO dispatcher);
+
+}
diff --git a/src/main/java/org/springblade/modules/dispatcher/service/impl/DispatcherServiceImpl.java b/src/main/java/org/springblade/modules/dispatcher/service/impl/DispatcherServiceImpl.java
new file mode 100644
index 0000000..3ed4df9
--- /dev/null
+++ b/src/main/java/org/springblade/modules/dispatcher/service/impl/DispatcherServiceImpl.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.dispatcher.service.impl;
+
+import org.springblade.modules.dispatcher.entity.Dispatcher;
+import org.springblade.modules.dispatcher.vo.DispatcherVO;
+import org.springblade.modules.dispatcher.mapper.DispatcherMapper;
+import org.springblade.modules.dispatcher.service.IDispatcherService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2021-07-07
+ */
+@Service
+public class DispatcherServiceImpl extends ServiceImpl<DispatcherMapper, Dispatcher> implements IDispatcherService {
+
+	@Override
+	public IPage<DispatcherVO> selectDispatcherPage(IPage<DispatcherVO> page, DispatcherVO dispatcher) {
+		return page.setRecords(baseMapper.selectDispatcherPage(page, dispatcher));
+	}
+
+}
diff --git a/src/main/java/org/springblade/modules/dispatcher/vo/DispatcherVO.java b/src/main/java/org/springblade/modules/dispatcher/vo/DispatcherVO.java
new file mode 100644
index 0000000..97926b4
--- /dev/null
+++ b/src/main/java/org/springblade/modules/dispatcher/vo/DispatcherVO.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.dispatcher.vo;
+
+import org.springblade.modules.dispatcher.entity.Dispatcher;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2021-07-07
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "DispatcherVO对象", description = "DispatcherVO对象")
+public class DispatcherVO extends Dispatcher {
+	private static final long serialVersionUID = 1L;
+
+}

--
Gitblit v1.9.3