diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysDictData.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysDictData.java index e0c4a17..5d96995 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysDictData.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/SysDictData.java @@ -52,6 +52,8 @@ public class SysDictData extends BaseEntity @Excel(name = "状态", readConverterExp = "0=正常,1=停用") private String status; + private String languageCode; + public Long getDictCode() { return dictCode; @@ -153,7 +155,15 @@ public class SysDictData extends BaseEntity { this.status = status; } - + + public String getLanguageCode() { + return languageCode; + } + + public void setLanguageCode(String languageCode) { + this.languageCode = languageCode; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-modules/hw-basic/.gitignore b/ruoyi-modules/hw-basic/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/ruoyi-modules/hw-basic/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/HwBasicApplication.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/HwBasicApplication.java new file mode 100644 index 0000000..7f593fe --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/HwBasicApplication.java @@ -0,0 +1,34 @@ +package com.ruoyi.basic; + +import com.ruoyi.common.security.annotation.EnableCustomConfig; +import com.ruoyi.common.security.annotation.EnableRyFeignClients; +import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * 系统模块 + * + * @author ruoyi + */ +@EnableCustomConfig +@EnableCustomSwagger2 +@EnableRyFeignClients +@SpringBootApplication +public class HwBasicApplication +{ + public static void main(String[] args) + { + SpringApplication.run(HwBasicApplication.class, args); + System.out.println("(♥◠‿◠)ノ゙ 物联网平台基本模块启动成功 ლ(´ڡ`ლ)゙ \n" + + " .-------. ____ __ \n" + + " | _ _ \\ \\ \\ / / \n" + + " | ( ' ) | \\ _. / ' \n" + + " |(_ o _) / _( )_ .' \n" + + " | (_,_).' __ ___(_ o _)' \n" + + " | |\\ \\ | || |(_,_)' \n" + + " | | \\ `' /| `-' / \n" + + " | | \\ / \\ / \n" + + " ''-' `'-' `-..-' "); + } +} diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/HwLanguageController.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/HwLanguageController.java new file mode 100644 index 0000000..a985dbb --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/controller/HwLanguageController.java @@ -0,0 +1,105 @@ +package com.ruoyi.basic.controller; + +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +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.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.security.annotation.RequiresPermissions; +import com.ruoyi.basic.domain.HwLanguage; +import com.ruoyi.basic.service.IHwLanguageService; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.page.TableDataInfo; + +/** + * 语言信息Controller + * + * @author xins + * @date 2023-08-24 + */ +@RestController +@RequestMapping("/language") +public class HwLanguageController extends BaseController +{ + @Autowired + private IHwLanguageService hwLanguageService; + + /** + * 查询语言信息列表 + */ + @RequiresPermissions("basic:language:list") + @GetMapping("/list") + public TableDataInfo list(HwLanguage hwLanguage) + { + startPage(); + List list = hwLanguageService.selectHwLanguageList(hwLanguage); + return getDataTable(list); + } + + /** + * 导出语言信息列表 + */ + @RequiresPermissions("basic:language:export") + @Log(title = "语言信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, HwLanguage hwLanguage) + { + List list = hwLanguageService.selectHwLanguageList(hwLanguage); + ExcelUtil util = new ExcelUtil(HwLanguage.class); + util.exportExcel(response, list, "语言信息数据"); + } + + /** + * 获取语言信息详细信息 + */ + @RequiresPermissions("basic:language:query") + @GetMapping(value = "/{languageId}") + public AjaxResult getInfo(@PathVariable("languageId") Long languageId) + { + return success(hwLanguageService.selectHwLanguageByLanguageId(languageId)); + } + + /** + * 新增语言信息 + */ + @RequiresPermissions("basic:language:add") + @Log(title = "语言信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody HwLanguage hwLanguage) + { + return toAjax(hwLanguageService.insertHwLanguage(hwLanguage)); + } + + /** + * 修改语言信息 + */ + @RequiresPermissions("basic:language:edit") + @Log(title = "语言信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody HwLanguage hwLanguage) + { + return toAjax(hwLanguageService.updateHwLanguage(hwLanguage)); + } + + /** + * 删除语言信息 + */ + @RequiresPermissions("basic:language:remove") + @Log(title = "语言信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{languageIds}") + public AjaxResult remove(@PathVariable Long[] languageIds) + { + return toAjax(hwLanguageService.deleteHwLanguageByLanguageIds(languageIds)); + } +} diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/HwLanguage.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/HwLanguage.java new file mode 100644 index 0000000..4cfe27b --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/domain/HwLanguage.java @@ -0,0 +1,107 @@ +package com.ruoyi.basic.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.core.annotation.Excel; +import com.ruoyi.common.core.web.domain.BaseEntity; + +/** + * 语言信息对象 hw_language + * + * @author xins + * @date 2023-08-24 + */ +public class HwLanguage extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 语言ID */ + private Long languageId; + + /** 语言编码(例如,zh_CN) */ + @Excel(name = "语言编码", readConverterExp = "例=如,zh_CN") + private String languageCode; + + /** 语言名称 */ + @Excel(name = "语言名称") + private String languageName; + + /** 语言代码 */ + @Excel(name = "语言代码") + private String languageLang; + + /** 语言国家 */ + @Excel(name = "语言国家") + private String languageCountry; + + /** 是否默认(1、正常 0、否) */ + @Excel(name = "是否默认", readConverterExp = "1=、正常,0=、否") + private String defaultFlag; + + public void setLanguageId(Long languageId) + { + this.languageId = languageId; + } + + public Long getLanguageId() + { + return languageId; + } + public void setLanguageCode(String languageCode) + { + this.languageCode = languageCode; + } + + public String getLanguageCode() + { + return languageCode; + } + public void setLanguageName(String languageName) + { + this.languageName = languageName; + } + + public String getLanguageName() + { + return languageName; + } + public void setLanguageLang(String languageLang) + { + this.languageLang = languageLang; + } + + public String getLanguageLang() + { + return languageLang; + } + public void setLanguageCountry(String languageCountry) + { + this.languageCountry = languageCountry; + } + + public String getLanguageCountry() + { + return languageCountry; + } + public void setDefaultFlag(String defaultFlag) + { + this.defaultFlag = defaultFlag; + } + + public String getDefaultFlag() + { + return defaultFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("languageId", getLanguageId()) + .append("languageCode", getLanguageCode()) + .append("languageName", getLanguageName()) + .append("languageLang", getLanguageLang()) + .append("languageCountry", getLanguageCountry()) + .append("defaultFlag", getDefaultFlag()) + .toString(); + } +} diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/HwLanguageMapper.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/HwLanguageMapper.java new file mode 100644 index 0000000..376c06a --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/mapper/HwLanguageMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.basic.mapper; + +import java.util.List; +import com.ruoyi.basic.domain.HwLanguage; + +/** + * 语言信息Mapper接口 + * + * @author xins + * @date 2023-08-24 + */ +public interface HwLanguageMapper +{ + /** + * 查询语言信息 + * + * @param languageId 语言信息主键 + * @return 语言信息 + */ + public HwLanguage selectHwLanguageByLanguageId(Long languageId); + + /** + * 查询语言信息列表 + * + * @param hwLanguage 语言信息 + * @return 语言信息集合 + */ + public List selectHwLanguageList(HwLanguage hwLanguage); + + /** + * 新增语言信息 + * + * @param hwLanguage 语言信息 + * @return 结果 + */ + public int insertHwLanguage(HwLanguage hwLanguage); + + /** + * 修改语言信息 + * + * @param hwLanguage 语言信息 + * @return 结果 + */ + public int updateHwLanguage(HwLanguage hwLanguage); + + /** + * 删除语言信息 + * + * @param languageId 语言信息主键 + * @return 结果 + */ + public int deleteHwLanguageByLanguageId(Long languageId); + + /** + * 批量删除语言信息 + * + * @param languageIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteHwLanguageByLanguageIds(Long[] languageIds); +} diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/IHwLanguageService.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/IHwLanguageService.java new file mode 100644 index 0000000..00f67de --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/IHwLanguageService.java @@ -0,0 +1,61 @@ +package com.ruoyi.basic.service; + +import java.util.List; +import com.ruoyi.basic.domain.HwLanguage; + +/** + * 语言信息Service接口 + * + * @author xins + * @date 2023-08-24 + */ +public interface IHwLanguageService +{ + /** + * 查询语言信息 + * + * @param languageId 语言信息主键 + * @return 语言信息 + */ + public HwLanguage selectHwLanguageByLanguageId(Long languageId); + + /** + * 查询语言信息列表 + * + * @param hwLanguage 语言信息 + * @return 语言信息集合 + */ + public List selectHwLanguageList(HwLanguage hwLanguage); + + /** + * 新增语言信息 + * + * @param hwLanguage 语言信息 + * @return 结果 + */ + public int insertHwLanguage(HwLanguage hwLanguage); + + /** + * 修改语言信息 + * + * @param hwLanguage 语言信息 + * @return 结果 + */ + public int updateHwLanguage(HwLanguage hwLanguage); + + /** + * 批量删除语言信息 + * + * @param languageIds 需要删除的语言信息主键集合 + * @return 结果 + */ + public int deleteHwLanguageByLanguageIds(Long[] languageIds); + + /** + * 删除语言信息信息 + * + * @param languageId 语言信息主键 + * @return 结果 + */ + public int deleteHwLanguageByLanguageId(Long languageId); +} diff --git a/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/HwLanguageServiceImpl.java b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/HwLanguageServiceImpl.java new file mode 100644 index 0000000..9c4486d --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/java/com/ruoyi/basic/service/impl/HwLanguageServiceImpl.java @@ -0,0 +1,93 @@ +package com.ruoyi.basic.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.basic.mapper.HwLanguageMapper; +import com.ruoyi.basic.domain.HwLanguage; +import com.ruoyi.basic.service.IHwLanguageService; + +/** + * 语言信息Service业务层处理 + * + * @author xins + * @date 2023-08-24 + */ +@Service +public class HwLanguageServiceImpl implements IHwLanguageService +{ + @Autowired + private HwLanguageMapper hwLanguageMapper; + + /** + * 查询语言信息 + * + * @param languageId 语言信息主键 + * @return 语言信息 + */ + @Override + public HwLanguage selectHwLanguageByLanguageId(Long languageId) + { + return hwLanguageMapper.selectHwLanguageByLanguageId(languageId); + } + + /** + * 查询语言信息列表 + * + * @param hwLanguage 语言信息 + * @return 语言信息 + */ + @Override + public List selectHwLanguageList(HwLanguage hwLanguage) + { + return hwLanguageMapper.selectHwLanguageList(hwLanguage); + } + + /** + * 新增语言信息 + * + * @param hwLanguage 语言信息 + * @return 结果 + */ + @Override + public int insertHwLanguage(HwLanguage hwLanguage) + { + return hwLanguageMapper.insertHwLanguage(hwLanguage); + } + + /** + * 修改语言信息 + * + * @param hwLanguage 语言信息 + * @return 结果 + */ + @Override + public int updateHwLanguage(HwLanguage hwLanguage) + { + return hwLanguageMapper.updateHwLanguage(hwLanguage); + } + + /** + * 批量删除语言信息 + * + * @param languageIds 需要删除的语言信息主键 + * @return 结果 + */ + @Override + public int deleteHwLanguageByLanguageIds(Long[] languageIds) + { + return hwLanguageMapper.deleteHwLanguageByLanguageIds(languageIds); + } + + /** + * 删除语言信息信息 + * + * @param languageId 语言信息主键 + * @return 结果 + */ + @Override + public int deleteHwLanguageByLanguageId(Long languageId) + { + return hwLanguageMapper.deleteHwLanguageByLanguageId(languageId); + } +} diff --git a/ruoyi-modules/hw-basic/src/main/resources/banner.txt b/ruoyi-modules/hw-basic/src/main/resources/banner.txt new file mode 100644 index 0000000..fbd45f5 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/resources/banner.txt @@ -0,0 +1,10 @@ +Spring Boot Version: ${spring-boot.version} +Spring Application Name: ${spring.application.name} + _ _ + (_) | | + _ __ _ _ ___ _ _ _ ______ ___ _ _ ___ | |_ ___ _ __ ___ +| '__|| | | | / _ \ | | | || ||______|/ __|| | | |/ __|| __| / _ \| '_ ` _ \ +| | | |_| || (_) || |_| || | \__ \| |_| |\__ \| |_ | __/| | | | | | +|_| \__,_| \___/ \__, ||_| |___/ \__, ||___/ \__| \___||_| |_| |_| + __/ | __/ | + |___/ |___/ \ No newline at end of file diff --git a/ruoyi-modules/hw-basic/src/main/resources/bootstrap.yml b/ruoyi-modules/hw-basic/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..c36045a --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/resources/bootstrap.yml @@ -0,0 +1,25 @@ +# Tomcat +server: + port: 9600 + +# Spring +spring: + application: + # 应用名称 + name: hw-basic + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 127.0.0.1:8848 + config: + # 配置中心地址 + server-addr: 127.0.0.1:8848 + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} diff --git a/ruoyi-modules/hw-basic/src/main/resources/logback.xml b/ruoyi-modules/hw-basic/src/main/resources/logback.xml new file mode 100644 index 0000000..7236458 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/resources/logback.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwDictDataLanguageMapper.xml b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwDictDataLanguageMapper.xml new file mode 100644 index 0000000..27a7df7 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwDictDataLanguageMapper.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + select data_language_id, dict_code, dict_label, language_code from hw_dict_data_language + + + + + + + + insert into hw_dict_data_language + + dict_code, + dict_label, + language_code, + + + #{dictCode}, + #{dictLabel}, + #{languageCode}, + + + + + update hw_dict_data_language + + dict_code = #{dictCode}, + dict_label = #{dictLabel}, + language_code = #{languageCode}, + + where data_language_id = #{dataLanguageId} + + + + delete from hw_dict_data_language where data_language_id = #{dataLanguageId} + + + + delete from hw_dict_data_language where data_language_id in + + #{dataLanguageId} + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwDictDataMapper.xml b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwDictDataMapper.xml new file mode 100644 index 0000000..f7e6af6 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwDictDataMapper.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark from hw_dict_data + + + + + + + + + + + + insert into hw_dict_data + + dict_sort, + dict_label, + dict_value, + dict_type, + css_class, + list_class, + is_default, + status, + create_by, + create_time, + update_by, + update_time, + remark, + + + #{dictSort}, + #{dictLabel}, + #{dictValue}, + #{dictType}, + #{cssClass}, + #{listClass}, + #{isDefault}, + #{status}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update hw_dict_data + + dict_sort = #{dictSort}, + dict_label = #{dictLabel}, + dict_value = #{dictValue}, + dict_type = #{dictType}, + css_class = #{cssClass}, + list_class = #{listClass}, + is_default = #{isDefault}, + status = #{status}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where dict_code = #{dictCode} + + + + delete from hw_dict_data where dict_code = #{dictCode} + + + + delete from hw_dict_data where dict_code in + + #{dictCode} + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwDictTypeMapper.xml b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwDictTypeMapper.xml new file mode 100644 index 0000000..448d66e --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwDictTypeMapper.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + select dict_id, dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark from hw_dict_type + + + + + + + + insert into hw_dict_type + + dict_name, + dict_type, + status, + create_by, + create_time, + update_by, + update_time, + remark, + + + #{dictName}, + #{dictType}, + #{status}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update hw_dict_type + + dict_name = #{dictName}, + dict_type = #{dictType}, + status = #{status}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where dict_id = #{dictId} + + + + delete from hw_dict_type where dict_id = #{dictId} + + + + delete from hw_dict_type where dict_id in + + #{dictId} + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwLanguageMapper.xml b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwLanguageMapper.xml new file mode 100644 index 0000000..de79b87 --- /dev/null +++ b/ruoyi-modules/hw-basic/src/main/resources/mapper/basic/HwLanguageMapper.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + select language_id, language_code, language_name, language_lang, language_country, default_flag from hw_language + + + + + + + + insert into hw_language + + language_code, + language_name, + language_lang, + language_country, + default_flag, + + + #{languageCode}, + #{languageName}, + #{languageLang}, + #{languageCountry}, + #{defaultFlag}, + + + + + update hw_language + + language_code = #{languageCode}, + language_name = #{languageName}, + language_lang = #{languageLang}, + language_country = #{languageCountry}, + default_flag = #{defaultFlag}, + + where language_id = #{languageId} + + + + delete from hw_language where language_id = #{languageId} + + + + delete from hw_language where language_id in + + #{languageId} + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-business/pom.xml b/ruoyi-modules/hw-business/pom.xml index 7f65eaf..d193c8e 100644 --- a/ruoyi-modules/hw-business/pom.xml +++ b/ruoyi-modules/hw-business/pom.xml @@ -78,6 +78,11 @@ ruoyi-common-swagger + + com.ruoyi + ruoyi-api-system + + com.ruoyi diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java new file mode 100644 index 0000000..b5b8c91 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java @@ -0,0 +1,105 @@ +package com.ruoyi.business.controller; + +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +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.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.security.annotation.RequiresPermissions; +import com.ruoyi.business.domain.HwDevice; +import com.ruoyi.business.service.IHwDeviceService; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.page.TableDataInfo; + +/** + * 设备信息Controller + * + * @author xins + * @date 2023-08-24 + */ +@RestController +@RequestMapping("/device") +public class HwDeviceController extends BaseController +{ + @Autowired + private IHwDeviceService hwDeviceService; + + /** + * 查询设备信息列表 + */ + @RequiresPermissions("business:device:list") + @GetMapping("/list") + public TableDataInfo list(HwDevice hwDevice) + { + startPage(); + List list = hwDeviceService.selectHwDeviceList(hwDevice); + return getDataTable(list); + } + + /** + * 导出设备信息列表 + */ + @RequiresPermissions("business:device:export") + @Log(title = "设备信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, HwDevice hwDevice) + { + List list = hwDeviceService.selectHwDeviceList(hwDevice); + ExcelUtil util = new ExcelUtil(HwDevice.class); + util.exportExcel(response, list, "设备信息数据"); + } + + /** + * 获取设备信息详细信息 + */ + @RequiresPermissions("business:device:query") + @GetMapping(value = "/{deviceId}") + public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) + { + return success(hwDeviceService.selectHwDeviceByDeviceId(deviceId)); + } + + /** + * 新增设备信息 + */ + @RequiresPermissions("business:device:add") + @Log(title = "设备信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody HwDevice hwDevice) + { + return toAjax(hwDeviceService.insertHwDevice(hwDevice)); + } + + /** + * 修改设备信息 + */ + @RequiresPermissions("business:device:edit") + @Log(title = "设备信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody HwDevice hwDevice) + { + return toAjax(hwDeviceService.updateHwDevice(hwDevice)); + } + + /** + * 删除设备信息 + */ + @RequiresPermissions("business:device:remove") + @Log(title = "设备信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{deviceIds}") + public AjaxResult remove(@PathVariable Long[] deviceIds) + { + return toAjax(hwDeviceService.deleteHwDeviceByDeviceIds(deviceIds)); + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwSceneController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwSceneController.java new file mode 100644 index 0000000..d472540 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwSceneController.java @@ -0,0 +1,114 @@ +package com.ruoyi.business.controller; + +import java.util.List; +import java.io.IOException; +import java.util.Locale; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.i18n.utils.MessageUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.security.annotation.RequiresPermissions; +import com.ruoyi.business.domain.HwScene; +import com.ruoyi.business.service.IHwSceneService; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.page.TableDataInfo; + +/** + * 场景信息Controller + * + * @author xins + * @date 2023-08-23 + */ +@RestController +@RequestMapping("/scene") +public class HwSceneController extends BaseController +{ + @Autowired + private IHwSceneService hwSceneService; + + @ResponseBody + @RequestMapping("getLanDemo") + public String getLanDemo(HttpServletResponse response) { + Locale locale = LocaleContextHolder.getLocale(); + System.out.println(locale.getLanguage()+"---"+locale.getCountry()); + return MessageUtils.getMessage("user.login.username"); + + } + + /** + * 查询场景信息列表 + */ + @RequiresPermissions("business:scene:list") + @GetMapping("/list") + public TableDataInfo list(HwScene hwScene) + { + startPage(); + List list = hwSceneService.selectHwSceneList(hwScene); + return getDataTable(list); + } + + /** + * 导出场景信息列表 + */ + @RequiresPermissions("business:scene:export") + @Log(title = "场景信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, HwScene hwScene) + { + List list = hwSceneService.selectHwSceneList(hwScene); + ExcelUtil util = new ExcelUtil(HwScene.class); + util.exportExcel(response, list, "场景信息数据"); + } + + /** + * 获取场景信息详细信息 + */ + @RequiresPermissions("business:scene:query") + @GetMapping(value = "/{sceneId}") + public AjaxResult getInfo(@PathVariable("sceneId") Long sceneId) + { + return success(hwSceneService.selectHwSceneBySceneId(sceneId)); + } + + /** + * 新增场景信息 + */ + @RequiresPermissions("business:scene:add") + @Log(title = "场景信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody @Validated HwScene hwScene) + { + return toAjax(hwSceneService.insertHwScene(hwScene)); + } + + /** + * 修改场景信息 + */ + @RequiresPermissions("business:scene:edit") + @Log(title = "场景信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody HwScene hwScene) + { + return toAjax(hwSceneService.updateHwScene(hwScene)); + } + + /** + * 删除场景信息 + */ + @RequiresPermissions("business:scene:remove") + @Log(title = "场景信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{sceneIds}") + public AjaxResult remove(@PathVariable Long[] sceneIds) + { + return toAjax(hwSceneService.deleteHwSceneBySceneIds(sceneIds)); + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDevice.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDevice.java new file mode 100644 index 0000000..8f1c3fd --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDevice.java @@ -0,0 +1,340 @@ +package com.ruoyi.business.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.ruoyi.common.core.annotation.Excel; +import com.ruoyi.common.core.web.domain.BaseEntity; + +/** + * 设备信息对象 hw_device + * + * @author xins + * @date 2023-08-24 + */ +public class HwDevice extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 设备ID */ + private Long deviceId; + + /** 设备编号 */ + @Excel(name = "设备编号") + private String deviceCode; + + /** 设备名称 */ + @Excel(name = "设备名称") + private String deviceName; + + /** 所属场景,关联hw_scene表的scene_id字段 */ + @Excel(name = "所属场景,关联hw_scene表的scene_id字段") + private Long sceneId; + + /** 所属监控单元,关联表hw_monitor_unit字段monitor_unit_id */ + @Excel(name = "所属监控单元,关联表hw_monitor_unit字段monitor_unit_id") + private Long monitorUnitId; + + /** 设备类型(1:网关设备,2:网关子设备,3:直连设备) */ + @Excel(name = "设备类型", readConverterExp = "1=:网关设备,2:网关子设备,3:直连设备") + private String deviceType; + + /** 联网方式(1:Wi-Fi,2、蜂窝(2G/3G/4G/5G),3、以太网,4、其他) */ + @Excel(name = "联网方式(1:Wi-Fi,2、蜂窝(2G/3G/4G/5G),3、以太网,4、其他)") + private String networkingMode; + + /** 接入协议(1、MQTT) */ + @Excel(name = "接入协议", readConverterExp = "1=、MQTT") + private Long accessProtocol; + + /** 数据格式(1、Json) */ + @Excel(name = "数据格式", readConverterExp = "1=、Json") + private Long dataFormat; + + /** 关联设备,hw_device表中国的device_id */ + @Excel(name = "关联设备,hw_device表中国的device_id") + private Long releatedDeviceId; + + /** 设备模型,关联表hw_device_mode的字段device_mode_id */ + @Excel(name = "设备模型,关联表hw_device_mode的字段device_mode_id") + private Long deviceModeId; + + /** 接入网关协议(1、Modbus) + OPC-UA,Modbus,北向接入(阿里云、小度接入),南向接入,视频类接入,通道类接入,自定义接入 */ + @Excel(name = "接入网关协议", readConverterExp = "1=、Modbus") + private Long accessGwProtocol; + + /** 激活状态(1、激活,0、未激活) */ + @Excel(name = "激活状态", readConverterExp = "1=、激活,0、未激活") + private String activeStatus; + + /** 设备状态(0、测试,1、发布,9、删除) */ + @Excel(name = "设备状态", readConverterExp = "0=、测试,1、发布,9、删除") + private String deviceStatus; + + /** 设备激活时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "设备激活时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date activeTime; + + /** 设备图片地址(如果为空则可以使用设备模型图片) */ + @Excel(name = "设备图片地址", readConverterExp = "如=果为空则可以使用设备模型图片") + private String devicePic; + + /** 网络地址 */ + @Excel(name = "网络地址") + private String ipAddress; + + /** 预留字段,设备所在区域ID,关联表hw_area字段area_id) */ + @Excel(name = "预留字段,设备所在区域ID,关联表hw_area字段area_id)") + private Long areaId; + + /** 预留字段,设备位置(手动定位(在地图上选择设备所在的固定位置),自动定位(设备自动定位位置,关联网关自动定位位置。目前仅G780V2(固件版本V2.2.0之后)、PLCNET510、G800 V2和ModbusRTU(云端轮询)定位型变量支持选择自动定位功能)) */ + @Excel(name = "预留字段,设备位置", readConverterExp = "手=动定位(在地图上选择设备所在的固定位置") + private String deviceLocation; + + /** 当前固件版本(Linux系统) */ + @Excel(name = "当前固件版本(Linux系统)") + private String currentModuleVersion; + + /** 当前单片机固件版本 */ + @Excel(name = "当前单片机固件版本") + private String currentSinglechipVersion; + + /** 预留字段 */ + @Excel(name = "预留字段") + private String deviceField; + + public void setDeviceId(Long deviceId) + { + this.deviceId = deviceId; + } + + public Long getDeviceId() + { + return deviceId; + } + public void setDeviceCode(String deviceCode) + { + this.deviceCode = deviceCode; + } + + public String getDeviceCode() + { + return deviceCode; + } + public void setDeviceName(String deviceName) + { + this.deviceName = deviceName; + } + + public String getDeviceName() + { + return deviceName; + } + public void setSceneId(Long sceneId) + { + this.sceneId = sceneId; + } + + public Long getSceneId() + { + return sceneId; + } + public void setMonitorUnitId(Long monitorUnitId) + { + this.monitorUnitId = monitorUnitId; + } + + public Long getMonitorUnitId() + { + return monitorUnitId; + } + public void setDeviceType(String deviceType) + { + this.deviceType = deviceType; + } + + public String getDeviceType() + { + return deviceType; + } + public void setNetworkingMode(String networkingMode) + { + this.networkingMode = networkingMode; + } + + public String getNetworkingMode() + { + return networkingMode; + } + public void setAccessProtocol(Long accessProtocol) + { + this.accessProtocol = accessProtocol; + } + + public Long getAccessProtocol() + { + return accessProtocol; + } + public void setDataFormat(Long dataFormat) + { + this.dataFormat = dataFormat; + } + + public Long getDataFormat() + { + return dataFormat; + } + public void setReleatedDeviceId(Long releatedDeviceId) + { + this.releatedDeviceId = releatedDeviceId; + } + + public Long getReleatedDeviceId() + { + return releatedDeviceId; + } + public void setDeviceModeId(Long deviceModeId) + { + this.deviceModeId = deviceModeId; + } + + public Long getDeviceModeId() + { + return deviceModeId; + } + public void setAccessGwProtocol(Long accessGwProtocol) + { + this.accessGwProtocol = accessGwProtocol; + } + + public Long getAccessGwProtocol() + { + return accessGwProtocol; + } + public void setActiveStatus(String activeStatus) + { + this.activeStatus = activeStatus; + } + + public String getActiveStatus() + { + return activeStatus; + } + public void setDeviceStatus(String deviceStatus) + { + this.deviceStatus = deviceStatus; + } + + public String getDeviceStatus() + { + return deviceStatus; + } + public void setActiveTime(Date activeTime) + { + this.activeTime = activeTime; + } + + public Date getActiveTime() + { + return activeTime; + } + public void setDevicePic(String devicePic) + { + this.devicePic = devicePic; + } + + public String getDevicePic() + { + return devicePic; + } + public void setIpAddress(String ipAddress) + { + this.ipAddress = ipAddress; + } + + public String getIpAddress() + { + return ipAddress; + } + public void setAreaId(Long areaId) + { + this.areaId = areaId; + } + + public Long getAreaId() + { + return areaId; + } + public void setDeviceLocation(String deviceLocation) + { + this.deviceLocation = deviceLocation; + } + + public String getDeviceLocation() + { + return deviceLocation; + } + public void setCurrentModuleVersion(String currentModuleVersion) + { + this.currentModuleVersion = currentModuleVersion; + } + + public String getCurrentModuleVersion() + { + return currentModuleVersion; + } + public void setCurrentSinglechipVersion(String currentSinglechipVersion) + { + this.currentSinglechipVersion = currentSinglechipVersion; + } + + public String getCurrentSinglechipVersion() + { + return currentSinglechipVersion; + } + public void setDeviceField(String deviceField) + { + this.deviceField = deviceField; + } + + public String getDeviceField() + { + return deviceField; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("deviceId", getDeviceId()) + .append("deviceCode", getDeviceCode()) + .append("deviceName", getDeviceName()) + .append("sceneId", getSceneId()) + .append("monitorUnitId", getMonitorUnitId()) + .append("deviceType", getDeviceType()) + .append("networkingMode", getNetworkingMode()) + .append("accessProtocol", getAccessProtocol()) + .append("dataFormat", getDataFormat()) + .append("releatedDeviceId", getReleatedDeviceId()) + .append("deviceModeId", getDeviceModeId()) + .append("accessGwProtocol", getAccessGwProtocol()) + .append("activeStatus", getActiveStatus()) + .append("deviceStatus", getDeviceStatus()) + .append("activeTime", getActiveTime()) + .append("devicePic", getDevicePic()) + .append("ipAddress", getIpAddress()) + .append("areaId", getAreaId()) + .append("deviceLocation", getDeviceLocation()) + .append("currentModuleVersion", getCurrentModuleVersion()) + .append("currentSinglechipVersion", getCurrentSinglechipVersion()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("deviceField", getDeviceField()) + .toString(); + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwScene.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwScene.java new file mode 100644 index 0000000..a9a2c2e --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwScene.java @@ -0,0 +1,242 @@ +package com.ruoyi.business.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.core.annotation.Excel; +import com.ruoyi.common.core.web.domain.BaseEntity; + +import javax.validation.constraints.NotNull; + +/** + * 场景信息对象 hw_scene + * + * @author xins + * @date 2023-08-23 + */ +public class HwScene extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 场景ID */ + private Long sceneId; + + /** 场景名称 */ + @Excel(name = "场景名称") + private String sceneName; + + /** 租户ID,关联hw_tenant的tenant_id */ + @Excel(name = "租户ID,关联hw_tenant的tenant_id") + private Long tenantId; + + /** 场景类型,关联表hw_scene_mode的scene_mode_id */ + @Excel(name = "场景类型,关联表hw_scene_mode的scene_mode_id") + private Long sceneModeId; + + /** 场景图片地址 */ + @Excel(name = "场景图片地址") + private String scenePic; + + /** 是否默认(1、正常 0、否) */ + @Excel(name = "是否默认", readConverterExp = "1=、正常,0=、否") + private String defaultFlag; + + /** 状态(1、正常 9、删除) */ + @NotNull(message = "{user.login.username}") + @Excel(name = "状态", readConverterExp = "1=、正常,9=、删除") + private String sceneStatus; + + /** 认证方式(1、密钥认证) */ + @Excel(name = "认证方式", readConverterExp = "1=、密钥认证") + private String authMode; + + /** 场景账号(暂时不用) */ + @Excel(name = "场景账号", readConverterExp = "暂=时不用") + private String modeAccount; + + /** 场景key(一场景一密) */ + @Excel(name = "场景key", readConverterExp = "一=场景一密") + private String modeKey; + + /** 场景secret */ + @Excel(name = "场景secret") + private String modeSecret; + + /** 保存周期(单位:天)默认90天 */ + @Excel(name = "保存周期(单位:天)默认90天") + private BigDecimal preserveTime; + + /** 测试环境保存周期(单位:天)默认30天 */ + @Excel(name = "测试环境保存周期(单位:天)默认30天") + private BigDecimal testPreserveTime; + + /** 预留字段,租户环境(0:测试环境,1:正式环境) */ + @Excel(name = "预留字段,租户环境", readConverterExp = "0=:测试环境,1:正式环境") + private String sceneEnvironment; + + /** 预留字段 */ + @Excel(name = "预留字段") + private String sceneField; + + public void setSceneId(Long sceneId) + { + this.sceneId = sceneId; + } + + public Long getSceneId() + { + return sceneId; + } + public void setSceneName(String sceneName) + { + this.sceneName = sceneName; + } + + public String getSceneName() + { + return sceneName; + } + public void setTenantId(Long tenantId) + { + this.tenantId = tenantId; + } + + public Long getTenantId() + { + return tenantId; + } + public void setSceneModeId(Long sceneModeId) + { + this.sceneModeId = sceneModeId; + } + + public Long getSceneModeId() + { + return sceneModeId; + } + public void setScenePic(String scenePic) + { + this.scenePic = scenePic; + } + + public String getScenePic() + { + return scenePic; + } + public void setDefaultFlag(String defaultFlag) + { + this.defaultFlag = defaultFlag; + } + + public String getDefaultFlag() + { + return defaultFlag; + } + public void setSceneStatus(String sceneStatus) + { + this.sceneStatus = sceneStatus; + } + + public String getSceneStatus() + { + return sceneStatus; + } + public void setAuthMode(String authMode) + { + this.authMode = authMode; + } + + public String getAuthMode() + { + return authMode; + } + public void setModeAccount(String modeAccount) + { + this.modeAccount = modeAccount; + } + + public String getModeAccount() + { + return modeAccount; + } + public void setModeKey(String modeKey) + { + this.modeKey = modeKey; + } + + public String getModeKey() + { + return modeKey; + } + public void setModeSecret(String modeSecret) + { + this.modeSecret = modeSecret; + } + + public String getModeSecret() + { + return modeSecret; + } + public void setPreserveTime(BigDecimal preserveTime) + { + this.preserveTime = preserveTime; + } + + public BigDecimal getPreserveTime() + { + return preserveTime; + } + public void setTestPreserveTime(BigDecimal testPreserveTime) + { + this.testPreserveTime = testPreserveTime; + } + + public BigDecimal getTestPreserveTime() + { + return testPreserveTime; + } + public void setSceneEnvironment(String sceneEnvironment) + { + this.sceneEnvironment = sceneEnvironment; + } + + public String getSceneEnvironment() + { + return sceneEnvironment; + } + public void setSceneField(String sceneField) + { + this.sceneField = sceneField; + } + + public String getSceneField() + { + return sceneField; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("sceneId", getSceneId()) + .append("sceneName", getSceneName()) + .append("tenantId", getTenantId()) + .append("sceneModeId", getSceneModeId()) + .append("scenePic", getScenePic()) + .append("defaultFlag", getDefaultFlag()) + .append("sceneStatus", getSceneStatus()) + .append("authMode", getAuthMode()) + .append("modeAccount", getModeAccount()) + .append("modeKey", getModeKey()) + .append("modeSecret", getModeSecret()) + .append("preserveTime", getPreserveTime()) + .append("testPreserveTime", getTestPreserveTime()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("sceneEnvironment", getSceneEnvironment()) + .append("sceneField", getSceneField()) + .toString(); + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceMapper.java new file mode 100644 index 0000000..6bd4696 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.business.mapper; + +import java.util.List; +import com.ruoyi.business.domain.HwDevice; + +/** + * 设备信息Mapper接口 + * + * @author xins + * @date 2023-08-24 + */ +public interface HwDeviceMapper +{ + /** + * 查询设备信息 + * + * @param deviceId 设备信息主键 + * @return 设备信息 + */ + public HwDevice selectHwDeviceByDeviceId(Long deviceId); + + /** + * 查询设备信息列表 + * + * @param hwDevice 设备信息 + * @return 设备信息集合 + */ + public List selectHwDeviceList(HwDevice hwDevice); + + /** + * 新增设备信息 + * + * @param hwDevice 设备信息 + * @return 结果 + */ + public int insertHwDevice(HwDevice hwDevice); + + /** + * 修改设备信息 + * + * @param hwDevice 设备信息 + * @return 结果 + */ + public int updateHwDevice(HwDevice hwDevice); + + /** + * 删除设备信息 + * + * @param deviceId 设备信息主键 + * @return 结果 + */ + public int deleteHwDeviceByDeviceId(Long deviceId); + + /** + * 批量删除设备信息 + * + * @param deviceIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteHwDeviceByDeviceIds(Long[] deviceIds); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwSceneMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwSceneMapper.java new file mode 100644 index 0000000..ecaeea9 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwSceneMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.business.mapper; + +import java.util.List; +import com.ruoyi.business.domain.HwScene; + +/** + * 场景信息Mapper接口 + * + * @author xins + * @date 2023-08-23 + */ +public interface HwSceneMapper +{ + /** + * 查询场景信息 + * + * @param sceneId 场景信息主键 + * @return 场景信息 + */ + public HwScene selectHwSceneBySceneId(Long sceneId); + + /** + * 查询场景信息列表 + * + * @param hwScene 场景信息 + * @return 场景信息集合 + */ + public List selectHwSceneList(HwScene hwScene); + + /** + * 新增场景信息 + * + * @param hwScene 场景信息 + * @return 结果 + */ + public int insertHwScene(HwScene hwScene); + + /** + * 修改场景信息 + * + * @param hwScene 场景信息 + * @return 结果 + */ + public int updateHwScene(HwScene hwScene); + + /** + * 删除场景信息 + * + * @param sceneId 场景信息主键 + * @return 结果 + */ + public int deleteHwSceneBySceneId(Long sceneId); + + /** + * 批量删除场景信息 + * + * @param sceneIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteHwSceneBySceneIds(Long[] sceneIds); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceService.java new file mode 100644 index 0000000..3a2afc2 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceService.java @@ -0,0 +1,61 @@ +package com.ruoyi.business.service; + +import java.util.List; +import com.ruoyi.business.domain.HwDevice; + +/** + * 设备信息Service接口 + * + * @author xins + * @date 2023-08-24 + */ +public interface IHwDeviceService +{ + /** + * 查询设备信息 + * + * @param deviceId 设备信息主键 + * @return 设备信息 + */ + public HwDevice selectHwDeviceByDeviceId(Long deviceId); + + /** + * 查询设备信息列表 + * + * @param hwDevice 设备信息 + * @return 设备信息集合 + */ + public List selectHwDeviceList(HwDevice hwDevice); + + /** + * 新增设备信息 + * + * @param hwDevice 设备信息 + * @return 结果 + */ + public int insertHwDevice(HwDevice hwDevice); + + /** + * 修改设备信息 + * + * @param hwDevice 设备信息 + * @return 结果 + */ + public int updateHwDevice(HwDevice hwDevice); + + /** + * 批量删除设备信息 + * + * @param deviceIds 需要删除的设备信息主键集合 + * @return 结果 + */ + public int deleteHwDeviceByDeviceIds(Long[] deviceIds); + + /** + * 删除设备信息信息 + * + * @param deviceId 设备信息主键 + * @return 结果 + */ + public int deleteHwDeviceByDeviceId(Long deviceId); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwSceneService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwSceneService.java new file mode 100644 index 0000000..f4c4ff6 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwSceneService.java @@ -0,0 +1,61 @@ +package com.ruoyi.business.service; + +import java.util.List; +import com.ruoyi.business.domain.HwScene; + +/** + * 场景信息Service接口 + * + * @author xins + * @date 2023-08-23 + */ +public interface IHwSceneService +{ + /** + * 查询场景信息 + * + * @param sceneId 场景信息主键 + * @return 场景信息 + */ + public HwScene selectHwSceneBySceneId(Long sceneId); + + /** + * 查询场景信息列表 + * + * @param hwScene 场景信息 + * @return 场景信息集合 + */ + public List selectHwSceneList(HwScene hwScene); + + /** + * 新增场景信息 + * + * @param hwScene 场景信息 + * @return 结果 + */ + public int insertHwScene(HwScene hwScene); + + /** + * 修改场景信息 + * + * @param hwScene 场景信息 + * @return 结果 + */ + public int updateHwScene(HwScene hwScene); + + /** + * 批量删除场景信息 + * + * @param sceneIds 需要删除的场景信息主键集合 + * @return 结果 + */ + public int deleteHwSceneBySceneIds(Long[] sceneIds); + + /** + * 删除场景信息信息 + * + * @param sceneId 场景信息主键 + * @return 结果 + */ + public int deleteHwSceneBySceneId(Long sceneId); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java new file mode 100644 index 0000000..8cadd7a --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java @@ -0,0 +1,96 @@ +package com.ruoyi.business.service.impl; + +import java.util.List; +import com.ruoyi.common.core.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.business.mapper.HwDeviceMapper; +import com.ruoyi.business.domain.HwDevice; +import com.ruoyi.business.service.IHwDeviceService; + +/** + * 设备信息Service业务层处理 + * + * @author xins + * @date 2023-08-24 + */ +@Service +public class HwDeviceServiceImpl implements IHwDeviceService +{ + @Autowired + private HwDeviceMapper hwDeviceMapper; + + /** + * 查询设备信息 + * + * @param deviceId 设备信息主键 + * @return 设备信息 + */ + @Override + public HwDevice selectHwDeviceByDeviceId(Long deviceId) + { + return hwDeviceMapper.selectHwDeviceByDeviceId(deviceId); + } + + /** + * 查询设备信息列表 + * + * @param hwDevice 设备信息 + * @return 设备信息 + */ + @Override + public List selectHwDeviceList(HwDevice hwDevice) + { + return hwDeviceMapper.selectHwDeviceList(hwDevice); + } + + /** + * 新增设备信息 + * + * @param hwDevice 设备信息 + * @return 结果 + */ + @Override + public int insertHwDevice(HwDevice hwDevice) + { + hwDevice.setCreateTime(DateUtils.getNowDate()); + return hwDeviceMapper.insertHwDevice(hwDevice); + } + + /** + * 修改设备信息 + * + * @param hwDevice 设备信息 + * @return 结果 + */ + @Override + public int updateHwDevice(HwDevice hwDevice) + { + hwDevice.setUpdateTime(DateUtils.getNowDate()); + return hwDeviceMapper.updateHwDevice(hwDevice); + } + + /** + * 批量删除设备信息 + * + * @param deviceIds 需要删除的设备信息主键 + * @return 结果 + */ + @Override + public int deleteHwDeviceByDeviceIds(Long[] deviceIds) + { + return hwDeviceMapper.deleteHwDeviceByDeviceIds(deviceIds); + } + + /** + * 删除设备信息信息 + * + * @param deviceId 设备信息主键 + * @return 结果 + */ + @Override + public int deleteHwDeviceByDeviceId(Long deviceId) + { + return hwDeviceMapper.deleteHwDeviceByDeviceId(deviceId); + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java new file mode 100644 index 0000000..fc2db64 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwSceneServiceImpl.java @@ -0,0 +1,96 @@ +package com.ruoyi.business.service.impl; + +import java.util.List; +import com.ruoyi.common.core.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.business.mapper.HwSceneMapper; +import com.ruoyi.business.domain.HwScene; +import com.ruoyi.business.service.IHwSceneService; + +/** + * 场景信息Service业务层处理 + * + * @author xins + * @date 2023-08-23 + */ +@Service +public class HwSceneServiceImpl implements IHwSceneService +{ + @Autowired + private HwSceneMapper hwSceneMapper; + + /** + * 查询场景信息 + * + * @param sceneId 场景信息主键 + * @return 场景信息 + */ + @Override + public HwScene selectHwSceneBySceneId(Long sceneId) + { + return hwSceneMapper.selectHwSceneBySceneId(sceneId); + } + + /** + * 查询场景信息列表 + * + * @param hwScene 场景信息 + * @return 场景信息 + */ + @Override + public List selectHwSceneList(HwScene hwScene) + { + return hwSceneMapper.selectHwSceneList(hwScene); + } + + /** + * 新增场景信息 + * + * @param hwScene 场景信息 + * @return 结果 + */ + @Override + public int insertHwScene(HwScene hwScene) + { + hwScene.setCreateTime(DateUtils.getNowDate()); + return hwSceneMapper.insertHwScene(hwScene); + } + + /** + * 修改场景信息 + * + * @param hwScene 场景信息 + * @return 结果 + */ + @Override + public int updateHwScene(HwScene hwScene) + { + hwScene.setUpdateTime(DateUtils.getNowDate()); + return hwSceneMapper.updateHwScene(hwScene); + } + + /** + * 批量删除场景信息 + * + * @param sceneIds 需要删除的场景信息主键 + * @return 结果 + */ + @Override + public int deleteHwSceneBySceneIds(Long[] sceneIds) + { + return hwSceneMapper.deleteHwSceneBySceneIds(sceneIds); + } + + /** + * 删除场景信息信息 + * + * @param sceneId 场景信息主键 + * @return 结果 + */ + @Override + public int deleteHwSceneBySceneId(Long sceneId) + { + return hwSceneMapper.deleteHwSceneBySceneId(sceneId); + } +} diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml new file mode 100644 index 0000000..c4a8dc8 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select device_id, device_code, device_name, scene_id, monitor_unit_id, device_type, networking_mode, access_protocol, data_format, releated_device_id, device_mode_id, access_gw_protocol, active_status, device_status, active_time, device_pic, ip_address, area_id, device_location, current_module_version, current_singlechip_version, remark, create_by, create_time, update_by, update_time, device_field from hw_device + + + + + + + + insert into hw_device + + device_code, + device_name, + scene_id, + monitor_unit_id, + device_type, + networking_mode, + access_protocol, + data_format, + releated_device_id, + device_mode_id, + access_gw_protocol, + active_status, + device_status, + active_time, + device_pic, + ip_address, + area_id, + device_location, + current_module_version, + current_singlechip_version, + remark, + create_by, + create_time, + update_by, + update_time, + device_field, + + + #{deviceCode}, + #{deviceName}, + #{sceneId}, + #{monitorUnitId}, + #{deviceType}, + #{networkingMode}, + #{accessProtocol}, + #{dataFormat}, + #{releatedDeviceId}, + #{deviceModeId}, + #{accessGwProtocol}, + #{activeStatus}, + #{deviceStatus}, + #{activeTime}, + #{devicePic}, + #{ipAddress}, + #{areaId}, + #{deviceLocation}, + #{currentModuleVersion}, + #{currentSinglechipVersion}, + #{remark}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{deviceField}, + + + + + update hw_device + + device_code = #{deviceCode}, + device_name = #{deviceName}, + scene_id = #{sceneId}, + monitor_unit_id = #{monitorUnitId}, + device_type = #{deviceType}, + networking_mode = #{networkingMode}, + access_protocol = #{accessProtocol}, + data_format = #{dataFormat}, + releated_device_id = #{releatedDeviceId}, + device_mode_id = #{deviceModeId}, + access_gw_protocol = #{accessGwProtocol}, + active_status = #{activeStatus}, + device_status = #{deviceStatus}, + active_time = #{activeTime}, + device_pic = #{devicePic}, + ip_address = #{ipAddress}, + area_id = #{areaId}, + device_location = #{deviceLocation}, + current_module_version = #{currentModuleVersion}, + current_singlechip_version = #{currentSinglechipVersion}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + device_field = #{deviceField}, + + where device_id = #{deviceId} + + + + delete from hw_device where device_id = #{deviceId} + + + + delete from hw_device where device_id in + + #{deviceId} + + + \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java index b004c59..1248d4f 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java @@ -92,4 +92,13 @@ public interface SysDictDataMapper * @return 结果 */ public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType); + + /** + * 查询国际化多语言信息 + * + * @param dictData 字典数据信息 + * @return 字典数据集合信息 + */ + public List selectInternationalDictDataList(SysDictData dictData); + } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java index 1ac0925..2b09e74 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java @@ -2,10 +2,12 @@ package com.ruoyi.system.service.impl; import java.util.Comparator; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.stream.Collectors; import javax.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.ruoyi.common.core.constant.UserConstants; @@ -76,17 +78,30 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService List dictDatas = DictUtils.getDictCache(dictType); if (StringUtils.isNotEmpty(dictDatas)) { - return dictDatas; + return getInternaltionDictDatas(dictDatas); } dictDatas = dictDataMapper.selectDictDataByType(dictType); if (StringUtils.isNotEmpty(dictDatas)) { DictUtils.setDictCache(dictType, dictDatas); - return dictDatas; + return getInternaltionDictDatas(dictDatas); } return null; } + /** + * 根据locale获取对应语言的数据字典信息 + * @return + */ + private List getInternaltionDictDatas(List sysDictDatas){ + Locale locale = LocaleContextHolder.getLocale(); + String country = locale.getCountry(); + String language = locale.getLanguage(); + String localeStr = language+"_"+country; + List dictDatas = sysDictDatas.stream().filter(b->StringUtils.isNotEmpty(b.getLanguageCode()) && b.getLanguageCode().equals(localeStr)).collect(Collectors.toList()); + return dictDatas; + } + /** * 根据字典类型ID查询信息 * @@ -139,7 +154,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService { SysDictData dictData = new SysDictData(); dictData.setStatus("0"); - Map> dictDataMap = dictDataMapper.selectDictDataList(dictData).stream().collect(Collectors.groupingBy(SysDictData::getDictType)); + Map> dictDataMap = dictDataMapper.selectInternationalDictDataList(dictData).stream().collect(Collectors.groupingBy(SysDictData::getDictType)); for (Map.Entry> entry : dictDataMap.entrySet()) { DictUtils.setDictCache(entry.getKey(), entry.getValue().stream().sorted(Comparator.comparing(SysDictData::getDictSort)).collect(Collectors.toList())); diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml index 8da9030..7319321 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml @@ -18,6 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -120,5 +121,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" sysdate() ) - + + + + + + \ No newline at end of file diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index 0a29f02..036b7c9 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -55,6 +55,8 @@ "vue": "2.6.12", "vue-count-to": "1.0.13", "vue-cropper": "0.5.5", + "vue-i18n": "8.26.7", + "Vue-i18n": "npm:vue-i18n@^8.26.7", "vue-meta": "2.4.0", "vue-router": "3.4.9", "vuedraggable": "2.24.3", @@ -77,6 +79,7 @@ "sass-loader": "10.1.1", "script-ext-html-webpack-plugin": "2.1.5", "svg-sprite-loader": "5.1.1", + "vue-i18n": "8.26.7", "vue-template-compiler": "2.6.12" }, "engines": { diff --git a/ruoyi-ui/src/components/LangSelect/index.vue b/ruoyi-ui/src/components/LangSelect/index.vue new file mode 100644 index 0000000..bc5829d --- /dev/null +++ b/ruoyi-ui/src/components/LangSelect/index.vue @@ -0,0 +1,35 @@ + + + diff --git a/ruoyi-ui/src/lang/en_US.js b/ruoyi-ui/src/lang/en_US.js new file mode 100644 index 0000000..c963187 --- /dev/null +++ b/ruoyi-ui/src/lang/en_US.js @@ -0,0 +1,22 @@ +// en.js +export default { + login: { + title: 'RuoYi Login Form', + logIn: 'Log in', + username: 'Username', + password: 'Password' + }, + tagsView: { + refresh: 'Refresh', + close: 'Close', + closeOthers: 'Close Others', + closeAll: 'Close All' + }, + settings: { + title: 'Page style setting', + theme: 'Theme Color', + tagsView: 'Open Tags-View', + fixedHeader: 'Fixed Header', + sidebarLogo: 'Sidebar Logo' + } +} diff --git a/ruoyi-ui/src/lang/index.js b/ruoyi-ui/src/lang/index.js new file mode 100644 index 0000000..e580add --- /dev/null +++ b/ruoyi-ui/src/lang/index.js @@ -0,0 +1,30 @@ +// index.js +import Vue from 'vue' +import VueI18n from 'vue-i18n' +import Cookies from 'js-cookie' +import elementEnLocale from 'element-ui/lib/locale/lang/en' // element-ui lang +import elementZhLocale from 'element-ui/lib/locale/lang/zh-CN'// element-ui lang +import enLocale from './en_US' +import zhLocale from './zh_CN' + +Vue.use(VueI18n) + +const messages = { + en_US: { + ...enLocale, + ...elementEnLocale + }, + zh_CN: { + ...zhLocale, + ...elementZhLocale + } +} + +const i18n = new VueI18n({ + // 设置语言 选项 en_US | zh_CN + locale: Cookies.get('language') || 'en_US', + // 设置文本内容 + messages +}) + +export default i18n diff --git a/ruoyi-ui/src/lang/zh_CN.js b/ruoyi-ui/src/lang/zh_CN.js new file mode 100644 index 0000000..9f3298c --- /dev/null +++ b/ruoyi-ui/src/lang/zh_CN.js @@ -0,0 +1,22 @@ +// zh.js +export default { + login: { + title: '若依后台管理系统', + logIn: '登录', + username: '账号', + password: '密码' + }, + tagsView: { + refresh: '刷新', + close: '关闭', + closeOthers: '关闭其它', + closeAll: '关闭所有' + }, + settings: { + title: '系统布局配置', + theme: '主题色', + tagsView: '开启 Tags-View', + fixedHeader: '固定 Header', + sidebarLogo: '侧边栏 Logo' + } +} diff --git a/ruoyi-ui/src/store/getters.js b/ruoyi-ui/src/store/getters.js index 8adb1b6..3115cb5 100644 --- a/ruoyi-ui/src/store/getters.js +++ b/ruoyi-ui/src/store/getters.js @@ -15,5 +15,6 @@ const getters = { topbarRouters:state => state.permission.topbarRouters, defaultRoutes:state => state.permission.defaultRoutes, sidebarRouters:state => state.permission.sidebarRouters, + language: state => state.app.language, } export default getters diff --git a/ruoyi-ui/src/store/modules/app.js b/ruoyi-ui/src/store/modules/app.js index 3e22d1c..0f3c1e7 100644 --- a/ruoyi-ui/src/store/modules/app.js +++ b/ruoyi-ui/src/store/modules/app.js @@ -7,7 +7,8 @@ const state = { hide: false }, device: 'desktop', - size: Cookies.get('size') || 'medium' + size: Cookies.get('size') || 'medium', + language: Cookies.get('language') || 'en_US' } const mutations = { @@ -37,9 +38,14 @@ const mutations = { }, SET_SIDEBAR_HIDE: (state, status) => { state.sidebar.hide = status + }, + SET_LANGUAGE: (state, language) => { + state.language = language + Cookies.set('language', language) } } + const actions = { toggleSideBar({ commit }) { commit('TOGGLE_SIDEBAR') @@ -55,6 +61,9 @@ const actions = { }, toggleSideBarHide({ commit }, status) { commit('SET_SIDEBAR_HIDE', status) + }, + setLanguage({ commit }, language) { + commit('SET_LANGUAGE', language) } } diff --git a/ruoyi-ui/src/views/business/scene/index.vue b/ruoyi-ui/src/views/business/scene/index.vue index 1e6db74..2f598d1 100644 --- a/ruoyi-ui/src/views/business/scene/index.vue +++ b/ruoyi-ui/src/views/business/scene/index.vue @@ -25,7 +25,7 @@ @keyup.enter.native="handleQuery" /> - + - - - + + + + + + + + - +