first commit

This commit is contained in:
wangqiy 2025-04-15 17:57:16 +08:00
commit dfdae52bb1
1227 changed files with 140478 additions and 0 deletions

51
.gitignore vendored Normal file
View File

@ -0,0 +1,51 @@
######################################################################
# Build Tools
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
target/
!.mvn/wrapper/maven-wrapper.jar
######################################################################
# IDE
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### JRebel ###
rebel.xml
### NetBeans ###
nbproject/private/
build/*
nbbuild/
dist/
nbdist/
.nb-gradle/
######################################################################
# Others
*.log
*.xml.versionsBackup
*.swp
!*/build/*.java
!*/build/*.html
!*/build/*.xml
.DS_Store
**/.DS_Store
.DS_Store?

20
LICENSE Normal file
View File

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2018 RuoYi
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1
README.md Normal file
View File

@ -0,0 +1 @@
文档地址https://zosoftware.yuque.com/org-wiki-zosoftware-ms7q4x/frog

123
base-admin/pom.xml Normal file
View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>smart-agri-cloud</artifactId>
<groupId>com.agri</groupId>
<version>3.8.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>base-admin</artifactId>
<description>
web服务入口
</description>
<dependencies>
<!-- spring-boot-devtools -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 表示依赖不会传递 -->
</dependency>
<!-- swagger3-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
</dependency>
<!-- 防止进入swagger页面报类型转换错误排除3.0.0中的引用手动增加1.6.2版本 -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.6.2</version>
</dependency>
<!-- Mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- 核心模块-->
<dependency>
<groupId>com.agri</groupId>
<artifactId>base-framework</artifactId>
</dependency>
<!-- 定时任务-->
<dependency>
<groupId>com.agri</groupId>
<artifactId>base-quartz</artifactId>
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>com.agri</groupId>
<artifactId>base-generator</artifactId>
</dependency>
<!-- 物联网-->
<dependency>
<groupId>com.agri</groupId>
<artifactId>base-iot</artifactId>
</dependency>
<dependency>
<groupId>com.agri</groupId>
<artifactId>base-view</artifactId>
</dependency>
<dependency>
<groupId>com.agri</groupId>
<artifactId>base-sip-server</artifactId>
</dependency>
<dependency>
<groupId>com.agri</groupId>
<artifactId>base-agriculture</artifactId>
<version>${frog.version}</version>
</dependency>
<dependency>
<groupId>com.agri</groupId>
<artifactId>base-trace</artifactId>
<version>${frog.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.1.RELEASE</version>
<configuration>
<fork>true</fork> <!-- 如果没有该配置devtools不会生效 -->
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.artifactId}</warName>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
</project>

View File

@ -0,0 +1,36 @@
package com.agri;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.data.repository.init.ResourceReader;
import org.springframework.scheduling.annotation.EnableScheduling;
import java.io.*;
/**
* 启动程序
*
* @author ruoyi
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@EnableScheduling
public class AdminApplication
{
public static void main(String[] args)
{
SpringApplication.run(AdminApplication.class, args);
InputStream inputStream = ResourceReader.class.getClassLoader().getResourceAsStream("logo.txt");
//打印启动成功logo
if (inputStream != null) {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

View File

@ -0,0 +1,18 @@
package com.agri;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/**
* web容器中进行部署
*
* @author ruoyi
*/
public class AdminServletInitializer extends SpringBootServletInitializer
{
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
{
return application.sources(AdminApplication.class);
}
}

View File

@ -0,0 +1,93 @@
package com.agri.web.controller.common;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import com.agri.common.config.RuoYiConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.google.code.kaptcha.Producer;
import com.agri.common.constant.Constants;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.core.redis.RedisCache;
import com.agri.common.utils.sign.Base64;
import com.agri.common.utils.uuid.IdUtils;
import com.agri.system.service.ISysConfigService;
/**
* 验证码操作处理
*
* @author ruoyi
*/
@RestController
public class CaptchaController
{
@Resource(name = "captchaProducer")
private Producer captchaProducer;
@Resource(name = "captchaProducerMath")
private Producer captchaProducerMath;
@Autowired
private RedisCache redisCache;
@Autowired
private ISysConfigService configService;
/**
* 生成验证码
*/
@GetMapping("/captchaImage")
public AjaxResult getCode(HttpServletResponse response) throws IOException
{
AjaxResult ajax = AjaxResult.success();
boolean captchaOnOff = configService.selectCaptchaOnOff();
ajax.put("captchaOnOff", captchaOnOff);
if (!captchaOnOff)
{
return ajax;
}
// 保存验证码信息
String uuid = IdUtils.simpleUUID();
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
String capStr = null, code = null;
BufferedImage image = null;
// 生成验证码
String captchaType = RuoYiConfig.getCaptchaType();
if ("math".equals(captchaType))
{
String capText = captchaProducerMath.createText();
capStr = capText.substring(0, capText.lastIndexOf("@"));
code = capText.substring(capText.lastIndexOf("@") + 1);
image = captchaProducerMath.createImage(capStr);
}
else if ("char".equals(captchaType))
{
capStr = code = captchaProducer.createText();
image = captchaProducer.createImage(capStr);
}
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
// 转换流信息写出
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
try
{
ImageIO.write(image, "jpg", os);
}
catch (IOException e)
{
return AjaxResult.error(e.getMessage());
}
ajax.put("uuid", uuid);
ajax.put("img", Base64.encode(os.toByteArray()));
return ajax;
}
}

View File

@ -0,0 +1,118 @@
package com.agri.web.controller.common;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.agri.common.config.RuoYiConfig;
import com.agri.common.constant.Constants;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.utils.StringUtils;
import com.agri.common.utils.file.FileUploadUtils;
import com.agri.common.utils.file.FileUtils;
import com.agri.framework.config.ServerConfig;
/**
* 通用请求处理
*
* @author ruoyi
*/
@RestController
public class CommonController
{
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
@Autowired
private ServerConfig serverConfig;
/**
* 通用下载请求
*
* @param fileName 文件名称
* @param delete 是否删除
*/
@GetMapping("common/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
{
try
{
if (!FileUtils.checkAllowDownload(fileName))
{
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
}
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
String filePath = RuoYiConfig.getDownloadPath() + fileName;
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, realFileName);
FileUtils.writeBytes(filePath, response.getOutputStream());
if (delete)
{
FileUtils.deleteFile(filePath);
}
}
catch (Exception e)
{
log.error("下载文件失败", e);
}
}
/**
* 通用上传请求
*/
@PostMapping("/common/upload")
public AjaxResult uploadFile(MultipartFile file) throws Exception
{
try
{
// 上传文件路径
String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;
AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName);
ajax.put("url", url);
return ajax;
}
catch (Exception e)
{
return AjaxResult.error(e.getMessage());
}
}
/**
* 本地资源通用下载
*/
@GetMapping("/common/download/resource")
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
throws Exception
{
try
{
if (!FileUtils.checkAllowDownload(resource))
{
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
}
// 本地资源路径
String localPath = RuoYiConfig.getProfile();
// 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
// 下载名称
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, downloadName);
FileUtils.writeBytes(downloadPath, response.getOutputStream());
}
catch (Exception e)
{
log.error("下载文件失败", e);
}
}
}

View File

@ -0,0 +1,53 @@
package com.agri.web.controller.monitor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.utils.StringUtils;
/**
* 缓存监控
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/cache")
public class CacheController
{
@Autowired
private RedisTemplate<String, String> redisTemplate;
@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping()
public AjaxResult getInfo() throws Exception
{
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
Map<String, Object> result = new HashMap<>(3);
result.put("info", info);
result.put("dbSize", dbSize);
List<Map<String, String>> pieList = new ArrayList<>();
commandStats.stringPropertyNames().forEach(key -> {
Map<String, String> data = new HashMap<>(2);
String property = commandStats.getProperty(key);
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
pieList.add(data);
});
result.put("commandStats", pieList);
return AjaxResult.success(result);
}
}

View File

@ -0,0 +1,27 @@
package com.agri.web.controller.monitor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.framework.web.domain.Server;
/**
* 服务器监控
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/server")
public class ServerController
{
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
@GetMapping()
public AjaxResult getInfo() throws Exception
{
Server server = new Server();
server.copyTo();
return AjaxResult.success(server);
}
}

View File

@ -0,0 +1,69 @@
package com.agri.web.controller.monitor;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.core.page.TableDataInfo;
import com.agri.common.enums.BusinessType;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.system.domain.SysLogininfor;
import com.agri.system.service.ISysLogininforService;
/**
* 系统访问记录
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/logininfor")
public class SysLogininforController extends BaseController
{
@Autowired
private ISysLogininforService logininforService;
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
@GetMapping("/list")
public TableDataInfo list(SysLogininfor logininfor)
{
startPage();
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list);
}
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysLogininfor logininfor)
{
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
util.exportExcel(response, list, "登录日志");
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{infoIds}")
public AjaxResult remove(@PathVariable Long[] infoIds)
{
return toAjax(logininforService.deleteLogininforByIds(infoIds));
}
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
@DeleteMapping("/clean")
public AjaxResult clean()
{
logininforService.cleanLogininfor();
return AjaxResult.success();
}
}

View File

@ -0,0 +1,69 @@
package com.agri.web.controller.monitor;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.core.page.TableDataInfo;
import com.agri.common.enums.BusinessType;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.system.domain.SysOperLog;
import com.agri.system.service.ISysOperLogService;
/**
* 操作日志记录
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/operlog")
public class SysOperlogController extends BaseController
{
@Autowired
private ISysOperLogService operLogService;
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
@GetMapping("/list")
public TableDataInfo list(SysOperLog operLog)
{
startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list);
}
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysOperLog operLog)
{
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
util.exportExcel(response, list, "操作日志");
}
@Log(title = "操作日志", businessType = BusinessType.DELETE)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/{operIds}")
public AjaxResult remove(@PathVariable Long[] operIds)
{
return toAjax(operLogService.deleteOperLogByIds(operIds));
}
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
@DeleteMapping("/clean")
public AjaxResult clean()
{
operLogService.cleanOperLog();
return AjaxResult.success();
}
}

View File

@ -0,0 +1,92 @@
package com.agri.web.controller.monitor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.constant.Constants;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.core.domain.model.LoginUser;
import com.agri.common.core.page.TableDataInfo;
import com.agri.common.core.redis.RedisCache;
import com.agri.common.enums.BusinessType;
import com.agri.common.utils.StringUtils;
import com.agri.system.domain.SysUserOnline;
import com.agri.system.service.ISysUserOnlineService;
/**
* 在线用户监控
*
* @author ruoyi
*/
@RestController
@RequestMapping("/monitor/online")
public class SysUserOnlineController extends BaseController
{
@Autowired
private ISysUserOnlineService userOnlineService;
@Autowired
private RedisCache redisCache;
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
@GetMapping("/list")
public TableDataInfo list(String ipaddr, String userName)
{
Collection<String> keys = redisCache.keys(Constants.LOGIN_TOKEN_KEY + "*");
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
for (String key : keys)
{
LoginUser user = redisCache.getCacheObject(key);
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
{
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))
{
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
}
}
else if (StringUtils.isNotEmpty(ipaddr))
{
if (StringUtils.equals(ipaddr, user.getIpaddr()))
{
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
}
}
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
{
if (StringUtils.equals(userName, user.getUsername()))
{
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
}
}
else
{
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
}
}
Collections.reverse(userOnlineList);
userOnlineList.removeAll(Collections.singleton(null));
return getDataTable(userOnlineList);
}
/**
* 强退用户
*/
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@DeleteMapping("/{tokenId}")
public AjaxResult forceLogout(@PathVariable String tokenId)
{
redisCache.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId);
return AjaxResult.success();
}
}

View File

@ -0,0 +1,118 @@
package com.agri.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.system.domain.SysAppUpgrade;
import com.agri.system.service.ISysAppUpgradeService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* App升级Controller
*
* @author nealtsiao
* @date 2023-08-23
*/
@RestController
@RequestMapping("/system/upgrade")
public class SysAppUpgradeController extends BaseController
{
@Autowired
private ISysAppUpgradeService sysAppUpgradeService;
/**
* 查询App升级列表
*/
@PreAuthorize("@ss.hasPermi('agriculture:upgrade:list')")
@GetMapping("/list")
public TableDataInfo list(SysAppUpgrade sysAppUpgrade)
{
startPage();
List<SysAppUpgrade> list = sysAppUpgradeService.selectExtUpgradeList(sysAppUpgrade);
return getDataTable(list);
}
/**
* 导出App升级列表
*/
@PreAuthorize("@ss.hasPermi('agriculture:upgrade:export')")
@Log(title = "App升级", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SysAppUpgrade sysAppUpgrade)
{
List<SysAppUpgrade> list = sysAppUpgradeService.selectExtUpgradeList(sysAppUpgrade);
ExcelUtil<SysAppUpgrade> util = new ExcelUtil<SysAppUpgrade>(SysAppUpgrade.class);
util.exportExcel(response, list, "App升级数据");
}
/**
* 获取App升级详细信息
*/
@PreAuthorize("@ss.hasPermi('agriculture:upgrade:query')")
@GetMapping(value = "/{recordId}")
public AjaxResult getInfo(@PathVariable("recordId") Long recordId)
{
return AjaxResult.success(sysAppUpgradeService.selectExtUpgradeByRecordId(recordId));
}
/**
* 新增App升级
*/
@PreAuthorize("@ss.hasPermi('agriculture:upgrade:add')")
@Log(title = "App升级", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysAppUpgrade sysAppUpgrade)
{
return toAjax(sysAppUpgradeService.insertExtUpgrade(sysAppUpgrade));
}
/**
* 修改App升级
*/
@PreAuthorize("@ss.hasPermi('agriculture:upgrade:edit')")
@Log(title = "App升级", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysAppUpgrade sysAppUpgrade)
{
return toAjax(sysAppUpgradeService.updateExtUpgrade(sysAppUpgrade));
}
/**
* 删除App升级
*/
@PreAuthorize("@ss.hasPermi('agriculture:upgrade:remove')")
@Log(title = "App升级", businessType = BusinessType.DELETE)
@DeleteMapping("/{recordIds}")
public AjaxResult remove(@PathVariable Long[] recordIds)
{
return toAjax(sysAppUpgradeService.deleteExtUpgradeByRecordIds(recordIds));
}
/**
* 手机端升级使用
* @param sysAppUpgrade
* @return
*/
@GetMapping("/mobile/list")
public TableDataInfo mobileList(SysAppUpgrade sysAppUpgrade)
{
startPage();
List<SysAppUpgrade> list = sysAppUpgradeService.selectExtUpgradeList(sysAppUpgrade);
return getDataTable(list);
}
}

View File

@ -0,0 +1,134 @@
package com.agri.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.constant.UserConstants;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.core.page.TableDataInfo;
import com.agri.common.enums.BusinessType;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.system.domain.SysConfig;
import com.agri.system.service.ISysConfigService;
/**
* 参数配置 信息操作处理
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/config")
public class SysConfigController extends BaseController
{
@Autowired
private ISysConfigService configService;
/**
* 获取参数配置列表
*/
@PreAuthorize("@ss.hasPermi('system:config:list')")
@GetMapping("/list")
public TableDataInfo list(SysConfig config)
{
startPage();
List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list);
}
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:config:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysConfig config)
{
List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
util.exportExcel(response, list, "参数数据");
}
/**
* 根据参数编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:config:query')")
@GetMapping(value = "/{configId}")
public AjaxResult getInfo(@PathVariable Long configId)
{
return AjaxResult.success(configService.selectConfigById(configId));
}
/**
* 根据参数键名查询参数值
*/
@GetMapping(value = "/configKey/{configKey}")
public AjaxResult getConfigKey(@PathVariable String configKey)
{
return AjaxResult.success(configService.selectConfigByKey(configKey));
}
/**
* 新增参数配置
*/
@PreAuthorize("@ss.hasPermi('system:config:add')")
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysConfig config)
{
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
{
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setCreateBy(getUsername());
return toAjax(configService.insertConfig(config));
}
/**
* 修改参数配置
*/
@PreAuthorize("@ss.hasPermi('system:config:edit')")
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysConfig config)
{
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
{
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setUpdateBy(getUsername());
return toAjax(configService.updateConfig(config));
}
/**
* 删除参数配置
*/
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}")
public AjaxResult remove(@PathVariable Long[] configIds)
{
configService.deleteConfigByIds(configIds);
return success();
}
/**
* 刷新参数缓存
*/
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public AjaxResult refreshCache()
{
configService.resetConfigCache();
return AjaxResult.success();
}
}

View File

@ -0,0 +1,163 @@
package com.agri.web.controller.system;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.constant.UserConstants;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.core.domain.entity.SysDept;
import com.agri.common.enums.BusinessType;
import com.agri.common.utils.StringUtils;
import com.agri.system.service.ISysDeptService;
/**
* 部门信息
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/dept")
public class SysDeptController extends BaseController
{
@Autowired
private ISysDeptService deptService;
/**
* 获取部门列表
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list")
public AjaxResult list(SysDept dept)
{
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(depts);
}
/**
* 查询部门列表排除节点
*/
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list/exclude/{deptId}")
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
{
List<SysDept> depts = deptService.selectDeptList(new SysDept());
Iterator<SysDept> it = depts.iterator();
while (it.hasNext())
{
SysDept d = (SysDept) it.next();
if (d.getDeptId().intValue() == deptId
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
{
it.remove();
}
}
return AjaxResult.success(depts);
}
/**
* 根据部门编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:dept:query')")
@GetMapping(value = "/{deptId}")
public AjaxResult getInfo(@PathVariable Long deptId)
{
deptService.checkDeptDataScope(deptId);
return AjaxResult.success(deptService.selectDeptById(deptId));
}
/**
* 获取部门下拉树列表
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(SysDept dept)
{
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
}
/**
* 加载对应角色部门列表树
*/
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId)
{
List<SysDept> depts = deptService.selectDeptList(new SysDept());
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
ajax.put("depts", deptService.buildDeptTreeSelect(depts));
return ajax;
}
/**
* 新增部门
*/
@PreAuthorize("@ss.hasPermi('system:dept:add')")
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDept dept)
{
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
{
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
dept.setCreateBy(getUsername());
return toAjax(deptService.insertDept(dept));
}
/**
* 修改部门
*/
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDept dept)
{
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
{
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
else if (dept.getParentId().equals(dept.getDeptId()))
{
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
}
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
{
return AjaxResult.error("该部门包含未停用的子部门!");
}
dept.setUpdateBy(getUsername());
return toAjax(deptService.updateDept(dept));
}
/**
* 删除部门
*/
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{deptId}")
public AjaxResult remove(@PathVariable Long deptId)
{
if (deptService.hasChildByDeptId(deptId))
{
return AjaxResult.error("存在下级部门,不允许删除");
}
if (deptService.checkDeptExistUser(deptId))
{
return AjaxResult.error("部门存在用户,不允许删除");
}
return toAjax(deptService.deleteDeptById(deptId));
}
}

View File

@ -0,0 +1,121 @@
package com.agri.web.controller.system;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.core.domain.entity.SysDictData;
import com.agri.common.core.page.TableDataInfo;
import com.agri.common.enums.BusinessType;
import com.agri.common.utils.StringUtils;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.system.service.ISysDictDataService;
import com.agri.system.service.ISysDictTypeService;
/**
* 数据字典信息
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/dict/data")
public class SysDictDataController extends BaseController
{
@Autowired
private ISysDictDataService dictDataService;
@Autowired
private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list")
public TableDataInfo list(SysDictData dictData)
{
startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list);
}
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysDictData dictData)
{
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
util.exportExcel(response, list, "字典数据");
}
/**
* 查询字典数据详细
*/
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictCode}")
public AjaxResult getInfo(@PathVariable Long dictCode)
{
return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
}
/**
* 根据字典类型查询字典数据信息
*/
@GetMapping(value = "/type/{dictType}")
public AjaxResult dictType(@PathVariable String dictType)
{
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data))
{
data = new ArrayList<SysDictData>();
}
return AjaxResult.success(data);
}
/**
* 新增字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictData dict)
{
dict.setCreateBy(getUsername());
return toAjax(dictDataService.insertDictData(dict));
}
/**
* 修改保存字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
{
dict.setUpdateBy(getUsername());
return toAjax(dictDataService.updateDictData(dict));
}
/**
* 删除字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictCodes}")
public AjaxResult remove(@PathVariable Long[] dictCodes)
{
dictDataService.deleteDictDataByIds(dictCodes);
return success();
}
}

View File

@ -0,0 +1,132 @@
package com.agri.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.constant.UserConstants;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.core.domain.entity.SysDictType;
import com.agri.common.core.page.TableDataInfo;
import com.agri.common.enums.BusinessType;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.system.service.ISysDictTypeService;
/**
* 数据字典信息
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/dict/type")
public class SysDictTypeController extends BaseController
{
@Autowired
private ISysDictTypeService dictTypeService;
@PreAuthorize("@ss.hasPermi('system:dict:list')")
@GetMapping("/list")
public TableDataInfo list(SysDictType dictType)
{
startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list);
}
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:dict:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysDictType dictType)
{
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
util.exportExcel(response, list, "字典类型");
}
/**
* 查询字典类型详细
*/
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictId}")
public AjaxResult getInfo(@PathVariable Long dictId)
{
return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
}
/**
* 新增字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:add')")
@Log(title = "字典类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictType dict)
{
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
{
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setCreateBy(getUsername());
return toAjax(dictTypeService.insertDictType(dict));
}
/**
* 修改字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
{
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
{
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setUpdateBy(getUsername());
return toAjax(dictTypeService.updateDictType(dict));
}
/**
* 删除字典类型
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictIds}")
public AjaxResult remove(@PathVariable Long[] dictIds)
{
dictTypeService.deleteDictTypeByIds(dictIds);
return success();
}
/**
* 刷新字典缓存
*/
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public AjaxResult refreshCache()
{
dictTypeService.resetDictCache();
return AjaxResult.success();
}
/**
* 获取字典选择框列表
*/
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
return AjaxResult.success(dictTypes);
}
}

