若依微服务1.03版本

1、数据字典支持国际化,场景中有示例
dev
xins 1 year ago
parent f80251884e
commit 894389c8a2

@ -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;
@ -154,6 +156,14 @@ 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)

@ -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

@ -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" +
" ''-' `'-' `-..-' ");
}
}

@ -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<HwLanguage> 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<HwLanguage> list = hwLanguageService.selectHwLanguageList(hwLanguage);
ExcelUtil<HwLanguage> util = new ExcelUtil<HwLanguage>(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));
}
}

@ -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();
}
}

@ -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<HwLanguage> 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);
}

@ -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<HwLanguage> 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);
}

@ -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<HwLanguage> 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);
}
}

@ -0,0 +1,10 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}
_ _
(_) | |
_ __ _ _ ___ _ _ _ ______ ___ _ _ ___ | |_ ___ _ __ ___
| '__|| | | | / _ \ | | | || ||______|/ __|| | | |/ __|| __| / _ \| '_ ` _ \
| | | |_| || (_) || |_| || | \__ \| |_| |\__ \| |_ | __/| | | | | |
|_| \__,_| \___/ \__, ||_| |___/ \__, ||___/ \__| \___||_| |_| |_|
__/ | __/ |
|___/ |___/

@ -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}

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

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.HwDictDataLanguageMapper">
<resultMap type="HwDictDataLanguage" id="HwDictDataLanguageResult">
<result property="dataLanguageId" column="data_language_id" />
<result property="dictCode" column="dict_code" />
<result property="dictLabel" column="dict_label" />
<result property="languageCode" column="language_code" />
</resultMap>
<sql id="selectHwDictDataLanguageVo">
select data_language_id, dict_code, dict_label, language_code from hw_dict_data_language
</sql>
<select id="selectHwDictDataLanguageList" parameterType="HwDictDataLanguage" resultMap="HwDictDataLanguageResult">
<include refid="selectHwDictDataLanguageVo"/>
<where>
<if test="dictCode != null "> and dict_code = #{dictCode}</if>
<if test="dictLabel != null and dictLabel != ''"> and dict_label = #{dictLabel}</if>
<if test="languageCode != null and languageCode != ''"> and language_code = #{languageCode}</if>
</where>
</select>
<select id="selectHwDictDataLanguageByDataLanguageId" parameterType="Long" resultMap="HwDictDataLanguageResult">
<include refid="selectHwDictDataLanguageVo"/>
where data_language_id = #{dataLanguageId}
</select>
<insert id="insertHwDictDataLanguage" parameterType="HwDictDataLanguage" useGeneratedKeys="true" keyProperty="dataLanguageId">
insert into hw_dict_data_language
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dictCode != null">dict_code,</if>
<if test="dictLabel != null">dict_label,</if>
<if test="languageCode != null and languageCode != ''">language_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dictCode != null">#{dictCode},</if>
<if test="dictLabel != null">#{dictLabel},</if>
<if test="languageCode != null and languageCode != ''">#{languageCode},</if>
</trim>
</insert>
<update id="updateHwDictDataLanguage" parameterType="HwDictDataLanguage">
update hw_dict_data_language
<trim prefix="SET" suffixOverrides=",">
<if test="dictCode != null">dict_code = #{dictCode},</if>
<if test="dictLabel != null">dict_label = #{dictLabel},</if>
<if test="languageCode != null and languageCode != ''">language_code = #{languageCode},</if>
</trim>
where data_language_id = #{dataLanguageId}
</update>
<delete id="deleteHwDictDataLanguageByDataLanguageId" parameterType="Long">
delete from hw_dict_data_language where data_language_id = #{dataLanguageId}
</delete>
<delete id="deleteHwDictDataLanguageByDataLanguageIds" parameterType="String">
delete from hw_dict_data_language where data_language_id in
<foreach item="dataLanguageId" collection="array" open="(" separator="," close=")">
#{dataLanguageId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.HwDictDataMapper">
<resultMap type="HwDictData" id="HwDictDataResult">
<result property="dictCode" column="dict_code" />
<result property="dictSort" column="dict_sort" />
<result property="dictLabel" column="dict_label" />
<result property="dictValue" column="dict_value" />
<result property="dictType" column="dict_type" />
<result property="cssClass" column="css_class" />
<result property="listClass" column="list_class" />
<result property="isDefault" column="is_default" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectHwDictDataVo">
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
</sql>
<select id="selectHwDictDataByType" parameterType="HwDictData" resultMap="HwDictDataResult">
<include refid="selectHwDictDataVo"/>
where status = '1' and dict_type = #{dictType} order by dict_sort asc
</select>
<select id="selectHwDictDataList" parameterType="HwDictData" resultMap="HwDictDataResult">
<include refid="selectHwDictDataVo"/>
<where>
<if test="dictSort != null "> and dict_sort = #{dictSort}</if>
<if test="dictLabel != null and dictLabel != ''"> and dict_label = #{dictLabel}</if>
<if test="dictValue != null and dictValue != ''"> and dict_value = #{dictValue}</if>
<if test="dictType != null and dictType != ''"> and dict_type = #{dictType}</if>
<if test="cssClass != null and cssClass != ''"> and css_class = #{cssClass}</if>
<if test="listClass != null and listClass != ''"> and list_class = #{listClass}</if>
<if test="isDefault != null and isDefault != ''"> and is_default = #{isDefault}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectHwDictDataByDictCode" parameterType="Long" resultMap="HwDictDataResult">
<include refid="selectHwDictDataVo"/>
where dict_code = #{dictCode}
</select>
<insert id="insertHwDictData" parameterType="HwDictData" useGeneratedKeys="true" keyProperty="dictCode">
insert into hw_dict_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dictSort != null">dict_sort,</if>
<if test="dictLabel != null">dict_label,</if>
<if test="dictValue != null">dict_value,</if>
<if test="dictType != null">dict_type,</if>
<if test="cssClass != null">css_class,</if>
<if test="listClass != null">list_class,</if>
<if test="isDefault != null">is_default,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dictSort != null">#{dictSort},</if>
<if test="dictLabel != null">#{dictLabel},</if>
<if test="dictValue != null">#{dictValue},</if>
<if test="dictType != null">#{dictType},</if>
<if test="cssClass != null">#{cssClass},</if>
<if test="listClass != null">#{listClass},</if>
<if test="isDefault != null">#{isDefault},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateHwDictData" parameterType="HwDictData">
update hw_dict_data
<trim prefix="SET" suffixOverrides=",">
<if test="dictSort != null">dict_sort = #{dictSort},</if>
<if test="dictLabel != null">dict_label = #{dictLabel},</if>
<if test="dictValue != null">dict_value = #{dictValue},</if>
<if test="dictType != null">dict_type = #{dictType},</if>
<if test="cssClass != null">css_class = #{cssClass},</if>
<if test="listClass != null">list_class = #{listClass},</if>
<if test="isDefault != null">is_default = #{isDefault},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where dict_code = #{dictCode}
</update>
<delete id="deleteHwDictDataByDictCode" parameterType="Long">
delete from hw_dict_data where dict_code = #{dictCode}
</delete>
<delete id="deleteHwDictDataByDictCodes" parameterType="String">
delete from hw_dict_data where dict_code in
<foreach item="dictCode" collection="array" open="(" separator="," close=")">
#{dictCode}
</foreach>
</delete>
</mapper>

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.HwDictTypeMapper">
<resultMap type="HwDictType" id="HwDictTypeResult">
<result property="dictId" column="dict_id" />
<result property="dictName" column="dict_name" />
<result property="dictType" column="dict_type" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectHwDictTypeVo">
select dict_id, dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark from hw_dict_type
</sql>
<select id="selectHwDictTypeList" parameterType="HwDictType" resultMap="HwDictTypeResult">
<include refid="selectHwDictTypeVo"/>
<where>
<if test="dictName != null and dictName != ''"> and dict_name like concat('%', #{dictName}, '%')</if>
<if test="dictType != null and dictType != ''"> and dict_type = #{dictType}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectHwDictTypeByDictId" parameterType="Long" resultMap="HwDictTypeResult">
<include refid="selectHwDictTypeVo"/>
where dict_id = #{dictId}
</select>
<insert id="insertHwDictType" parameterType="HwDictType" useGeneratedKeys="true" keyProperty="dictId">
insert into hw_dict_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dictName != null">dict_name,</if>
<if test="dictType != null">dict_type,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dictName != null">#{dictName},</if>
<if test="dictType != null">#{dictType},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateHwDictType" parameterType="HwDictType">
update hw_dict_type
<trim prefix="SET" suffixOverrides=",">
<if test="dictName != null">dict_name = #{dictName},</if>
<if test="dictType != null">dict_type = #{dictType},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where dict_id = #{dictId}
</update>
<delete id="deleteHwDictTypeByDictId" parameterType="Long">
delete from hw_dict_type where dict_id = #{dictId}
</delete>
<delete id="deleteHwDictTypeByDictIds" parameterType="String">
delete from hw_dict_type where dict_id in
<foreach item="dictId" collection="array" open="(" separator="," close=")">
#{dictId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.HwLanguageMapper">
<resultMap type="HwLanguage" id="HwLanguageResult">
<result property="languageId" column="language_id" />
<result property="languageCode" column="language_code" />
<result property="languageName" column="language_name" />
<result property="languageLang" column="language_lang" />
<result property="languageCountry" column="language_country" />
<result property="defaultFlag" column="default_flag" />
</resultMap>
<sql id="selectHwLanguageVo">
select language_id, language_code, language_name, language_lang, language_country, default_flag from hw_language
</sql>
<select id="selectHwLanguageList" parameterType="HwLanguage" resultMap="HwLanguageResult">
<include refid="selectHwLanguageVo"/>
<where>
<if test="languageCode != null and languageCode != ''"> and language_code = #{languageCode}</if>
<if test="languageName != null and languageName != ''"> and language_name like concat('%', #{languageName}, '%')</if>
<if test="languageLang != null and languageLang != ''"> and language_lang = #{languageLang}</if>
<if test="languageCountry != null and languageCountry != ''"> and language_country = #{languageCountry}</if>
<if test="defaultFlag != null and defaultFlag != ''"> and default_flag = #{defaultFlag}</if>
</where>
</select>
<select id="selectHwLanguageByLanguageId" parameterType="Long" resultMap="HwLanguageResult">
<include refid="selectHwLanguageVo"/>
where language_id = #{languageId}
</select>
<insert id="insertHwLanguage" parameterType="HwLanguage" useGeneratedKeys="true" keyProperty="languageId">
insert into hw_language
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="languageCode != null and languageCode != ''">language_code,</if>
<if test="languageName != null and languageName != ''">language_name,</if>
<if test="languageLang != null">language_lang,</if>
<if test="languageCountry != null">language_country,</if>
<if test="defaultFlag != null and defaultFlag != ''">default_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="languageCode != null and languageCode != ''">#{languageCode},</if>
<if test="languageName != null and languageName != ''">#{languageName},</if>
<if test="languageLang != null">#{languageLang},</if>
<if test="languageCountry != null">#{languageCountry},</if>
<if test="defaultFlag != null and defaultFlag != ''">#{defaultFlag},</if>
</trim>
</insert>
<update id="updateHwLanguage" parameterType="HwLanguage">
update hw_language
<trim prefix="SET" suffixOverrides=",">
<if test="languageCode != null and languageCode != ''">language_code = #{languageCode},</if>
<if test="languageName != null and languageName != ''">language_name = #{languageName},</if>
<if test="languageLang != null">language_lang = #{languageLang},</if>
<if test="languageCountry != null">language_country = #{languageCountry},</if>
<if test="defaultFlag != null and defaultFlag != ''">default_flag = #{defaultFlag},</if>
</trim>
where language_id = #{languageId}
</update>
<delete id="deleteHwLanguageByLanguageId" parameterType="Long">
delete from hw_language where language_id = #{languageId}
</delete>
<delete id="deleteHwLanguageByLanguageIds" parameterType="String">
delete from hw_language where language_id in
<foreach item="languageId" collection="array" open="(" separator="," close=")">
#{languageId}
</foreach>
</delete>
</mapper>

@ -78,6 +78,11 @@
<artifactId>ruoyi-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-api-system</artifactId>
</dependency>
<!-- RuoYi Common International Language -->
<dependency>
<groupId>com.ruoyi</groupId>

@ -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<HwDevice> 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<HwDevice> list = hwDeviceService.selectHwDeviceList(hwDevice);
ExcelUtil<HwDevice> util = new ExcelUtil<HwDevice>(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));
}
}

@ -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<HwScene> 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<HwScene> list = hwSceneService.selectHwSceneList(hwScene);
ExcelUtil<HwScene> util = new ExcelUtil<HwScene>(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));
}
}

@ -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-Fi2、蜂窝(2G/3G/4G/5G),3、以太网4、其他) */
@Excel(name = "联网方式(1:Wi-Fi2、蜂窝(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;
/** 1Modbus
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();
}
}

@ -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();
}
}

@ -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<HwDevice> 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);
}

@ -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<HwScene> 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);
}

@ -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<HwDevice> 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);
}

@ -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<HwScene> 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);
}

@ -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<HwDevice> 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);
}
}

@ -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<HwScene> 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);
}
}

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.business.mapper.HwDeviceMapper">
<resultMap type="HwDevice" id="HwDeviceResult">
<result property="deviceId" column="device_id" />
<result property="deviceCode" column="device_code" />
<result property="deviceName" column="device_name" />
<result property="sceneId" column="scene_id" />
<result property="monitorUnitId" column="monitor_unit_id" />
<result property="deviceType" column="device_type" />
<result property="networkingMode" column="networking_mode" />
<result property="accessProtocol" column="access_protocol" />
<result property="dataFormat" column="data_format" />
<result property="releatedDeviceId" column="releated_device_id" />
<result property="deviceModeId" column="device_mode_id" />
<result property="accessGwProtocol" column="access_gw_protocol" />
<result property="activeStatus" column="active_status" />
<result property="deviceStatus" column="device_status" />
<result property="activeTime" column="active_time" />
<result property="devicePic" column="device_pic" />
<result property="ipAddress" column="ip_address" />
<result property="areaId" column="area_id" />
<result property="deviceLocation" column="device_location" />
<result property="currentModuleVersion" column="current_module_version" />
<result property="currentSinglechipVersion" column="current_singlechip_version" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="deviceField" column="device_field" />
</resultMap>
<sql id="selectHwDeviceVo">
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
</sql>
<select id="selectHwDeviceList" parameterType="HwDevice" resultMap="HwDeviceResult">
<include refid="selectHwDeviceVo"/>
<where>
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode}</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
<if test="sceneId != null "> and scene_id = #{sceneId}</if>
<if test="monitorUnitId != null "> and monitor_unit_id = #{monitorUnitId}</if>
<if test="deviceType != null and deviceType != ''"> and device_type = #{deviceType}</if>
<if test="networkingMode != null and networkingMode != ''"> and networking_mode = #{networkingMode}</if>
<if test="accessProtocol != null "> and access_protocol = #{accessProtocol}</if>
<if test="dataFormat != null "> and data_format = #{dataFormat}</if>
<if test="releatedDeviceId != null "> and releated_device_id = #{releatedDeviceId}</if>
<if test="deviceModeId != null "> and device_mode_id = #{deviceModeId}</if>
<if test="accessGwProtocol != null "> and access_gw_protocol = #{accessGwProtocol}</if>
<if test="activeStatus != null and activeStatus != ''"> and active_status = #{activeStatus}</if>
<if test="deviceStatus != null and deviceStatus != ''"> and device_status = #{deviceStatus}</if>
<if test="activeTime != null "> and active_time = #{activeTime}</if>
<if test="devicePic != null and devicePic != ''"> and device_pic = #{devicePic}</if>
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
<if test="areaId != null "> and area_id = #{areaId}</if>
<if test="deviceLocation != null and deviceLocation != ''"> and device_location = #{deviceLocation}</if>
<if test="currentModuleVersion != null and currentModuleVersion != ''"> and current_module_version = #{currentModuleVersion}</if>
<if test="currentSinglechipVersion != null and currentSinglechipVersion != ''"> and current_singlechip_version = #{currentSinglechipVersion}</if>
<if test="deviceField != null and deviceField != ''"> and device_field = #{deviceField}</if>
</where>
</select>
<select id="selectHwDeviceByDeviceId" parameterType="Long" resultMap="HwDeviceResult">
<include refid="selectHwDeviceVo"/>
where device_id = #{deviceId}
</select>
<insert id="insertHwDevice" parameterType="HwDevice" useGeneratedKeys="true" keyProperty="deviceId">
insert into hw_device
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deviceCode != null and deviceCode != ''">device_code,</if>
<if test="deviceName != null and deviceName != ''">device_name,</if>
<if test="sceneId != null">scene_id,</if>
<if test="monitorUnitId != null">monitor_unit_id,</if>
<if test="deviceType != null and deviceType != ''">device_type,</if>
<if test="networkingMode != null and networkingMode != ''">networking_mode,</if>
<if test="accessProtocol != null">access_protocol,</if>
<if test="dataFormat != null">data_format,</if>
<if test="releatedDeviceId != null">releated_device_id,</if>
<if test="deviceModeId != null">device_mode_id,</if>
<if test="accessGwProtocol != null">access_gw_protocol,</if>
<if test="activeStatus != null and activeStatus != ''">active_status,</if>
<if test="deviceStatus != null and deviceStatus != ''">device_status,</if>
<if test="activeTime != null">active_time,</if>
<if test="devicePic != null">device_pic,</if>
<if test="ipAddress != null">ip_address,</if>
<if test="areaId != null">area_id,</if>
<if test="deviceLocation != null">device_location,</if>
<if test="currentModuleVersion != null">current_module_version,</if>
<if test="currentSinglechipVersion != null">current_singlechip_version,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="deviceField != null">device_field,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceCode != null and deviceCode != ''">#{deviceCode},</if>
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
<if test="sceneId != null">#{sceneId},</if>
<if test="monitorUnitId != null">#{monitorUnitId},</if>
<if test="deviceType != null and deviceType != ''">#{deviceType},</if>
<if test="networkingMode != null and networkingMode != ''">#{networkingMode},</if>
<if test="accessProtocol != null">#{accessProtocol},</if>
<if test="dataFormat != null">#{dataFormat},</if>
<if test="releatedDeviceId != null">#{releatedDeviceId},</if>
<if test="deviceModeId != null">#{deviceModeId},</if>
<if test="accessGwProtocol != null">#{accessGwProtocol},</if>
<if test="activeStatus != null and activeStatus != ''">#{activeStatus},</if>
<if test="deviceStatus != null and deviceStatus != ''">#{deviceStatus},</if>
<if test="activeTime != null">#{activeTime},</if>
<if test="devicePic != null">#{devicePic},</if>
<if test="ipAddress != null">#{ipAddress},</if>
<if test="areaId != null">#{areaId},</if>
<if test="deviceLocation != null">#{deviceLocation},</if>
<if test="currentModuleVersion != null">#{currentModuleVersion},</if>
<if test="currentSinglechipVersion != null">#{currentSinglechipVersion},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deviceField != null">#{deviceField},</if>
</trim>
</insert>
<update id="updateHwDevice" parameterType="HwDevice">
update hw_device
<trim prefix="SET" suffixOverrides=",">
<if test="deviceCode != null and deviceCode != ''">device_code = #{deviceCode},</if>
<if test="deviceName != null and deviceName != ''">device_name = #{deviceName},</if>
<if test="sceneId != null">scene_id = #{sceneId},</if>
<if test="monitorUnitId != null">monitor_unit_id = #{monitorUnitId},</if>
<if test="deviceType != null and deviceType != ''">device_type = #{deviceType},</if>
<if test="networkingMode != null and networkingMode != ''">networking_mode = #{networkingMode},</if>
<if test="accessProtocol != null">access_protocol = #{accessProtocol},</if>
<if test="dataFormat != null">data_format = #{dataFormat},</if>
<if test="releatedDeviceId != null">releated_device_id = #{releatedDeviceId},</if>
<if test="deviceModeId != null">device_mode_id = #{deviceModeId},</if>
<if test="accessGwProtocol != null">access_gw_protocol = #{accessGwProtocol},</if>
<if test="activeStatus != null and activeStatus != ''">active_status = #{activeStatus},</if>
<if test="deviceStatus != null and deviceStatus != ''">device_status = #{deviceStatus},</if>
<if test="activeTime != null">active_time = #{activeTime},</if>
<if test="devicePic != null">device_pic = #{devicePic},</if>
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
<if test="areaId != null">area_id = #{areaId},</if>
<if test="deviceLocation != null">device_location = #{deviceLocation},</if>
<if test="currentModuleVersion != null">current_module_version = #{currentModuleVersion},</if>
<if test="currentSinglechipVersion != null">current_singlechip_version = #{currentSinglechipVersion},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deviceField != null">device_field = #{deviceField},</if>
</trim>
where device_id = #{deviceId}
</update>
<delete id="deleteHwDeviceByDeviceId" parameterType="Long">
delete from hw_device where device_id = #{deviceId}
</delete>
<delete id="deleteHwDeviceByDeviceIds" parameterType="String">
delete from hw_device where device_id in
<foreach item="deviceId" collection="array" open="(" separator="," close=")">
#{deviceId}
</foreach>
</delete>
</mapper>

@ -92,4 +92,13 @@ public interface SysDictDataMapper
* @return
*/
public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType);
/**
*
*
* @param dictData
* @return
*/
public List<SysDictData> selectInternationalDictDataList(SysDictData dictData);
}

@ -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<SysDictData> 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<SysDictData> getInternaltionDictDatas(List<SysDictData> sysDictDatas){
Locale locale = LocaleContextHolder.getLocale();
String country = locale.getCountry();
String language = locale.getLanguage();
String localeStr = language+"_"+country;
List<SysDictData> 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<String, List<SysDictData>> dictDataMap = dictDataMapper.selectDictDataList(dictData).stream().collect(Collectors.groupingBy(SysDictData::getDictType));
Map<String, List<SysDictData>> dictDataMap = dictDataMapper.selectInternationalDictDataList(dictData).stream().collect(Collectors.groupingBy(SysDictData::getDictType));
for (Map.Entry<String, List<SysDictData>> entry : dictDataMap.entrySet())
{
DictUtils.setDictCache(entry.getKey(), entry.getValue().stream().sorted(Comparator.comparing(SysDictData::getDictSort)).collect(Collectors.toList()));

@ -18,6 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="languageCode" column="language_code" />
</resultMap>
<sql id="selectDictDataVo">
@ -121,4 +122,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</insert>
<select id="selectInternationalDictDataList" parameterType="SysDictData" resultMap="SysDictDataResult">
select sdd.dict_code, sdd.dict_sort, hddl.dict_label, sdd.dict_value, sdd.dict_type,hddl.language_code
from sys_dict_data sdd left join hw_dict_data_language hddl on sdd.dict_code=hddl.dict_code
<where>
<if test="dictType != null and dictType != ''">
AND sdd.dict_type = #{dictType}
</if>
<if test="dictLabel != null and dictLabel != ''">
AND sdd.dict_label like concat('%', #{dictLabel}, '%')
</if>
<if test="status != null and status != ''">
AND sdd.status = #{status}
</if>
</where>
order by sdd.dict_sort asc
</select>
</mapper>

@ -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": {

@ -0,0 +1,35 @@
<template>
<el-dropdown trigger="click" class="international" @command="handleSetLanguage">
<div>
<svg-icon class-name="international-icon" icon-class="language" />
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :disabled="language==='zh_CN'" command="zh_CN">
中文
</el-dropdown-item>
<el-dropdown-item :disabled="language==='en_US'" command="en_US">
English
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
<script>
export default {
computed: {
language() {
return this.$store.getters.language
}
},
methods: {
handleSetLanguage(lang) {
this.$i18n.locale = lang
this.$store.dispatch('app/setLanguage', lang)
this.$message({
message: '设置语言成功',
type: 'success'
})
}
}
}
</script>

@ -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'
}
}

@ -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

@ -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'
}
}

@ -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

@ -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)
}
}

@ -25,7 +25,7 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="场景图片地址" prop="scenePic">
<el-form-item label="场景图片地址" prop="scenePic">
<el-input
v-model="queryParams.scenePic"
placeholder="请输入场景图片地址"
@ -33,14 +33,19 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否默认" prop="defaultFlag">
<el-input
v-model="queryParams.defaultFlag"
placeholder="请输入是否默认"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="defaultFlag">
<el-select v-model="queryParams.defaultFlag" placeholder="部门状态" clearable>
<el-option
v-for="dict in dict.type.sys_user_sex"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="认证方式" prop="authMode">
<el-input
v-model="queryParams.authMode"
@ -262,6 +267,7 @@ import { listScene, getScene, delScene, addScene, updateScene } from "@/api/busi
export default {
name: "Scene",
dicts: ['sys_user_sex'],
data() {
return {
//

@ -1,14 +1,10 @@
<template>
<div class="login">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">若依后台管理系统</h3>
<h3 class="title">{{ $t('login.title') }}</h3>
<lang-select class="set-language" />
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
type="text"
auto-complete="off"
placeholder="账号"
>
<el-input v-model="loginForm.username" type="text" auto-complete="off" :placeholder="$t('login.username')">
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
@ -17,13 +13,13 @@
v-model="loginForm.password"
type="password"
auto-complete="off"
placeholder="密码"
:placeholder="$t('login.password')"
@keyup.enter.native="handleLogin"
>
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnabled">
<el-form-item prop="code">
<el-input
v-model="loginForm.code"
auto-complete="off"
@ -46,31 +42,31 @@
style="width:100%;"
@click.native.prevent="handleLogin"
>
<span v-if="!loading"> </span>
<span v-if="!loading">{{ $t('login.logIn') }}</span>
<span v-else> ...</span>
</el-button>
<div style="float: right;" v-if="register">
<router-link class="link-type" :to="'/register'">立即注册</router-link>
</div>
</el-form-item>
</el-form>
<!-- 底部 -->
<div class="el-login-footer">
<span>Copyright © 2018-2023 ruoyi.vip All Rights Reserved.</span>
<span>Copyright © 2018-2019 ruoyi.vip All Rights Reserved.</span>
</div>
</div>
</template>
<script>
import LangSelect from '@/components/LangSelect'
import { getCodeImg } from "@/api/login";
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'
export default {
name: "Login",
components: { LangSelect },
data() {
return {
codeUrl: "",
cookiePassword: "",
loginForm: {
username: "admin",
password: "admin123",
@ -80,18 +76,14 @@ export default {
},
loginRules: {
username: [
{ required: true, trigger: "blur", message: "请输入您的账号" }
{ required: true, trigger: "blur", message: "用户名不能为空" }
],
password: [
{ required: true, trigger: "blur", message: "请输入您的密码" }
{ required: true, trigger: "blur", message: "密码不能为空" }
],
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
code: [{ required: true, trigger: "change", message: "验证码不能为空" }]
},
loading: false,
//
captchaEnabled: true,
//
register: false,
redirect: undefined
};
},
@ -110,11 +102,8 @@ export default {
methods: {
getCode() {
getCodeImg().then(res => {
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
if (this.captchaEnabled) {
this.codeUrl = "data:image/gif;base64," + res.img;
this.loginForm.uuid = res.uuid;
}
this.codeUrl = "data:image/gif;base64," + res.img;
this.loginForm.uuid = res.uuid;
});
},
getCookie() {
@ -140,14 +129,16 @@ export default {
Cookies.remove("password");
Cookies.remove('rememberMe');
}
this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
}).catch(() => {
this.loading = false;
if (this.captchaEnabled) {
this.$store
.dispatch("Login", this.loginForm)
.then(() => {
this.loading = false;
this.$router.push({ path: this.redirect || "/" });
})
.catch(() => {
this.loading = false;
this.getCode();
}
});
});
}
});
}
@ -213,6 +204,7 @@ export default {
font-size: 12px;
letter-spacing: 1px;
}
.login-code-img {
height: 38px;
}

Loading…
Cancel
Save