From ffeb38a6d9d6288f9e6a2c303a6b063f7b60b638 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Mon, 02 Aug 2021 11:34:45 +0800
Subject: [PATCH] 1.能量树

---
 src/main/java/org/springblade/modules/energy/service/IEnergyTreeService.java         |   34 ++
 src/main/java/org/springblade/modules/energy/controller/EnergyTreeController.java    |  125 +++++++
 src/main/java/org/springblade/modules/energy/mapper/EnergyMapper.java                |   40 ++
 src/main/java/org/springblade/modules/energy/mapper/EnergyTreeMapper.java            |   34 ++
 src/main/java/org/springblade/modules/energy/controller/EnergyController.java        |  213 +++++++++++++
 src/main/java/org/springblade/modules/energy/vo/EnergyTreeVO.java                    |   37 ++
 src/main/java/org/springblade/modules/energy/wrapper/EnergyTreeWrapper.java          |   46 ++
 src/main/java/org/springblade/modules/energy/entity/EnergyTree.java                  |   50 +++
 src/main/java/org/springblade/modules/energy/service/impl/EnergyServiceImpl.java     |   69 ++++
 src/main/java/org/springblade/modules/energy/service/IEnergyService.java             |   40 ++
 src/main/java/org/springblade/modules/energy/service/impl/EnergyTreeServiceImpl.java |   49 +++
 src/main/java/org/springblade/modules/energy/vo/EnergyVO.java                        |   37 ++
 src/main/java/org/springblade/common/config/BladeConfiguration.java                  |    1 
 src/main/java/org/springblade/modules/energy/mapper/EnergyTreeMapper.xml             |   23 +
 src/main/java/org/springblade/modules/energy/wrapper/EnergyWrapper.java              |   46 ++
 src/main/java/org/springblade/modules/energy/entity/Energy.java                      |   53 +++
 src/main/java/org/springblade/modules/energy/mapper/EnergyMapper.xml                 |   37 ++
 17 files changed, 934 insertions(+), 0 deletions(-)

diff --git a/src/main/java/org/springblade/common/config/BladeConfiguration.java b/src/main/java/org/springblade/common/config/BladeConfiguration.java
index 2adfe12..efa02a9 100644
--- a/src/main/java/org/springblade/common/config/BladeConfiguration.java
+++ b/src/main/java/org/springblade/common/config/BladeConfiguration.java
@@ -95,6 +95,7 @@
 		secureRegistry.excludePathPatterns("/wj/wj/**");
 		secureRegistry.excludePathPatterns("/xlfeedback/xlfeedback/**");
 		secureRegistry.excludePathPatterns("/zc/**");
+		secureRegistry.excludePathPatterns("/energy/**");
 		return secureRegistry;
 	}
 