View File

@ -0,0 +1,29 @@
package com.agri.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.config.RuoYiConfig;
import com.agri.common.utils.StringUtils;
/**
* 首页
*
* @author ruoyi
*/
@RestController
public class SysIndexController
{
/** 系统基础配置 */
@Autowired
private RuoYiConfig ruoyiConfig;
/**
* 访问首页提示语
*/
@RequestMapping("/")
public String index()
{
return StringUtils.format("欢迎使用{}后台管理框架当前版本v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion());
}
}

View File

@ -0,0 +1,86 @@
package com.agri.web.controller.system;
import java.util.List;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.constant.Constants;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.core.domain.entity.SysMenu;
import com.agri.common.core.domain.entity.SysUser;
import com.agri.common.core.domain.model.LoginBody;
import com.agri.common.utils.SecurityUtils;
import com.agri.framework.web.service.SysLoginService;
import com.agri.framework.web.service.SysPermissionService;
import com.agri.system.service.ISysMenuService;
/**
* 登录验证
*
* @author ruoyi
*/
@RestController
public class SysLoginController
{
@Autowired
private SysLoginService loginService;
@Autowired
private ISysMenuService menuService;
@Autowired
private SysPermissionService permissionService;
/**
* 登录方法
*
* @param loginBody 登录信息
* @return 结果
*/
@PostMapping("/login")
public AjaxResult login(@RequestBody LoginBody loginBody)
{
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
loginBody.getUuid());
ajax.put(Constants.TOKEN, token);
return ajax;
}
/**
* 获取用户信息
*
* @return 用户信息
*/
@GetMapping("getInfo")
public AjaxResult getInfo()
{
SysUser user = SecurityUtils.getLoginUser().getUser();
// 角色集合
Set<String> roles = permissionService.getRolePermission(user);
// 权限集合
Set<String> permissions = permissionService.getMenuPermission(user);
AjaxResult ajax = AjaxResult.success();
ajax.put("user", user);
ajax.put("roles", roles);
ajax.put("permissions", permissions);
return ajax;
}
/**
* 获取路由信息
*
* @return 路由信息
*/
@GetMapping("getRouters")
public AjaxResult getRouters()
{
Long userId = SecurityUtils.getUserId();
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
return AjaxResult.success(menuService.buildMenus(menus));
}
}

View File

@ -0,0 +1,142 @@
package com.agri.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.constant.UserConstants;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.core.domain.entity.SysMenu;
import com.agri.common.enums.BusinessType;
import com.agri.common.utils.StringUtils;
import com.agri.system.service.ISysMenuService;
/**
* 菜单信息
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/menu")
public class SysMenuController extends BaseController
{
@Autowired
private ISysMenuService menuService;
/**
* 获取菜单列表
*/
@PreAuthorize("@ss.hasPermi('system:menu:list')")
@GetMapping("/list")
public AjaxResult list(SysMenu menu)
{
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return AjaxResult.success(menus);
}
/**
* 根据菜单编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:menu:query')")
@GetMapping(value = "/{menuId}")
public AjaxResult getInfo(@PathVariable Long menuId)
{
return AjaxResult.success(menuService.selectMenuById(menuId));
}
/**
* 获取菜单下拉树列表
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(SysMenu menu)
{
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
}
/**
* 加载对应角色菜单列表树
*/
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
{
List<SysMenu> menus = menuService.selectMenuList(getUserId());
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
return ajax;
}
/**
* 新增菜单
*/
@PreAuthorize("@ss.hasPermi('system:menu:add')")
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysMenu menu)
{
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
{
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
}
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
{
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
}
menu.setCreateBy(getUsername());
return toAjax(menuService.insertMenu(menu));
}
/**
* 修改菜单
*/
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysMenu menu)
{
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
{
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
}
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
{
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
}
else if (menu.getMenuId().equals(menu.getParentId()))
{
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
}
menu.setUpdateBy(getUsername());
return toAjax(menuService.updateMenu(menu));
}
/**
* 删除菜单
*/
@PreAuthorize("@ss.hasPermi('system:menu:remove')")
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{menuId}")
public AjaxResult remove(@PathVariable("menuId") Long menuId)
{
if (menuService.hasChildByMenuId(menuId))
{
return AjaxResult.error("存在子菜单,不允许删除");
}
if (menuService.checkMenuExistRole(menuId))
{
return AjaxResult.error("菜单已分配,不允许删除");
}
return toAjax(menuService.deleteMenuById(menuId));
}
}

View File

@ -0,0 +1,91 @@
package com.agri.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.core.page.TableDataInfo;
import com.agri.common.enums.BusinessType;
import com.agri.system.domain.SysNotice;
import com.agri.system.service.ISysNoticeService;
/**
* 公告 信息操作处理
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/notice")
public class SysNoticeController extends BaseController
{
@Autowired
private ISysNoticeService noticeService;
/**
* 获取通知公告列表
*/
@PreAuthorize("@ss.hasPermi('system:notice:list')")
@GetMapping("/list")
public TableDataInfo list(SysNotice notice)
{
startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice);
return getDataTable(list);
}
/**
* 根据通知公告编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:notice:query')")
@GetMapping(value = "/{noticeId}")
public AjaxResult getInfo(@PathVariable Long noticeId)
{
return AjaxResult.success(noticeService.selectNoticeById(noticeId));
}
/**
* 新增通知公告
*/
@PreAuthorize("@ss.hasPermi('system:notice:add')")
@Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysNotice notice)
{
notice.setCreateBy(getUsername());
return toAjax(noticeService.insertNotice(notice));
}
/**
* 修改通知公告
*/
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysNotice notice)
{
notice.setUpdateBy(getUsername());
return toAjax(noticeService.updateNotice(notice));
}
/**
* 删除通知公告
*/
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
@Log(title = "通知公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeIds}")
public AjaxResult remove(@PathVariable Long[] noticeIds)
{
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
}
}

View File

@ -0,0 +1,130 @@
package com.agri.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.constant.UserConstants;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.core.page.TableDataInfo;
import com.agri.common.enums.BusinessType;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.system.domain.SysPost;
import com.agri.system.service.ISysPostService;
/**
* 岗位信息操作处理
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/post")
public class SysPostController extends BaseController
{
@Autowired
private ISysPostService postService;
/**
* 获取岗位列表
*/
@PreAuthorize("@ss.hasPermi('system:post:list')")
@GetMapping("/list")
public TableDataInfo list(SysPost post)
{
startPage();
List<SysPost> list = postService.selectPostList(post);
return getDataTable(list);
}
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:post:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysPost post)
{
List<SysPost> list = postService.selectPostList(post);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
util.exportExcel(response, list, "岗位数据");
}
/**
* 根据岗位编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:post:query')")
@GetMapping(value = "/{postId}")
public AjaxResult getInfo(@PathVariable Long postId)
{
return AjaxResult.success(postService.selectPostById(postId));
}
/**
* 新增岗位
*/
@PreAuthorize("@ss.hasPermi('system:post:add')")
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysPost post)
{
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
{
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
}
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
{
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setCreateBy(getUsername());
return toAjax(postService.insertPost(post));
}
/**
* 修改岗位
*/
@PreAuthorize("@ss.hasPermi('system:post:edit')")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysPost post)
{
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
{
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
}
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
{
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setUpdateBy(getUsername());
return toAjax(postService.updatePost(post));
}
/**
* 删除岗位
*/
@PreAuthorize("@ss.hasPermi('system:post:remove')")
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{postIds}")
public AjaxResult remove(@PathVariable Long[] postIds)
{
return toAjax(postService.deletePostByIds(postIds));
}
/**
* 获取岗位选择框列表
*/
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
List<SysPost> posts = postService.selectPostAll();
return AjaxResult.success(posts);
}
}

View File

@ -0,0 +1,140 @@
package com.agri.web.controller.system;
import com.agri.common.annotation.Log;
import com.agri.common.config.RuoYiConfig;
import com.agri.common.constant.UserConstants;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.core.domain.entity.SysUser;
import com.agri.common.core.domain.model.LoginUser;
import com.agri.common.enums.BusinessType;
import com.agri.common.utils.SecurityUtils;
import com.agri.common.utils.StringUtils;
import com.agri.common.utils.file.FileUploadUtils;
import com.agri.framework.web.service.TokenService;
import com.agri.iot.service.IUserSocialProfileService;
import com.agri.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
/**
* 个人信息 业务处理
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/user/profile")
public class SysProfileController extends BaseController {
@Autowired
private ISysUserService userService;
@Autowired
private TokenService tokenService;
@Autowired
private IUserSocialProfileService iUserSocialProfileService;
/**
* 个人信息
*/
@GetMapping
public AjaxResult profile() {
LoginUser loginUser = getLoginUser();
SysUser user = loginUser.getUser();
AjaxResult ajax = AjaxResult.success(user);
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
ajax.put("socialGroup", iUserSocialProfileService.selectUserSocialProfile(loginUser.getUserId()));
return ajax;
}
/**
* 修改用户
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult updateProfile(@RequestBody SysUser user)
{
LoginUser loginUser = getLoginUser();
SysUser sysUser = loginUser.getUser();
user.setUserName(sysUser.getUserName());
if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
{
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
}
if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
{
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setUserId(sysUser.getUserId());
user.setPassword(null);
if (userService.updateUserProfile(user) > 0)
{
// 更新缓存用户信息
sysUser.setNickName(user.getNickName());
sysUser.setPhonenumber(user.getPhonenumber());
sysUser.setEmail(user.getEmail());
sysUser.setSex(user.getSex());
tokenService.setLoginUser(loginUser);
return AjaxResult.success();
}
return AjaxResult.error("修改个人信息异常,请联系管理员");
}
/**
* 重置密码
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping("/updatePwd")
public AjaxResult updatePwd(String oldPassword, String newPassword)
{
LoginUser loginUser = getLoginUser();
String userName = loginUser.getUsername();
String password = loginUser.getPassword();
if (!SecurityUtils.matchesPassword(oldPassword, password))
{
return AjaxResult.error("修改密码失败,旧密码错误");
}
if (SecurityUtils.matchesPassword(newPassword, password))
{
return AjaxResult.error("新密码不能与旧密码相同");
}
if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
{
// 更新缓存用户密码
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
tokenService.setLoginUser(loginUser);
return AjaxResult.success();
}
return AjaxResult.error("修改密码异常,请联系管理员");
}
/**
* 头像上传
*/
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
@PostMapping("/avatar")
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws IOException
{
if (!file.isEmpty())
{
LoginUser loginUser = getLoginUser();
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
{
AjaxResult ajax = AjaxResult.success();
ajax.put("imgUrl", avatar);
// 更新缓存用户头像
loginUser.getUser().setAvatar(avatar);
tokenService.setLoginUser(loginUser);
return ajax;
}
}
return AjaxResult.error("上传图片异常,请联系管理员");
}
}

View File

@ -0,0 +1,38 @@
package com.agri.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.core.domain.model.RegisterBody;
import com.agri.common.utils.StringUtils;
import com.agri.framework.web.service.SysRegisterService;
import com.agri.system.service.ISysConfigService;
/**
* 注册验证
*
* @author ruoyi
*/
@RestController
public class SysRegisterController extends BaseController
{
@Autowired
private SysRegisterService registerService;
@Autowired
private ISysConfigService configService;
@PostMapping("/register")
public AjaxResult register(@RequestBody RegisterBody user)
{
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
{
return error("当前系统没有开启注册功能!");
}
String msg = registerService.register(user);
return StringUtils.isEmpty(msg) ? success() : error(msg);
}
}

View File

@ -0,0 +1,241 @@
package com.agri.web.controller.system;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.constant.UserConstants;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.core.domain.entity.SysRole;
import com.agri.common.core.domain.entity.SysUser;
import com.agri.common.core.domain.model.LoginUser;
import com.agri.common.core.page.TableDataInfo;
import com.agri.common.enums.BusinessType;
import com.agri.common.utils.StringUtils;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.framework.web.service.SysPermissionService;
import com.agri.framework.web.service.TokenService;
import com.agri.system.domain.SysUserRole;
import com.agri.system.service.ISysRoleService;
import com.agri.system.service.ISysUserService;
/**
* 角色信息
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/role")
public class SysRoleController extends BaseController
{
@Autowired
private ISysRoleService roleService;
@Autowired
private TokenService tokenService;
@Autowired
private SysPermissionService permissionService;
@Autowired
private ISysUserService userService;
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/list")
public TableDataInfo list(SysRole role)
{
startPage();
List<SysRole> list = roleService.selectRoleList(role);
return getDataTable(list);
}
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:role:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysRole role)
{
List<SysRole> list = roleService.selectRoleList(role);
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
util.exportExcel(response, list, "角色数据");
}
/**
* 根据角色编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping(value = "/{roleId}")
public AjaxResult getInfo(@PathVariable Long roleId)
{
roleService.checkRoleDataScope(roleId);
return AjaxResult.success(roleService.selectRoleById(roleId));
}
/**
* 新增角色
*/
@PreAuthorize("@ss.hasPermi('system:role:add')")
@Log(title = "角色管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysRole role)
{
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
{
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
}
else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
{
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setCreateBy(getUsername());
return toAjax(roleService.insertRole(role));
}
/**
* 修改保存角色
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysRole role)
{
roleService.checkRoleAllowed(role);
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
{
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
}
else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
{
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setUpdateBy(getUsername());
if (roleService.updateRole(role) > 0)
{
// 更新缓存用户权限
LoginUser loginUser = getLoginUser();
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
{
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
tokenService.setLoginUser(loginUser);
}
return AjaxResult.success();
}
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
}
/**
* 修改保存数据权限
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/dataScope")
public AjaxResult dataScope(@RequestBody SysRole role)
{
roleService.checkRoleAllowed(role);
return toAjax(roleService.authDataScope(role));
}
/**
* 状态修改
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysRole role)
{
roleService.checkRoleAllowed(role);
role.setUpdateBy(getUsername());
return toAjax(roleService.updateRoleStatus(role));
}
/**
* 删除角色
*/
@PreAuthorize("@ss.hasPermi('system:role:remove')")
@Log(title = "角色管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{roleIds}")
public AjaxResult remove(@PathVariable Long[] roleIds)
{
return toAjax(roleService.deleteRoleByIds(roleIds));
}
/**
* 获取角色选择框列表
*/
@PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping("/optionselect")
public AjaxResult optionselect()
{
return AjaxResult.success(roleService.selectRoleAll());
}
/**
* 查询已分配用户角色列表
*/
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/authUser/allocatedList")
public TableDataInfo allocatedList(SysUser user)
{
startPage();
List<SysUser> list = userService.selectAllocatedList(user);
return getDataTable(list);
}
/**
* 查询未分配用户角色列表
*/
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/authUser/unallocatedList")
public TableDataInfo unallocatedList(SysUser user)
{
startPage();
List<SysUser> list = userService.selectUnallocatedList(user);
return getDataTable(list);
}
/**
* 取消授权用户
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancel")
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
{
return toAjax(roleService.deleteAuthUser(userRole));
}
/**
* 批量取消授权用户
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancelAll")
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
{
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
}
/**
* 批量选择用户授权
*/
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "角色管理", businessType = BusinessType.GRANT)
@PutMapping("/authUser/selectAll")
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
{
return toAjax(roleService.insertAuthUsers(roleId, userIds));
}
}

View File

@ -0,0 +1,239 @@
package com.agri.web.controller.system;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.agri.common.annotation.Log;
import com.agri.common.constant.UserConstants;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.core.domain.entity.SysRole;
import com.agri.common.core.domain.entity.SysUser;
import com.agri.common.core.page.TableDataInfo;
import com.agri.common.enums.BusinessType;
import com.agri.common.utils.SecurityUtils;
import com.agri.common.utils.StringUtils;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.system.service.ISysPostService;
import com.agri.system.service.ISysRoleService;
import com.agri.system.service.ISysUserService;
/**
* 用户信息
*
* @author ruoyi
*/
@RestController
@RequestMapping("/system/user")
public class SysUserController extends BaseController
{
@Autowired
private ISysUserService userService;
@Autowired
private ISysRoleService roleService;
@Autowired
private ISysPostService postService;
/**
* 获取用户列表
*/
@PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/list")
public TableDataInfo list(SysUser user)
{
startPage();
List<SysUser> list = userService.selectUserList(user);
return getDataTable(list);
}
@GetMapping("/baseUserList")
public AjaxResult baseUserList()
{
List<SysUser> list = userService.selectBaseUserList();
return AjaxResult.success(list);
}
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:user:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, SysUser user)
{
List<SysUser> list = userService.selectUserList(user);
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
util.exportExcel(response, list, "用户数据");
}
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('system:user:import')")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
{
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
List<SysUser> userList = util.importExcel(file.getInputStream());
String operName = getUsername();
String message = userService.importUser(userList, updateSupport, operName);
return AjaxResult.success(message);
}
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response)
{
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
util.importTemplateExcel(response, "用户数据");
}
/**
* 根据用户编号获取详细信息
*/
@PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping(value = { "/", "/{userId}" })
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
{
userService.checkUserDataScope(userId);
AjaxResult ajax = AjaxResult.success();
List<SysRole> roles = roleService.selectRoleAll();
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
ajax.put("posts", postService.selectPostAll());
if (StringUtils.isNotNull(userId))
{
ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId));
ajax.put("postIds", postService.selectPostListByUserId(userId));
ajax.put("roleIds", roleService.selectRoleListByUserId(userId));
}
return ajax;
}
/**
* 新增用户
*/
@PreAuthorize("@ss.hasPermi('system:user:add')")
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysUser user)
{
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName())))
{
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
}
else if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
{
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
}
else if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
{
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setCreateBy(getUsername());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
return toAjax(userService.insertUser(user));
}
/**
* 修改用户
*/
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysUser user)
{
userService.checkUserAllowed(user);
if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
{
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
}
else if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
{
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setUpdateBy(getUsername());
return toAjax(userService.updateUser(user));
}
/**
* 删除用户
*/
@PreAuthorize("@ss.hasPermi('system:user:remove')")
@Log(title = "用户管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}")
public AjaxResult remove(@PathVariable Long[] userIds)
{
if (ArrayUtils.contains(userIds, getUserId()))
{
return error("当前用户不能删除");
}
return toAjax(userService.deleteUserByIds(userIds));
}
/**
* 重置密码
*/
@PreAuthorize("@ss.hasPermi('system:user:resetPwd')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/resetPwd")
public AjaxResult resetPwd(@RequestBody SysUser user)
{
userService.checkUserAllowed(user);
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
user.setUpdateBy(getUsername());
return toAjax(userService.resetPwd(user));
}
/**
* 状态修改
*/
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysUser user)
{
userService.checkUserAllowed(user);
user.setUpdateBy(getUsername());
return toAjax(userService.updateUserStatus(user));
}
/**
* 根据用户编号获取授权角色
*/
@PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping("/authRole/{userId}")
public AjaxResult authRole(@PathVariable("userId") Long userId)
{
AjaxResult ajax = AjaxResult.success();
SysUser user = userService.selectUserById(userId);
List<SysRole> roles = roleService.selectRolesByUserId(userId);
ajax.put("user", user);
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
return ajax;
}
/**
* 用户授权角色
*/
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "用户管理", businessType = BusinessType.GRANT)
@PutMapping("/authRole")
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
{
userService.insertUserAuth(userId, roleIds);
return success();
}
}

View File

@ -0,0 +1,24 @@
package com.agri.web.controller.tool;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.agri.common.core.controller.BaseController;
/**
* swagger 接口
*
* @author ruoyi
*/
@Controller
@RequestMapping("/tool/swagger")
public class SwaggerController extends BaseController
{
@PreAuthorize("@ss.hasPermi('tool:swagger:view')")
@GetMapping()
public String index()
{
return redirect("/swagger-ui.html");
}
}

View File

