From 70012d074637e665697aa13c5bf15e4cd34a696d Mon Sep 17 00:00:00 2001 From: 18650502300 <18650502300@163.com> Date: Sat, 11 Nov 2023 21:09:36 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=86=E6=88=90mybatis-plus=E3=80=81?= =?UTF-8?q?=E5=BC=95=E5=85=A5lombok?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/SysStudentController.java | 103 ++++++ .../src/main/resources/application.yml | 13 +- .../src/main/resources/banner.txt | 42 ++- AutoSprout-common/pom.xml | 15 + .../ruoyi/framework/config/MyBatisConfig.java | 132 ------- .../framework/config/MybatisPlusConfig.java | 62 ++++ .../com/ruoyi/system/domain/SysStudent.java | 130 +++++++ .../ruoyi/system/mapper/SysStudentMapper.java | 14 + .../system/service/ISysStudentService.java | 21 ++ .../service/impl/SysStudentServiceImpl.java | 42 +++ AutoSprout-ui/src/api/system/student.js | 53 +++ .../src/views/system/student/index.vue | 338 ++++++++++++++++++ AutoSprout-watering/pom.xml | 5 + .../com/ruoyi/device/domain/AsDevice.java | 225 +----------- .../ruoyi/device/domain/AsDeviceClassify.java | 39 +- .../ruoyi/device/domain/AsDeviceVersion.java | 74 +--- .../java/com/ruoyi/device/domain/AsModel.java | 105 +----- .../impl/AsDeviceClassifyServiceImpl.java | 10 +- pom.xml | 17 + 19 files changed, 854 insertions(+), 586 deletions(-) create mode 100644 AutoSprout-admin/src/main/java/com/ruoyi/web/controller/system/SysStudentController.java delete mode 100644 AutoSprout-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java create mode 100644 AutoSprout-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java create mode 100644 AutoSprout-system/src/main/java/com/ruoyi/system/domain/SysStudent.java create mode 100644 AutoSprout-system/src/main/java/com/ruoyi/system/mapper/SysStudentMapper.java create mode 100644 AutoSprout-system/src/main/java/com/ruoyi/system/service/ISysStudentService.java create mode 100644 AutoSprout-system/src/main/java/com/ruoyi/system/service/impl/SysStudentServiceImpl.java create mode 100644 AutoSprout-ui/src/api/system/student.js create mode 100644 AutoSprout-ui/src/views/system/student/index.vue diff --git a/AutoSprout-admin/src/main/java/com/ruoyi/web/controller/system/SysStudentController.java b/AutoSprout-admin/src/main/java/com/ruoyi/web/controller/system/SysStudentController.java new file mode 100644 index 0000000..0628593 --- /dev/null +++ b/AutoSprout-admin/src/main/java/com/ruoyi/web/controller/system/SysStudentController.java @@ -0,0 +1,103 @@ +package com.ruoyi.web.controller.system; + +import java.util.Arrays; +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.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.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.domain.SysStudent; +import com.ruoyi.system.service.ISysStudentService; + +/** + * 学生信息Controller + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/student") +public class SysStudentController extends BaseController +{ + @Autowired + private ISysStudentService sysStudentService; + + /** + * 查询学生信息列表 + */ + @PreAuthorize("@ss.hasPermi('system:student:list')") + @GetMapping("/list") + public TableDataInfo list(SysStudent sysStudent) + { + startPage(); + List list = sysStudentService.queryList(sysStudent); + return getDataTable(list); + } + + /** + * 导出学生信息列表 + */ + @PreAuthorize("@ss.hasPermi('system:student:export')") + @Log(title = "学生信息", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(SysStudent sysStudent) + { + List list = sysStudentService.queryList(sysStudent); + ExcelUtil util = new ExcelUtil(SysStudent.class); + return util.exportExcel(list, "student"); + } + + /** + * 获取学生信息详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:student:query')") + @GetMapping(value = "/{studentId}") + public AjaxResult getInfo(@PathVariable("studentId") Long studentId) + { + return AjaxResult.success(sysStudentService.getById(studentId)); + } + + /** + * 新增学生信息 + */ + @PreAuthorize("@ss.hasPermi('system:student:add')") + @Log(title = "学生信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysStudent sysStudent) + { + return toAjax(sysStudentService.save(sysStudent)); + } + + /** + * 修改学生信息 + */ + @PreAuthorize("@ss.hasPermi('system:student:edit')") + @Log(title = "学生信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysStudent sysStudent) + { + return toAjax(sysStudentService.updateById(sysStudent)); + } + + /** + * 删除学生信息 + */ + @PreAuthorize("@ss.hasPermi('system:student:remove')") + @Log(title = "学生信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{studentIds}") + public AjaxResult remove(@PathVariable Long[] studentIds) + { + return toAjax(sysStudentService.removeByIds(Arrays.asList(studentIds))); + } +} diff --git a/AutoSprout-admin/src/main/resources/application.yml b/AutoSprout-admin/src/main/resources/application.yml index cfe0d50..09e2e0b 100644 --- a/AutoSprout-admin/src/main/resources/application.yml +++ b/AutoSprout-admin/src/main/resources/application.yml @@ -99,8 +99,17 @@ token: # 令牌有效期(默认30分钟) expireTime: 30 -# MyBatis配置 -mybatis: +## MyBatis配置 +#mybatis: +# # 搜索指定包别名 +# typeAliasesPackage: com.ruoyi.**.domain +# # 配置mapper的扫描,找到所有的mapper.xml映射文件 +# mapperLocations: classpath*:mapper/**/*Mapper.xml +# # 加载全局的配置文件 +# configLocation: classpath:mybatis/mybatis-config.xml + +# MyBatis Plus配置 +mybatis-plus: # 搜索指定包别名 typeAliasesPackage: com.ruoyi.**.domain # 配置mapper的扫描,找到所有的mapper.xml映射文件 diff --git a/AutoSprout-admin/src/main/resources/banner.txt b/AutoSprout-admin/src/main/resources/banner.txt index 0931cb8..c2e4eb4 100644 --- a/AutoSprout-admin/src/main/resources/banner.txt +++ b/AutoSprout-admin/src/main/resources/banner.txt @@ -1,24 +1,22 @@ Application Version: ${ruoyi.version} Spring Boot Version: ${spring-boot.version} -//////////////////////////////////////////////////////////////////// -// _ooOoo_ // -// o8888888o // -// 88" . "88 // -// (| ^_^ |) // -// O\ = /O // -// ____/`---'\____ // -// .' \\| |// `. // -// / \\||| : |||// \ // -// / _||||| -:- |||||- \ // -// | | \\\ - /// | | // -// | \_| ''\---/'' | | // -// \ .-\__ `-` ___/-. / // -// ___`. .' /--.--\ `. . ___ // -// ."" '< `.___\_<|>_/___.' >'"". // -// | | : `- \`.;`\ _ /`;.`/ - ` : | | // -// \ \ `-. \_ __\ /__ _/ .-` / / // -// ========`-.____`-.___\_____/___.-`____.-'======== // -// `=---=' // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// 佛祖保佑 永不宕机 永无BUG // -//////////////////////////////////////////////////////////////////// \ No newline at end of file +/** + * .::::. + * .::::::::. + * ::::::::::: DEAR CODER!! LET ME SERVE YOU , COME ON BABY!! + * ..:::::::::::' + * '::::::::::::' + * .:::::::::: + * '::::::::::::::.. + * ..::::::::::::. + * ``:::::::::::::::: + * ::::``:::::::::' .:::. + * ::::' ':::::' .::::::::. + * .::::' :::: .:::::::'::::. + * .:::' ::::: .:::::::::' ':::::. + * .::' :::::.:::::::::' ':::::. + * .::' ::::::::::::::' ``::::. + * ...::: ::::::::::::' ``::. + * ```` ':. ':::::::::' ::::.. + * '.:::::' ':'````.. + */ \ No newline at end of file diff --git a/AutoSprout-common/pom.xml b/AutoSprout-common/pom.xml index 6d0a120..775f9ae 100644 --- a/AutoSprout-common/pom.xml +++ b/AutoSprout-common/pom.xml @@ -126,6 +126,21 @@ javax.servlet-api + + org.projectlombok + lombok + ${lombok.version} + provided + + + + + com.baomidou + mybatis-plus-boot-starter + 3.4.1 + + + \ No newline at end of file diff --git a/AutoSprout-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java b/AutoSprout-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java deleted file mode 100644 index 057c941..0000000 --- a/AutoSprout-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.ruoyi.framework.config; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import javax.sql.DataSource; -import org.apache.ibatis.io.VFS; -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.SqlSessionFactoryBean; -import org.mybatis.spring.boot.autoconfigure.SpringBootVFS; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.env.Environment; -import org.springframework.core.io.DefaultResourceLoader; -import org.springframework.core.io.Resource; -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; -import org.springframework.core.io.support.ResourcePatternResolver; -import org.springframework.core.type.classreading.CachingMetadataReaderFactory; -import org.springframework.core.type.classreading.MetadataReader; -import org.springframework.core.type.classreading.MetadataReaderFactory; -import org.springframework.util.ClassUtils; -import com.ruoyi.common.utils.StringUtils; - -/** - * Mybatis支持*匹配扫描包 - * - * @author ruoyi - */ -@Configuration -public class MyBatisConfig -{ - @Autowired - private Environment env; - - static final String DEFAULT_RESOURCE_PATTERN = "**/*.class"; - - public static String setTypeAliasesPackage(String typeAliasesPackage) - { - ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver(); - MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver); - List allResult = new ArrayList(); - try - { - for (String aliasesPackage : typeAliasesPackage.split(",")) - { - List result = new ArrayList(); - aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX - + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN; - Resource[] resources = resolver.getResources(aliasesPackage); - if (resources != null && resources.length > 0) - { - MetadataReader metadataReader = null; - for (Resource resource : resources) - { - if (resource.isReadable()) - { - metadataReader = metadataReaderFactory.getMetadataReader(resource); - try - { - result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName()); - } - catch (ClassNotFoundException e) - { - e.printStackTrace(); - } - } - } - } - if (result.size() > 0) - { - HashSet hashResult = new HashSet(result); - allResult.addAll(hashResult); - } - } - if (allResult.size() > 0) - { - typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0])); - } - else - { - throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包"); - } - } - catch (IOException e) - { - e.printStackTrace(); - } - return typeAliasesPackage; - } - - public Resource[] resolveMapperLocations(String[] mapperLocations) - { - ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver(); - List resources = new ArrayList(); - if (mapperLocations != null) - { - for (String mapperLocation : mapperLocations) - { - try - { - Resource[] mappers = resourceResolver.getResources(mapperLocation); - resources.addAll(Arrays.asList(mappers)); - } - catch (IOException e) - { - // ignore - } - } - } - return resources.toArray(new Resource[resources.size()]); - } - - @Bean - public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception - { - String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage"); - String mapperLocations = env.getProperty("mybatis.mapperLocations"); - String configLocation = env.getProperty("mybatis.configLocation"); - typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage); - VFS.addImplClass(SpringBootVFS.class); - - final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); - sessionFactory.setDataSource(dataSource); - sessionFactory.setTypeAliasesPackage(typeAliasesPackage); - sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ","))); - sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation)); - return sessionFactory.getObject(); - } -} \ No newline at end of file diff --git a/AutoSprout-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java b/AutoSprout-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java new file mode 100644 index 0000000..f712180 --- /dev/null +++ b/AutoSprout-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java @@ -0,0 +1,62 @@ +package com.ruoyi.framework.config; + +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +/** + * Mybatis Plus 配置 + * + * @author ruoyi + */ +@EnableTransactionManagement(proxyTargetClass = true) +@Configuration +public class MybatisPlusConfig +{ + @Bean + public MybatisPlusInterceptor mybatisPlusInterceptor() + { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + // 分页插件 + interceptor.addInnerInterceptor(paginationInnerInterceptor()); + // 乐观锁插件 + interceptor.addInnerInterceptor(optimisticLockerInnerInterceptor()); + // 阻断插件 + interceptor.addInnerInterceptor(blockAttackInnerInterceptor()); + return interceptor; + } + + /** + * 分页插件,自动识别数据库类型 https://baomidou.com/guide/interceptor-pagination.html + */ + public PaginationInnerInterceptor paginationInnerInterceptor() + { + PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(); + // 设置数据库类型为mysql + paginationInnerInterceptor.setDbType(DbType.MYSQL); + // 设置最大单页限制数量,默认 500 条,-1 不受限制 + paginationInnerInterceptor.setMaxLimit(-1L); + return paginationInnerInterceptor; + } + + /** + * 乐观锁插件 https://baomidou.com/guide/interceptor-optimistic-locker.html + */ + public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor() + { + return new OptimisticLockerInnerInterceptor(); + } + + /** + * 如果是对全表的删除或更新操作,就会终止该操作 https://baomidou.com/guide/interceptor-block-attack.html + */ + public BlockAttackInnerInterceptor blockAttackInnerInterceptor() + { + return new BlockAttackInnerInterceptor(); + } +} \ No newline at end of file diff --git a/AutoSprout-system/src/main/java/com/ruoyi/system/domain/SysStudent.java b/AutoSprout-system/src/main/java/com/ruoyi/system/domain/SysStudent.java new file mode 100644 index 0000000..253244f --- /dev/null +++ b/AutoSprout-system/src/main/java/com/ruoyi/system/domain/SysStudent.java @@ -0,0 +1,130 @@ +package com.ruoyi.system.domain; + +import java.io.Serializable; +import java.util.Date; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; + +/** + * 学生信息对象 sys_student + * + * @author ruoyi + */ +@TableName(value = "sys_student") +public class SysStudent implements Serializable +{ + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + /** 编号 */ + @TableId(type = IdType.AUTO) + private Long studentId; + + /** 学生名称 */ + @Excel(name = "学生名称") + private String studentName; + + /** 年龄 */ + @Excel(name = "年龄") + private Integer studentAge; + + /** 爱好(0代码 1音乐 2电影) */ + @Excel(name = "爱好", readConverterExp = "0=代码,1=音乐,2=电影") + private String studentHobby; + + /** 性别(0男 1女 2未知) */ + @Excel(name = "性别", readConverterExp = "0=男,1=女,2=未知") + private String studentSex; + + /** 状态(0正常 1停用) */ + @Excel(name = "状态", readConverterExp = "0=正常,1=停用") + private String studentStatus; + + /** 生日 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "生日", width = 30, dateFormat = "yyyy-MM-dd") + private Date studentBirthday; + + public void setStudentId(Long studentId) + { + this.studentId = studentId; + } + + public Long getStudentId() + { + return studentId; + } + public void setStudentName(String studentName) + { + this.studentName = studentName; + } + + public String getStudentName() + { + return studentName; + } + public void setStudentAge(Integer studentAge) + { + this.studentAge = studentAge; + } + + public Integer getStudentAge() + { + return studentAge; + } + public void setStudentHobby(String studentHobby) + { + this.studentHobby = studentHobby; + } + + public String getStudentHobby() + { + return studentHobby; + } + public void setStudentSex(String studentSex) + { + this.studentSex = studentSex; + } + + public String getStudentSex() + { + return studentSex; + } + public void setStudentStatus(String studentStatus) + { + this.studentStatus = studentStatus; + } + + public String getStudentStatus() + { + return studentStatus; + } + public void setStudentBirthday(Date studentBirthday) + { + this.studentBirthday = studentBirthday; + } + + public Date getStudentBirthday() + { + return studentBirthday; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("studentId", getStudentId()) + .append("studentName", getStudentName()) + .append("studentAge", getStudentAge()) + .append("studentHobby", getStudentHobby()) + .append("studentSex", getStudentSex()) + .append("studentStatus", getStudentStatus()) + .append("studentBirthday", getStudentBirthday()) + .toString(); + } +} diff --git a/AutoSprout-system/src/main/java/com/ruoyi/system/mapper/SysStudentMapper.java b/AutoSprout-system/src/main/java/com/ruoyi/system/mapper/SysStudentMapper.java new file mode 100644 index 0000000..ddb8e0b --- /dev/null +++ b/AutoSprout-system/src/main/java/com/ruoyi/system/mapper/SysStudentMapper.java @@ -0,0 +1,14 @@ +package com.ruoyi.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.system.domain.SysStudent; + +/** + * 学生信息Mapper接口 + * + * @author ruoyi + */ +public interface SysStudentMapper extends BaseMapper +{ + +} \ No newline at end of file diff --git a/AutoSprout-system/src/main/java/com/ruoyi/system/service/ISysStudentService.java b/AutoSprout-system/src/main/java/com/ruoyi/system/service/ISysStudentService.java new file mode 100644 index 0000000..fff6259 --- /dev/null +++ b/AutoSprout-system/src/main/java/com/ruoyi/system/service/ISysStudentService.java @@ -0,0 +1,21 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.system.domain.SysStudent; + +/** + * 学生信息Service接口 + * + * @author ruoyi + */ +public interface ISysStudentService extends IService +{ + /** + * 查询学生信息列表 + * + * @param sysStudent 学生信息 + * @return 学生信息集合 + */ + public List queryList(SysStudent sysStudent); +} \ No newline at end of file diff --git a/AutoSprout-system/src/main/java/com/ruoyi/system/service/impl/SysStudentServiceImpl.java b/AutoSprout-system/src/main/java/com/ruoyi/system/service/impl/SysStudentServiceImpl.java new file mode 100644 index 0000000..8e0b71f --- /dev/null +++ b/AutoSprout-system/src/main/java/com/ruoyi/system/service/impl/SysStudentServiceImpl.java @@ -0,0 +1,42 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.SysStudent; +import com.ruoyi.system.mapper.SysStudentMapper; +import com.ruoyi.system.service.ISysStudentService; + +/** + * 学生信息Service业务层处理 + * + * @author ruoyi + */ +@Service +public class SysStudentServiceImpl extends ServiceImpl implements ISysStudentService +{ + @Override + public List queryList(SysStudent sysStudent) + { + // 注意:mybatis-plus lambda 模式不支持 eclipse 的编译器 + // LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); + // queryWrapper.eq(SysStudent::getStudentName, sysStudent.getStudentName()); + QueryWrapper queryWrapper = Wrappers.query(); + if (StringUtils.isNotEmpty(sysStudent.getStudentName())) + { + queryWrapper.eq("student_name", sysStudent.getStudentName()); + } + if (StringUtils.isNotNull(sysStudent.getStudentAge())) + { + queryWrapper.eq("student_age", sysStudent.getStudentAge()); + } + if (StringUtils.isNotEmpty(sysStudent.getStudentHobby())) + { + queryWrapper.eq("student_hobby", sysStudent.getStudentHobby()); + } + return this.list(queryWrapper); + } +} \ No newline at end of file diff --git a/AutoSprout-ui/src/api/system/student.js b/AutoSprout-ui/src/api/system/student.js new file mode 100644 index 0000000..949855c --- /dev/null +++ b/AutoSprout-ui/src/api/system/student.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 查询学生信息列表 +export function listStudent(query) { + return request({ + url: '/system/student/list', + method: 'get', + params: query + }) +} + +// 查询学生信息详细 +export function getStudent(studentId) { + return request({ + url: '/system/student/' + studentId, + method: 'get' + }) +} + +// 新增学生信息 +export function addStudent(data) { + return request({ + url: '/system/student', + method: 'post', + data: data + }) +} + +// 修改学生信息 +export function updateStudent(data) { + return request({ + url: '/system/student', + method: 'put', + data: data + }) +} + +// 删除学生信息 +export function delStudent(studentId) { + return request({ + url: '/system/student/' + studentId, + method: 'delete' + }) +} + +// 导出学生信息 +export function exportStudent(query) { + return request({ + url: '/system/student/export', + method: 'get', + params: query + }) +} diff --git a/AutoSprout-ui/src/views/system/student/index.vue b/AutoSprout-ui/src/views/system/student/index.vue new file mode 100644 index 0000000..7ffe44d --- /dev/null +++ b/AutoSprout-ui/src/views/system/student/index.vue @@ -0,0 +1,338 @@ + + + diff --git a/AutoSprout-watering/pom.xml b/AutoSprout-watering/pom.xml index 4757dc0..ecf7ff7 100644 --- a/AutoSprout-watering/pom.xml +++ b/AutoSprout-watering/pom.xml @@ -29,6 +29,11 @@ Autosprout-system + + org.projectlombok + lombok + + \ No newline at end of file diff --git a/AutoSprout-watering/src/main/java/com/ruoyi/device/domain/AsDevice.java b/AutoSprout-watering/src/main/java/com/ruoyi/device/domain/AsDevice.java index 6163a03..7a9ee6b 100644 --- a/AutoSprout-watering/src/main/java/com/ruoyi/device/domain/AsDevice.java +++ b/AutoSprout-watering/src/main/java/com/ruoyi/device/domain/AsDevice.java @@ -2,8 +2,7 @@ package com.ruoyi.device.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 lombok.Data; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; @@ -13,6 +12,7 @@ import com.ruoyi.common.core.domain.BaseEntity; * @author 邱贞招 * @date 2023-11-11 */ +@Data public class AsDevice extends BaseEntity { private static final long serialVersionUID = 1L; @@ -98,225 +98,4 @@ public class AsDevice extends BaseEntity @Excel(name = "版本号") private Long version; - public void setDeviceId(Long deviceId) - { - this.deviceId = deviceId; - } - - public Long getDeviceId() - { - return deviceId; - } - public void setPicture(String picture) - { - this.picture = picture; - } - - public String getPicture() - { - return picture; - } - public void setDeviceName(String deviceName) - { - this.deviceName = deviceName; - } - - public String getDeviceName() - { - return deviceName; - } - public void setClassifyId(Long classifyId) - { - this.classifyId = classifyId; - } - - public Long getClassifyId() - { - return classifyId; - } - public void setClassifyName(String classifyName) - { - this.classifyName = classifyName; - } - - public String getClassifyName() - { - return classifyName; - } - public void setModelId(Long modelId) - { - this.modelId = modelId; - } - - public Long getModelId() - { - return modelId; - } - public void setModel(String model) - { - this.model = model; - } - - public String getModel() - { - return model; - } - public void setMac(String mac) - { - this.mac = mac; - } - - public String getMac() - { - return mac; - } - public void setActivationTime(Date activationTime) - { - this.activationTime = activationTime; - } - - public Date getActivationTime() - { - return activationTime; - } - public void setOnlineStatus(String onlineStatus) - { - this.onlineStatus = onlineStatus; - } - - public String getOnlineStatus() - { - return onlineStatus; - } - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - public void setUserName(String userName) - { - this.userName = userName; - } - - public String getUserName() - { - return userName; - } - public void setNickName(String nickName) - { - this.nickName = nickName; - } - - public String getNickName() - { - return nickName; - } - public void setRegularWatering(String regularWatering) - { - this.regularWatering = regularWatering; - } - - public String getRegularWatering() - { - return regularWatering; - } - public void setSoilMoistureOpen(String soilMoistureOpen) - { - this.soilMoistureOpen = soilMoistureOpen; - } - - public String getSoilMoistureOpen() - { - return soilMoistureOpen; - } - public void setSoilMoistureClose(String soilMoistureClose) - { - this.soilMoistureClose = soilMoistureClose; - } - - public String getSoilMoistureClose() - { - return soilMoistureClose; - } - public void setWaterIntensity(String waterIntensity) - { - this.waterIntensity = waterIntensity; - } - - public String getWaterIntensity() - { - return waterIntensity; - } - public void setPulseMode(String pulseMode) - { - this.pulseMode = pulseMode; - } - - public String getPulseMode() - { - return pulseMode; - } - public void setPulseModeParam(String pulseModeParam) - { - this.pulseModeParam = pulseModeParam; - } - - public String getPulseModeParam() - { - return pulseModeParam; - } - public void setScreenRestTime(String screenRestTime) - { - this.screenRestTime = screenRestTime; - } - - public String getScreenRestTime() - { - return screenRestTime; - } - public void setVersion(Long version) - { - this.version = version; - } - - public Long getVersion() - { - return version; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("deviceId", getDeviceId()) - .append("picture", getPicture()) - .append("deviceName", getDeviceName()) - .append("classifyId", getClassifyId()) - .append("classifyName", getClassifyName()) - .append("modelId", getModelId()) - .append("model", getModel()) - .append("mac", getMac()) - .append("activationTime", getActivationTime()) - .append("onlineStatus", getOnlineStatus()) - .append("userId", getUserId()) - .append("userName", getUserName()) - .append("nickName", getNickName()) - .append("regularWatering", getRegularWatering()) - .append("soilMoistureOpen", getSoilMoistureOpen()) - .append("soilMoistureClose", getSoilMoistureClose()) - .append("waterIntensity", getWaterIntensity()) - .append("pulseMode", getPulseMode()) - .append("pulseModeParam", getPulseModeParam()) - .append("screenRestTime", getScreenRestTime()) - .append("version", getVersion()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("remark", getRemark()) - .toString(); - } } diff --git a/AutoSprout-watering/src/main/java/com/ruoyi/device/domain/AsDeviceClassify.java b/AutoSprout-watering/src/main/java/com/ruoyi/device/domain/AsDeviceClassify.java index 8e7fcfa..ac42eda 100644 --- a/AutoSprout-watering/src/main/java/com/ruoyi/device/domain/AsDeviceClassify.java +++ b/AutoSprout-watering/src/main/java/com/ruoyi/device/domain/AsDeviceClassify.java @@ -1,8 +1,7 @@ package com.ruoyi.device.domain; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; +import lombok.Data; import com.ruoyi.common.core.domain.BaseEntity; /** @@ -11,6 +10,7 @@ import com.ruoyi.common.core.domain.BaseEntity; * @author qiuzhenzhao * @date 2023-11-11 */ +@Data public class AsDeviceClassify extends BaseEntity { private static final long serialVersionUID = 1L; @@ -23,35 +23,12 @@ public class AsDeviceClassify extends BaseEntity @Excel(name = "分类名称") private String classifyName; - public void setClassifyId(Long classifyId) - { - this.classifyId = classifyId; - } + /** 型号数 */ + @Excel(name = "型号数") + private String modelNum; - public Long getClassifyId() - { - return classifyId; - } - public void setClassifyName(String classifyName) - { - this.classifyName = classifyName; - } + /** 设备数 */ + @Excel(name = "设备数") + private String deviceNum; - public String getClassifyName() - { - return classifyName; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("classifyId", getClassifyId()) - .append("classifyName", getClassifyName()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("remark", getRemark()) - .toString(); - } } diff --git a/AutoSprout-watering/src/main/java/com/ruoyi/device/domain/AsDeviceVersion.java b/AutoSprout-watering/src/main/java/com/ruoyi/device/domain/AsDeviceVersion.java index 5be0238..e99e260 100644 --- a/AutoSprout-watering/src/main/java/com/ruoyi/device/domain/AsDeviceVersion.java +++ b/AutoSprout-watering/src/main/java/com/ruoyi/device/domain/AsDeviceVersion.java @@ -1,7 +1,6 @@ package com.ruoyi.device.domain; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; +import lombok.Data; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; @@ -11,6 +10,7 @@ import com.ruoyi.common.core.domain.BaseEntity; * @author qiuzhenzhao * @date 2023-11-11 */ +@Data public class AsDeviceVersion extends BaseEntity { private static final long serialVersionUID = 1L; @@ -39,74 +39,4 @@ public class AsDeviceVersion extends BaseEntity @Excel(name = "描述") private String describe; - public void setVersionId(Long versionId) - { - this.versionId = versionId; - } - - public Long getVersionId() - { - return versionId; - } - public void setModelId(Long modelId) - { - this.modelId = modelId; - } - - public Long getModelId() - { - return modelId; - } - public void setVersion(String version) - { - this.version = version; - } - - public String getVersion() - { - return version; - } - public void setSize(Long size) - { - this.size = size; - } - - public Long getSize() - { - return size; - } - public void setRequire(String require) - { - this.require = require; - } - - public String getRequire() - { - return require; - } - public void setDescribe(String describe) - { - this.describe = describe; - } - - public String getDescribe() - { - return describe; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("versionId", getVersionId()) - .append("modelId", getModelId()) - .append("version", getVersion()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("size", getSize()) - .append("require", getRequire()) - .append("describe", getDescribe()) - .toString(); - } } diff --git a/AutoSprout-watering/src/main/java/com/ruoyi/device/domain/AsModel.java b/AutoSprout-watering/src/main/java/com/ruoyi/device/domain/AsModel.java index dcb88d5..dd5ad95 100644 --- a/AutoSprout-watering/src/main/java/com/ruoyi/device/domain/AsModel.java +++ b/AutoSprout-watering/src/main/java/com/ruoyi/device/domain/AsModel.java @@ -1,7 +1,6 @@ package com.ruoyi.device.domain; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; +import lombok.Data; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; @@ -11,6 +10,7 @@ import com.ruoyi.common.core.domain.BaseEntity; * @author qiuzhenzhao * @date 2023-11-11 */ +@Data public class AsModel extends BaseEntity { private static final long serialVersionUID = 1L; @@ -49,105 +49,4 @@ public class AsModel extends BaseEntity @Excel(name = "产品介绍") private String introduce; - public void setModelId(Long modelId) - { - this.modelId = modelId; - } - - public Long getModelId() - { - return modelId; - } - public void setClassifyId(Long classifyId) - { - this.classifyId = classifyId; - } - - public Long getClassifyId() - { - return classifyId; - } - public void setModelName(String modelName) - { - this.modelName = modelName; - } - - public String getModelName() - { - return modelName; - } - public void setModel(String model) - { - this.model = model; - } - - public String getModel() - { - return model; - } - public void setPicture(String picture) - { - this.picture = picture; - } - - public String getPicture() - { - return picture; - } - public void setIdCode(String idCode) - { - this.idCode = idCode; - } - - public String getIdCode() - { - return idCode; - } - public void setClassifyName(String classifyName) - { - this.classifyName = classifyName; - } - - public String getClassifyName() - { - return classifyName; - } - public void setVersionId(Long versionId) - { - this.versionId = versionId; - } - - public Long getVersionId() - { - return versionId; - } - public void setIntroduce(String introduce) - { - this.introduce = introduce; - } - - public String getIntroduce() - { - return introduce; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("modelId", getModelId()) - .append("classifyId", getClassifyId()) - .append("modelName", getModelName()) - .append("model", getModel()) - .append("picture", getPicture()) - .append("idCode", getIdCode()) - .append("classifyName", getClassifyName()) - .append("versionId", getVersionId()) - .append("introduce", getIntroduce()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("remark", getRemark()) - .toString(); - } } diff --git a/AutoSprout-watering/src/main/java/com/ruoyi/device/service/impl/AsDeviceClassifyServiceImpl.java b/AutoSprout-watering/src/main/java/com/ruoyi/device/service/impl/AsDeviceClassifyServiceImpl.java index bc0acba..a4649ec 100644 --- a/AutoSprout-watering/src/main/java/com/ruoyi/device/service/impl/AsDeviceClassifyServiceImpl.java +++ b/AutoSprout-watering/src/main/java/com/ruoyi/device/service/impl/AsDeviceClassifyServiceImpl.java @@ -2,12 +2,15 @@ package com.ruoyi.device.service.impl; import java.util.List; import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.device.mapper.AsDeviceMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.device.mapper.AsDeviceClassifyMapper; import com.ruoyi.device.domain.AsDeviceClassify; import com.ruoyi.device.service.IAsDeviceClassifyService; +import javax.annotation.Resource; + /** * 设备分类Service业务层处理 * @@ -17,9 +20,12 @@ import com.ruoyi.device.service.IAsDeviceClassifyService; @Service public class AsDeviceClassifyServiceImpl implements IAsDeviceClassifyService { - @Autowired + @Resource private AsDeviceClassifyMapper asDeviceClassifyMapper; + @Resource + private AsDeviceMapper asDeviceMapper; + /** * 查询设备分类 * @@ -41,6 +47,8 @@ public class AsDeviceClassifyServiceImpl implements IAsDeviceClassifyService @Override public List selectAsDeviceClassifyList(AsDeviceClassify asDeviceClassify) { + //型号数,设备数 +// asDeviceMapper return asDeviceClassifyMapper.selectAsDeviceClassifyList(asDeviceClassify); } diff --git a/pom.xml b/pom.xml index f540c75..fd916fb 100644 --- a/pom.xml +++ b/pom.xml @@ -30,6 +30,8 @@ 4.1.2 2.3 0.9.1 + 1.18.4 + 5.7.20 @@ -134,6 +136,21 @@ kaptcha ${kaptcha.version} + + + org.projectlombok + lombok + ${lombok.version} + provided + + + + + cn.hutool + hutool-all + ${hutool.version} + +