diff --git a/src/main/java/org/springblade/modules/energy/controller/EnergyController.java b/src/main/java/org/springblade/modules/energy/controller/EnergyController.java
new file mode 100644
index 0000000..0ba32e7
--- /dev/null
+++ b/src/main/java/org/springblade/modules/energy/controller/EnergyController.java
@@ -0,0 +1,213 @@
+/*
+ *      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.energy.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.google.common.collect.Lists;
+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.dj.entity.Dj;
+import org.springblade.modules.dj.service.IDjService;
+import org.springblade.modules.dj.vo.DjVO;
+import org.springblade.modules.dj.wrapper.DjWrapper;
+import org.springblade.modules.energy.entity.Energy;
+import org.springblade.modules.energy.entity.EnergyTree;
+import org.springblade.modules.energy.service.IEnergyService;
+import org.springblade.modules.energy.service.IEnergyTreeService;
+import org.springblade.modules.energy.vo.EnergyVO;
+import org.springblade.modules.energy.wrapper.EnergyWrapper;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  控制器
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/energy")
+@Api(value = "", tags = "接口")
+public class EnergyController extends BladeController {
+
+	private final IEnergyService energyService;
+	private final IEnergyTreeService energyTreeService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入dj")
+	public R<EnergyVO> detail(Energy energy) {
+		Energy detail = energyService.getOne(Condition.getQueryWrapper(energy));
+		return R.data(EnergyWrapper.build().entityVO(detail));
+	}
+
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入dj")
+	public R<IPage<EnergyVO>> list(Energy energy, Query query) {
+		IPage<Energy> pages = energyService.page(Condition.getPage(query), Condition.getQueryWrapper(energy));
+		return R.data(EnergyWrapper.build().pageVO(pages));
+	}
+
+
+	/**
+	 * 新增
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入dj")
+	public R save(@Valid @RequestBody Energy energy) {
+		List<String> list = energyService.selectEnergyTree(energy.getIdentification());
+		if (list==null){
+			EnergyTree energyTree= new EnergyTree();
+			energyTree.setIdentification(energy.getIdentification());
+			energyTreeService.save(energyTree);
+		}
+		return R.status(energyService.save(energy));
+	}
+
+	/**
+	 * 修改
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入dj")
+	public R update(@Valid @RequestBody Energy energy) {
+		return R.status(energyService.updateById(energy));
+	}
+
+	/**
+	 * 新增或修改
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入dj")
+	public R submit(@Valid @RequestBody Energy energy) {
+		return R.status(energyService.saveOrUpdate(energy));
+	}
+
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(energyService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+	/**
+	 * 能量统计
+	 * @return
+	 */
+	@PostMapping("/selectTreeNum")
+	public R selectTreeNum() {
+		Date date=new Date();
+		DateFormat format=new SimpleDateFormat("yyyy-MM-dd");
+		String time=format.format(date);
+		List<String> list = energyService.selectTreeNum(time);
+		List<List<String>> lists = splitList(list, 3);
+		return R.data(lists);
+	}
+
+	/**
+	 * 拾取能量
+	 * @param id
+	 * @return
+	 */
+	@PostMapping("/updateEnergyId")
+	public R updateEnergyId(String id,String identification) {
+		String[] strArray = id.split(",");
+		for (int i = 0; i < strArray.length; i++) {
+			energyService.updateEnergyId(strArray[i]);
+		}
+		//能量树
+		String nums = energyTreeService.selectNum(identification);
+		Integer a=Integer.valueOf(nums);
+		int length = strArray.length;
+		int i = a + length;
+		String num=String.valueOf(i);
+		energyTreeService.updateEnergyTreeId(num,identification);
+		return R.success("拾取成功");
+	}
+
+
+	private List<List<String>> splitList(List<String> list , int groupSize){
+		int length = list.size();
+		// 计算可以分成多少组
+		int num = ( length + groupSize - 1 )/groupSize ; // TODO
+		List<List<String>> newList = new ArrayList<>(num);
+		for (int i = 0; i < num; i++) {
+			// 开始位置
+			int fromIndex = i * groupSize;
+			// 结束位置
+			int toIndex = (i+1) * groupSize < length ? ( i+1 ) * groupSize : length ;
+			newList.add(list.subList(fromIndex,toIndex)) ;
+		}
+		return  newList ;
+	}
+
+	/**
+	 * 每天23点自动拾取能量
+	 *
+	 */
+	@PostMapping("/pickup")
+	public void pickup(String ids,String time,String identification) {
+		String[] split = ids.split(",");
+		String strArrays = "";
+		for (int i = 0; i < split.length; i++) {
+			strArrays += "'" + split[i] + "',";
+		}
+		String code = strArrays.substring(0, strArrays.length() - 1);
+		energyService.updateEnergyType(code,time);
+		//能量树
+		String nums = energyTreeService.selectNum(identification);
+		Integer a=Integer.valueOf(nums);
+		int length = split.length;
+		int i = a + length;
+		String num=String.valueOf(i);
+		energyTreeService.updateEnergyTreeId(num,identification);
+	}
+
+}
diff --git a/src/main/java/org/springblade/modules/energy/controller/EnergyTreeController.java b/src/main/java/org/springblade/modules/energy/controller/EnergyTreeController.java
new file mode 100644
index 0000000..95eff6a
--- /dev/null
+++ b/src/main/java/org/springblade/modules/energy/controller/EnergyTreeController.java
@@ -0,0 +1,125 @@
+/*
+ *      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.energy.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.energy.entity.Energy;
+import org.springblade.modules.energy.entity.EnergyTree;
+import org.springblade.modules.energy.service.IEnergyService;
+import org.springblade.modules.energy.service.IEnergyTreeService;
+import org.springblade.modules.energy.vo.EnergyTreeVO;
+import org.springblade.modules.energy.vo.EnergyVO;
+import org.springblade.modules.energy.wrapper.EnergyTreeWrapper;
+import org.springblade.modules.energy.wrapper.EnergyWrapper;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ *  控制器
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/energyTree")
+@Api(value = "", tags = "接口")
+public class EnergyTreeController extends BladeController {
+
+	private final IEnergyTreeService energyTreeService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入dj")
+	public R<EnergyTreeVO> detail(EnergyTree energyTree) {
+		EnergyTree detail = energyTreeService.getOne(Condition.getQueryWrapper(energyTree));
+		return R.data(EnergyTreeWrapper.build().entityVO(detail));
+	}
+
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入dj")
+	public R<IPage<EnergyTreeVO>> list(EnergyTree energyTree, Query query) {
+		IPage<EnergyTree> pages = energyTreeService.page(Condition.getPage(query), Condition.getQueryWrapper(energyTree));
+		return R.data(EnergyTreeWrapper.build().pageVO(pages));
+	}
+
+
+	/**
+	 * 新增
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入dj")
+	public R save(@Valid @RequestBody EnergyTree energyTree) {
+		return R.status(energyTreeService.save(energyTree));
+	}
+
+	/**
+	 * 修改
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入dj")
+	public R update(@Valid @RequestBody EnergyTree energyTree) {
+		return R.status(energyTreeService.updateById(energyTree));
+	}
+
+	/**
+	 * 新增或修改
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入dj")
+	public R submit(@Valid @RequestBody EnergyTree energyTree) {
+		return R.status(energyTreeService.saveOrUpdate(energyTree));
+	}
+
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(energyTreeService.removeByIds(Func.toLongList(ids)));
+	}
+
+}
diff --git a/src/main/java/org/springblade/modules/energy/entity/Energy.java b/src/main/java/org/springblade/modules/energy/entity/Energy.java
new file mode 100644
index 0000000..cf981c2
--- /dev/null
+++ b/src/main/java/org/springblade/modules/energy/entity/Energy.java
@@ -0,0 +1,53 @@
+/*
+ *      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.energy.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+@Data
+@TableName("sys_energy")
+@ApiModel(value = "Dj对象", description = "Dj对象")
+public class Energy implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+
+	@TableId(value = "id", type = IdType.AUTO)
+	private Integer id;
+	private String identification;
+	@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	private Date time;
+	private String type;
+
+
+}
diff --git a/src/main/java/org/springblade/modules/energy/entity/EnergyTree.java b/src/main/java/org/springblade/modules/energy/entity/EnergyTree.java
new file mode 100644
index 0000000..8cb4879
--- /dev/null
+++ b/src/main/java/org/springblade/modules/energy/entity/EnergyTree.java
@@ -0,0 +1,50 @@
+/*
+ *      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.energy.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+@Data
+@TableName("sys_energy")
+@ApiModel(value = "Dj对象", description = "Dj对象")
+public class EnergyTree implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+
+	@TableId(value = "id", type = IdType.AUTO)
+	private Integer id;
+	private String identification;
+	private String num;
+
+
+}
diff --git a/src/main/java/org/springblade/modules/energy/mapper/EnergyMapper.java b/src/main/java/org/springblade/modules/energy/mapper/EnergyMapper.java
new file mode 100644
index 0000000..97afe6e
--- /dev/null
+++ b/src/main/java/org/springblade/modules/energy/mapper/EnergyMapper.java
@@ -0,0 +1,40 @@
+/*
+ *      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.energy.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.modules.dj.entity.Dj;
+import org.springblade.modules.dj.vo.DjVO;
+import org.springblade.modules.energy.entity.Energy;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+public interface EnergyMapper extends BaseMapper<Energy> {
+	List<String> selectTreeNum(String time);
+	List<String> selectEnergyTree(String identification);
+	void  updateEnergyId(String id);
+	void  updateEnergyType(String code,String time);
+	String selectType(String time);
+}
diff --git a/src/main/java/org/springblade/modules/energy/mapper/EnergyMapper.xml b/src/main/java/org/springblade/modules/energy/mapper/EnergyMapper.xml
new file mode 100644
index 0000000..c2821ff
--- /dev/null
+++ b/src/main/java/org/springblade/modules/energy/mapper/EnergyMapper.xml
@@ -0,0 +1,37 @@
+<?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.energy.mapper.EnergyMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="EnergyResultMap" type="org.springblade.modules.energy.entity.Energy">
+        <id column="id" property="id"/>
+        <result column="identification" property="identification"/>
+        <result column="time" property="time"/>
+        <result column="type" property="type"/>
+    </resultMap>
+
+
+    <select id="selectTreeNum" resultType="java.util.HashMap">
+        SELECT *  FROM `sys_energy` WHERE time=#{time} and type=1
+    </select>
+
+    <update id="updateEnergyId">
+        UPDATE sys_energy SET
+            type = 0 WHERE id = #{id}
+    </update>
+
+    <select id="selectType" resultType="java.lang.String">
+        select GROUP_CONCAT(id) as ids from sys_energy WHERE type=1 and time=#{time};
+    </select>
+
+    <update id="updateEnergyType">
+        UPDATE sys_energy SET
+            type = 0 WHERE id in(${code}) and time=#{time}
+    </update>
+
+    <select id="selectEnergyTree" resultType="java.util.HashMap">
+        SELECT *  FROM `sys_energytree` where identification=#{identification}
+    </select>
+
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/energy/mapper/EnergyTreeMapper.java b/src/main/java/org/springblade/modules/energy/mapper/EnergyTreeMapper.java
new file mode 100644
index 0000000..43e7e05
--- /dev/null
+++ b/src/main/java/org/springblade/modules/energy/mapper/EnergyTreeMapper.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.energy.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springblade.modules.energy.entity.Energy;
+import org.springblade.modules.energy.entity.EnergyTree;
+
+import java.util.List;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+public interface EnergyTreeMapper extends BaseMapper<EnergyTree> {
+	String selectNum(String identification);
+	void updateEnergyTreeId(String num,String identification);
+}
diff --git a/src/main/java/org/springblade/modules/energy/mapper/EnergyTreeMapper.xml b/src/main/java/org/springblade/modules/energy/mapper/EnergyTreeMapper.xml
new file mode 100644
index 0000000..86df6ac
--- /dev/null
+++ b/src/main/java/org/springblade/modules/energy/mapper/EnergyTreeMapper.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.energy.mapper.EnergyTreeMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="EnergyTreeResultMap" type="org.springblade.modules.energy.entity.EnergyTree">
+        <id column="id" property="id"/>
+        <result column="identification" property="identification"/>
+        <result column="num" property="num"/>
+    </resultMap>
+
+
+    <select id="selectNum" resultType="java.lang.String">
+        SELECT num FROM sys_energytree where  identification=#{identification}
+    </select>
+
+
+    <update id="updateEnergyTreeId">
+        UPDATE sys_energytree SET
+            num =#{num} WHERE identification = #{identification}
+    </update>
+
+</mapper>
diff --git a/src/main/java/org/springblade/modules/energy/service/IEnergyService.java b/src/main/java/org/springblade/modules/energy/service/IEnergyService.java
new file mode 100644
index 0000000..f145d6f
--- /dev/null
+++ b/src/main/java/org/springblade/modules/energy/service/IEnergyService.java
@@ -0,0 +1,40 @@
+/*
+ *      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.energy.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.modules.dj.entity.Dj;
+import org.springblade.modules.dj.vo.DjVO;
+import org.springblade.modules.energy.entity.Energy;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+public interface IEnergyService extends IService<Energy> {
+	List<String> selectTreeNum(String time);
+	void  updateEnergyId(String id);
+	void  updateEnergyType(String code,String time);
+	String selectType(String time);
+	List<String> selectEnergyTree(String identification);
+}
diff --git a/src/main/java/org/springblade/modules/energy/service/IEnergyTreeService.java b/src/main/java/org/springblade/modules/energy/service/IEnergyTreeService.java
new file mode 100644
index 0000000..3c7b37a
--- /dev/null
+++ b/src/main/java/org/springblade/modules/energy/service/IEnergyTreeService.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.energy.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.modules.energy.entity.Energy;
+import org.springblade.modules.energy.entity.EnergyTree;
+
+import java.util.List;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+public interface IEnergyTreeService extends IService<EnergyTree> {
+	String selectNum(String identification);
+	void updateEnergyTreeId(String num,String identification);
+}
diff --git a/src/main/java/org/springblade/modules/energy/service/impl/EnergyServiceImpl.java b/src/main/java/org/springblade/modules/energy/service/impl/EnergyServiceImpl.java
new file mode 100644
index 0000000..84f2be7
--- /dev/null
+++ b/src/main/java/org/springblade/modules/energy/service/impl/EnergyServiceImpl.java
@@ -0,0 +1,69 @@
+/*
+ *      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.energy.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.modules.dj.entity.Dj;
+import org.springblade.modules.dj.mapper.DjMapper;
+import org.springblade.modules.dj.service.IDjService;
+import org.springblade.modules.dj.vo.DjVO;
+import org.springblade.modules.energy.entity.Energy;
+import org.springblade.modules.energy.mapper.EnergyMapper;
+import org.springblade.modules.energy.service.IEnergyService;
+import org.springblade.modules.energy.vo.EnergyVO;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+@Service
+
+public class EnergyServiceImpl extends ServiceImpl<EnergyMapper, Energy> implements IEnergyService {
+
+	@Override
+	public List<String> selectTreeNum(String time) {
+		return baseMapper.selectTreeNum(time);
+	}
+
+	@Override
+	public void updateEnergyId(String id) {
+		baseMapper.updateEnergyId(id);
+	}
+
+	@Override
+	public void updateEnergyType(String code,String time) {
+		baseMapper.updateEnergyType(code,time);
+	}
+
+	@Override
+	public String selectType(String time) {
+		return baseMapper.selectType(time);
+	}
+
+	@Override
+	public List<String> selectEnergyTree(String identification) {
+		return baseMapper.selectEnergyTree(identification);
+	}
+}
diff --git a/src/main/java/org/springblade/modules/energy/service/impl/EnergyTreeServiceImpl.java b/src/main/java/org/springblade/modules/energy/service/impl/EnergyTreeServiceImpl.java
new file mode 100644
index 0000000..40ead70
--- /dev/null
+++ b/src/main/java/org/springblade/modules/energy/service/impl/EnergyTreeServiceImpl.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.energy.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.modules.energy.entity.Energy;
+import org.springblade.modules.energy.entity.EnergyTree;
+import org.springblade.modules.energy.mapper.EnergyMapper;
+import org.springblade.modules.energy.mapper.EnergyTreeMapper;
+import org.springblade.modules.energy.service.IEnergyService;
+import org.springblade.modules.energy.service.IEnergyTreeService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+@Service
+
+public class EnergyTreeServiceImpl extends ServiceImpl<EnergyTreeMapper, EnergyTree> implements IEnergyTreeService {
+
+	@Override
+	public String selectNum(String identification) {
+		return baseMapper.selectNum(identification);
+	}
+
+	@Override
+	public void updateEnergyTreeId(String num, String identification) {
+		baseMapper.updateEnergyTreeId(num, identification);
+	}
+}
diff --git a/src/main/java/org/springblade/modules/energy/vo/EnergyTreeVO.java b/src/main/java/org/springblade/modules/energy/vo/EnergyTreeVO.java
new file mode 100644
index 0000000..3699cb9
--- /dev/null
+++ b/src/main/java/org/springblade/modules/energy/vo/EnergyTreeVO.java
@@ -0,0 +1,37 @@
+/*
+ *      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.energy.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.energy.entity.Energy;
+import org.springblade.modules.energy.entity.EnergyTree;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "EnergyTree对象", description = "EnergyTree对象")
+public class EnergyTreeVO extends EnergyTree {
+	private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/energy/vo/EnergyVO.java b/src/main/java/org/springblade/modules/energy/vo/EnergyVO.java
new file mode 100644
index 0000000..b899b7a
--- /dev/null
+++ b/src/main/java/org/springblade/modules/energy/vo/EnergyVO.java
@@ -0,0 +1,37 @@
+/*
+ *      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.energy.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.dj.entity.Dj;
+import org.springblade.modules.energy.entity.Energy;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "Energy对象", description = "Energy对象")
+public class EnergyVO extends Energy {
+	private static final long serialVersionUID = 1L;
+
+}
diff --git a/src/main/java/org/springblade/modules/energy/wrapper/EnergyTreeWrapper.java b/src/main/java/org/springblade/modules/energy/wrapper/EnergyTreeWrapper.java
new file mode 100644
index 0000000..b729a96
--- /dev/null
+++ b/src/main/java/org/springblade/modules/energy/wrapper/EnergyTreeWrapper.java
@@ -0,0 +1,46 @@
+/*
+ *      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.energy.wrapper;
+
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.modules.energy.entity.Energy;
+import org.springblade.modules.energy.entity.EnergyTree;
+import org.springblade.modules.energy.vo.EnergyTreeVO;
+import org.springblade.modules.energy.vo.EnergyVO;
+
+import java.util.Objects;
+
+/**
+ * 包装类,返回视图层所需的字段
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+public class EnergyTreeWrapper extends BaseEntityWrapper<EnergyTree, EnergyTreeVO> {
+
+	public static EnergyTreeWrapper build() {
+		return new EnergyTreeWrapper();
+ 	}
+
+	@Override
+	public EnergyTreeVO entityVO(EnergyTree energyTree) {
+		EnergyTreeVO energyTreeVO = Objects.requireNonNull(BeanUtil.copy(energyTree, EnergyTreeVO.class));
+		return energyTreeVO;
+	}
+
+}
diff --git a/src/main/java/org/springblade/modules/energy/wrapper/EnergyWrapper.java b/src/main/java/org/springblade/modules/energy/wrapper/EnergyWrapper.java
new file mode 100644
index 0000000..8feece3
--- /dev/null
+++ b/src/main/java/org/springblade/modules/energy/wrapper/EnergyWrapper.java
@@ -0,0 +1,46 @@
+/*
+ *      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.energy.wrapper;
+
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.modules.dj.entity.Dj;
+import org.springblade.modules.dj.vo.DjVO;
+import org.springblade.modules.energy.entity.Energy;
+import org.springblade.modules.energy.vo.EnergyVO;
+
+import java.util.Objects;
+
+/**
+ * 包装类,返回视图层所需的字段
+ *
+ * @author BladeX
+ * @since 2020-07-19
+ */
+public class EnergyWrapper extends BaseEntityWrapper<Energy, EnergyVO> {
+
+	public static EnergyWrapper build() {
+		return new EnergyWrapper();
+ 	}
+
+	@Override
+	public EnergyVO entityVO(Energy energy) {
+		EnergyVO energyVO = Objects.requireNonNull(BeanUtil.copy(energy, EnergyVO.class));
+		return energyVO;
+	}
+
+}

--
Gitblit v1.9.3