@ -0,0 +1,174 @@
package com.agri.web.controller.tool;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
/**
* swagger 用户测试方法
*
* @author ruoyi
*/
@RestController
@RequestMapping("/test/user")
public class TestController extends BaseController
{
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
{
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
}
@GetMapping("/list")
public AjaxResult userList()
{
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
return AjaxResult.success(userList);
}
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@GetMapping("/{userId}")
public AjaxResult getUser(@PathVariable Integer userId)
{
if (!users.isEmpty() && users.containsKey(userId))
{
return AjaxResult.success(users.get(userId));
}
else
{
return error("用户不存在");
}
}
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
})
@PostMapping("/save")
public AjaxResult save(UserEntity user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
return error("用户ID不能为空");
}
return AjaxResult.success(users.put(user.getUserId(), user));
}
@PutMapping("/update")
public AjaxResult update(@RequestBody UserEntity user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
return error("用户ID不能为空");
}
if (users.isEmpty() || !users.containsKey(user.getUserId()))
{
return error("用户不存在");
}
users.remove(user.getUserId());
return AjaxResult.success(users.put(user.getUserId(), user));
}
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@DeleteMapping("/{userId}")
public AjaxResult delete(@PathVariable Integer userId)
{
if (!users.isEmpty() && users.containsKey(userId))
{
users.remove(userId);
return success();
}
else
{
return error("用户不存在");
}
}
}
class UserEntity
{
@ApiModelProperty("用户ID")
private Integer userId;
@ApiModelProperty("用户名称")
private String username;
@ApiModelProperty("用户密码")
private String password;
@ApiModelProperty("用户手机")
private String mobile;
public UserEntity()
{
}
public UserEntity(Integer userId, String username, String password, String mobile)
{
this.userId = userId;
this.username = username;
this.password = password;
this.mobile = mobile;
}
public Integer getUserId()
{
return userId;
}
public void setUserId(Integer userId)
{
this.userId = userId;
}
public String getUsername()
{
return username;
}
public void setUsername(String username)
{
this.username = username;
}
public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
public String getMobile()
{
return mobile;
}
public void setMobile(String mobile)
{
this.mobile = mobile;
}
}

View File

@ -0,0 +1,125 @@
package com.agri.web.core.config;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.agri.common.config.RuoYiConfig;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey;
import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.Contact;
import springfox.documentation.service.SecurityReference;
import springfox.documentation.service.SecurityScheme;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
/**
* Swagger2的接口配置
*
* @author ruoyi
*/
@Configuration
public class SwaggerConfig
{
/** 系统基础配置 */
@Autowired
private RuoYiConfig ruoyiConfig;
/** 是否开启swagger */
@Value("${swagger.enabled}")
private boolean enabled;
/** 设置请求的统一前缀 */
@Value("${swagger.pathMapping}")
private String pathMapping;
/**
* 创建API
*/
@Bean
public Docket createRestApi()
{
return new Docket(DocumentationType.OAS_30)
// 是否启用Swagger
.enable(enabled)
// 用来创建该API的基本信息展示在文档的页面中自定义展示的信息
.apiInfo(apiInfo())
// 设置哪些接口暴露给Swagger展示
.select()
// 扫描所有有注解的api用这种方式更灵活
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
// 扫描指定包中的swagger注解
// .apis(RequestHandlerSelectors.basePackage("com.agri.project.tool.swagger"))
// 扫描所有 .apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
/* 设置安全模式swagger可以设置访问token */
.securitySchemes(securitySchemes())
.securityContexts(securityContexts())
.pathMapping(pathMapping);
}
/**
* 安全模式这里指定token通过Authorization头请求头传递
*/
private List<SecurityScheme> securitySchemes()
{
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue()));
return apiKeyList;
}
/**
* 安全上下文
*/
private List<SecurityContext> securityContexts()
{
List<SecurityContext> securityContexts = new ArrayList<>();
securityContexts.add(
SecurityContext.builder()
.securityReferences(defaultAuth())
.operationSelector(o -> o.requestMappingPattern().matches("/.*"))
.build());
return securityContexts;
}
/**
* 默认的安全上引用
*/
private List<SecurityReference> defaultAuth()
{
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
List<SecurityReference> securityReferences = new ArrayList<>();
securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
return securityReferences;
}
/**
* 添加摘要信息
*/
private ApiInfo apiInfo()
{
// 用ApiInfoBuilder进行定制
return new ApiInfoBuilder()
// 设置标题
.title("标题frog接口文档")
// 描述
.description("描述:青蛙农业")
// 作者信息
.contact(new Contact(ruoyiConfig.getName(), null, null))
// 版本
.version("版本号:" + ruoyiConfig.getVersion())
.build();
}
}

View File

@ -0,0 +1,69 @@
Manifest-Version: 1.0
Main-Class: com.agri.AdminApplication
Class-Path: javax.servlet-api-4.0.1.jar okhttp-3.14.9.jar thymeleaf-extr
as-java8time-3.0.4.RELEASE.jar jna-5.9.0.jar jackson-datatype-jdk8-2.12
.5.jar slf4j-api-1.7.32.jar jackson-annotations-2.12.5.jar spring-boot-
starter-jdbc-2.5.6.jar spring-core-5.3.12.jar spring-tx-5.3.12.jar erro
r_prone_annotations-2.5.1.jar springfox-oas-3.0.0.jar jjwt-0.9.1.jar sp
ringfox-core-3.0.0.jar springfox-data-rest-3.0.0.jar UserAgentUtils-1.2
1.jar spring-boot-starter-data-redis-2.5.6.jar swagger-models-2.1.2.jar
mysql-connector-java-8.0.27.jar commons-math3-3.6.1.jar spring-plugin-
core-2.0.0.RELEASE.jar failureaccess-1.0.1.jar lettuce-core-6.1.5.RELEA
SE.jar jackson-core-2.12.5.jar JustAuth-1.16.5.jar mybatis-spring-boot-
starter-2.2.0.jar SparseBitSet-1.2.jar reactor-core-3.4.11.jar springfo
x-spring-web-3.0.0.jar snakeyaml-1.28.jar commons-collections-3.2.2.jar
commons-compress-1.19.jar spring-data-keyvalue-2.5.6.jar log4j-to-slf4
j-2.14.1.jar xmlbeans-3.1.0.jar tomcat-embed-websocket-9.0.54.jar sprin
g-data-redis-2.5.6.jar spring-jcl-5.3.12.jar jakarta.validation-api-2.0
.2.jar mybatis-3.5.7.jar swagger-models-1.6.2.jar httpmime-4.5.13.jar s
pring-aop-5.3.12.jar reactive-streams-1.0.3.jar tomcat-embed-core-9.0.5
4.jar netty-handler-4.1.69.Final.jar netty-common-4.1.69.Final.jar oshi
-core-5.8.2.jar spring-boot-starter-tomcat-2.5.6.jar netty-resolver-4.1
.69.Final.jar simple-http-1.0.5.jar commons-lang3-3.12.0.jar jain-sip-r
i-1.3.0-91.jar protobuf-java-3.14.0.jar transmittable-thread-local-2.14
.0.jar attoparser-2.0.5.RELEASE.jar spring-webmvc-5.3.12.jar netty-code
c-4.1.69.Final.jar thymeleaf-3.0.12.RELEASE.jar velocity-engine-core-2.
3.jar springfox-swagger-ui-3.0.0.jar jboss-logging-3.4.2.Final.jar spri
ng-oxm-5.3.12.jar guava-30.1.1-jre.jar pagehelper-spring-boot-autoconfi
gure-1.4.0.jar springfox-spring-webmvc-3.0.0.jar pagehelper-5.3.0.jar H
ikariCP-4.0.3.jar spring-security-crypto-5.5.3.jar org.eclipse.paho.cli
ent.mqttv3-1.2.5.jar commons-collections4-4.4.jar curvesapi-1.06.jar fo
rest-core-1.5.19.jar logback-core-1.2.6.jar poi-ooxml-4.1.2.jar spring-
boot-starter-thymeleaf-2.5.6.jar forest-spring-boot-starter-1.5.19.jar
log4j-api-2.14.1.jar spring-boot-starter-validation-2.5.6.jar lombok-1.
18.22.jar commons-codec-1.15.jar spring-boot-configuration-processor-2.
5.6.jar byte-buddy-1.10.22.jar hibernate-validator-6.2.0.Final.jar jack
son-databind-2.12.5.jar spring-expression-5.3.12.jar spring-data-common
s-2.5.6.jar springfox-boot-starter-3.0.0.jar juniversalchardet-1.0.3.ja
r poi-ooxml-schemas-4.1.2.jar springfox-swagger-common-3.0.0.jar spring
-web-5.3.12.jar spring-boot-devtools-2.5.6.jar poi-4.1.2.jar classgraph
-4.8.83.jar jackson-datatype-jsr310-2.12.5.jar commons-pool2-2.9.0.jar
spring-security-web-5.5.3.jar springfox-swagger2-3.0.0.jar com.springso
urce.org.apache.log4j-1.2.16.jar spring-plugin-metadata-2.0.0.RELEASE.j
ar j2objc-annotations-1.3.jar spring-boot-starter-aop-2.5.6.jar aspectj
weaver-1.9.7.jar kaptcha-2.3.2.jar mybatis-spring-boot-autoconfigure-2.
2.0.jar netty-transport-4.1.69.Final.jar httpcore-4.4.14.jar httpclient
-4.5.13.jar spring-context-5.3.12.jar spring-boot-starter-web-2.5.6.jar
commons-fileupload-1.4.jar jsqlparser-4.2.jar mybatis-spring-2.0.6.jar
spring-boot-starter-logging-2.5.6.jar listenablefuture-9999.0-empty-to
-avoid-conflict-with-guava.jar mchange-commons-java-0.2.15.jar checker-
qual-3.8.0.jar spring-security-config-5.5.3.jar druid-1.2.8.jar jul-to-
slf4j-1.7.32.jar unbescape-1.1.6.RELEASE.jar taos-jdbcdriver-2.0.38.jar
spring-boot-starter-security-2.5.6.jar spring-jdbc-5.3.12.jar javax.ac
tivation-api-1.2.0.jar classmate-1.5.1.jar druid-spring-boot-starter-1.
2.8.jar jakarta.annotation-api-1.3.5.jar thymeleaf-spring5-3.0.12.RELEA
SE.jar spring-boot-starter-json-2.5.6.jar commons-io-2.11.0.jar spring-
boot-autoconfigure-2.5.6.jar Java-WebSocket-1.5.2.jar springfox-spi-3.0
.0.jar mapstruct-1.3.1.Final.jar spring-beans-5.3.12.jar swagger-annota
tions-1.6.2.jar spring-boot-starter-2.5.6.jar logback-classic-1.2.6.jar
commons-text-1.6.jar jna-platform-5.9.0.jar jaxb-api-2.3.1.jar commons
-logging-1.2.jar jsr305-3.0.1.jar fastjson-1.2.78.jar spring-security-o
auth2-2.5.1.RELEASE.jar httpclient-cache-4.5.13.jar dom4j-2.1.3.jar spr
ing-context-support-5.3.12.jar springfox-schema-3.0.0.jar jackson-modul
e-parameter-names-2.12.5.jar forest-spring-1.5.19.jar springfox-spring-
webflux-3.0.0.jar netty-buffer-4.1.69.Final.jar quartz-2.3.2.jar spring
fox-bean-validators-3.0.0.jar spring-boot-2.5.6.jar swagger-annotations
-2.1.2.jar tomcat-embed-el-9.0.54.jar pagehelper-spring-boot-starter-1.
4.0.jar spring-security-core-5.5.3.jar okio-1.17.2.jar filters-2.0.235-
1.jar

View File

@ -0,0 +1 @@
restart.include.json=/com.alibaba.fastjson.*.jar

View File

@ -0,0 +1,228 @@
# 项目相关配置
ruoyi:
# 名称
name: admin
# 版本
version: 2.1.2
# 版权年份
copyrightYear: 2028
# 实例演示开关
demoEnabled: true
# 文件路径以uploadPath结尾 示例( Windows配置 D:/uploadPathLinux配置 /uploadPath, Mac /Users/xxx
profile: F:/agri/uploadPath
# 获取ip地址开关
addressEnabled: true
# 验证码类型 math 数组计算 char 字符验证
captchaType: math
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 8080
servlet:
# 应用的访问路径
context-path: /
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# tomcat最大线程数默认为200
max-threads: 800
# Tomcat启动初始化的线程数默认值25
min-spare-threads: 30
# 日志配置
logging:
level:
com.agri.iot: info
com.agri.agriculture: warn
org.springframework: warn
com.agri.sip: warn
com.agri.system: warn
# Spring配置
spring:
#MVC
mvc:
servlet:
#配置servlet随容器启动
load-on-startup: 1
# 资源信息
messages:
# 国际化资源文件路径
basename: i18n/messages
# 数据库配置
datasource:
druid:
# 主库数据源
master:
url: jdbc:mysql://47.109.205.240:3306/smart-agri-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: sznyb@2025
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# tdengine数据源
tdengine:
enabled: false # 默认不启用TDenginetrue=启用false=不启用
driverClassName: com.taosdata.jdbc.rs.RestfulDriver
url: jdbc:TAOS-RS://localhost:6041?timezone=Asia/Beijing&charset=utf-8
username: root
password: taosdata
dbName: frog_agriculture_log
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: frog
login-password: wumei-smart
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 10MB
# 设置总上传的文件大小
max-request-size: 20MB
# 服务模块
devtools:
restart:
# 热部署开关
enabled: true
# redis 配置
redis:
# 地址
host: 47.109.205.240
# 端口默认为6379
port: 6379
# 数据库索引
database: 2
# 密码
password: tairui_redis
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# mqtt 配置
mqtt:
username: admin # 账号
password: sznyb@2025 # 密码
host-url: tcp://47.109.205.240:1883 # mqtt连接tcp地址
client-id: ${random.int} # 客户端Id不能相同采用随机数 ${random.value}
default-topic: test # 默认主题
timeout: 30 # 超时时间
keepalive: 30 # 保持连接
clearSession: true # 清除会话(设置为false,断开连接,重连后使用原来的会话 保留订阅的主题,能接收离线期间的消息)
# token配置
token:
# 令牌自定义标识
header: Authorization
# 令牌密钥
secret: abcdefghijklfrogrstuvwxyz
# 令牌有效期默认30分钟1440为一天
expireTime: 1440
# MyBatis配置
mybatis:
# 搜索指定包别名
typeAliasesPackage: com.agri.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件
pagehelper:
helperDialect: mysql
supportMethodsArguments: true
params: count=countSql
# Swagger配置
swagger:
# 是否开启swagger
enabled: true
# 请求前缀
pathMapping: /dev-api
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
# sip 配置
sip:
enabled: false # 是否启用视频监控SIPtrue为启用
ip: 192.168.3.186 # 本地运行为局域网IP地址部署公网为公网IP地址
port: 5061 # SIP端口(保持默认)
domain: 3402000000 # 由省级、市级、区级、基层编号组成参照GB/T 2260-2007(可保持默认)
id: 34020000002000000001 # 同上,另外增加编号,(可保持默认)
password: 12345678 # 监控设备接入的密码
monitorTime: 300000 # 5分钟检查一次尽量不要修改这个配置定时任务定时检查摄像头在线情况因为摄像头离线没有消息单位毫秒
# 短信配置
sms:
# 标注从yml读取配置
config-type: yaml
blends:
# 自定义的标识也就是configId这里可以是任意值最好不要是中文
b1:
#厂商标识,标定此配置是哪个厂商,详细请看厂商标识介绍部分
supplier: alibaba
#您的accessKey
access-key-id: LTAI5tKAjCJzH1caVSBhej7T
#您的accessKeySecret
access-key-secret: TBWK9qMy68oUbDaWXTfMslJccybqOs
#您的短信签名
signature: 青蛙农业
#模板ID 非必须配置如果使用sendMessage的快速发送需此配置
template-id: SMS_473805253

View File

@ -0,0 +1,228 @@
# 项目相关配置
ruoyi:
# 名称
name: frog
# 版本
version: 2.1.2
# 版权年份
copyrightYear: 2028
# 实例演示开关
demoEnabled: true
# 文件路径以uploadPath结尾 示例( Windows配置 D:/uploadPathLinux配置 /uploadPath
profile: /uploadPath
# 获取ip地址开关
addressEnabled: true
# 验证码类型 math 数组计算 char 字符验证
captchaType: math
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 8080
servlet:
# 应用的访问路径
context-path: /
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# tomcat最大线程数默认为200
max-threads: 800
# Tomcat启动初始化的线程数默认值25
min-spare-threads: 30
# 日志配置
logging:
level:
com.agri.iot: warn
com.agri.agriculture: warn
org.springframework: warn
com.agri.sip: warn
# Spring配置
spring:
#MVC
mvc:
servlet:
#配置servlet随容器启动
load-on-startup: 1
# 资源信息
messages:
# 国际化资源文件路径
basename: i18n/messages
# 数据库配置
datasource:
druid:
# 主库数据源
master:
url: jdbc:mysql://177.7.0.11:3306/frog_agriculture_tenant?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: frog
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# tdengine数据源
tdengine:
enabled: true # 默认不启用TDenginetrue=启用false=不启用
driverClassName: com.taosdata.jdbc.rs.RestfulDriver
url: jdbc:TAOS-RS://177.7.0.16:6041?timezone=Asia/Beijing&charset=utf-8
username: root
password: taosdata
dbName: frog_agriculture_log
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: frog
login-password: wumei-smart
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 10MB
# 设置总上传的文件大小
max-request-size: 20MB
# 服务模块
devtools:
restart:
# 热部署开关
enabled: true
# redis 配置
redis:
# 地址
host: 177.7.0.10
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
password: frog
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# mqtt 配置
mqtt:
username: frog # 账号
password: frog # 密码
host-url: tcp://emqx:1883 # mqtt连接tcp地址
client-id: ${random.int} # 客户端Id不能相同采用随机数 ${random.value}
default-topic: test # 默认主题
timeout: 30 # 超时时间
keepalive: 30 # 保持连接
clearSession: true # 清除会话(设置为false,断开连接,重连后使用原来的会话 保留订阅的主题,能接收离线期间的消息)
# token配置
token:
# 令牌自定义标识
header: Authorization
# 令牌密钥
secret: abcdefghijklfrogrstuvwxyz
# 令牌有效期默认30分钟1440为一天
expireTime: 1440
# MyBatis配置
mybatis:
# 搜索指定包别名
typeAliasesPackage: com.agri.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件
pagehelper:
helperDialect: mysql
supportMethodsArguments: true
params: count=countSql
# Swagger配置
swagger:
# 是否开启swagger
enabled: true
# 请求前缀
pathMapping: /dev-api
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
# sip 配置
sip:
enabled: true # 是否启用视频监控SIPtrue为启用
ip: 177.7.0.13 # docker容器的IP地址
port: 5061 # SIP端口(保持默认)
domain: 3402000000 # 由省级、市级、区级、基层编号组成参照GB/T 2260-2007(可保持默认)
id: 34020000002000000001 # 同上,另外增加编号,(可保持默认)
password: 12345678 # 监控设备接入的密码
monitorTime: 300000 # 5分钟检查一次尽量不要修改这个配置定时任务定时检查摄像头在线情况因为摄像头离线没有消息单位毫秒
# 短信配置
sms:
# 标注从yml读取配置
config-type: yaml
blends:
# 自定义的标识也就是configId这里可以是任意值最好不要是中文
b1:
#厂商标识,标定此配置是哪个厂商,详细请看厂商标识介绍部分
supplier: alibaba
#您的accessKey
access-key-id: LTAI5tKAjCJzH1caVSBhej7T
#您的accessKeySecret
access-key-secret: TBWK9qMy68oUbDaWXTfMslJccybqOs
#您的短信签名
signature: 盐城零一软件科技
#模板ID 非必须配置如果使用sendMessage的快速发送需此配置
template-id: SMS_473710010

View File

@ -0,0 +1,4 @@
#配置启动环境
spring:
profiles:
active: dev

View File

@ -0,0 +1,2 @@
青蛙农业版本: ${ruoyi.version}
SpringBoot版本: ${spring-boot.version}

View File

@ -0,0 +1,37 @@
#错误消息
not.null=* 必须填写
user.jcaptcha.error=验证码错误
user.jcaptcha.expire=验证码已失效
user.not.exists=用户不存在/密码错误
user.password.not.match=用户不存在/密码错误
user.password.retry.limit.count=密码输入错误{0}次
user.password.retry.limit.exceed=密码输入错误{0}次帐户锁定10分钟
user.password.delete=对不起,您的账号已被删除
user.blocked=用户已封禁,请联系管理员
role.blocked=角色已封禁,请联系管理员
user.logout.success=退出成功
length.not.valid=长度必须在{min}到{max}个字符之间
user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成且必须以非数字开头
user.password.not.valid=* 5-50个字符
user.email.not.valid=邮箱格式错误
user.mobile.phone.number.not.valid=手机号格式错误
user.login.success=登录成功
user.register.success=注册成功
user.notfound=请重新登录
user.forcelogout=管理员强制退出,请重新登录
user.unknown.error=未知错误,请重新登录
##文件上传消息
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB
upload.filename.exceed.length=上传的文件名最长{0}个字符
##权限
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 生产环境路径为/logs-->
<property name="log.path" value="/logs" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>3</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>3</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 用户访问日志输出 -->
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-user.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 按天回滚 daily -->
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>3</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 设置根 logger 的级别 -->
<root level="info">
<appender-ref ref="console" />
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
<!--系统用户操作日志-->
<logger name="sys-user" level="info">
<appender-ref ref="sys-user"/>
</logger>
<!-- 系统模块日志级别控制 -->
<logger name="com.agri" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
</configuration>

View File

@ -0,0 +1,8 @@
=====================================================================
_____ __ __ ._.
_/ ____\______ ____ ____ _______/ |______ ________/ |_ | |
\ __\\_ __ \/ _ \ / ___\ / ___/\ __\__ \\_ __ \ __\ | |
| | | | \( <_> ) /_/ > \___ \ | | / __ \| | \/| | \|
|__| |__| \____/\___ / /____ > |__| (____ /__| |__| __
/_____/ \/ \/ \/
============================frog启动成功===============================

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<!-- 全局参数 -->
<settings>
<!-- 使全局的映射器启用或禁用缓存 -->
<setting name="cacheEnabled" value="true" />
<!-- 允许JDBC 支持自动生成主键 -->
<setting name="useGeneratedKeys" value="true" />
<!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
<setting name="defaultExecutorType" value="SIMPLE" />
<!-- 指定 MyBatis 所用日志的具体实现 -->
<setting name="logImpl" value="SLF4J" />
<!-- 使用驼峰命名法转换字段 -->
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
</settings>
</configuration>

62
base-agriculture/pom.xml Normal file
View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>smart-agri-cloud</artifactId>
<groupId>com.agri</groupId>
<version>3.8.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>base-agriculture</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- 通用工具-->
<dependency>
<groupId>com.agri</groupId>
<artifactId>base-common</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
</dependency>
<dependency>
<groupId>com.agri</groupId>
<artifactId>base-iot</artifactId>
</dependency>
<!-- 生成二维码 -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.agri</groupId>
<artifactId>base-trace</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,149 @@
package com.agri.agriculture.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.Baseinfo;
import com.agri.agriculture.service.IBaseinfoService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 基地信息Controller
*
* @author nealtsiao
* @date 2023-05-13
*/
@Api(tags = "agri-基地信息管理")
@RestController
@RequestMapping("/agriculture/baseinfo")
public class BaseinfoController extends BaseController
{
@Autowired
private IBaseinfoService baseinfoService;
/**
* 查询基地信息列表
*/
@ApiOperation("查询基地信息列表")
@PreAuthorize("@ss.hasPermi('agriculture:baseinfo:list')")
@GetMapping("/list")
public TableDataInfo list(Baseinfo baseinfo)
{
startPage();
List<Baseinfo> list = baseinfoService.selectBaseinfoList(baseinfo);
return getDataTable(list);
}
/**
* 查询基地信息列表
*/
@ApiOperation("根据角色查询基地信息列表")
@GetMapping("/selectBaseinfoListByRoles")
public AjaxResult selectBaseinfoListByRoles(Baseinfo baseinfo)
{
List<Baseinfo> list = baseinfoService.selectBaseinfoListByRoles(baseinfo);
return AjaxResult.success(list);
}
/**
* 查询基地信息列表(table)
*/
@ApiOperation("根据角色查询基地信息列表格包含用户")
@GetMapping("/selectBaseinfoListByRolesForTable")
public TableDataInfo selectBaseinfoListByRolesForTable(Baseinfo baseinfo)
{
startPage();
List<Baseinfo> list = baseinfoService.selectBaseinfoAndUsersListByRoles(baseinfo);
TableDataInfo dataTable = getDataTable(list);
return dataTable;
}
/**
* 导出基地信息列表
*/
@ApiOperation("导出基地信息列表")
@PreAuthorize("@ss.hasPermi('agriculture:baseinfo:export')")
@Log(title = "基地信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Baseinfo baseinfo)
{
List<Baseinfo> list = baseinfoService.selectBaseinfoList(baseinfo);
ExcelUtil<Baseinfo> util = new ExcelUtil<Baseinfo>(Baseinfo.class);
util.exportExcel(response, list, "基地信息数据");
}
/**
* 获取基地信息详细信息
*/
@ApiOperation("获取基地信息详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:baseinfo:query')")
@GetMapping(value = "/{baseId}")
public AjaxResult getInfo(@PathVariable("baseId") Long baseId)
{
return AjaxResult.success(baseinfoService.selectBaseinfoByBaseId(baseId));
}
/*
* 通过部门Id查询基地信息
*/
@ApiOperation("通过部门Id查询基地信息")
@PreAuthorize("@ss.hasPermi('agriculture:baseinfo:query')")
@GetMapping(value = "/getBaseinfoByDeptId/{deptId}")
public AjaxResult getBaseinfoByDeptId(@PathVariable("deptId") Long deptId)
{
return AjaxResult.success(baseinfoService.selectBaseinfoByDeptId(deptId));
}
/**
* 新增基地信息
*/
@ApiOperation("新增基地信息")
@PreAuthorize("@ss.hasPermi('agriculture:baseinfo:add')")
@Log(title = "基地信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Baseinfo baseinfo)
{
return toAjax(baseinfoService.insertBaseinfo(baseinfo));
}
/**
* 修改基地信息
*/
@ApiOperation("修改基地信息")
@PreAuthorize("@ss.hasPermi('agriculture:baseinfo:edit')")
@Log(title = "基地信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Baseinfo baseinfo)
{
return toAjax(baseinfoService.updateBaseinfo(baseinfo));
}
/**
* 删除基地信息
*/
@ApiOperation("删除基地信息")
@PreAuthorize("@ss.hasPermi('agriculture:baseinfo:remove')")
@Log(title = "基地信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{baseIds}")
public AjaxResult remove(@PathVariable Long[] baseIds)
{
return toAjax(baseinfoService.deleteBaseinfoByBaseIds(baseIds));
}
}

View File

@ -0,0 +1,139 @@
package com.agri.agriculture.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.BatchTask;
import com.agri.agriculture.service.IBatchTaskService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 批次任务Controller
*
* @author xuweidong
* @date 2023-05-24
*/
@Api(tags = "agri-任务管理")
@RestController
@RequestMapping("/agriculture/batchTask")
public class BatchTaskController extends BaseController
{
@Autowired
private IBatchTaskService batchTaskService;
/**
* 查询批次任务列表
*/
@ApiOperation("查询批次任务列表")
@PreAuthorize("@ss.hasPermi('agriculture:batchTask:list')")
@GetMapping("/list")
public TableDataInfo list(BatchTask batchTask)
{
startPage();
List<BatchTask> list = batchTaskService.selectBatchTaskList(batchTask);
return getDataTable(list);
}
/**
* 查询自己的批次任务列表
*/
@ApiOperation("查询自己的批次任务列表")
@PreAuthorize("@ss.hasPermi('agriculture:batchTask:list')")
@GetMapping("/listOfMine")
public TableDataInfo listOfMine(BatchTask batchTask)
{
startPage();
List<BatchTask> list = batchTaskService.selectBatchTaskListOfMine(batchTask);
return getDataTable(list);
}
/**
* 导出批次任务列表
*/
@ApiOperation("导出批次任务列表")
@PreAuthorize("@ss.hasPermi('agriculture:batchTask:export')")
@Log(title = "批次任务", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BatchTask batchTask)
{
List<BatchTask> list = batchTaskService.selectBatchTaskList(batchTask);
ExcelUtil<BatchTask> util = new ExcelUtil<BatchTask>(BatchTask.class);
util.exportExcel(response, list, "批次任务数据");
}
/**
* 获取批次任务详细信息
*/
@ApiOperation("获取批次任务详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:batchTask:query')")
@GetMapping(value = "/{taskId}")
public AjaxResult getInfo(@PathVariable("taskId") Long taskId)
{
return AjaxResult.success(batchTaskService.selectBatchTaskByTaskId(taskId));
}
/**
* 新增批次任务
*/
@ApiOperation("新增批次任务")
@PreAuthorize("@ss.hasPermi('agriculture:batchTask:add')")
@Log(title = "批次任务", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BatchTask batchTask)
{
return toAjax(batchTaskService.insertBatchTask(batchTask));
}
/**
* 修改批次任务
*/
@ApiOperation("修改批次任务")
@PreAuthorize("@ss.hasPermi('agriculture:batchTask:edit')")
@Log(title = "批次任务", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BatchTask batchTask)
{
return toAjax(batchTaskService.updateBatchTask(batchTask));
}
/**
* 删除批次任务
*/
@ApiOperation("删除批次任务")
@PreAuthorize("@ss.hasPermi('agriculture:batchTask:remove')")
@Log(title = "批次任务", businessType = BusinessType.DELETE)
@DeleteMapping("/{taskIds}")
public AjaxResult remove(@PathVariable Long[] taskIds)
{
return toAjax(batchTaskService.deleteBatchTaskByTaskIds(taskIds));
}
/**
* 移动端查询批次任务列表
*/
@ApiOperation("移动端查询批次任务列表")
@GetMapping("/mobilelist")
public TableDataInfo mobileList(BatchTask batchTask)
{
startPage();
List<BatchTask> list = batchTaskService.selectBatchTaskListToMobile(batchTask);
return getDataTable(list);
}
}

View File

@ -0,0 +1,114 @@
package com.agri.agriculture.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.CostEmployee;
import com.agri.agriculture.service.ICostEmployeeService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 人工工时Controller
*
* @author xuweidong
* @date 2023-05-24
*/
@Api(tags = "argi-人工工时")
@RestController
@RequestMapping("/agriculture/costEmployee")
public class CostEmployeeController extends BaseController
{
@Autowired
private ICostEmployeeService costEmployeeService;
/**
* 查询人工工时列表
*/
@ApiOperation("查询人工工时列表")
@PreAuthorize("@ss.hasPermi('agriculture:costEmployee:list')")
@GetMapping("/list")
public TableDataInfo list(CostEmployee costEmployee)
{
startPage();
List<CostEmployee> list = costEmployeeService.selectCostEmployeeList(costEmployee);
return getDataTable(list);
}
/**
* 导出人工工时列表
*/
@ApiOperation("导出人工工时列表")
@PreAuthorize("@ss.hasPermi('agriculture:costEmployee:export')")
@Log(title = "人工工时", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CostEmployee costEmployee)
{
List<CostEmployee> list = costEmployeeService.selectCostEmployeeList(costEmployee);
ExcelUtil<CostEmployee> util = new ExcelUtil<CostEmployee>(CostEmployee.class);
util.exportExcel(response, list, "人工工时数据");
}
/**
* 获取人工工时详细信息
*/
@ApiOperation("获取人工工时详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:costEmployee:query')")
@GetMapping(value = "/{costId}")
public AjaxResult getInfo(@PathVariable("costId") Long costId)
{
return AjaxResult.success(costEmployeeService.selectCostEmployeeByCostId(costId));
}
/**
* 新增人工工时
*/
@ApiOperation("新增人工工时")
@PreAuthorize("@ss.hasPermi('agriculture:costEmployee:add')")
@Log(title = "人工工时", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CostEmployee costEmployee)
{
return toAjax(costEmployeeService.insertCostEmployee(costEmployee));
}
/**
* 修改人工工时
*/
@ApiOperation("修改人工工时")
@PreAuthorize("@ss.hasPermi('agriculture:costEmployee:edit')")
@Log(title = "人工工时", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CostEmployee costEmployee)
{
return toAjax(costEmployeeService.updateCostEmployee(costEmployee));
}
/**
* 删除人工工时
*/
@ApiOperation("删除人工工时")
@PreAuthorize("@ss.hasPermi('agriculture:costEmployee:remove')")
@Log(title = "人工工时", businessType = BusinessType.DELETE)
@DeleteMapping("/{costIds}")
public AjaxResult remove(@PathVariable Long[] costIds)
{
return toAjax(costEmployeeService.deleteCostEmployeeByCostIds(costIds));
}
}

View File

@ -0,0 +1,114 @@
package com.agri.agriculture.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.CostMachine;
import com.agri.agriculture.service.ICostMachineService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 机械工时Controller
*
* @author xuweidong
* @date 2023-05-24
*/
@Api(tags = "argi-机械工时")
@RestController
@RequestMapping("/agriculture/costMachine")
public class CostMachineController extends BaseController
{
@Autowired
private ICostMachineService costMachineService;
/**
* 查询机械工时列表
*/
@ApiOperation("查询机械工时列表")
@PreAuthorize("@ss.hasPermi('agriculture:costMachine:list')")
@GetMapping("/list")
public TableDataInfo list(CostMachine costMachine)
{
startPage();
List<CostMachine> list = costMachineService.selectCostMachineList(costMachine);
return getDataTable(list);
}
/**
* 导出机械工时列表
*/
@ApiOperation("导出机械工时列表")
@PreAuthorize("@ss.hasPermi('agriculture:costMachine:export')")
@Log(title = "机械工时", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CostMachine costMachine)
{
List<CostMachine> list = costMachineService.selectCostMachineList(costMachine);
ExcelUtil<CostMachine> util = new ExcelUtil<CostMachine>(CostMachine.class);
util.exportExcel(response, list, "机械工时数据");
}
/**
* 获取机械工时详细信息
*/
@ApiOperation("获取机械工时详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:costMachine:query')")
@GetMapping(value = "/{costId}")
public AjaxResult getInfo(@PathVariable("costId") Long costId)
{
return AjaxResult.success(costMachineService.selectCostMachineByCostId(costId));
}
/**
* 新增机械工时
*/
@ApiOperation("新增机械工时")
@PreAuthorize("@ss.hasPermi('agriculture:costMachine:add')")
@Log(title = "机械工时", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CostMachine costMachine)
{
return toAjax(costMachineService.insertCostMachine(costMachine));
}
/**
* 修改机械工时
*/
@ApiOperation("修改机械工时")
@PreAuthorize("@ss.hasPermi('agriculture:costMachine:edit')")
@Log(title = "机械工时", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CostMachine costMachine)
{
return toAjax(costMachineService.updateCostMachine(costMachine));
}
/**
* 删除机械工时
*/
@ApiOperation("删除机械工时")
@PreAuthorize("@ss.hasPermi('agriculture:costMachine:remove')")
@Log(title = "机械工时", businessType = BusinessType.DELETE)
@DeleteMapping("/{costIds}")
public AjaxResult remove(@PathVariable Long[] costIds)
{
return toAjax(costMachineService.deleteCostMachineByCostIds(costIds));
}
}

View File

@ -0,0 +1,128 @@
package com.agri.agriculture.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.CostMaterial;
import com.agri.agriculture.service.ICostMaterialService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 农资用量Controller
*
* @author xuweidong
* @date 2023-05-24
*/
@Api(tags = "agri-农资用量")
@RestController
@RequestMapping("/agriculture/costMaterial")
public class CostMaterialController extends BaseController
{
@Autowired
private ICostMaterialService costMaterialService;
/**
* 查询农资用量列表
*/
@ApiOperation("查询农资用量列表")
@PreAuthorize("@ss.hasPermi('agriculture:costMaterial:list')")
@GetMapping("/list")
public TableDataInfo list(CostMaterial costMaterial)
{
startPage();
List<CostMaterial> list = costMaterialService.selectCostMaterialList(costMaterial);
return getDataTable(list);
}
/**
* 导出农资用量列表
*/
@ApiOperation("导出农资用量列表")
@PreAuthorize("@ss.hasPermi('agriculture:costMaterial:export')")
@Log(title = "农资用量", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CostMaterial costMaterial)
{
List<CostMaterial> list = costMaterialService.selectCostMaterialList(costMaterial);
ExcelUtil<CostMaterial> util = new ExcelUtil<CostMaterial>(CostMaterial.class);
util.exportExcel(response, list, "农资用量数据");
}
/**
* 获取农资用量详细信息
*/
@ApiOperation("获取农资用量详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:costMaterial:query')")
@GetMapping(value = "/{costId}")
public AjaxResult getInfo(@PathVariable("costId") Long costId)
{
return AjaxResult.success(costMaterialService.selectCostMaterialByCostId(costId));
}
/**
* 新增农资用量
*/
@ApiOperation("新增农资用量")
@PreAuthorize("@ss.hasPermi('agriculture:costMaterial:add')")
@Log(title = "农资用量", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CostMaterial costMaterial)
{
return toAjax(costMaterialService.insertCostMaterial(costMaterial));
}
/**
* 修改农资用量
*/
@ApiOperation("修改农资用量")
@PreAuthorize("@ss.hasPermi('agriculture:costMaterial:edit')")
@Log(title = "农资用量", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CostMaterial costMaterial)
{
return toAjax(costMaterialService.updateCostMaterial(costMaterial));
}
/**
* 删除农资用量
*/
@ApiOperation("删除农资用量")
@PreAuthorize("@ss.hasPermi('agriculture:costMaterial:remove')")
@Log(title = "农资用量", businessType = BusinessType.DELETE)
@DeleteMapping("/{costIds}")
public AjaxResult remove(@PathVariable Long[] costIds)
{
return toAjax(costMaterialService.deleteCostMaterialByCostIds(costIds));
}
/** 手机端接口 **/
/**
* 手机端任务详情界面按照农资名称分组统计用量
* @param taskId
* @return
*/
@ApiOperation("手机端任务详情界面,按照农资名称分组统计用量")
@GetMapping(value = "selectMaterialGroupByMaterialName/{taskId}")
public AjaxResult selectMaterialGroupByMaterialName(@PathVariable("taskId") Long taskId)
{
return AjaxResult.success(costMaterialService.selectMaterialGroupByMaterialName(taskId));
}
}

View File

@ -0,0 +1,144 @@
package com.agri.agriculture.controller;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.agri.common.utils.SecurityUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.CropBatch;
import com.agri.agriculture.service.ICropBatchService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 作物批次Controller
*
* @author nealtsiao
* @date 2023-05-13
*/
@Api(tags = "agri-作物批次")
@RestController
@RequestMapping("/agriculture/batch")
public class CropBatchController extends BaseController
{
@Autowired
private ICropBatchService cropBatchService;
/**
* 查询作物批次列表
*/
@ApiOperation("查询作物批次列表")
@PreAuthorize("@ss.hasPermi('agriculture:batch:list')")
@GetMapping("/list")
public TableDataInfo list(CropBatch cropBatch)
{
startPage();
List<CropBatch> list = cropBatchService.selectCropBatchList(cropBatch);
return getDataTable(list);
}
/**
* 查询自己负责作物批次列表
*/
@ApiOperation("查询自己负责作物批次列表")
@PreAuthorize("@ss.hasPermi('agriculture:batch:list')")
@GetMapping("/listOfMine")
public TableDataInfo listOfMine(CropBatch cropBatch)
{
startPage();
List<CropBatch> list = cropBatchService.selectCropBatchListOfMine(cropBatch);
return getDataTable(list);
}
/**
* 导出作物批次列表
*/
@ApiOperation("导出作物批次列表")
@PreAuthorize("@ss.hasPermi('agriculture:batch:export')")
@Log(title = "作物批次", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CropBatch cropBatch)
{
List<CropBatch> list = cropBatchService.selectCropBatchList(cropBatch);
ExcelUtil<CropBatch> util = new ExcelUtil<CropBatch>(CropBatch.class);
util.exportExcel(response, list, "作物批次数据");
}
/**
* 获取作物批次详细信息
*/
@ApiOperation("获取作物批次详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:batch:query')")
@GetMapping(value = "/{batchId}")
public AjaxResult getInfo(@PathVariable("batchId") Long batchId)
{
return AjaxResult.success(cropBatchService.selectCropBatchByBatchId(batchId));
}
/**
* 新增作物批次
*/
@ApiOperation("新增作物批次")
@PreAuthorize("@ss.hasPermi('agriculture:batch:add')")
@Log(title = "作物批次", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CropBatch cropBatch)
{
return toAjax(cropBatchService.insertCropBatch(cropBatch));
}
/**
* 修改作物批次
*/
@ApiOperation("修改作物批次")
@PreAuthorize("@ss.hasPermi('agriculture:batch:edit')")
@Log(title = "作物批次", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CropBatch cropBatch)
{
return toAjax(cropBatchService.updateCropBatch(cropBatch));
}
/**
* 删除作物批次
*/
@ApiOperation("删除作物批次")
@PreAuthorize("@ss.hasPermi('agriculture:batch:remove')")
@Log(title = "作物批次", businessType = BusinessType.DELETE)
@DeleteMapping("/{batchId}")
public AjaxResult remove(@PathVariable Long batchId)
{
return toAjax(cropBatchService.deleteCropBatchByBatchId(batchId));
}
/** ----- 手机端接口----- **/
/**
* 手机端作物批次列表
*/
@ApiOperation("手机端作物批次列表")
@GetMapping("/mobilelist")
public TableDataInfo mobileList(CropBatch cropBatch)
{
startPage();
List<HashMap> list = cropBatchService.selectCropBatchListToMobile(cropBatch);
return getDataTable(list);
}
}

View File

@ -0,0 +1,93 @@
package com.agri.agriculture.controller;
import com.agri.agriculture.service.IDataStatisticsService;
import com.agri.trace.service.ITraceRecordService;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
@Api(tags = "agri-统计分析")
@RestController
@RequestMapping("/agriculture/statistics")
public class DataStatisticsController extends BaseController {
@Autowired
private IDataStatisticsService dataStatisticsService;
@Autowired
private ITraceRecordService traceRecordService;
/**
* 统计基地信息
*/
@ApiOperation("统计基地信息-大屏和工作台使用")
@GetMapping("/selectBaseInfo/{baseId}")
public TableDataInfo selectBaseInfo(@PathVariable Long baseId){
List<HashMap> list = dataStatisticsService.selectBaseInfo(baseId);
return getDataTable(list);
}
/**
* 统计设备信息
*/
@ApiOperation("统计设备信息")
@GetMapping("/selectDeviceInfo/{baseId}")
public TableDataInfo selectDeviceInfo(@PathVariable Long baseId){
List<HashMap> list = dataStatisticsService.selectDeviceInfo(baseId);
return getDataTable(list);
}
/**
* 统计设备定时任务信息
*/
@ApiOperation("统计设备数据上报信息")
@GetMapping("/selectDeviceLog/{baseId}")
public TableDataInfo selectDeviceJobInfo(@PathVariable Long baseId){
List<HashMap> list = dataStatisticsService.selectDeviceAlert(baseId);
return getDataTable(list);
}
/**
* 统计农事任务信息
*/
@ApiOperation("统计农事任务信息")
@GetMapping("/selectTaskInfo/{baseId}")
public TableDataInfo selectTaskInfo(@PathVariable Long baseId){
List<HashMap> list = dataStatisticsService.selectTaskInfo(baseId);
return getDataTable(list);
}
/**
* 统计农事任务信息
*/
@ApiOperation("统计分配给我的农事任务信息")
@GetMapping("/selectTaskInfoOfMine")
public TableDataInfo selectTaskInfoOfMine(){
List<HashMap> list = dataStatisticsService.selectTaskInfoOfMine();
return getDataTable(list);
}
/**
* 统计种植面积信息
*/
@ApiOperation("统计批次信息")
@GetMapping("/selectBatchInfo/{baseId}")
public TableDataInfo selectAreaInfo(@PathVariable Long baseId){
List<HashMap> list = dataStatisticsService.selectBatchInfo(baseId);
return getDataTable(list);
}
/**
* 查询今日待办任务
*/
@ApiOperation("查询今日待办任务")
@GetMapping("/selectToadyTaskCountByTaskHead")
public AjaxResult selectToadyTaskCountByTaskHead(){
HashMap data = dataStatisticsService.selectToadyTaskCountByTaskHead();
return AjaxResult.success(data);
}
}

View File

@ -0,0 +1,114 @@
package com.agri.agriculture.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.Employee;
import com.agri.agriculture.service.IEmployeeService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 雇员Controller
*
* @author nealtsiao
* @date 2023-05-13
*/
@Api(tags = "agri-雇员")
@RestController
@RequestMapping("/agriculture/employee")
public class EmployeeController extends BaseController
{
@Autowired
private IEmployeeService employeeService;
/**
* 查询雇员列表
*/
@ApiOperation("查询雇员列表")
@PreAuthorize("@ss.hasPermi('agriculture:employee:list')")
@GetMapping("/list")
public TableDataInfo list(Employee employee)
{
startPage();
List<Employee> list = employeeService.selectEmployeeList(employee);
return getDataTable(list);
}
/**
* 导出雇员列表
*/
@ApiOperation("导出雇员列表")
@PreAuthorize("@ss.hasPermi('agriculture:employee:export')")
@Log(title = "雇员", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Employee employee)
{
List<Employee> list = employeeService.selectEmployeeList(employee);
ExcelUtil<Employee> util = new ExcelUtil<Employee>(Employee.class);
util.exportExcel(response, list, "雇员数据");
}
/**
* 获取雇员详细信息
*/
@ApiOperation("获取雇员详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:employee:query')")
@GetMapping(value = "/{employeeId}")
public AjaxResult getInfo(@PathVariable("employeeId") Long employeeId)
{
return AjaxResult.success(employeeService.selectEmployeeByEmployeeId(employeeId));
}
/**
* 新增雇员
*/
@ApiOperation("新增雇员")
@PreAuthorize("@ss.hasPermi('agriculture:employee:add')")
@Log(title = "雇员", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Employee employee)
{
return toAjax(employeeService.insertEmployee(employee));
}
/**
* 修改雇员
*/
@ApiOperation("修改雇员")
@PreAuthorize("@ss.hasPermi('agriculture:employee:edit')")
@Log(title = "雇员", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Employee employee)
{
return toAjax(employeeService.updateEmployee(employee));
}
/**
* 删除雇员
*/
@ApiOperation("删除雇员")
@PreAuthorize("@ss.hasPermi('agriculture:employee:remove')")
@Log(title = "雇员", businessType = BusinessType.DELETE)
@DeleteMapping("/{employeeIds}")
public AjaxResult remove(@PathVariable Long[] employeeIds)
{
return toAjax(employeeService.deleteEmployeeByEmployeeIds(employeeIds));
}
}

View File

@ -0,0 +1,114 @@
package com.agri.agriculture.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.Germplasm;
import com.agri.agriculture.service.IGermplasmService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 种质Controller
*
* @author nealtsiao
* @date 2023-05-13
*/
@Api(tags = "agri-种质")
@RestController
@RequestMapping("/agriculture/germplasm")
public class GermplasmController extends BaseController
{
@Autowired
private IGermplasmService germplasmService;
/**
* 查询种质列表
*/
@ApiOperation("查询种质列表")
@PreAuthorize("@ss.hasPermi('agriculture:germplasm:list')")
@GetMapping("/list")
public TableDataInfo list(Germplasm germplasm)
{
startPage();
List<Germplasm> list = germplasmService.selectGermplasmList(germplasm);
return getDataTable(list);
}
/**
* 导出种质列表
*/
@ApiOperation("导出种质列表")
@PreAuthorize("@ss.hasPermi('agriculture:germplasm:export')")
@Log(title = "种质", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Germplasm germplasm)
{
List<Germplasm> list = germplasmService.selectGermplasmList(germplasm);
ExcelUtil<Germplasm> util = new ExcelUtil<Germplasm>(Germplasm.class);
util.exportExcel(response, list, "种质数据");
}
/**
* 获取种质详细信息
*/
@ApiOperation("获取种质详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:germplasm:query')")
@GetMapping(value = "/{germplasmId}")
public AjaxResult getInfo(@PathVariable("germplasmId") Long germplasmId)
{
return AjaxResult.success(germplasmService.selectGermplasmByGermplasmId(germplasmId));
}
/**
* 新增种质
*/
@ApiOperation("新增种质")
@PreAuthorize("@ss.hasPermi('agriculture:germplasm:add')")
@Log(title = "种质", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Germplasm germplasm)
{
return toAjax(germplasmService.insertGermplasm(germplasm));
}
/**
* 修改种质
*/
@ApiOperation("修改种质")
@PreAuthorize("@ss.hasPermi('agriculture:germplasm:edit')")
@Log(title = "种质", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Germplasm germplasm)
{
return toAjax(germplasmService.updateGermplasm(germplasm));
}
/**
* 删除种质
*/
@ApiOperation("删除种质")
@PreAuthorize("@ss.hasPermi('agriculture:germplasm:remove')")
@Log(title = "种质", businessType = BusinessType.DELETE)
@DeleteMapping("/{germplasmIds}")
public AjaxResult remove(@PathVariable Long[] germplasmIds)
{
return toAjax(germplasmService.deleteGermplasmByGermplasmIds(germplasmIds));
}
}

View File

@ -0,0 +1,114 @@
package com.agri.agriculture.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.GermplasmIntro;
import com.agri.agriculture.service.IGermplasmIntroService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 种质介绍Controller
*
* @author nealtsiao
* @date 2023-05-13
*/
@Api(tags = "agri-种质介绍")
@RestController
@RequestMapping("/agriculture/intro")
public class GermplasmIntroController extends BaseController
{
@Autowired
private IGermplasmIntroService germplasmIntroService;
/**
* 查询种质介绍列表
*/
@ApiOperation("查询种质介绍列表")
@PreAuthorize("@ss.hasPermi('agriculture:intro:list')")
@GetMapping("/list")
public TableDataInfo list(GermplasmIntro germplasmIntro)
{
startPage();
List<GermplasmIntro> list = germplasmIntroService.selectGermplasmIntroList(germplasmIntro);
return getDataTable(list);
}
/**
* 导出种质介绍列表
*/
@ApiOperation("导出种质介绍列表")
@PreAuthorize("@ss.hasPermi('agriculture:intro:export')")
@Log(title = "种质介绍", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, GermplasmIntro germplasmIntro)
{
List<GermplasmIntro> list = germplasmIntroService.selectGermplasmIntroList(germplasmIntro);
ExcelUtil<GermplasmIntro> util = new ExcelUtil<GermplasmIntro>(GermplasmIntro.class);
util.exportExcel(response, list, "种质介绍数据");
}
/**
* 获取种质介绍详细信息
*/
@ApiOperation("获取种质介绍详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:intro:query')")
@GetMapping(value = "/{introId}")
public AjaxResult getInfo(@PathVariable("introId") Long introId)
{
return AjaxResult.success(germplasmIntroService.selectGermplasmIntroByIntroId(introId));
}
/**
* 新增种质介绍
*/
@ApiOperation("新增种质介绍")
@PreAuthorize("@ss.hasPermi('agriculture:intro:add')")
@Log(title = "种质介绍", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody GermplasmIntro germplasmIntro)
{
return toAjax(germplasmIntroService.insertGermplasmIntro(germplasmIntro));
}
/**
* 修改种质介绍
*/
@ApiOperation("修改种质介绍")
@PreAuthorize("@ss.hasPermi('agriculture:intro:edit')")
@Log(title = "种质介绍", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody GermplasmIntro germplasmIntro)
{
return toAjax(germplasmIntroService.updateGermplasmIntro(germplasmIntro));
}
/**
* 删除种质介绍
*/
@ApiOperation("删除种质介绍")
@PreAuthorize("@ss.hasPermi('agriculture:intro:remove')")
@Log(title = "种质介绍", businessType = BusinessType.DELETE)
@DeleteMapping("/{introIds}")
public AjaxResult remove(@PathVariable Long[] introIds)
{
return toAjax(germplasmIntroService.deleteGermplasmIntroByIntroIds(introIds));
}
}

View File

@ -0,0 +1,114 @@
package com.agri.agriculture.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.Land;
import com.agri.agriculture.service.ILandService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 地块Controller
*
* @author nealtsiao
* @date 2023-05-13
*/
@Api(tags = "agri-地块")
@RestController
@RequestMapping("/agriculture/land")
public class LandController extends BaseController
{
@Autowired
private ILandService landService;
/**
* 查询地块列表
*/
@ApiOperation("查询地块列表")
@PreAuthorize("@ss.hasPermi('agriculture:land:list')")
@GetMapping("/list")
public TableDataInfo list(Land land)
{
startPage();
List<Land> list = landService.selectLandList(land);
return getDataTable(list);
}
/**
* 导出地块列表
*/
@ApiOperation("导出地块列表")
@PreAuthorize("@ss.hasPermi('agriculture:land:export')")
@Log(title = "地块", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Land land)
{
List<Land> list = landService.selectLandList(land);
ExcelUtil<Land> util = new ExcelUtil<Land>(Land.class);
util.exportExcel(response, list, "地块数据");
}
/**
* 获取地块详细信息
*/
@ApiOperation("获取地块详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:land:query')")
@GetMapping(value = "/{landId}")
public AjaxResult getInfo(@PathVariable("landId") Long landId)
{
return AjaxResult.success(landService.selectLandByLandId(landId));
}
/**
* 新增地块
*/
@ApiOperation("新增地块")
@PreAuthorize("@ss.hasPermi('agriculture:land:add')")
@Log(title = "地块", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Land land)
{
return toAjax(landService.insertLand(land));
}
/**
* 修改地块
*/
@ApiOperation("修改地块")
@PreAuthorize("@ss.hasPermi('agriculture:land:edit')")
@Log(title = "地块", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Land land)
{
return toAjax(landService.updateLand(land));
}
/**
* 删除地块
*/
@ApiOperation("删除地块")
@PreAuthorize("@ss.hasPermi('agriculture:land:remove')")
@Log(title = "地块", businessType = BusinessType.DELETE)
@DeleteMapping("/{landIds}")
public AjaxResult remove(@PathVariable Long[] landIds)
{
return toAjax(landService.deleteLandByLandIds(landIds));
}
}

View File

@ -0,0 +1,114 @@
package com.agri.agriculture.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.MachineInfo;
import com.agri.agriculture.service.IMachineInfoService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 机械信息Controller
*
* @author xuweidong
* @date 2023-05-24
*/
@Api(tags = "agri-机械信息")
@RestController
@RequestMapping("/agriculture/machineInfo")
public class MachineInfoController extends BaseController
{
@Autowired
private IMachineInfoService machineInfoService;
/**
* 查询机械信息列表
*/
@ApiOperation("查询机械信息列表")
@PreAuthorize("@ss.hasPermi('agriculture:machineInfo:list')")
@GetMapping("/list")
public TableDataInfo list(MachineInfo machineInfo)
{
startPage();
List<MachineInfo> list = machineInfoService.selectMachineInfoList(machineInfo);
return getDataTable(list);
}
/**
* 导出机械信息列表
*/
@ApiOperation("导出机械信息列表")
@PreAuthorize("@ss.hasPermi('agriculture:machineInfo:export')")
@Log(title = "机械信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MachineInfo machineInfo)
{
List<MachineInfo> list = machineInfoService.selectMachineInfoList(machineInfo);
ExcelUtil<MachineInfo> util = new ExcelUtil<MachineInfo>(MachineInfo.class);
util.exportExcel(response, list, "机械信息数据");
}
/**
* 获取机械信息详细信息
*/
@ApiOperation("获取机械信息详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:machineInfo:query')")
@GetMapping(value = "/{machineId}")
public AjaxResult getInfo(@PathVariable("machineId") Long machineId)
{
return AjaxResult.success(machineInfoService.selectMachineInfoByMachineId(machineId));
}
/**
* 新增机械信息
*/
@ApiOperation("新增机械信息")
@PreAuthorize("@ss.hasPermi('agriculture:machineInfo:add')")
@Log(title = "机械信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MachineInfo machineInfo)
{
return toAjax(machineInfoService.insertMachineInfo(machineInfo));
}
/**
* 修改机械信息
*/
@ApiOperation("修改机械信息")
@PreAuthorize("@ss.hasPermi('agriculture:machineInfo:edit')")
@Log(title = "机械信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MachineInfo machineInfo)
{
return toAjax(machineInfoService.updateMachineInfo(machineInfo));
}
/**
* 删除机械信息
*/
@ApiOperation("删除机械信息")
@PreAuthorize("@ss.hasPermi('agriculture:machineInfo:remove')")
@Log(title = "机械信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{machineIds}")
public AjaxResult remove(@PathVariable Long[] machineIds)
{
return toAjax(machineInfoService.deleteMachineInfoByMachineIds(machineIds));
}
}

View File

@ -0,0 +1,114 @@
package com.agri.agriculture.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.MachineType;
import com.agri.agriculture.service.IMachineTypeService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 机械类别Controller
*
* @author kerwincui
* @date 2023-05-24
*/
@Api(tags = "agri-机械类别")
@RestController
@RequestMapping("/agriculture/machineType")
public class MachineTypeController extends BaseController
{
@Autowired
private IMachineTypeService machineTypeService;
/**
* 查询机械类别列表
*/
@ApiOperation("查询机械类别列表")
@PreAuthorize("@ss.hasPermi('agriculture:machineType:list')")
@GetMapping("/list")
public TableDataInfo list(MachineType machineType)
{
startPage();
List<MachineType> list = machineTypeService.selectMachineTypeList(machineType);
return getDataTable(list);
}
/**
* 导出机械类别列表
*/
@ApiOperation("导出机械类别列表")
@PreAuthorize("@ss.hasPermi('agriculture:machineType:export')")
@Log(title = "机械类别", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MachineType machineType)
{
List<MachineType> list = machineTypeService.selectMachineTypeList(machineType);
ExcelUtil<MachineType> util = new ExcelUtil<MachineType>(MachineType.class);
util.exportExcel(response, list, "机械类别数据");
}
/**
* 获取机械类别详细信息
*/
@ApiOperation("获取机械类别详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:machineType:query')")
@GetMapping(value = "/{machineTypeId}")
public AjaxResult getInfo(@PathVariable("machineTypeId") Long machineTypeId)
{
return AjaxResult.success(machineTypeService.selectMachineTypeByMachineTypeId(machineTypeId));
}
/**
* 新增机械类别
*/
@ApiOperation("新增机械类别")
@PreAuthorize("@ss.hasPermi('agriculture:machineType:add')")
@Log(title = "机械类别", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MachineType machineType)
{
return toAjax(machineTypeService.insertMachineType(machineType));
}
/**
* 修改机械类别
*/
@ApiOperation("修改机械类别")
@PreAuthorize("@ss.hasPermi('agriculture:machineType:edit')")
@Log(title = "机械类别", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MachineType machineType)
{
return toAjax(machineTypeService.updateMachineType(machineType));
}
/**
* 删除机械类别
*/
@ApiOperation("删除机械类别")
@PreAuthorize("@ss.hasPermi('agriculture:machineType:remove')")
@Log(title = "机械类别", businessType = BusinessType.DELETE)
@DeleteMapping("/{machineTypeIds}")
public AjaxResult remove(@PathVariable Long[] machineTypeIds)
{
return toAjax(machineTypeService.deleteMachineTypeByMachineTypeIds(machineTypeIds));
}
}

View File

@ -0,0 +1,114 @@
package com.agri.agriculture.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.MaterialInfo;
import com.agri.agriculture.service.IMaterialInfoService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 农资信息Controller
*
* @author xuweidong
* @date 2023-05-24
*/
@Api(tags = "agri-农资信息")
@RestController
@RequestMapping("/agriculture/materialInfo")
public class MaterialInfoController extends BaseController
{
@Autowired
private IMaterialInfoService materialInfoService;
/**
* 查询农资信息列表
*/
@ApiOperation("查询农资信息列表")
@PreAuthorize("@ss.hasPermi('agriculture:materialInfo:list')")
@GetMapping("/list")
public TableDataInfo list(MaterialInfo materialInfo)
{
startPage();
List<MaterialInfo> list = materialInfoService.selectMaterialInfoList(materialInfo);
return getDataTable(list);
}
/**
* 导出农资信息列表
*/
@ApiOperation("导出农资信息列表")
@PreAuthorize("@ss.hasPermi('agriculture:materialInfo:export')")
@Log(title = "农资信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MaterialInfo materialInfo)
{
List<MaterialInfo> list = materialInfoService.selectMaterialInfoList(materialInfo);
ExcelUtil<MaterialInfo> util = new ExcelUtil<MaterialInfo>(MaterialInfo.class);
util.exportExcel(response, list, "农资信息数据");
}
/**
* 获取农资信息详细信息
*/
@ApiOperation("获取农资信息详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:materialInfo:query')")
@GetMapping(value = "/{materialId}")
public AjaxResult getInfo(@PathVariable("materialId") Long materialId)
{
return AjaxResult.success(materialInfoService.selectMaterialInfoByMaterialId(materialId));
}
/**
* 新增农资信息
*/
@ApiOperation("新增农资信息")
@PreAuthorize("@ss.hasPermi('agriculture:materialInfo:add')")
@Log(title = "农资信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MaterialInfo materialInfo)
{
return toAjax(materialInfoService.insertMaterialInfo(materialInfo));
}
/**
* 修改农资信息
*/
@ApiOperation("修改农资信息")
@PreAuthorize("@ss.hasPermi('agriculture:materialInfo:edit')")
@Log(title = "农资信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MaterialInfo materialInfo)
{
return toAjax(materialInfoService.updateMaterialInfo(materialInfo));
}
/**
* 删除农资信息
*/
@ApiOperation("删除农资信息")
@PreAuthorize("@ss.hasPermi('agriculture:materialInfo:remove')")
@Log(title = "农资信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{materialIds}")
public AjaxResult remove(@PathVariable Long[] materialIds)
{
return toAjax(materialInfoService.deleteMaterialInfoByMaterialIds(materialIds));
}
}

View File

@ -0,0 +1,114 @@
package com.agri.agriculture.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.MaterialType;
import com.agri.agriculture.service.IMaterialTypeService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 农资类别Controller
*
* @author xuweidong
* @date 2023-05-24
*/
@Api(tags = "agri-农资类别")
@RestController
@RequestMapping("/agriculture/materialType")
public class MaterialTypeController extends BaseController
{
@Autowired
private IMaterialTypeService materialTypeService;
/**
* 查询农资类别列表
*/
@ApiOperation("查询农资类别列表")
@PreAuthorize("@ss.hasPermi('agriculture:materialType:list')")
@GetMapping("/list")
public TableDataInfo list(MaterialType materialType)
{
startPage();
List<MaterialType> list = materialTypeService.selectMaterialTypeList(materialType);
return getDataTable(list);
}
/**
* 导出农资类别列表
*/
@ApiOperation("导出农资类别列表")
@PreAuthorize("@ss.hasPermi('agriculture:materialType:export')")
@Log(title = "农资类别", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MaterialType materialType)
{
List<MaterialType> list = materialTypeService.selectMaterialTypeList(materialType);
ExcelUtil<MaterialType> util = new ExcelUtil<MaterialType>(MaterialType.class);
util.exportExcel(response, list, "农资类别数据");
}
/**
* 获取农资类别详细信息
*/
@ApiOperation("获取农资类别详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:materialType:query')")
@GetMapping(value = "/{materialTypeId}")
public AjaxResult getInfo(@PathVariable("materialTypeId") Long materialTypeId)
{
return AjaxResult.success(materialTypeService.selectMaterialTypeByMaterialTypeId(materialTypeId));
}
/**
* 新增农资类别
*/
@ApiOperation("新增农资类别")
@PreAuthorize("@ss.hasPermi('agriculture:materialType:add')")
@Log(title = "农资类别", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MaterialType materialType)
{
return toAjax(materialTypeService.insertMaterialType(materialType));
}
/**
* 修改农资类别
*/
@ApiOperation("修改农资类别")
@PreAuthorize("@ss.hasPermi('agriculture:materialType:edit')")
@Log(title = "农资类别", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MaterialType materialType)
{
return toAjax(materialTypeService.updateMaterialType(materialType));
}
/**
* 删除农资类别
*/
@ApiOperation("删除农资类别")
@PreAuthorize("@ss.hasPermi('agriculture:materialType:remove')")
@Log(title = "农资类别", businessType = BusinessType.DELETE)
@DeleteMapping("/{materialTypeIds}")
public AjaxResult remove(@PathVariable Long[] materialTypeIds)
{
return toAjax(materialTypeService.deleteMaterialTypeByMaterialTypeIds(materialTypeIds));
}
}

View File

@ -0,0 +1,114 @@
package com.agri.agriculture.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.PlantMethod;
import com.agri.agriculture.service.IPlantMethodService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 种植方法Controller
*
* @author nealtsiao
* @date 2023-05-13
*/
@Api(tags = "agri-种质种植方法")
@RestController
@RequestMapping("/agriculture/method")
public class PlantMethodController extends BaseController
{
@Autowired
private IPlantMethodService plantMethodService;
/**
* 查询种植方法列表
*/
@ApiOperation("查询种植方法列表")
@PreAuthorize("@ss.hasPermi('agriculture:method:list')")
@GetMapping("/list")
public TableDataInfo list(PlantMethod plantMethod)
{
startPage();
List<PlantMethod> list = plantMethodService.selectPlantMethodList(plantMethod);
return getDataTable(list);
}
/**
* 导出种植方法列表
*/
@ApiOperation("导出种植方法列表")
@PreAuthorize("@ss.hasPermi('agriculture:method:export')")
@Log(title = "种植方法", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, PlantMethod plantMethod)
{
List<PlantMethod> list = plantMethodService.selectPlantMethodList(plantMethod);
ExcelUtil<PlantMethod> util = new ExcelUtil<PlantMethod>(PlantMethod.class);
util.exportExcel(response, list, "种植方法数据");
}
/**
* 获取种植方法详细信息
*/
@ApiOperation("获取种植方法详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:method:query')")
@GetMapping(value = "/{methodId}")
public AjaxResult getInfo(@PathVariable("methodId") Long methodId)
{
return AjaxResult.success(plantMethodService.selectPlantMethodByMethodId(methodId));
}
/**
* 新增种植方法
*/
@ApiOperation("新增种植方法")
@PreAuthorize("@ss.hasPermi('agriculture:method:add')")
@Log(title = "种植方法", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PlantMethod plantMethod)
{
return toAjax(plantMethodService.insertPlantMethod(plantMethod));
}
/**
* 修改种植方法
*/
@ApiOperation("修改种植方法")
@PreAuthorize("@ss.hasPermi('agriculture:method:edit')")
@Log(title = "种植方法", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PlantMethod plantMethod)
{
return toAjax(plantMethodService.updatePlantMethod(plantMethod));
}
/**
* 删除种植方法
*/
@ApiOperation("删除种植方法")
@PreAuthorize("@ss.hasPermi('agriculture:method:remove')")
@Log(title = "种植方法", businessType = BusinessType.DELETE)
@DeleteMapping("/{methodIds}")
public AjaxResult remove(@PathVariable Long[] methodIds)
{
return toAjax(plantMethodService.deletePlantMethodByMethodIds(methodIds));
}
}

View File

@ -0,0 +1,114 @@
package com.agri.agriculture.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.StandardJob;
import com.agri.agriculture.service.IStandardJobService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 标准作业任务Controller
*
* @author xuweidong
* @date 2023-05-24
*/
@Api(tags = "agri-种质标准作业流程")
@RestController
@RequestMapping("/agriculture/standardJob")
public class StandardJobController extends BaseController
{
@Autowired
private IStandardJobService standardJobService;
/**
* 查询标准作业任务列表
*/
@ApiOperation("查询标准作业任务列表")
@PreAuthorize("@ss.hasPermi('agriculture:standardJob:list')")
@GetMapping("/list")
public TableDataInfo list(StandardJob standardJob)
{
startPage();
List<StandardJob> list = standardJobService.selectStandardJobList(standardJob);
return getDataTable(list);
}
/**
* 导出标准作业任务列表
*/
@ApiOperation("导出标准作业任务列表")
@PreAuthorize("@ss.hasPermi('agriculture:standardJob:export')")
@Log(title = "标准作业任务", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, StandardJob standardJob)
{
List<StandardJob> list = standardJobService.selectStandardJobList(standardJob);
ExcelUtil<StandardJob> util = new ExcelUtil<StandardJob>(StandardJob.class);
util.exportExcel(response, list, "标准作业任务数据");
}
/**
* 获取标准作业任务详细信息
*/
@ApiOperation("获取标准作业任务详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:standardJob:query')")
@GetMapping(value = "/{jobId}")
public AjaxResult getInfo(@PathVariable("jobId") Long jobId)
{
return AjaxResult.success(standardJobService.selectStandardJobByJobId(jobId));
}
/**
* 新增标准作业任务
*/
@ApiOperation("新增标准作业任务")
@PreAuthorize("@ss.hasPermi('agriculture:standardJob:add')")
@Log(title = "标准作业任务", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody StandardJob standardJob)
{
return toAjax(standardJobService.insertStandardJob(standardJob));
}
/**
* 修改标准作业任务
*/
@ApiOperation("修改标准作业任务")
@PreAuthorize("@ss.hasPermi('agriculture:standardJob:edit')")
@Log(title = "标准作业任务", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody StandardJob standardJob)
{
return toAjax(standardJobService.updateStandardJob(standardJob));
}
/**
* 删除标准作业任务
*/
@ApiOperation("删除标准作业任务")
@PreAuthorize("@ss.hasPermi('agriculture:standardJob:remove')")
@Log(title = "标准作业任务", businessType = BusinessType.DELETE)
@DeleteMapping("/{jobIds}")
public AjaxResult remove(@PathVariable Long[] jobIds)
{
return toAjax(standardJobService.deleteStandardJobByJobIds(jobIds));
}
}

View File

@ -0,0 +1,126 @@
package com.agri.agriculture.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.TaskEmployee;
import com.agri.agriculture.service.ITaskEmployeeService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 批次任务工人Controller
*
* @author xuweidong
* @date 2023-05-24
*/
@Api(tags = "agri-参与任务人员")
@RestController
@RequestMapping("/agriculture/taskEmployee")
public class TaskEmployeeController extends BaseController
{
@Autowired
private ITaskEmployeeService taskEmployeeService;
/**
* 查询批次任务工人列表
*/
@ApiOperation("查询批次任务工人列表")
@PreAuthorize("@ss.hasPermi('agriculture:taskEmployee:list')")
@GetMapping("/list")
public TableDataInfo list(TaskEmployee taskEmployee)
{
startPage();
List<TaskEmployee> list = taskEmployeeService.selectTaskEmployeeList(taskEmployee);
return getDataTable(list);
}
/**
* 导出批次任务工人列表
*/
@ApiOperation("导出批次任务工人列表")
@PreAuthorize("@ss.hasPermi('agriculture:taskEmployee:export')")
@Log(title = "批次任务工人", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TaskEmployee taskEmployee)
{
List<TaskEmployee> list = taskEmployeeService.selectTaskEmployeeList(taskEmployee);
ExcelUtil<TaskEmployee> util = new ExcelUtil<TaskEmployee>(TaskEmployee.class);
util.exportExcel(response, list, "批次任务工人数据");
}
/**
* 获取批次任务工人详细信息
*/
@ApiOperation("获取批次任务工人详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:taskEmployee:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(taskEmployeeService.selectTaskEmployeeById(id));
}
/**
* 新增批次任务工人
*/
@ApiOperation("新增批次任务工人")
@PreAuthorize("@ss.hasPermi('agriculture:taskEmployee:add')")
@Log(title = "批次任务工人", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TaskEmployee taskEmployee)
{
return toAjax(taskEmployeeService.insertTaskEmployee(taskEmployee));
}
/**
* 修改批次任务工人
*/
@ApiOperation("修改批次任务工人")
@PreAuthorize("@ss.hasPermi('agriculture:taskEmployee:edit')")
@Log(title = "批次任务工人", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TaskEmployee taskEmployee)
{
return toAjax(taskEmployeeService.updateTaskEmployee(taskEmployee));
}
/**
* 删除批次任务工人
*/
@ApiOperation("删除批次任务工人")
@PreAuthorize("@ss.hasPermi('agriculture:taskEmployee:remove')")
@Log(title = "批次任务工人", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(taskEmployeeService.deleteTaskEmployeeByIds(ids));
}
/**
* 根据任务id和工人id删除工人
*/
@ApiOperation("根据任务id和工人id删除工人")
@PreAuthorize("@ss.hasPermi('agriculture:taskEmployee:remove')")
@Log(title = "批次任务工人", businessType = BusinessType.DELETE)
@DeleteMapping("/{taskId}/{employeeId}")
public AjaxResult remove(@PathVariable Long taskId,@PathVariable Long employeeId)
{
return toAjax(taskEmployeeService.deleteTaskEmployeeByTaskIdAndEmployeeId(taskId,employeeId));
}
}

View File

@ -0,0 +1,114 @@
package com.agri.agriculture.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.annotation.Log;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.common.enums.BusinessType;
import com.agri.agriculture.domain.TaskLog;
import com.agri.agriculture.service.ITaskLogService;
import com.agri.common.utils.poi.ExcelUtil;
import com.agri.common.core.page.TableDataInfo;
/**
* 批次任务日志Controller
*
* @author nealtsiao
* @date 2023-06-06
*/
@Api(tags = "agri-任务日志")
@RestController
@RequestMapping("/agriculture/log")
public class TaskLogController extends BaseController
{
@Autowired
private ITaskLogService taskLogService;
/**
* 查询批次任务日志列表
*/
@ApiOperation("查询批次任务日志列表")
@PreAuthorize("@ss.hasPermi('agriculture:log:list')")
@GetMapping("/list")
public TableDataInfo list(TaskLog taskLog)
{
startPage();
List<TaskLog> list = taskLogService.selectTaskLogList(taskLog);
return getDataTable(list);
}
/**
* 导出批次任务日志列表
*/
@ApiOperation("导出批次任务日志列表")
@PreAuthorize("@ss.hasPermi('agriculture:log:export')")
@Log(title = "批次任务日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TaskLog taskLog)
{
List<TaskLog> list = taskLogService.selectTaskLogList(taskLog);
ExcelUtil<TaskLog> util = new ExcelUtil<TaskLog>(TaskLog.class);
util.exportExcel(response, list, "批次任务日志数据");
}
/**
* 获取批次任务日志详细信息
*/
@ApiOperation("获取批次任务日志详细信息")
@PreAuthorize("@ss.hasPermi('agriculture:log:query')")
@GetMapping(value = "/{logId}")
public AjaxResult getInfo(@PathVariable("logId") Long logId)
{
return AjaxResult.success(taskLogService.selectTaskLogByLogId(logId));
}
/**
* 新增批次任务日志
*/
@ApiOperation("新增批次任务日志")
@PreAuthorize("@ss.hasPermi('agriculture:log:add')")
@Log(title = "批次任务日志", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TaskLog taskLog)
{
return toAjax(taskLogService.insertTaskLog(taskLog));
}
/**
* 修改批次任务日志
*/
@ApiOperation("修改批次任务日志")
@PreAuthorize("@ss.hasPermi('agriculture:log:edit')")
@Log(title = "批次任务日志", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TaskLog taskLog)
{
return toAjax(taskLogService.updateTaskLog(taskLog));
}
/**
* 删除批次任务日志
*/
@ApiOperation("删除批次任务日志")
@PreAuthorize("@ss.hasPermi('agriculture:log:remove')")
@Log(title = "批次任务日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{logIds}")
public AjaxResult remove(@PathVariable Long[] logIds)
{
return toAjax(taskLogService.deleteTaskLogByLogIds(logIds));
}
}

View File

@ -0,0 +1,86 @@
package com.agri.agriculture.controller;
import java.util.HashMap;
import java.util.List;
import com.agri.agriculture.domain.CropBatch;
import com.agri.agriculture.domain.Land;
import com.agri.agriculture.model.UnitParams;
import com.agri.iot.domain.AlertLog;
import com.agri.iot.domain.Device;
import com.agri.iot.domain.Scene;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.agri.common.core.controller.BaseController;
import com.agri.common.core.domain.AjaxResult;
import com.agri.agriculture.service.IUnitService;
import com.agri.common.core.page.TableDataInfo;
/**
* 种植单元Controller
*
* @author nealtsiao
* @date 2024-07-26
*/
@RestController
@RequestMapping("/agriculture/unit")
public class UnitController extends BaseController
{
@Autowired
private IUnitService unitService;
/**
* 配置种植单元
*/
@PreAuthorize("@ss.hasPermi('agriculture:unit:cfg')")
@PostMapping("/cfg")
public AjaxResult cfg(@RequestBody UnitParams unitParams)
{
return toAjax(unitService.configUnit(unitParams));
}
@PreAuthorize("@ss.hasPermi('agriculture:unit:cfg')")
@GetMapping("getUnit/{landId}")
public AjaxResult getUnit(@PathVariable Long landId){
return AjaxResult.success(unitService.getUnit(landId));
}
@GetMapping("selectDeviceList/{landId}")
public TableDataInfo selectDeviceList(@PathVariable Long landId){
startPage();
List<Device> list = unitService.selectDeviceList(landId);
return getDataTable(list);
}
@GetMapping("selectCameraList/{landId}")
public TableDataInfo selectCameraList(@PathVariable Long landId){
startPage();
List<Device> list = unitService.selectCameraList(landId);
return getDataTable(list);
}
@GetMapping("selectBatchList/{landId}")
public TableDataInfo selectBatchList(@PathVariable Long landId){
startPage();
List<HashMap> list = unitService.selectBatchList(landId);
return getDataTable(list);
}
@GetMapping("selectSceneList/{landId}")
public TableDataInfo selectSceneList(@PathVariable Long landId){
startPage();
List<Scene> list = unitService.selectSceneList(landId);
return getDataTable(list);
}
@GetMapping("selectAlertLogList")
public TableDataInfo selectAlertLogList(Land land){
startPage();
List<AlertLog> list = unitService.selectAlertLogList(land.getLandId());
return getDataTable(list);
}
}

View File

@ -0,0 +1,84 @@
package com.agri.agriculture.domain;
import com.agri.common.core.domain.entity.SysUser;
import lombok.Data;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
import java.util.List;
/**
* 基地信息对象 agriculture_baseinfo
*
* @author nealtsiao
* @date 2023-05-13
*/
@Data
public class Baseinfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 基地ID */
private Long baseId;
/** 基地简称 */
@Excel(name = "基地简称")
private String baseShortName;
/** 基地编号 */
@Excel(name = "基地编号")
private String baseCode;
/** 基地全称 */
@Excel(name = "基地全称")
private String baseName;
/** 基地负责人 */
@Excel(name = "基地负责人")
private String baseLeader;
/** 基地负责人电话 */
@Excel(name = "基地负责人电话")
private String leaderTel;
/** 基地负责人电话 */
@Excel(name = "基地负责人电话")
private String baseAddress;
/** 基地面积 */
@Excel(name = "基地面积")
private String baseArea;
/** 基地海拔 */
@Excel(name = "基地海拔")
private Long baseAltitude;
/** 现场图片 */
@Excel(name = "现场图片")
private String baseImg;
/** 基地描述 */
@Excel(name = "基地描述")
private String baseDes;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 基地坐标 */
@Excel(name = "基地坐标")
private String baseCoordinate;
/** 排序 */
@Excel(name = "排序")
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 绑定部门ID */
private Long deptId;
private List<SysUser> children;
}

View File

@ -0,0 +1,90 @@
package com.agri.agriculture.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 批次任务对象 agriculture_batch_task
*
* @author nealtsiao
* @date 2023-05-30
*/
@Data
public class BatchTask extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 任务ID */
private Long taskId;
/** 批次ID */
@Excel(name = "批次ID")
private Long batchId;
/** 任务名称 */
@Excel(name = "任务名称")
private String taskName;
/** 计划开始日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "计划开始日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date planStart;
/** 计划结束日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "计划结束日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date planFinish;
/** 实际开始日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "实际开始日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date actualStart;
/** 实际结束日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "实际结束日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date actualFinish;
/** 任务详情 */
@Excel(name = "任务详情")
private String taskDetail;
/** 图片资料 */
@Excel(name = "图片资料")
private String taskImages;
/** 视频资料 */
@Excel(name = "视频资料")
private String taskVideos;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 排序 */
@Excel(name = "排序")
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
private Long batchHead;
private String userName;
private Long landId;
private String landName;
private String batchName;
private Long taskHead;
private String taskHeadName;
private Long baseId;
}

View File

@ -0,0 +1,158 @@
package com.agri.agriculture.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
/**
* 人工工时对象 agriculture_cost_employee
*
* @author xuweidong
* @date 2023-05-24
*/
public class CostEmployee extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** ID */
private Long costId;
/** 任务ID */
@Excel(name = "任务ID")
private Long taskId;
/** 雇员ID */
@Excel(name = "雇员ID")
private Long employeeId;
/** 工时 */
@Excel(name = "工时")
private BigDecimal workingHours;
/** 开始日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date workingStart;
/** 结束日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date workingFinish;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 排序 */
@Excel(name = "排序")
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
public void setCostId(Long costId)
{
this.costId = costId;
}
public Long getCostId()
{
return costId;
}
public void setTaskId(Long taskId)
{
this.taskId = taskId;
}
public Long getTaskId()
{
return taskId;
}
public void setEmployeeId(Long employeeId)
{
this.employeeId = employeeId;
}
public Long getEmployeeId()
{
return employeeId;
}
public void setWorkingHours(BigDecimal workingHours)
{
this.workingHours = workingHours;
}
public BigDecimal getWorkingHours()
{
return workingHours;
}
public void setWorkingStart(Date workingStart)
{
this.workingStart = workingStart;
}
public Date getWorkingStart()
{
return workingStart;
}
public void setWorkingFinish(Date workingFinish)
{
this.workingFinish = workingFinish;
}
public Date getWorkingFinish()
{
return workingFinish;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setOrderNum(Long orderNum)
{
this.orderNum = orderNum;
}
public Long getOrderNum()
{
return orderNum;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("costId", getCostId())
.append("taskId", getTaskId())
.append("employeeId", getEmployeeId())
.append("workingHours", getWorkingHours())
.append("workingStart", getWorkingStart())
.append("workingFinish", getWorkingFinish())
.append("remark", getRemark())
.append("status", getStatus())
.append("orderNum", getOrderNum())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("delFlag", getDelFlag())
.toString();
}
}

View File

@ -0,0 +1,172 @@
package com.agri.agriculture.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
/**
* 机械工时对象 agriculture_cost_machine
*
* @author xuweidong
* @date 2023-05-24
*/
public class CostMachine extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** ID */
private Long costId;
/** 任务ID */
@Excel(name = "任务ID")
private Long taskId;
/** 机械ID */
@Excel(name = "机械ID")
private Long machineId;
/** 机械数量 */
@Excel(name = "机械数量")
private Long machineCount;
/** 工时 */
@Excel(name = "工时")
private BigDecimal workingHours;
/** 开始日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date workingStart;
/** 结束日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date workingFinish;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 排序 */
@Excel(name = "排序")
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
public void setCostId(Long costId)
{
this.costId = costId;
}
public Long getCostId()
{
return costId;
}
public void setTaskId(Long taskId)
{
this.taskId = taskId;
}
public Long getTaskId()
{
return taskId;
}
public void setMachineId(Long machineId)
{
this.machineId = machineId;
}
public Long getMachineId()
{
return machineId;
}
public void setMachineCount(Long machineCount)
{
this.machineCount = machineCount;
}
public Long getMachineCount()
{
return machineCount;
}
public void setWorkingHours(BigDecimal workingHours)
{
this.workingHours = workingHours;
}
public BigDecimal getWorkingHours()
{
return workingHours;
}
public void setWorkingStart(Date workingStart)
{
this.workingStart = workingStart;
}
public Date getWorkingStart()
{
return workingStart;
}
public void setWorkingFinish(Date workingFinish)
{
this.workingFinish = workingFinish;
}
public Date getWorkingFinish()
{
return workingFinish;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setOrderNum(Long orderNum)
{
this.orderNum = orderNum;
}
public Long getOrderNum()
{
return orderNum;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("costId", getCostId())
.append("taskId", getTaskId())
.append("machineId", getMachineId())
.append("machineCount", getMachineCount())
.append("workingHours", getWorkingHours())
.append("workingStart", getWorkingStart())
.append("workingFinish", getWorkingFinish())
.append("remark", getRemark())
.append("status", getStatus())
.append("orderNum", getOrderNum())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("delFlag", getDelFlag())
.toString();
}
}

View File

@ -0,0 +1,171 @@
package com.agri.agriculture.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
/**
* 农资用量对象 agriculture_cost_material
*
* @author xuweidong
* @date 2023-05-24
*/
public class CostMaterial extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** ID */
private Long costId;
/** 任务ID */
@Excel(name = "任务ID")
private Long taskId;
/** 农资ID */
@Excel(name = "农资ID")
private Long materialId;
/** 使用数量 */
@Excel(name = "使用数量")
private Long materialCount;
/** 计量单位 */
@Excel(name = "计量单位")
private String measureUnit;
/** 开始日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date workingStart;
/** 结束日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date workingFinish;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 排序 */
@Excel(name = "排序")
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
public void setCostId(Long costId)
{
this.costId = costId;
}
public Long getCostId()
{
return costId;
}
public void setTaskId(Long taskId)
{
this.taskId = taskId;
}
public Long getTaskId()
{
return taskId;
}
public void setMaterialId(Long materialId)
{
this.materialId = materialId;
}
public Long getMaterialId()
{
return materialId;
}
public void setMaterialCount(Long materialCount)
{
this.materialCount = materialCount;
}
public Long getMaterialCount()
{
return materialCount;
}
public void setMeasureUnit(String measureUnit)
{
this.measureUnit = measureUnit;
}
public String getMeasureUnit()
{
return measureUnit;
}
public void setWorkingStart(Date workingStart)
{
this.workingStart = workingStart;
}
public Date getWorkingStart()
{
return workingStart;
}
public void setWorkingFinish(Date workingFinish)
{
this.workingFinish = workingFinish;
}
public Date getWorkingFinish()
{
return workingFinish;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setOrderNum(Long orderNum)
{
this.orderNum = orderNum;
}
public Long getOrderNum()
{
return orderNum;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("costId", getCostId())
.append("taskId", getTaskId())
.append("materialId", getMaterialId())
.append("materialCount", getMaterialCount())
.append("measureUnit", getMeasureUnit())
.append("workingStart", getWorkingStart())
.append("workingFinish", getWorkingFinish())
.append("remark", getRemark())
.append("status", getStatus())
.append("orderNum", getOrderNum())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("delFlag", getDelFlag())
.toString();
}
}

View File

@ -0,0 +1,72 @@
package com.agri.agriculture.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
/**
* 作物批次对象 agriculture_crop_batch
*
* @author nealtsiao
* @date 2023-05-13
*/
@Data
public class CropBatch extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 批次ID */
private Long batchId;
/** 批次名称 */
@Excel(name = "批次名称")
private String batchName;
/** 种质ID */
@Excel(name = "种质ID")
private Long germplasmId;
/** 地块ID */
@Excel(name = "地块ID")
private Long landId;
/** 种植面积(亩) */
@Excel(name = "种植面积", readConverterExp = "亩=")
private BigDecimal cropArea;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 负责人 */
@Excel(name = "负责人")
private Long batchHead;
/** 状态 */
private String status;
/** 排序 */
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
private String germplasmImg;
/** 租户ID */
private Long tenantId;
/** 基地ID */
private Long baseId;
/** 用户部门ID */
private Long deptId;
/** 用户ID */
private Long userId;
}

View File

@ -0,0 +1,67 @@
package com.agri.agriculture.domain;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
/**
* 雇员对象 agriculture_employee
*
* @author nealtsiao
* @date 2023-05-13
*/
@Data
public class Employee extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 雇员ID */
private Long employeeId;
/** 编码 */
@Excel(name = "编码")
private String employeeCode;
/** 姓名 */
@Excel(name = "姓名")
private String employeeName;
/** 字典 agriculture_employee_type */
@Excel(name = "字典 agriculture_employee_type")
private String employeeType;
/** 手机号码 */
@Excel(name = "手机号码")
private String employeeTel;
/** 字典 sys_user_sex */
@Excel(name = "字典 sys_user_sex")
private String employeeSex;
/** 地址 */
@Excel(name = "地址")
private String employeeAddress;
/** 状态 */
private String status;
/** 排序 */
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 租户ID */
private Long tenantId;
/** 基地ID */
private Long baseId;
/** 用户部门ID */
private Long deptId;
/** 用户ID */
private Long userId;
}

View File

@ -0,0 +1,67 @@
package com.agri.agriculture.domain;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
/**
* 种质对象 agriculture_germplasm
*
* @author nealtsiao
* @date 2023-05-13
*/
@Data
public class Germplasm extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 种质ID */
private Long germplasmId;
/** 作物名称 */
@Excel(name = "作物名称")
private String cropName;
/** 作物英文名称 */
@Excel(name = "作物英文名称")
private String cropEnName;
/** 种质名称 */
@Excel(name = "种质名称")
private String germplasmName;
/** 种质英文名称 */
@Excel(name = "种质英文名称")
private String germplasmEnName;
/** 种质图片 */
@Excel(name = "种质图片")
private String germplasmImg;
/** 宣传语 */
@Excel(name = "宣传语")
private String germplasmDes;
/** 状态 */
private String status;
/** 排序 */
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 租户ID */
private Long tenantId;
/** 基地ID */
private Long baseId;
/** 用户部门ID */
private Long deptId;
/** 用户ID */
private Long userId;
}

View File

@ -0,0 +1,139 @@
package com.agri.agriculture.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
/**
* 种质介绍对象 agriculture_germplasm_intro
*
* @author nealtsiao
* @date 2023-05-13
*/
public class GermplasmIntro extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 介绍ID */
private Long introId;
/** 种质ID */
@Excel(name = "种质ID")
private Long germplasmId;
/** 名称 */
@Excel(name = "名称")
private String introName;
/** 图片 */
@Excel(name = "图片")
private String introImg;
/** 描述 */
@Excel(name = "描述")
private String introDes;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 排序 */
@Excel(name = "排序")
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
public void setIntroId(Long introId)
{
this.introId = introId;
}
public Long getIntroId()
{
return introId;
}
public void setGermplasmId(Long germplasmId)
{
this.germplasmId = germplasmId;
}
public Long getGermplasmId()
{
return germplasmId;
}
public void setIntroName(String introName)
{
this.introName = introName;
}
public String getIntroName()
{
return introName;
}
public void setIntroImg(String introImg)
{
this.introImg = introImg;
}
public String getIntroImg()
{
return introImg;
}
public void setIntroDes(String introDes)
{
this.introDes = introDes;
}
public String getIntroDes()
{
return introDes;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setOrderNum(Long orderNum)
{
this.orderNum = orderNum;
}
public Long getOrderNum()
{
return orderNum;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("introId", getIntroId())
.append("germplasmId", getGermplasmId())
.append("introName", getIntroName())
.append("introImg", getIntroImg())
.append("introDes", getIntroDes())
.append("remark", getRemark())
.append("status", getStatus())
.append("orderNum", getOrderNum())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("delFlag", getDelFlag())
.toString();
}
}

View File

@ -0,0 +1,86 @@
package com.agri.agriculture.domain;
import java.math.BigDecimal;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
/**
* 地块对象 agriculture_land
*
* @author nealtsiao
* @date 2023-05-13
*/
@Data
public class Land extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 地块ID */
private Long landId;
/** 地块名称 */
@Excel(name = "地块名称")
private String landName;
/** 字典 agriculture_land_type */
@Excel(name = "字典 agriculture_land_type")
private String landType;
/** 地块面积 */
@Excel(name = "地块面积")
private BigDecimal landArea;
/** 边框宽度 */
@Excel(name = "边框宽度")
private Integer strokeWeight;
/** 边框颜色 */
@Excel(name = "边框颜色")
private String strokeColor;
/** 边框透明度 */
@Excel(name = "边框透明度")
private BigDecimal strokeOpacity;
/** 地块路径 */
@Excel(name = "地块路径")
private String landPath;
/** 地块背景颜色 */
@Excel(name = "地块背景颜色")
private String fillColor;
/** 地块透明度 */
@Excel(name = "地块透明度")
private BigDecimal fillOpacity;
/** 当前种植批次 */
@Excel(name = "当前种植批次")
private Long currentBatch;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 排序 */
@Excel(name = "排序")
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 租户ID */
private Long tenantId;
/** 基地ID */
private Long baseId;
/** 用户部门ID */
private Long deptId;
/** 用户ID */
private Long userId;
}

View File

@ -0,0 +1,61 @@
package com.agri.agriculture.domain;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
/**
* 机械信息对象 agriculture_machine_info
*
* @author xuweidong
* @date 2023-05-24
*/
@Data
public class MachineInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 机械ID */
private Long machineId;
/** 机械编码 */
@Excel(name = "机械编码")
private String machineCode;
/** 机械名称 */
@Excel(name = "机械名称")
private String machineName;
/** 机械类别 */
@Excel(name = "机械类别")
private Long machineTypeId;
/** 计量单位 */
@Excel(name = "计量单位")
private String measureUnit;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 排序 */
@Excel(name = "排序")
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 租户ID */
private Long tenantId;
/** 基地ID */
private Long baseId;
/** 用户部门ID */
private Long deptId;
/** 用户ID */
private Long userId;
}

View File

@ -0,0 +1,48 @@
package com.agri.agriculture.domain;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
/**
* 机械类别对象 agriculture_machine_type
*
* @author kerwincui
* @date 2023-05-24
*/
@Data
public class MachineType extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 机械类别ID */
private Long machineTypeId;
/** 机械类别名称 */
@Excel(name = "机械类别名称")
private String machineTypeName;
/** 状态 */
private String status;
/** 排序 */
@Excel(name = "排序")
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 租户ID */
private Long tenantId;
/** 基地ID */
private Long baseId;
/** 用户部门ID */
private Long deptId;
/** 用户ID */
private Long userId;
}

View File

@ -0,0 +1,61 @@
package com.agri.agriculture.domain;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
/**
* 农资信息对象 agriculture_material_info
*
* @author xuweidong
* @date 2023-05-24
*/
@Data
public class MaterialInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 农资ID */
private Long materialId;
/** 农资编码 */
@Excel(name = "农资编码")
private String materialCode;
/** 农资名称 */
@Excel(name = "农资名称")
private String materialName;
/** 农资类别 */
@Excel(name = "农资类别")
private Long materialTypeId;
/** 计量单位 */
@Excel(name = "计量单位")
private String measureUnit;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 排序 */
@Excel(name = "排序")
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 租户ID */
private Long tenantId;
/** 基地ID */
private Long baseId;
/** 用户部门ID */
private Long deptId;
/** 用户ID */
private Long userId;
}

View File

@ -0,0 +1,48 @@
package com.agri.agriculture.domain;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
/**
* 农资类别对象 agriculture_material_type
*
* @author xuweidong
* @date 2023-05-24
*/
@Data
public class MaterialType extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 农资类别ID */
private Long materialTypeId;
/** 农资类别名称 */
@Excel(name = "农资类别名称")
private String materialTypeName;
/** 状态 */
private String status;
/** 排序 */
@Excel(name = "排序")
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 租户ID */
private Long tenantId;
/** 基地ID */
private Long baseId;
/** 用户部门ID */
private Long deptId;
/** 用户ID */
private Long userId;
}

View File

@ -0,0 +1,139 @@
package com.agri.agriculture.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
/**
* 种植方法对象 agriculture_plant_method
*
* @author nealtsiao
* @date 2023-05-13
*/
public class PlantMethod extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 方法ID */
private Long methodId;
/** 种质ID */
@Excel(name = "种质ID")
private Long germplasmId;
/** 名称 */
@Excel(name = "名称")
private String methodName;
/** 图片 */
@Excel(name = "图片")
private String methodImg;
/** 描述 */
@Excel(name = "描述")
private String methodDes;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 排序 */
@Excel(name = "排序")
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
public void setMethodId(Long methodId)
{
this.methodId = methodId;
}
public Long getMethodId()
{
return methodId;
}
public void setGermplasmId(Long germplasmId)
{
this.germplasmId = germplasmId;
}
public Long getGermplasmId()
{
return germplasmId;
}
public void setMethodName(String methodName)
{
this.methodName = methodName;
}
public String getMethodName()
{
return methodName;
}
public void setMethodImg(String methodImg)
{
this.methodImg = methodImg;
}
public String getMethodImg()
{
return methodImg;
}
public void setMethodDes(String methodDes)
{
this.methodDes = methodDes;
}
public String getMethodDes()
{
return methodDes;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setOrderNum(Long orderNum)
{
this.orderNum = orderNum;
}
public Long getOrderNum()
{
return orderNum;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("methodId", getMethodId())
.append("germplasmId", getGermplasmId())
.append("methodName", getMethodName())
.append("methodImg", getMethodImg())
.append("methodDes", getMethodDes())
.append("remark", getRemark())
.append("status", getStatus())
.append("orderNum", getOrderNum())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("delFlag", getDelFlag())
.toString();
}
}

View File

@ -0,0 +1,153 @@
package com.agri.agriculture.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
/**
* 标准作业任务对象 agriculture_standard_job
*
* @author xuweidong
* @date 2023-05-24
*/
public class StandardJob extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 作业任务ID */
private Long jobId;
/** 种质ID */
@Excel(name = "种质ID")
private Long germplasmId;
/** 作业任务名称 */
@Excel(name = "作业任务名称")
private String jobName;
/** 作业周期单位0代表周 1代表天 */
@Excel(name = "作业周期单位", readConverterExp = "0=代表周,1=代表天")
private String cycleUnit;
/** 起始周/天 */
@Excel(name = "起始周/天")
private Long jobStart;
/** 结束周/天 */
@Excel(name = "结束周/天")
private Long jobFinish;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 排序 */
@Excel(name = "排序")
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
public void setJobId(Long jobId)
{
this.jobId = jobId;
}
public Long getJobId()
{
return jobId;
}
public void setGermplasmId(Long germplasmId)
{
this.germplasmId = germplasmId;
}
public Long getGermplasmId()
{
return germplasmId;
}
public void setJobName(String jobName)
{
this.jobName = jobName;
}
public String getJobName()
{
return jobName;
}
public void setCycleUnit(String cycleUnit)
{
this.cycleUnit = cycleUnit;
}
public String getCycleUnit()
{
return cycleUnit;
}
public void setJobStart(Long jobStart)
{
this.jobStart = jobStart;
}
public Long getJobStart()
{
return jobStart;
}
public void setJobFinish(Long jobFinish)
{
this.jobFinish = jobFinish;
}
public Long getJobFinish()
{
return jobFinish;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setOrderNum(Long orderNum)
{
this.orderNum = orderNum;
}
public Long getOrderNum()
{
return orderNum;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("jobId", getJobId())
.append("germplasmId", getGermplasmId())
.append("jobName", getJobName())
.append("cycleUnit", getCycleUnit())
.append("jobStart", getJobStart())
.append("jobFinish", getJobFinish())
.append("remark", getRemark())
.append("status", getStatus())
.append("orderNum", getOrderNum())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("delFlag", getDelFlag())
.toString();
}
}

View File

@ -0,0 +1,41 @@
package com.agri.agriculture.domain;
import lombok.Data;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
/**
* 批次任务工人对象 agriculture_task_employee
*
* @author xuweidong
* @date 2023-05-24
*/
@Data
public class TaskEmployee extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** ID */
private Long id;
/** 任务ID */
@Excel(name = "任务ID")
private Long taskId;
/** 雇员ID */
@Excel(name = "雇员ID")
private Long employeeId;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 排序 */
@Excel(name = "排序")
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 雇员姓名 */
private String employeeName;
}

View File

@ -0,0 +1,139 @@
package com.agri.agriculture.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
/**
* 批次任务日志对象 agriculture_task_log
*
* @author nealtsiao
* @date 2023-06-06
*/
public class TaskLog extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 日志ID */
private Long logId;
/** 任务ID */
@Excel(name = "任务ID")
private Long taskId;
/** 操作人名称 */
@Excel(name = "操作人名称")
private String operName;
/** 操作人Id */
@Excel(name = "操作人Id")
private Long operId;
/** 操作描述 */
@Excel(name = "操作描述")
private String operDes;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 排序 */
@Excel(name = "排序")
private Long orderNum;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
public void setLogId(Long logId)
{
this.logId = logId;
}
public Long getLogId()
{
return logId;
}
public void setTaskId(Long taskId)
{
this.taskId = taskId;
}
public Long getTaskId()
{
return taskId;
}
public void setOperName(String operName)
{
this.operName = operName;
}
public String getOperName()
{
return operName;
}
public void setOperId(Long operId)
{
this.operId = operId;
}
public Long getOperId()
{
return operId;
}
public void setOperDes(String operDes)
{
this.operDes = operDes;
}
public String getOperDes()
{
return operDes;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setOrderNum(Long orderNum)
{
this.orderNum = orderNum;
}
public Long getOrderNum()
{
return orderNum;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("logId", getLogId())
.append("taskId", getTaskId())
.append("operName", getOperName())
.append("operId", getOperId())
.append("operDes", getOperDes())
.append("remark", getRemark())
.append("status", getStatus())
.append("orderNum", getOrderNum())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("delFlag", getDelFlag())
.toString();
}
}

View File

@ -0,0 +1,79 @@
package com.agri.agriculture.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.agri.common.annotation.Excel;
import com.agri.common.core.domain.BaseEntity;
/**
* 种植单元对象 agriculture_unit
*
* @author nealtsiao
* @date 2024-07-26
*/
public class Unit extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 地块id */
@Excel(name = "地块id")
private Long landId;
/** 单元要素类型1设备 2监控 3种植批次 4自动化场景 其他类型可自由拓展 */
@Excel(name = "单元要素类型1设备 2监控 3种植批次 4自动化场景 其他类型可自由拓展")
private Integer type;
/** 要素id */
@Excel(name = "要素id")
private Long elementId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setLandId(Long landId)
{
this.landId = landId;
}
public Long getLandId()
{
return landId;
}
public void setType(Integer type)
{
this.type = type;
}
public Integer getType()
{
return type;
}
public void setElementId(Long elementId)
{
this.elementId = elementId;
}
public Long getElementId()
{
return elementId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("landId", getLandId())
.append("type", getType())
.append("elementId", getElementId())
.toString();
}
}

View File

@ -0,0 +1,83 @@
package com.agri.agriculture.mapper;
import java.util.List;
import com.agri.agriculture.domain.Baseinfo;
/**
* 基地信息Mapper接口
*
* @author nealtsiao
* @date 2023-05-13
*/
public interface BaseinfoMapper
{
/**
* 查询基地信息
*
* @param baseId 基地信息主键
* @return 基地信息
*/
public Baseinfo selectBaseinfoByBaseId(Long baseId);
/**
* 查询基地信息
*
* @param deptId 基地信息主键
* @return 基地信息
*/
public Baseinfo selectBaseinfoByDeptId(Long deptId);
/**
* 查询基地信息列表
*
* @param baseinfo 基地信息
* @return 基地信息集合
*/
public List<Baseinfo> selectBaseinfoList(Baseinfo baseinfo);
/**
* 根据角色查询基地信息
*
* @param baseinfo
* @return
*/
public List<Baseinfo> selectBaseinfoListByRoles(Baseinfo baseinfo);
/**
* 根据角色查询基地信息包含基地用户
* @param baseinfo
* @return
*/
public List<Baseinfo> selectBaseinfoAndUsersListByRoles(Baseinfo baseinfo);
/**
* 新增基地信息
*
* @param baseinfo 基地信息
* @return 结果
*/
public int insertBaseinfo(Baseinfo baseinfo);
/**
* 修改基地信息
*
* @param baseinfo 基地信息
* @return 结果
*/
public int updateBaseinfo(Baseinfo baseinfo);
/**
* 删除基地信息
*
* @param baseId 基地信息主键
* @return 结果
*/
public int deleteBaseinfoByBaseId(Long baseId);
/**
* 批量删除基地信息
*
* @param baseIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteBaseinfoByBaseIds(Long[] baseIds);
}

View File

@ -0,0 +1,79 @@
package com.agri.agriculture.mapper;
import java.util.HashMap;
import java.util.List;
import com.agri.agriculture.domain.BatchTask;
import org.apache.ibatis.annotations.Param;
/**
* 批次任务Mapper接口
*
* @author xuweidong
* @date 2023-05-24
*/
public interface BatchTaskMapper
{
/**
* 查询批次任务
*
* @param taskId 批次任务主键
* @return 批次任务
*/
public BatchTask selectBatchTaskByTaskId(Long taskId);
/**
* 查询批次任务列表
*
* @param batchTask 批次任务
* @return 批次任务集合
*/
public List<BatchTask> selectBatchTaskList(BatchTask batchTask);
public HashMap selectFinishTask(@Param("batchId") Long batchId);
/**
* 新增批次任务
*
* @param batchTask 批次任务
* @return 结果
*/
public int insertBatchTask(BatchTask batchTask);
/**
* 修改批次任务
*
* @param batchTask 批次任务
* @return 结果
*/
public int updateBatchTask(BatchTask batchTask);
/**
* 删除批次任务
*
* @param taskId 批次任务主键
* @return 结果
*/
public int deleteBatchTaskByTaskId(Long taskId);
/**
* 删除批次任务
* @param batchId
* @return
*/
public int deleteBatchTaskByBatchId(Long batchId);
/**
* 批量删除批次任务
*
* @param taskIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteBatchTaskByTaskIds(Long[] taskIds);
/**
* 给手机端的任务列表
* @param batchTask
* @return
*/
public List<BatchTask> selectBatchTaskListToMobile(BatchTask batchTask);
}

View File

@ -0,0 +1,61 @@
package com.agri.agriculture.mapper;
import java.util.List;
import com.agri.agriculture.domain.CostEmployee;
/**
* 人工工时Mapper接口
*
* @author xuweidong
* @date 2023-05-24
*/
public interface CostEmployeeMapper
{
/**
* 查询人工工时
*
* @param costId 人工工时主键
* @return 人工工时
*/
public CostEmployee selectCostEmployeeByCostId(Long costId);
/**
* 查询人工工时列表
*
* @param costEmployee 人工工时
* @return 人工工时集合
*/
public List<CostEmployee> selectCostEmployeeList(CostEmployee costEmployee);
/**
* 新增人工工时
*
* @param costEmployee 人工工时
* @return 结果
*/
public int insertCostEmployee(CostEmployee costEmployee);
/**
* 修改人工工时
*
* @param costEmployee 人工工时
* @return 结果
*/
public int updateCostEmployee(CostEmployee costEmployee);
/**
* 删除人工工时
*
* @param costId 人工工时主键
* @return 结果
*/
public int deleteCostEmployeeByCostId(Long costId);
/**
* 批量删除人工工时
*
* @param costIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteCostEmployeeByCostIds(Long[] costIds);
}

View File

@ -0,0 +1,61 @@
package com.agri.agriculture.mapper;
import java.util.List;
import com.agri.agriculture.domain.CostMachine;
/**
* 机械工时Mapper接口
*
* @author xuweidong
* @date 2023-05-24
*/
public interface CostMachineMapper
{
/**
* 查询机械工时
*
* @param costId 机械工时主键
* @return 机械工时
*/
public CostMachine selectCostMachineByCostId(Long costId);
/**
* 查询机械工时列表
*
* @param costMachine 机械工时
* @return 机械工时集合
*/
public List<CostMachine> selectCostMachineList(CostMachine costMachine);
/**
* 新增机械工时
*
* @param costMachine 机械工时
* @return 结果
*/
public int insertCostMachine(CostMachine costMachine);
/**
* 修改机械工时
*
* @param costMachine 机械工时
* @return 结果
*/
public int updateCostMachine(CostMachine costMachine);
/**
* 删除机械工时
*
* @param costId 机械工时主键
* @return 结果
*/
public int deleteCostMachineByCostId(Long costId);
/**
* 批量删除机械工时
*
* @param costIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteCostMachineByCostIds(Long[] costIds);
}

View File

@ -0,0 +1,69 @@
package com.agri.agriculture.mapper;
import java.util.HashMap;
import java.util.List;
import com.agri.agriculture.domain.CostMaterial;
/**
* 农资用量Mapper接口
*
* @author xuweidong
* @date 2023-05-24
*/
public interface CostMaterialMapper
{
/**
* 查询农资用量
*
* @param costId 农资用量主键
* @return 农资用量
*/
public CostMaterial selectCostMaterialByCostId(Long costId);
/**
* 查询农资用量列表
*
* @param costMaterial 农资用量
* @return 农资用量集合
*/
public List<CostMaterial> selectCostMaterialList(CostMaterial costMaterial);
/**
* 新增农资用量
*
* @param costMaterial 农资用量
* @return 结果
*/
public int insertCostMaterial(CostMaterial costMaterial);
/**
* 修改农资用量
*
* @param costMaterial 农资用量
* @return 结果
*/
public int updateCostMaterial(CostMaterial costMaterial);
/**
* 删除农资用量
*
* @param costId 农资用量主键
* @return 结果
*/
public int deleteCostMaterialByCostId(Long costId);
/**
* 批量删除农资用量
*
* @param costIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteCostMaterialByCostIds(Long[] costIds);
/**
* 手机端任务详情使用按照农资类别统计用量
* @param taskId
* @return
*/
public List<HashMap> selectMaterialGroupByMaterialName(Long taskId);
}

View File

@ -0,0 +1,69 @@
package com.agri.agriculture.mapper;
import java.util.HashMap;
import java.util.List;
import com.agri.agriculture.domain.CropBatch;
/**
* 作物批次Mapper接口
*
* @author nealtsiao
* @date 2023-05-13
*/
public interface CropBatchMapper
{
/**
* 查询作物批次
*
* @param batchId 作物批次主键
* @return 作物批次
*/
public CropBatch selectCropBatchByBatchId(Long batchId);
/**
* 查询作物批次列表
*
* @param cropBatch 作物批次
* @return 作物批次集合
*/
public List<CropBatch> selectCropBatchList(CropBatch cropBatch);
/**
* 新增作物批次
*
* @param cropBatch 作物批次
* @return 结果
*/
public int insertCropBatch(CropBatch cropBatch);
/**
* 修改作物批次
*
* @param cropBatch 作物批次
* @return 结果
*/
public int updateCropBatch(CropBatch cropBatch);
/**
* 删除作物批次
*
* @param batchId 作物批次主键
* @return 结果
*/
public int deleteCropBatchByBatchId(Long batchId);
/**
* 批量删除作物批次
*
* @param batchIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteCropBatchByBatchIds(Long[] batchIds);
/**
* 给手机端批次列表查询数据
* @param cropBatch
* @return
*/
public List<HashMap> selectCropBatchListToMobile(CropBatch cropBatch);
}

View File

@ -0,0 +1,17 @@
package com.agri.agriculture.mapper;
import java.util.HashMap;
import java.util.List;
public interface DataStatisticsMapper {
public List<HashMap> selectBaseInfo(Long baseId);
public List<HashMap> selectDeviceInfo(Long baseId);
public List<HashMap> selectDeviceAlert(Long baseId);
public List<HashMap> selectTaskInfo(Long baseId);
public List<HashMap> selectTaskInfoOfMine(Long baseId);
public List<HashMap> selectBatchInfo(Long batchHead);
//根据batchHead查询今日待完成任务
public HashMap selectToadyTaskCountByTaskHead(Long batchHead);
}

View File

@ -0,0 +1,61 @@
package com.agri.agriculture.mapper;
import java.util.List;
import com.agri.agriculture.domain.Employee;
/**
* 雇员Mapper接口
*
* @author nealtsiao
* @date 2023-05-13
*/
public interface EmployeeMapper
{
/**
* 查询雇员
*
* @param employeeId 雇员主键
* @return 雇员
*/
public Employee selectEmployeeByEmployeeId(Long employeeId);
/**
* 查询雇员列表
*
* @param employee 雇员
* @return 雇员集合
*/
public List<Employee> selectEmployeeList(Employee employee);
/**
* 新增雇员
*
* @param employee 雇员
* @return 结果
*/
public int insertEmployee(Employee employee);
/**
* 修改雇员
*
* @param employee 雇员
* @return 结果
*/
public int updateEmployee(Employee employee);
/**
* 删除雇员
*
* @param employeeId 雇员主键
* @return 结果
*/
public int deleteEmployeeByEmployeeId(Long employeeId);
/**
* 批量删除雇员
*
* @param employeeIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteEmployeeByEmployeeIds(Long[] employeeIds);
}

View File

@ -0,0 +1,61 @@
package com.agri.agriculture.mapper;
import java.util.List;
import com.agri.agriculture.domain.GermplasmIntro;
/**
* 种质介绍Mapper接口
*
* @author nealtsiao
* @date 2023-05-13
*/
public interface GermplasmIntroMapper
{
/**
* 查询种质介绍
*
* @param introId 种质介绍主键
* @return 种质介绍
*/
public GermplasmIntro selectGermplasmIntroByIntroId(Long introId);
/**
* 查询种质介绍列表
*
* @param germplasmIntro 种质介绍
* @return 种质介绍集合
*/
public List<GermplasmIntro> selectGermplasmIntroList(GermplasmIntro germplasmIntro);
/**
* 新增种质介绍
*
* @param germplasmIntro 种质介绍
* @return 结果
*/
public int insertGermplasmIntro(GermplasmIntro germplasmIntro);
/**
* 修改种质介绍
*
* @param germplasmIntro 种质介绍
* @return 结果
*/
public int updateGermplasmIntro(GermplasmIntro germplasmIntro);
/**
* 删除种质介绍
*
* @param introId 种质介绍主键
* @return 结果
*/
public int deleteGermplasmIntroByIntroId(Long introId);
/**
* 批量删除种质介绍
*
* @param introIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteGermplasmIntroByIntroIds(Long[] introIds);
}

View File

@ -0,0 +1,61 @@
package com.agri.agriculture.mapper;
import java.util.List;
import com.agri.agriculture.domain.Germplasm;
/**
* 种质Mapper接口
*
* @author nealtsiao
* @date 2023-05-13
*/
public interface GermplasmMapper
{
/**
* 查询种质
*
* @param germplasmId 种质主键
* @return 种质
*/
public Germplasm selectGermplasmByGermplasmId(Long germplasmId);
/**
* 查询种质列表
*
* @param germplasm 种质
* @return 种质集合
*/
public List<Germplasm> selectGermplasmList(Germplasm germplasm);
/**
* 新增种质
*
* @param germplasm 种质
* @return 结果
*/
public int insertGermplasm(Germplasm germplasm);
/**
* 修改种质
*
* @param germplasm 种质
* @return 结果
*/
public int updateGermplasm(Germplasm germplasm);
/**
* 删除种质
*
* @param germplasmId 种质主键
* @return 结果
*/
public int deleteGermplasmByGermplasmId(Long germplasmId);
/**
* 批量删除种质
*
* @param germplasmIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteGermplasmByGermplasmIds(Long[] germplasmIds);
}

View File

@ -0,0 +1,61 @@
package com.agri.agriculture.mapper;
import java.util.List;
import com.agri.agriculture.domain.Land;
/**
* 地块Mapper接口
*
* @author nealtsiao
* @date 2023-05-13
*/
public interface LandMapper
{
/**
* 查询地块
*
* @param landId 地块主键
* @return 地块
*/
public Land selectLandByLandId(Long landId);
/**
* 查询地块列表
*
* @param land 地块
* @return 地块集合
*/
public List<Land> selectLandList(Land land);
/**
* 新增地块
*
* @param land 地块
* @return 结果
*/
public int insertLand(Land land);
/**
* 修改地块
*
* @param land 地块
* @return 结果
*/
public int updateLand(Land land);
/**
* 删除地块
*
* @param landId 地块主键
* @return 结果
*/
public int deleteLandByLandId(Long landId);
/**
* 批量删除地块
*
* @param landIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteLandByLandIds(Long[] landIds);
}

View File

@ -0,0 +1,61 @@
package com.agri.agriculture.mapper;
import java.util.List;
import com.agri.agriculture.domain.MachineInfo;
/**
* 机械信息Mapper接口
*
* @author xuweidong
* @date 2023-05-24
*/
public interface MachineInfoMapper
{
/**
* 查询机械信息
*
* @param machineId 机械信息主键
* @return 机械信息
*/
public MachineInfo selectMachineInfoByMachineId(Long machineId);
/**
* 查询机械信息列表
*
* @param machineInfo 机械信息
* @return 机械信息集合
*/
public List<MachineInfo> selectMachineInfoList(MachineInfo machineInfo);
/**
* 新增机械信息
*
* @param machineInfo 机械信息
* @return 结果
*/
public int insertMachineInfo(MachineInfo machineInfo);
/**
* 修改机械信息
*
* @param machineInfo 机械信息
* @return 结果
*/
public int updateMachineInfo(MachineInfo machineInfo);
/**
* 删除机械信息
*
* @param machineId 机械信息主键
* @return 结果
*/
public int deleteMachineInfoByMachineId(Long machineId);
/**
* 批量删除机械信息
*
* @param machineIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteMachineInfoByMachineIds(Long[] machineIds);
}

View File

@ -0,0 +1,61 @@
package com.agri.agriculture.mapper;
import java.util.List;
import com.agri.agriculture.domain.MachineType;
/**
* 机械类别Mapper接口
*
* @author kerwincui
* @date 2023-05-24
*/
public interface MachineTypeMapper
{
/**
* 查询机械类别
*
* @param machineTypeId 机械类别主键
* @return 机械类别
*/
public MachineType selectMachineTypeByMachineTypeId(Long machineTypeId);
/**
* 查询机械类别列表
*
* @param machineType 机械类别
* @return 机械类别集合
*/
public List<MachineType> selectMachineTypeList(MachineType machineType);
/**
* 新增机械类别
*
* @param machineType 机械类别
* @return 结果
*/
public int insertMachineType(MachineType machineType);
/**
* 修改机械类别
*
* @param machineType 机械类别
* @return 结果
*/
public int updateMachineType(MachineType machineType);
/**
* 删除机械类别
*
* @param machineTypeId 机械类别主键
* @return 结果
*/
public int deleteMachineTypeByMachineTypeId(Long machineTypeId);
/**
* 批量删除机械类别
*
* @param machineTypeIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteMachineTypeByMachineTypeIds(Long[] machineTypeIds);
}

View File

@ -0,0 +1,61 @@
package com.agri.agriculture.mapper;
import java.util.List;
import com.agri.agriculture.domain.MaterialInfo;
/**
* 农资信息Mapper接口
*
* @author xuweidong
* @date 2023-05-24
*/
public interface MaterialInfoMapper
{
/**
* 查询农资信息
*
* @param materialId 农资信息主键
* @return 农资信息
*/
public MaterialInfo selectMaterialInfoByMaterialId(Long materialId);
/**
* 查询农资信息列表
*
* @param materialInfo 农资信息
* @return 农资信息集合
*/
public List<MaterialInfo> selectMaterialInfoList(MaterialInfo materialInfo);
/**
* 新增农资信息
*
* @param materialInfo 农资信息
* @return 结果
*/
public int insertMaterialInfo(MaterialInfo materialInfo);
/**
* 修改农资信息
*
* @param materialInfo 农资信息
* @return 结果
*/
public int updateMaterialInfo(MaterialInfo materialInfo);
/**
* 删除农资信息
*
* @param materialId 农资信息主键
* @return 结果
*/
public int deleteMaterialInfoByMaterialId(Long materialId);
/**
* 批量删除农资信息
*
* @param materialIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteMaterialInfoByMaterialIds(Long[] materialIds);
}

View File

@ -0,0 +1,61 @@
package com.agri.agriculture.mapper;
import java.util.List;
import com.agri.agriculture.domain.MaterialType;
/**
* 农资类别Mapper接口
*
* @author xuweidong
* @date 2023-05-24
*/
public interface MaterialTypeMapper
{
/**
* 查询农资类别
*
* @param materialTypeId 农资类别主键
* @return 农资类别
*/
public MaterialType selectMaterialTypeByMaterialTypeId(Long materialTypeId);
/**
* 查询农资类别列表
*
* @param materialType 农资类别
* @return 农资类别集合
*/
public List<MaterialType> selectMaterialTypeList(MaterialType materialType);
/**
* 新增农资类别
*
* @param materialType 农资类别
* @return 结果
*/
public int insertMaterialType(MaterialType materialType);
/**
* 修改农资类别
*
* @param materialType 农资类别
* @return 结果
*/
public int updateMaterialType(MaterialType materialType);
/**
* 删除农资类别
*
* @param materialTypeId 农资类别主键
* @return 结果
*/
public int deleteMaterialTypeByMaterialTypeId(Long materialTypeId);
/**
* 批量删除农资类别
*
* @param materialTypeIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteMaterialTypeByMaterialTypeIds(Long[] materialTypeIds);
}

View File

@ -0,0 +1,61 @@
package com.agri.agriculture.mapper;
import java.util.List;
import com.agri.agriculture.domain.PlantMethod;
/**
* 种植方法Mapper接口
*
* @author nealtsiao
* @date 2023-05-13
*/
public interface PlantMethodMapper
{
/**
* 查询种植方法
*
* @param methodId 种植方法主键
* @return 种植方法
*/
public PlantMethod selectPlantMethodByMethodId(Long methodId);
/**
* 查询种植方法列表
*
* @param plantMethod 种植方法
* @return 种植方法集合
*/
public List<PlantMethod> selectPlantMethodList(PlantMethod plantMethod);
/**
* 新增种植方法
*
* @param plantMethod 种植方法
* @return 结果
*/
public int insertPlantMethod(PlantMethod plantMethod);
/**
* 修改种植方法
*
* @param plantMethod 种植方法
* @return 结果
*/
public int updatePlantMethod(PlantMethod plantMethod);
/**
* 删除种植方法
*
* @param methodId 种植方法主键
* @return 结果
*/
public int deletePlantMethodByMethodId(Long methodId);
/**
* 批量删除种植方法
*
* @param methodIds 需要删除的数据主键集合
* @return 结果
*/
public int deletePlantMethodByMethodIds(Long[] methodIds);
}

View File

@ -0,0 +1,61 @@
package com.agri.agriculture.mapper;
import java.util.List;
import com.agri.agriculture.domain.StandardJob;
/**
* 标准作业任务Mapper接口
*
* @author xuweidong
* @date 2023-05-24
*/
public interface StandardJobMapper
{
/**
* 查询标准作业任务
*
* @param jobId 标准作业任务主键
* @return 标准作业任务
*/
public StandardJob selectStandardJobByJobId(Long jobId);
/**
* 查询标准作业任务列表
*
* @param standardJob 标准作业任务
* @return 标准作业任务集合
*/
public List<StandardJob> selectStandardJobList(StandardJob standardJob);
/**
* 新增标准作业任务
*
* @param standardJob 标准作业任务
* @return 结果
*/
public int insertStandardJob(StandardJob standardJob);
/**
* 修改标准作业任务
*
* @param standardJob 标准作业任务
* @return 结果
*/
public int updateStandardJob(StandardJob standardJob);
/**
* 删除标准作业任务
*
* @param jobId 标准作业任务主键
* @return 结果
*/
public int deleteStandardJobByJobId(Long jobId);
/**
* 批量删除标准作业任务
*
* @param jobIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteStandardJobByJobIds(Long[] jobIds);
}

View File

@ -0,0 +1,70 @@
package com.agri.agriculture.mapper;
import java.util.List;
import com.agri.agriculture.domain.TaskEmployee;
import org.apache.ibatis.annotations.Param;
/**
* 批次任务工人Mapper接口
*
* @author xuweidong
* @date 2023-05-24
*/
public interface TaskEmployeeMapper
{
/**
* 查询批次任务工人
*
* @param id 批次任务工人主键
* @return 批次任务工人
*/
public TaskEmployee selectTaskEmployeeById(Long id);
/**
* 查询批次任务工人列表
*
* @param taskEmployee 批次任务工人
* @return 批次任务工人集合
*/
public List<TaskEmployee> selectTaskEmployeeList(TaskEmployee taskEmployee);
/**
* 新增批次任务工人
*
* @param taskEmployee 批次任务工人
* @return 结果
*/
public int insertTaskEmployee(TaskEmployee taskEmployee);
/**
* 修改批次任务工人
*
* @param taskEmployee 批次任务工人
* @return 结果
*/
public int updateTaskEmployee(TaskEmployee taskEmployee);
/**
* 删除批次任务工人
*
* @param id 批次任务工人主键
* @return 结果
*/
public int deleteTaskEmployeeById(Long id);
/**
* 批量删除批次任务工人
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteTaskEmployeeByIds(Long[] ids);
/**
* 删除批次任务工人
* @param taskId
* @param employeeId
* @return
*/
public int deleteTaskEmployeeByTaskIdAndEmployeeId(@Param("taskId") Long taskId ,@Param("employeeId") Long employeeId);
}

View File

@ -0,0 +1,61 @@
package com.agri.agriculture.mapper;
import java.util.List;
import com.agri.agriculture.domain.TaskLog;
/**
* 批次任务日志Mapper接口
*
* @author nealtsiao
* @date 2023-06-06
*/
public interface TaskLogMapper
{
/**
* 查询批次任务日志
*
* @param logId 批次任务日志主键
* @return 批次任务日志
*/
public TaskLog selectTaskLogByLogId(Long logId);
/**
* 查询批次任务日志列表
*
* @param taskLog 批次任务日志
* @return 批次任务日志集合
*/
public List<TaskLog> selectTaskLogList(TaskLog taskLog);
/**
* 新增批次任务日志
*
* @param taskLog 批次任务日志
* @return 结果
*/
public int insertTaskLog(TaskLog taskLog);
/**
* 修改批次任务日志
*
* @param taskLog 批次任务日志
* @return 结果
*/
public int updateTaskLog(TaskLog taskLog);
/**
* 删除批次任务日志
*
* @param logId 批次任务日志主键
* @return 结果
*/
public int deleteTaskLogByLogId(Long logId);
/**
* 批量删除批次任务日志
*
* @param logIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteTaskLogByLogIds(Long[] logIds);
}

View File

@ -0,0 +1,56 @@
package com.agri.agriculture.mapper;
import java.util.HashMap;
import java.util.List;
import com.agri.agriculture.domain.CropBatch;
import com.agri.agriculture.domain.Unit;
import com.agri.iot.domain.AlertLog;
import com.agri.iot.domain.Device;
import com.agri.iot.domain.Scene;
/**
* 种植单元Mapper接口
*
* @author nealtsiao
* @date 2024-07-26
*/
public interface UnitMapper
{
/**
* 查询种植单元
*
* @param id 种植单元主键
* @return 种植单元
*/
public Unit selectUnitById(Long id);
/**
* 查询种植单元列表
*
* @param unit 种植单元
* @return 种植单元集合
*/
public List<Unit> selectUnitList(Unit unit);
public List<Device> selectDeviceList(Long landId);
public List<Device> selectCameraList(Long landId);
public List<HashMap> selectBatchList(Long landId);
public List<Scene> selectSceneList(Long landId);
public List<AlertLog> selectAlertLogList(Long landId);
/**
* 新增种植单元
*
* @param unit 种植单元
* @return 结果
*/
public int insertUnit(Unit unit);
/**
* 删除种植单元
*
* @param landId 种植单元主键
* @return 结果
*/
public int deleteUnitByLandId(Long landId);
}

Some files were not shown because too many files have changed in this diff Show More