Commit 9368d5ae by zzrdark

1.增加持久层代码

2.增加utils
3.修改项目间依赖关系
4.增加service、controller
parent ac0a8a52
......@@ -7,8 +7,10 @@
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="cneeds-server-advice_control" />
<module name="cneeds-common-utils" />
<module name="cneeds-server-datashow" />
<module name="cneeds-server-logupload" />
<module name="cneeds-common-data" />
<module name="cneeds-server-device_activate" />
<module name="cneeds-server-user" />
<module name="cneeds-server-device" />
......@@ -20,6 +22,8 @@
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="cneeds-common-data" options="-parameters" />
<module name="cneeds-common-utils" options="-parameters" />
<module name="cneeds-server-advice_control" options="-parameters" />
<module name="cneeds-server-datashow" options="-parameters" />
<module name="cneeds-server-device" options="-parameters" />
......
......@@ -2,6 +2,8 @@
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/cneeds-common-data" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/cneeds-common-utils" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/cneeds-server-advice_control" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/cneeds-server-datashow" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/cneeds-server-device" charset="UTF-8" />
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="58efcb75-622d-40c1-b8e0-10cd2fb456b4" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/cneeds-server-datashow/pom.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-datashow/src/main/java/com/mx/cneeds/server/web/DatashowApplication.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-logupload/pom.xml" afterDir="false" />
<list default="true" id="58efcb75-622d-40c1-b8e0-10cd2fb456b4" name="Default Changelist" comment="1.修改不需要web服务 &#10;2.增加一个logupload">
<change afterPath="$PROJECT_DIR$/cneeds-common-data/cneeds-common-data.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/pom.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/dao/DeviceInfoDao.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/dao/DeviceLogDao.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/dao/DeviceLogmediaDao.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/dao/DeviceLogsettingDao.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/dao/SysDeptDao.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/dao/SysFuncDao.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/dao/SysRoleDao.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/dao/SysRoleDeptDao.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/dao/SysRoleFuncDao.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/dao/SysUserDao.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/dao/SysUserRoleDao.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/DeviceInfoEntity.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/DeviceLogEntity.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/DeviceLogmediaEntity.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/DeviceLogsettingEntity.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/SysDeptEntity.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/SysFuncEntity.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/SysRoleDeptEntity.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/SysRoleEntity.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/SysRoleFuncEntity.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/SysUserEntity.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/java/com/mx/cneeds/server/entity/SysUserRoleEntity.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/resources/application.yml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/resources/mapper/DeviceInfoDao.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/resources/mapper/DeviceLogDao.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/resources/mapper/DeviceLogmediaDao.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/resources/mapper/DeviceLogsettingDao.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/resources/mapper/SysDeptDao.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/resources/mapper/SysFuncDao.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/resources/mapper/SysRoleDao.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/resources/mapper/SysRoleDeptDao.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/resources/mapper/SysRoleFuncDao.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/resources/mapper/SysUserDao.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-data/src/main/resources/mapper/SysUserRoleDao.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-utils/cneeds-common-utils.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-utils/pom.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-utils/src/main/java/com/mx/cneeds/common/exception/RRException.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-utils/src/main/java/com/mx/cneeds/common/pager/Constant.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-utils/src/main/java/com/mx/cneeds/common/pager/PageUtils.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-utils/src/main/java/com/mx/cneeds/common/pager/Query.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-utils/src/main/java/com/mx/cneeds/common/result/R.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-utils/src/main/java/com/mx/cneeds/common/validator/ValidatorUtils.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-utils/src/main/java/com/mx/cneeds/common/xss/HTMLFilter.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-utils/src/main/java/com/mx/cneeds/common/xss/SQLFilter.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-utils/src/main/java/com/mx/cneeds/common/xss/XssFilter.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-common-utils/src/main/java/com/mx/cneeds/common/xss/XssHttpServletRequestWrapper.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-datashow/src/main/resources/application-dev.yml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-datashow/src/main/resources/application-test.yml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-datashow/src/main/resources/application.yml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/DeviceInfoService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/DeviceLogService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/DeviceLogmediaService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/DeviceLogsettingService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/impl/DeviceInfoServiceImpl.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/impl/DeviceLogServiceImpl.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/impl/DeviceLogmediaServiceImpl.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-device/src/main/java/com/mx/cneeds/server/device/service/impl/DeviceLogsettingServiceImpl.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-device/src/main/java/com/mx/cneeds/server/device/web/DeviceInfoController.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-device/src/main/java/com/mx/cneeds/server/device/web/DeviceLogController.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-device/src/main/java/com/mx/cneeds/server/device/web/DeviceLogmediaController.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-device/src/main/java/com/mx/cneeds/server/device/web/DeviceLogsettingController.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/SysDeptService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/SysFuncService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/SysRoleDeptService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/SysRoleFuncService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/SysRoleService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/SysUserRoleService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/SysUserService.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/impl/SysDeptServiceImpl.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/impl/SysFuncServiceImpl.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/impl/SysRoleDeptServiceImpl.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/impl/SysRoleFuncServiceImpl.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/impl/SysRoleServiceImpl.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/impl/SysUserRoleServiceImpl.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/service/impl/SysUserServiceImpl.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/web/SysDeptController.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/web/SysFuncController.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/web/SysRoleController.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/web/SysRoleDeptController.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/web/SysRoleFuncController.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/web/SysUserController.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/web/SysUserRoleController.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/resources/application.yml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/compiler.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/encodings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cneeds-server-advice_control/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/cneeds-server-advice_control/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cneeds-server-advice_control/src/main/java/com/mx/cneeds/server/advice/control/AdviceControlApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/cneeds-server-advice_control/src/main/java/com/mx/cneeds/server/advice/control/AdviceControlApplication.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cneeds-server-datashow/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/cneeds-server-datashow/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cneeds-server-datashow/src/main/java/com/mx/cneeds/server/web/DatashowApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/cneeds-server-datashow/src/main/java/com/mx/cneeds/server/datashow/DatashowApplication.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cneeds-server-device/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/cneeds-server-device/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cneeds-server-device/src/main/java/com/mx/cneeds/server/device/DeviceApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/cneeds-server-device/src/main/java/com/mx/cneeds/server/device/DeviceApplication.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cneeds-server-device_activate/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/cneeds-server-device_activate/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cneeds-server-device_activate/src/main/java/com/mx/cneeds/server/device/activate/DeviceActiveApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/cneeds-server-device_activate/src/main/java/com/mx/cneeds/server/device/activate/DeviceActiveApplication.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cneeds-server-eureka/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/cneeds-server-eureka/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cneeds-server-eureka/target/classes/META-INF/cneeds-server-eureka.kotlin_module" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/cneeds-server-eureka/target/classes/application.yml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/cneeds-server-eureka/target/classes/com/mx/cneeds/server/eureka/EurekaServerApplication.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/cneeds-server-user/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/cneeds-server-user/pom.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/UserServerApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/cneeds-server-user/src/main/java/com/mx/cneeds/server/user/UserServerApplication.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
......@@ -66,9 +146,10 @@
</component>
<component name="PropertiesComponent">
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="aspect.path.notification.shown" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/cneeds-server-datashow/src/main/resources" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="project.structure.last.edited" value="Modules" />
......@@ -77,7 +158,17 @@
<property name="settings.editor.selected.configurable" value="reference.settingsdialog.project.gradle" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="E:\mx_project\cneeds-server\cneeds-server-datashow\src\main\resources" />
<recent name="E:\mx_project\cneeds-server\cneeds-server-user\src\main\resources" />
<recent name="E:\mx_project\cneeds-server\cneeds-server-device\src\main\java\com\mx\cneeds\server\device\web" />
<recent name="E:\mx_project\cneeds-server\cneeds-server-device\src\main\java\com\mx\cneeds\server\device\service" />
<recent name="E:\mx_project\cneeds-server\cneeds-server-device\src\main\java\com\mx\cneeds\server\device\service\impl" />
</key>
<key name="CopyClassDialog.RECENTS_KEY">
<recent name="com.mx.cneeds.common.pager" />
<recent name="com.mx.cneeds.common.exception" />
<recent name="com.mx.cneeds.common.validator" />
<recent name="com.mx.cneeds.server.eureka" />
</key>
<key name="MoveFile.RECENT_KEYS">
......@@ -138,8 +229,17 @@
<workItem from="1578278611504" duration="10082000" />
<workItem from="1578295009682" duration="4167000" />
<workItem from="1578389632725" duration="4443000" />
<workItem from="1578448455421" duration="2444000" />
<workItem from="1578448455421" duration="3371000" />
<workItem from="1578536666336" duration="8875000" />
</task>
<task id="LOCAL-00001" summary="1.修改不需要web服务 &#10;2.增加一个logupload">
<created>1578451117064</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1578451117064</updated>
</task>
<option name="localTasksCounter" value="2" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
......@@ -160,5 +260,7 @@
</component>
<component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
<MESSAGE value="1.修改不需要web服务 &#10;2.增加一个logupload" />
<option name="LAST_COMMIT_MESSAGE" value="1.修改不需要web服务 &#10;2.增加一个logupload" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>cneeds-server</artifactId>
<groupId>com.mx.cneeds</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cneeds-common-data</artifactId>
<properties>
<mybatis.spring.boot.version>1.3.0</mybatis.spring.boot.version>
<pagehelper.spring.boot.version>1.2.5</pagehelper.spring.boot.version>
<mysql.version>8.0.16</mysql.version>
<mybatisplus.version>3.1.2</mybatisplus.version>
</properties>
<dependencies>
<!--<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis.spring.boot.version}</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper.spring.boot.version}</version>
</dependency>-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatisplus.version}</version>
<exclusions>
<exclusion>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.mx.cneeds.server.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mx.cneeds.server.entity.DeviceInfoEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 设备信息
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Mapper
public interface DeviceInfoDao extends BaseMapper<DeviceInfoEntity> {
}
package com.mx.cneeds.server.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mx.cneeds.server.entity.DeviceLogEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 测试上传的日志表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Mapper
public interface DeviceLogDao extends BaseMapper<DeviceLogEntity> {
}
package com.mx.cneeds.server.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mx.cneeds.server.entity.DeviceLogmediaEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 日志音频表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Mapper
public interface DeviceLogmediaDao extends BaseMapper<DeviceLogmediaEntity> {
}
package com.mx.cneeds.server.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mx.cneeds.server.entity.DeviceLogsettingEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 设备日志设置
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Mapper
public interface DeviceLogsettingDao extends BaseMapper<DeviceLogsettingEntity> {
}
package com.mx.cneeds.server.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mx.cneeds.server.entity.SysDeptEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 部门表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Mapper
public interface SysDeptDao extends BaseMapper<SysDeptEntity> {
}
package com.mx.cneeds.server.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mx.cneeds.server.entity.SysFuncEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 功能表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Mapper
public interface SysFuncDao extends BaseMapper<SysFuncEntity> {
}
package com.mx.cneeds.server.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mx.cneeds.server.entity.SysRoleEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 角色表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Mapper
public interface SysRoleDao extends BaseMapper<SysRoleEntity> {
}
package com.mx.cneeds.server.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mx.cneeds.server.entity.SysRoleDeptEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 部门与角色映射表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Mapper
public interface SysRoleDeptDao extends BaseMapper<SysRoleDeptEntity> {
}
package com.mx.cneeds.server.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mx.cneeds.server.entity.SysRoleFuncEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 功能与角色映射表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Mapper
public interface SysRoleFuncDao extends BaseMapper<SysRoleFuncEntity> {
}
package com.mx.cneeds.server.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mx.cneeds.server.entity.SysUserEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 用户信息表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Mapper
public interface SysUserDao extends BaseMapper<SysUserEntity> {
}
package com.mx.cneeds.server.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mx.cneeds.server.entity.SysUserRoleEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 角色用户映射表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Mapper
public interface SysUserRoleDao extends BaseMapper<SysUserRoleEntity> {
}
package com.mx.cneeds.server.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 设备信息
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Data
@TableName("device_info")
public class DeviceInfoEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 设备id
*/
@TableId
private Long deviceId;
/**
*
*/
private Long deptId;
/**
* imei
*/
private String imei;
/**
* iccid
*/
private String iccid;
/**
* 状态0未激活,1已激活
*/
private String status;
/**
* 设备版本
*/
private String deviceVersion;
/**
* 产品系列
*/
private String productSet;
/**
* 创建时间
*/
private Date createTime;
/**
* 激活时间
*/
private Date activeTime;
}
package com.mx.cneeds.server.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 测试上传的日志表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Data
@TableName("device_log")
public class DeviceLogEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
private Long logId;
/**
* bug名字
*/
private String logName;
/**
* 创建时间
*/
private Date createTime;
/**
* 设备id
*/
private Long deviceId;
/**
* 情况-1不可用 0未处理,1已查看
*/
private Integer status;
/**
* 创建人名字
*/
private String cteateUsername;
/**
*
*/
private Long userId;
/**
* 复现步骤
*/
private String repetitionSteps;
/**
* 日志文件存放路径
*/
private String logfileUrl;
/**
* 日志文件大小
*/
private Long logfileSize;
/**
* 日志文件上传状态,-1,失败,0上传中,1完成
*/
private Integer logfileStatus;
}
package com.mx.cneeds.server.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 日志音频表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Data
@TableName("device_logmedia")
public class DeviceLogmediaEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
private Long logmediaId;
/**
* 音频路径
*/
private String locationUrl;
/**
*
*/
private Long logId;
/**
* 格式
*/
private String type;
}
package com.mx.cneeds.server.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 设备日志设置
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Data
@TableName("device_logsetting")
public class DeviceLogsettingEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
private Long logsettingId;
/**
* 日志容量(MB)
*/
private Long logSize;
/**
* 设备Id
*/
private Long deviceId;
}
package com.mx.cneeds.server.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 部门表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Data
@TableName("sys_dept")
public class SysDeptEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
private Long deptId;
/**
* 上级部门ID,一级部门为0
*/
private Long parentId;
/**
* 部门名称
*/
private String name;
/**
* 排序
*/
private Integer orderNum;
/**
* 是否删除 -1:已删除 0:正常
*/
private Integer delFlag;
/**
* 渠道商号
*/
private String distributorNum;
}
package com.mx.cneeds.server.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 功能表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Data
@TableName("sys_func")
public class SysFuncEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
private Long funcId;
/**
*
*/
private Long parentId;
/**
*
*/
private String name;
/**
*
*/
private String url;
/**
*
*/
private String perms;
/**
*
*/
private Integer type;
/**
*
*/
private Integer orderNum;
}
package com.mx.cneeds.server.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 部门与角色映射表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Data
@TableName("sys_role_dept")
public class SysRoleDeptEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
private Long id;
/**
* 角色id
*/
private Long roleId;
/**
* 部门id
*/
private Long deptId;
}
package com.mx.cneeds.server.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 角色表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Data
@TableName("sys_role")
public class SysRoleEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
private Long roleId;
/**
* 角色名称
*/
private String roleName;
/**
* 备注
*/
private String remark;
/**
* 部门Id
*/
private Long deptId;
/**
* 创建时间
*/
private Date createTime;
}
package com.mx.cneeds.server.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 功能与角色映射表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Data
@TableName("sys_role_func")
public class SysRoleFuncEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
private Long id;
/**
* 角色Id
*/
private Long roleId;
/**
* 功能Id
*/
private Long funcId;
}
package com.mx.cneeds.server.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 用户信息表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Data
@TableName("sys_user")
public class SysUserEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 用户id
*/
@TableId
private Long userId;
/**
* 用户名
*/
private String username;
/**
* 密码
*/
private String password;
/**
* 加密盐
*/
private String salt;
/**
* 邮箱
*/
private String email;
/**
* 手机
*/
private String mobile;
/**
* 账户状态
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 部门id
*/
private Long deptId;
}
package com.mx.cneeds.server.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 角色用户映射表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@Data
@TableName("sys_user_role")
public class SysUserRoleEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
private Long id;
/**
* 用户id
*/
private Long userId;
/**
* 权限id
*/
private Long roleId;
}
mybatis-plus:
mapper-locations: classpath:mapper/*.xml
\ No newline at end of file
<?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.mx.cneeds.server.dao.DeviceInfoDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.mx.cneeds.server.entity.DeviceInfoEntity" id="deviceInfoMap">
<result property="deviceId" column="device_id"/>
<result property="deptId" column="dept_id"/>
<result property="imei" column="imei"/>
<result property="iccid" column="iccid"/>
<result property="status" column="status"/>
<result property="deviceVersion" column="device_version"/>
<result property="productSet" column="product_set"/>
<result property="createTime" column="create_time"/>
<result property="activeTime" column="active_time"/>
</resultMap>
</mapper>
\ No newline at end of file
<?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.mx.cneeds.server.dao.DeviceLogDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.mx.cneeds.server.entity.DeviceLogEntity" id="deviceLogMap">
<result property="logId" column="log_id"/>
<result property="logName" column="log_name"/>
<result property="createTime" column="create_time"/>
<result property="deviceId" column="device_id"/>
<result property="status" column="status"/>
<result property="cteateUsername" column="cteate_username"/>
<result property="userId" column="user_id"/>
<result property="repetitionSteps" column="repetition_steps"/>
<result property="logfileUrl" column="logfile_url"/>
<result property="logfileSize" column="logfile_size"/>
<result property="logfileStatus" column="logfile_status"/>
</resultMap>
</mapper>
\ No newline at end of file
<?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.mx.cneeds.server.dao.DeviceLogmediaDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.mx.cneeds.server.entity.DeviceLogmediaEntity" id="deviceLogmediaMap">
<result property="logmediaId" column="logmedia_id"/>
<result property="locationUrl" column="location_url"/>
<result property="logId" column="log_id"/>
<result property="type" column="type"/>
</resultMap>
</mapper>
\ No newline at end of file
<?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.mx.cneeds.server.dao.DeviceLogsettingDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.mx.cneeds.server.entity.DeviceLogsettingEntity" id="deviceLogsettingMap">
<result property="logsettingId" column="logsetting_id"/>
<result property="logSize" column="log_size"/>
<result property="deviceId" column="device_id"/>
</resultMap>
</mapper>
\ No newline at end of file
<?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.mx.cneeds.server.dao.SysDeptDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.mx.cneeds.server.entity.SysDeptEntity" id="sysDeptMap">
<result property="deptId" column="dept_id"/>
<result property="parentId" column="parent_id"/>
<result property="name" column="name"/>
<result property="orderNum" column="order_num"/>
<result property="delFlag" column="del_flag"/>
<result property="distributorNum" column="distributor_num"/>
</resultMap>
</mapper>
\ No newline at end of file
<?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.mx.cneeds.server.dao.SysFuncDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.mx.cneeds.server.entity.SysFuncEntity" id="sysFuncMap">
<result property="funcId" column="func_id"/>
<result property="parentId" column="parent_id"/>
<result property="name" column="name"/>
<result property="url" column="url"/>
<result property="perms" column="perms"/>
<result property="type" column="type"/>
<result property="orderNum" column="order_num"/>
</resultMap>
</mapper>
\ No newline at end of file
<?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.mx.cneeds.server.dao.SysRoleDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.mx.cneeds.server.entity.SysRoleEntity" id="sysRoleMap">
<result property="roleId" column="role_id"/>
<result property="roleName" column="role_name"/>
<result property="remark" column="remark"/>
<result property="deptId" column="dept_id"/>
<result property="createTime" column="create_time"/>
</resultMap>
</mapper>
\ No newline at end of file
<?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.mx.cneeds.server.dao.SysRoleDeptDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.mx.cneeds.server.entity.SysRoleDeptEntity" id="sysRoleDeptMap">
<result property="id" column="id"/>
<result property="roleId" column="role_id"/>
<result property="deptId" column="dept_id"/>
</resultMap>
</mapper>
\ No newline at end of file
<?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.mx.cneeds.server.dao.SysRoleFuncDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.mx.cneeds.server.entity.SysRoleFuncEntity" id="sysRoleFuncMap">
<result property="id" column="id"/>
<result property="roleId" column="role_id"/>
<result property="funcId" column="func_id"/>
</resultMap>
</mapper>
\ No newline at end of file
<?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.mx.cneeds.server.dao.SysUserDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.mx.cneeds.server.entity.SysUserEntity" id="sysUserMap">
<result property="userId" column="user_id"/>
<result property="username" column="username"/>
<result property="password" column="password"/>
<result property="salt" column="salt"/>
<result property="email" column="email"/>
<result property="mobile" column="mobile"/>
<result property="status" column="status"/>
<result property="createTime" column="create_time"/>
<result property="deptId" column="dept_id"/>
</resultMap>
</mapper>
\ No newline at end of file
<?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.mx.cneeds.server.dao.SysUserRoleDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.mx.cneeds.server.entity.SysUserRoleEntity" id="sysUserRoleMap">
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="roleId" column="role_id"/>
</resultMap>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>cneeds-server</artifactId>
<groupId>com.mx.cneeds</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cneeds-common-utils</artifactId>
<properties>
<mybatisplus.version>3.1.2</mybatisplus.version>
<commons.lang.version>2.6</commons.lang.version>
</properties>
<dependencies>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatisplus.version}</version>
<exclusions>
<exclusion>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>${commons.lang.version}</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/
package com.mx.cneeds.common.exception;
/**
* 自定义异常
*
* @author Mark sunlightcs@gmail.com
*/
public class RRException extends RuntimeException {
private static final long serialVersionUID = 1L;
private String msg;
private int code = 500;
public RRException(String msg) {
super(msg);
this.msg = msg;
}
public RRException(String msg, Throwable e) {
super(msg, e);
this.msg = msg;
}
public RRException(String msg, int code) {
super(msg);
this.msg = msg;
this.code = code;
}
public RRException(String msg, int code, Throwable e) {
super(msg, e);
this.msg = msg;
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
}
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/
package com.mx.cneeds.common.pager;
/**
* 常量
*
* @author Mark sunlightcs@gmail.com
*/
public class Constant {
/** 超级管理员ID */
public static final int SUPER_ADMIN = 1;
/** 数据权限过滤 */
public static final String SQL_FILTER = "sql_filter";
/**
* 当前页码
*/
public static final String PAGE = "page";
/**
* 每页显示记录数
*/
public static final String LIMIT = "limit";
/**
* 排序字段
*/
public static final String ORDER_FIELD = "sidx";
/**
* 排序方式
*/
public static final String ORDER = "order";
/**
* 升序
*/
public static final String ASC = "asc";
/**
* 菜单类型
*/
public enum MenuType {
/**
* 目录
*/
CATALOG(0),
/**
* 菜单
*/
MENU(1),
/**
* 按钮
*/
BUTTON(2);
private int value;
MenuType(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
/**
* 定时任务状态
*/
public enum ScheduleStatus {
/**
* 正常
*/
NORMAL(0),
/**
* 暂停
*/
PAUSE(1);
private int value;
ScheduleStatus(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
/**
* 云服务商
*/
public enum CloudService {
/**
* 七牛云
*/
QINIU(1),
/**
* 阿里云
*/
ALIYUN(2),
/**
* 腾讯云
*/
QCLOUD(3);
private int value;
CloudService(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
}
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/
package com.mx.cneeds.common.pager;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.io.Serializable;
import java.util.List;
/**
* 分页工具类
*
* @author Mark sunlightcs@gmail.com
*/
public class PageUtils implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 总记录数
*/
private int totalCount;
/**
* 每页记录数
*/
private int pageSize;
/**
* 总页数
*/
private int totalPage;
/**
* 当前页数
*/
private int currPage;
/**
* 列表数据
*/
private List<?> list;
/**
* 分页
* @param list 列表数据
* @param totalCount 总记录数
* @param pageSize 每页记录数
* @param currPage 当前页数
*/
public PageUtils(List<?> list, int totalCount, int pageSize, int currPage) {
this.list = list;
this.totalCount = totalCount;
this.pageSize = pageSize;
this.currPage = currPage;
this.totalPage = (int) Math.ceil((double)totalCount/pageSize);
}
/**
* 分页
*/
public PageUtils(IPage<?> page) {
this.list = page.getRecords();
this.totalCount = (int)page.getTotal();
this.pageSize = (int)page.getSize();
this.currPage = (int)page.getCurrent();
this.totalPage = (int)page.getPages();
}
public int getTotalCount() {
return totalCount;
}
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getCurrPage() {
return currPage;
}
public void setCurrPage(int currPage) {
this.currPage = currPage;
}
public List<?> getList() {
return list;
}
public void setList(List<?> list) {
this.list = list;
}
}
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/
package com.mx.cneeds.common.pager;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mx.cneeds.common.xss.SQLFilter;
import org.apache.commons.lang.StringUtils;
import java.util.Map;
/**
* 查询参数
*
* @author Mark sunlightcs@gmail.com
*/
public class Query<T> {
public IPage<T> getPage(Map<String, Object> params) {
return this.getPage(params, null, false);
}
public IPage<T> getPage(Map<String, Object> params, String defaultOrderField, boolean isAsc) {
//分页参数
long curPage = 1;
long limit = 10;
if(params.get(Constant.PAGE) != null){
curPage = Long.parseLong((String)params.get(Constant.PAGE));
}
if(params.get(Constant.LIMIT) != null){
limit = Long.parseLong((String)params.get(Constant.LIMIT));
}
//分页对象
Page<T> page = new Page<>(curPage, limit);
//分页参数
params.put(Constant.PAGE, page);
//排序字段
//防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险)
String orderField = SQLFilter.sqlInject((String)params.get(Constant.ORDER_FIELD));
String order = (String)params.get(Constant.ORDER);
//前端字段排序
if(StringUtils.isNotEmpty(orderField) && StringUtils.isNotEmpty(order)){
if(Constant.ASC.equalsIgnoreCase(order)) {
return page.addOrder(OrderItem.asc(orderField));
}else {
return page.addOrder(OrderItem.desc(orderField));
}
}
//没有排序字段,则不排序
if(StringUtils.isBlank(defaultOrderField)){
return page;
}
//默认排序
if(isAsc) {
page.addOrder(OrderItem.asc(defaultOrderField));
}else {
page.addOrder(OrderItem.desc(defaultOrderField));
}
return page;
}
}
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/
package com.mx.cneeds.common.result;
import java.util.HashMap;
import java.util.Map;
/**
* 返回数据
*
* @author Mark sunlightcs@gmail.com
*/
public class R extends HashMap<String, Object> {
private static final long serialVersionUID = 1L;
public R() {
put("code", 0);
put("msg", "success");
}
public static R error() {
return error(500, "未知异常,请联系管理员");
}
public static R error(String msg) {
return error(500, msg);
}
public static R error(int code, String msg) {
R r = new R();
r.put("code", code);
r.put("msg", msg);
return r;
}
public static R ok(String msg) {
R r = new R();
r.put("msg", msg);
return r;
}
public static R ok(Map<String, Object> map) {
R r = new R();
r.putAll(map);
return r;
}
public static R ok() {
return new R();
}
@Override
public R put(String key, Object value) {
super.put(key, value);
return this;
}
}
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/
package com.mx.cneeds.common.validator;
import com.mx.cneeds.common.exception.RRException;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import java.util.Set;
/**
* hibernate-validator校验工具类
*
* 参考文档:http://docs.jboss.org/hibernate/validator/5.4/reference/en-US/html_single/
*
* @author Mark sunlightcs@gmail.com
*/
public class ValidatorUtils {
private static Validator validator;
static {
validator = Validation.buildDefaultValidatorFactory().getValidator();
}
/**
* 校验对象
* @param object 待校验对象
* @param groups 待校验的组
* @throws RRException 校验不通过,则报RRException异常
*/
public static void validateEntity(Object object, Class<?>... groups)
throws RRException {
Set<ConstraintViolation<Object>> constraintViolations = validator.validate(object, groups);
if (!constraintViolations.isEmpty()) {
ConstraintViolation<Object> constraint = (ConstraintViolation<Object>)constraintViolations.iterator().next();
throw new RRException(constraint.getMessage());
}
}
}
package com.mx.cneeds.common.xss;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
* HTML filtering utility for protecting against XSS (Cross Site Scripting).
*
* This code is licensed LGPLv3
*
* This code is a Java port of the original work in PHP by Cal Hendersen.
* http://code.iamcal.com/php/lib_filter/
*
* The trickiest part of the translation was handling the differences in regex handling
* between PHP and Java. These resources were helpful in the process:
*
* http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
* http://us2.php.net/manual/en/reference.pcre.pattern.modifiers.php
* http://www.regular-expressions.info/modifiers.html
*
* A note on naming conventions: instance variables are prefixed with a "v"; global
* constants are in all caps.
*
* Sample use:
* String input = ...
* String clean = new HTMLFilter().filter( input );
*
* The class is not thread safe. Create a new instance if in doubt.
*
* If you find bugs or have suggestions on improvement (especially regarding
* performance), please contact us. The latest version of this
* source, and our contact details, can be found at http://xss-html-filter.sf.net
*
* @author Joseph O'Connell
* @author Cal Hendersen
* @author Michael Semb Wever
*/
public final class HTMLFilter {
/** regex flag union representing /si modifiers in php **/
private static final int REGEX_FLAGS_SI = Pattern.CASE_INSENSITIVE | Pattern.DOTALL;
private static final Pattern P_COMMENTS = Pattern.compile("<!--(.*?)-->", Pattern.DOTALL);
private static final Pattern P_COMMENT = Pattern.compile("^!--(.*)--$", REGEX_FLAGS_SI);
private static final Pattern P_TAGS = Pattern.compile("<(.*?)>", Pattern.DOTALL);
private static final Pattern P_END_TAG = Pattern.compile("^/([a-z0-9]+)", REGEX_FLAGS_SI);
private static final Pattern P_START_TAG = Pattern.compile("^([a-z0-9]+)(.*?)(/?)$", REGEX_FLAGS_SI);
private static final Pattern P_QUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)=([\"'])(.*?)\\2", REGEX_FLAGS_SI);
private static final Pattern P_UNQUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)(=)([^\"\\s']+)", REGEX_FLAGS_SI);
private static final Pattern P_PROTOCOL = Pattern.compile("^([^:]+):", REGEX_FLAGS_SI);
private static final Pattern P_ENTITY = Pattern.compile("&#(\\d+);?");
private static final Pattern P_ENTITY_UNICODE = Pattern.compile("&#x([0-9a-f]+);?");
private static final Pattern P_ENCODE = Pattern.compile("%([0-9a-f]{2});?");
private static final Pattern P_VALID_ENTITIES = Pattern.compile("&([^&;]*)(?=(;|&|$))");
private static final Pattern P_VALID_QUOTES = Pattern.compile("(>|^)([^<]+?)(<|$)", Pattern.DOTALL);
private static final Pattern P_END_ARROW = Pattern.compile("^>");
private static final Pattern P_BODY_TO_END = Pattern.compile("<([^>]*?)(?=<|$)");
private static final Pattern P_XML_CONTENT = Pattern.compile("(^|>)([^<]*?)(?=>)");
private static final Pattern P_STRAY_LEFT_ARROW = Pattern.compile("<([^>]*?)(?=<|$)");
private static final Pattern P_STRAY_RIGHT_ARROW = Pattern.compile("(^|>)([^<]*?)(?=>)");
private static final Pattern P_AMP = Pattern.compile("&");
private static final Pattern P_QUOTE = Pattern.compile("<");
private static final Pattern P_LEFT_ARROW = Pattern.compile("<");
private static final Pattern P_RIGHT_ARROW = Pattern.compile(">");
private static final Pattern P_BOTH_ARROWS = Pattern.compile("<>");
// @xxx could grow large... maybe use sesat's ReferenceMap
private static final ConcurrentMap<String, Pattern> P_REMOVE_PAIR_BLANKS = new ConcurrentHashMap<String, Pattern>();
private static final ConcurrentMap<String, Pattern> P_REMOVE_SELF_BLANKS = new ConcurrentHashMap<String, Pattern>();
/** set of allowed html elements, along with allowed attributes for each element **/
private final Map<String, List<String>> vAllowed;
/** counts of open tags for each (allowable) html element **/
private final Map<String, Integer> vTagCounts = new HashMap<String, Integer>();
/** html elements which must always be self-closing (e.g. "<img />") **/
private final String[] vSelfClosingTags;
/** html elements which must always have separate opening and closing tags (e.g. "<b></b>") **/
private final String[] vNeedClosingTags;
/** set of disallowed html elements **/
private final String[] vDisallowed;
/** attributes which should be checked for valid protocols **/
private final String[] vProtocolAtts;
/** allowed protocols **/
private final String[] vAllowedProtocols;
/** tags which should be removed if they contain no content (e.g. "<b></b>" or "<b />") **/
private final String[] vRemoveBlanks;
/** entities allowed within html markup **/
private final String[] vAllowedEntities;
/** flag determining whether comments are allowed in input String. */
private final boolean stripComment;
private final boolean encodeQuotes;
private boolean vDebug = false;
/**
* flag determining whether to try to make tags when presented with "unbalanced"
* angle brackets (e.g. "<b text </b>" becomes "<b> text </b>"). If set to false,
* unbalanced angle brackets will be html escaped.
*/
private final boolean alwaysMakeTags;
/** Default constructor.
*
*/
public HTMLFilter() {
vAllowed = new HashMap<>();
final ArrayList<String> a_atts = new ArrayList<String>();
a_atts.add("href");
a_atts.add("target");
vAllowed.put("a", a_atts);
final ArrayList<String> img_atts = new ArrayList<String>();
img_atts.add("src");
img_atts.add("width");
img_atts.add("height");
img_atts.add("alt");
vAllowed.put("img", img_atts);
final ArrayList<String> no_atts = new ArrayList<String>();
vAllowed.put("b", no_atts);
vAllowed.put("strong", no_atts);
vAllowed.put("i", no_atts);
vAllowed.put("em", no_atts);
vSelfClosingTags = new String[]{"img"};
vNeedClosingTags = new String[]{"a", "b", "strong", "i", "em"};
vDisallowed = new String[]{};
vAllowedProtocols = new String[]{"http", "mailto", "https"}; // no ftp.
vProtocolAtts = new String[]{"src", "href"};
vRemoveBlanks = new String[]{"a", "b", "strong", "i", "em"};
vAllowedEntities = new String[]{"amp", "gt", "lt", "quot"};
stripComment = true;
encodeQuotes = true;
alwaysMakeTags = true;
}
/** Set debug flag to true. Otherwise use default settings. See the default constructor.
*
* @param debug turn debug on with a true argument
*/
public HTMLFilter(final boolean debug) {
this();
vDebug = debug;
}
/** Map-parameter configurable constructor.
*
* @param conf map containing configuration. keys match field names.
*/
public HTMLFilter(final Map<String, Object> conf) {
assert conf.containsKey("vAllowed") : "configuration requires vAllowed";
assert conf.containsKey("vSelfClosingTags") : "configuration requires vSelfClosingTags";
assert conf.containsKey("vNeedClosingTags") : "configuration requires vNeedClosingTags";
assert conf.containsKey("vDisallowed") : "configuration requires vDisallowed";
assert conf.containsKey("vAllowedProtocols") : "configuration requires vAllowedProtocols";
assert conf.containsKey("vProtocolAtts") : "configuration requires vProtocolAtts";
assert conf.containsKey("vRemoveBlanks") : "configuration requires vRemoveBlanks";
assert conf.containsKey("vAllowedEntities") : "configuration requires vAllowedEntities";
vAllowed = Collections.unmodifiableMap((HashMap<String, List<String>>) conf.get("vAllowed"));
vSelfClosingTags = (String[]) conf.get("vSelfClosingTags");
vNeedClosingTags = (String[]) conf.get("vNeedClosingTags");
vDisallowed = (String[]) conf.get("vDisallowed");
vAllowedProtocols = (String[]) conf.get("vAllowedProtocols");
vProtocolAtts = (String[]) conf.get("vProtocolAtts");
vRemoveBlanks = (String[]) conf.get("vRemoveBlanks");
vAllowedEntities = (String[]) conf.get("vAllowedEntities");
stripComment = conf.containsKey("stripComment") ? (Boolean) conf.get("stripComment") : true;
encodeQuotes = conf.containsKey("encodeQuotes") ? (Boolean) conf.get("encodeQuotes") : true;
alwaysMakeTags = conf.containsKey("alwaysMakeTags") ? (Boolean) conf.get("alwaysMakeTags") : true;
}
private void reset() {
vTagCounts.clear();
}
private void debug(final String msg) {
if (vDebug) {
Logger.getAnonymousLogger().info(msg);
}
}
//---------------------------------------------------------------
// my versions of some PHP library functions
public static String chr(final int decimal) {
return String.valueOf((char) decimal);
}
public static String htmlSpecialChars(final String s) {
String result = s;
result = regexReplace(P_AMP, "&amp;", result);
result = regexReplace(P_QUOTE, "&quot;", result);
result = regexReplace(P_LEFT_ARROW, "&lt;", result);
result = regexReplace(P_RIGHT_ARROW, "&gt;", result);
return result;
}
//---------------------------------------------------------------
/**
* given a user submitted input String, filter out any invalid or restricted
* html.
*
* @param input text (i.e. submitted by a user) than may contain html
* @return "clean" version of input, with only valid, whitelisted html elements allowed
*/
public String filter(final String input) {
reset();
String s = input;
debug("************************************************");
debug(" INPUT: " + input);
s = escapeComments(s);
debug(" escapeComments: " + s);
s = balanceHTML(s);
debug(" balanceHTML: " + s);
s = checkTags(s);
debug(" checkTags: " + s);
s = processRemoveBlanks(s);
debug("processRemoveBlanks: " + s);
s = validateEntities(s);
debug(" validateEntites: " + s);
debug("************************************************\n\n");
return s;
}
public boolean isAlwaysMakeTags(){
return alwaysMakeTags;
}
public boolean isStripComments(){
return stripComment;
}
private String escapeComments(final String s) {
final Matcher m = P_COMMENTS.matcher(s);
final StringBuffer buf = new StringBuffer();
if (m.find()) {
final String match = m.group(1); //(.*?)
m.appendReplacement(buf, Matcher.quoteReplacement("<!--" + htmlSpecialChars(match) + "-->"));
}
m.appendTail(buf);
return buf.toString();
}
private String balanceHTML(String s) {
if (alwaysMakeTags) {
//
// try and form html
//
s = regexReplace(P_END_ARROW, "", s);
s = regexReplace(P_BODY_TO_END, "<$1>", s);
s = regexReplace(P_XML_CONTENT, "$1<$2", s);
} else {
//
// escape stray brackets
//
s = regexReplace(P_STRAY_LEFT_ARROW, "&lt;$1", s);
s = regexReplace(P_STRAY_RIGHT_ARROW, "$1$2&gt;<", s);
//
// the last regexp causes '<>' entities to appear
// (we need to do a lookahead assertion so that the last bracket can
// be used in the next pass of the regexp)
//
s = regexReplace(P_BOTH_ARROWS, "", s);
}
return s;
}
private String checkTags(String s) {
Matcher m = P_TAGS.matcher(s);
final StringBuffer buf = new StringBuffer();
while (m.find()) {
String replaceStr = m.group(1);
replaceStr = processTag(replaceStr);
m.appendReplacement(buf, Matcher.quoteReplacement(replaceStr));
}
m.appendTail(buf);
s = buf.toString();
// these get tallied in processTag
// (remember to reset before subsequent calls to filter method)
for (String key : vTagCounts.keySet()) {
for (int ii = 0; ii < vTagCounts.get(key); ii++) {
s += "</" + key + ">";
}
}
return s;
}
private String processRemoveBlanks(final String s) {
String result = s;
for (String tag : vRemoveBlanks) {
if(!P_REMOVE_PAIR_BLANKS.containsKey(tag)){
P_REMOVE_PAIR_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?></" + tag + ">"));
}
result = regexReplace(P_REMOVE_PAIR_BLANKS.get(tag), "", result);
if(!P_REMOVE_SELF_BLANKS.containsKey(tag)){
P_REMOVE_SELF_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?/>"));
}
result = regexReplace(P_REMOVE_SELF_BLANKS.get(tag), "", result);
}
return result;
}
private static String regexReplace(final Pattern regex_pattern, final String replacement, final String s) {
Matcher m = regex_pattern.matcher(s);
return m.replaceAll(replacement);
}
private String processTag(final String s) {
// ending tags
Matcher m = P_END_TAG.matcher(s);
if (m.find()) {
final String name = m.group(1).toLowerCase();
if (allowed(name)) {
if (!inArray(name, vSelfClosingTags)) {
if (vTagCounts.containsKey(name)) {
vTagCounts.put(name, vTagCounts.get(name) - 1);
return "</" + name + ">";
}
}
}
}
// starting tags
m = P_START_TAG.matcher(s);
if (m.find()) {
final String name = m.group(1).toLowerCase();
final String body = m.group(2);
String ending = m.group(3);
//debug( "in a starting tag, name='" + name + "'; body='" + body + "'; ending='" + ending + "'" );
if (allowed(name)) {
String params = "";
final Matcher m2 = P_QUOTED_ATTRIBUTES.matcher(body);
final Matcher m3 = P_UNQUOTED_ATTRIBUTES.matcher(body);
final List<String> paramNames = new ArrayList<String>();
final List<String> paramValues = new ArrayList<String>();
while (m2.find()) {
paramNames.add(m2.group(1)); //([a-z0-9]+)
paramValues.add(m2.group(3)); //(.*?)
}
while (m3.find()) {
paramNames.add(m3.group(1)); //([a-z0-9]+)
paramValues.add(m3.group(3)); //([^\"\\s']+)
}
String paramName, paramValue;
for (int ii = 0; ii < paramNames.size(); ii++) {
paramName = paramNames.get(ii).toLowerCase();
paramValue = paramValues.get(ii);
// debug( "paramName='" + paramName + "'" );
// debug( "paramValue='" + paramValue + "'" );
// debug( "allowed? " + vAllowed.get( name ).contains( paramName ) );
if (allowedAttribute(name, paramName)) {
if (inArray(paramName, vProtocolAtts)) {
paramValue = processParamProtocol(paramValue);
}
params += " " + paramName + "=\"" + paramValue + "\"";
}
}
if (inArray(name, vSelfClosingTags)) {
ending = " /";
}
if (inArray(name, vNeedClosingTags)) {
ending = "";
}
if (ending == null || ending.length() < 1) {
if (vTagCounts.containsKey(name)) {
vTagCounts.put(name, vTagCounts.get(name) + 1);
} else {
vTagCounts.put(name, 1);
}
} else {
ending = " /";
}
return "<" + name + params + ending + ">";
} else {
return "";
}
}
// comments
m = P_COMMENT.matcher(s);
if (!stripComment && m.find()) {
return "<" + m.group() + ">";
}
return "";
}
private String processParamProtocol(String s) {
s = decodeEntities(s);
final Matcher m = P_PROTOCOL.matcher(s);
if (m.find()) {
final String protocol = m.group(1);
if (!inArray(protocol, vAllowedProtocols)) {
// bad protocol, turn into local anchor link instead
s = "#" + s.substring(protocol.length() + 1, s.length());
if (s.startsWith("#//")) {
s = "#" + s.substring(3, s.length());
}
}
}
return s;
}
private String decodeEntities(String s) {
StringBuffer buf = new StringBuffer();
Matcher m = P_ENTITY.matcher(s);
while (m.find()) {
final String match = m.group(1);
final int decimal = Integer.decode(match).intValue();
m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal)));
}
m.appendTail(buf);
s = buf.toString();
buf = new StringBuffer();
m = P_ENTITY_UNICODE.matcher(s);
while (m.find()) {
final String match = m.group(1);
final int decimal = Integer.valueOf(match, 16).intValue();
m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal)));
}
m.appendTail(buf);
s = buf.toString();
buf = new StringBuffer();
m = P_ENCODE.matcher(s);
while (m.find()) {
final String match = m.group(1);
final int decimal = Integer.valueOf(match, 16).intValue();
m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal)));
}
m.appendTail(buf);
s = buf.toString();
s = validateEntities(s);
return s;
}
private String validateEntities(final String s) {
StringBuffer buf = new StringBuffer();
// validate entities throughout the string
Matcher m = P_VALID_ENTITIES.matcher(s);
while (m.find()) {
final String one = m.group(1); //([^&;]*)
final String two = m.group(2); //(?=(;|&|$))
m.appendReplacement(buf, Matcher.quoteReplacement(checkEntity(one, two)));
}
m.appendTail(buf);
return encodeQuotes(buf.toString());
}
private String encodeQuotes(final String s){
if(encodeQuotes){
StringBuffer buf = new StringBuffer();
Matcher m = P_VALID_QUOTES.matcher(s);
while (m.find()) {
final String one = m.group(1); //(>|^)
final String two = m.group(2); //([^<]+?)
final String three = m.group(3); //(<|$)
m.appendReplacement(buf, Matcher.quoteReplacement(one + regexReplace(P_QUOTE, "&quot;", two) + three));
}
m.appendTail(buf);
return buf.toString();
}else{
return s;
}
}
private String checkEntity(final String preamble, final String term) {
return ";".equals(term) && isValidEntity(preamble)
? '&' + preamble
: "&amp;" + preamble;
}
private boolean isValidEntity(final String entity) {
return inArray(entity, vAllowedEntities);
}
private static boolean inArray(final String s, final String[] array) {
for (String item : array) {
if (item != null && item.equals(s)) {
return true;
}
}
return false;
}
private boolean allowed(final String name) {
return (vAllowed.isEmpty() || vAllowed.containsKey(name)) && !inArray(name, vDisallowed);
}
private boolean allowedAttribute(final String name, final String paramName) {
return allowed(name) && (vAllowed.isEmpty() || vAllowed.get(name).contains(paramName));
}
}
\ No newline at end of file
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/
package com.mx.cneeds.common.xss;
import io.renren.common.exception.RRException;
import org.apache.commons.lang.StringUtils;
/**
* SQL过滤
*
* @author Mark sunlightcs@gmail.com
*/
public class SQLFilter {
/**
* SQL注入过滤
* @param str 待验证的字符串
*/
public static String sqlInject(String str){
if(StringUtils.isBlank(str)){
return null;
}
//去掉'|"|;|\字符
str = StringUtils.replace(str, "'", "");
str = StringUtils.replace(str, "\"", "");
str = StringUtils.replace(str, ";", "");
str = StringUtils.replace(str, "\\", "");
//转换成小写
str = str.toLowerCase();
//非法字符
String[] keywords = {"master", "truncate", "insert", "select", "delete", "update", "declare", "alter", "drop"};
//判断是否包含非法字符
for(String keyword : keywords){
if(str.indexOf(keyword) != -1){
throw new RRException("包含非法字符");
}
}
return str;
}
}
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/
package com.mx.cneeds.common.xss;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
/**
* XSS过滤
*
* @author Mark sunlightcs@gmail.com
*/
public class XssFilter implements Filter {
@Override
public void init(FilterConfig config) throws ServletException {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper(
(HttpServletRequest) request);
chain.doFilter(xssRequest, response);
}
@Override
public void destroy() {
}
}
\ No newline at end of file
/**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/
package com.mx.cneeds.common.xss;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* XSS过滤处理
*
* @author Mark sunlightcs@gmail.com
*/
public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
/**
* 没被包装过的HttpServletRequest(特殊场景,需要自己过滤)
*/
HttpServletRequest orgRequest;
/**
* html过滤
*/
private final static HTMLFilter htmlFilter = new HTMLFilter();
public XssHttpServletRequestWrapper(HttpServletRequest request) {
super(request);
orgRequest = request;
}
@Override
public ServletInputStream getInputStream() throws IOException {
//非json类型,直接返回
if(!MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(super.getHeader(HttpHeaders.CONTENT_TYPE))){
return super.getInputStream();
}
//为空,直接返回
String json = IOUtils.toString(super.getInputStream(), "utf-8");
if (StringUtils.isBlank(json)) {
return super.getInputStream();
}
//xss过滤
json = xssEncode(json);
final ByteArrayInputStream bis = new ByteArrayInputStream(json.getBytes("utf-8"));
return new ServletInputStream() {
@Override
public boolean isFinished() {
return true;
}
@Override
public boolean isReady() {
return true;
}
@Override
public void setReadListener(ReadListener readListener) {
}
@Override
public int read() throws IOException {
return bis.read();
}
};
}
@Override
public String getParameter(String name) {
String value = super.getParameter(xssEncode(name));
if (StringUtils.isNotBlank(value)) {
value = xssEncode(value);
}
return value;
}
@Override
public String[] getParameterValues(String name) {
String[] parameters = super.getParameterValues(name);
if (parameters == null || parameters.length == 0) {
return null;
}
for (int i = 0; i < parameters.length; i++) {
parameters[i] = xssEncode(parameters[i]);
}
return parameters;
}
@Override
public Map<String, String[]> getParameterMap() {
Map<String, String[]> map = new LinkedHashMap<>();
Map<String, String[]> parameters = super.getParameterMap();
for (String key : parameters.keySet()) {
String[] values = parameters.get(key);
for (int i = 0; i < values.length; i++) {
values[i] = xssEncode(values[i]);
}
map.put(key, values);
}
return map;
}
@Override
public String getHeader(String name) {
String value = super.getHeader(xssEncode(name));
if (StringUtils.isNotBlank(value)) {
value = xssEncode(value);
}
return value;
}
private String xssEncode(String input) {
return htmlFilter.filter(input);
}
/**
* 获取最原始的request
*/
public HttpServletRequest getOrgRequest() {
return orgRequest;
}
/**
* 获取最原始的request
*/
public static HttpServletRequest getOrgRequest(HttpServletRequest request) {
if (request instanceof XssHttpServletRequestWrapper) {
return ((XssHttpServletRequestWrapper) request).getOrgRequest();
}
return request;
}
}
......@@ -16,6 +16,12 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>com.mx.cneeds</groupId>
<artifactId>cneeds-common-data</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.mx.cneeds.server.web;
package com.mx.cneeds.server.datashow;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
......
spring:
profiles:
active: dev
datasource:
hikari:
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://192.168.2.244:3306/cneeds_server?useUnicode=true&characterEncoding=UTF-8
username: root
password: cneeds!QAZ1qaz
spring:
profiles:
active: dev
\ No newline at end of file
spring:
profiles:
active: dev
\ No newline at end of file
......@@ -17,6 +17,16 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>com.mx.cneeds</groupId>
<artifactId>cneeds-common-utils</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.mx.cneeds</groupId>
<artifactId>cneeds-common-data</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.mx.cneeds.server.device.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.server.entity.DeviceInfoEntity;
import java.util.Map;
/**
* 设备信息
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
public interface DeviceInfoService extends IService<DeviceInfoEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package com.mx.cneeds.server.device.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.server.entity.DeviceLogEntity;
import java.util.Map;
/**
* 测试上传的日志表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
public interface DeviceLogService extends IService<DeviceLogEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package com.mx.cneeds.server.device.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.server.entity.DeviceLogmediaEntity;
import java.util.Map;
/**
* 日志音频表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
public interface DeviceLogmediaService extends IService<DeviceLogmediaEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package com.mx.cneeds.server.device.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.server.entity.DeviceLogsettingEntity;
import java.util.Map;
/**
* 设备日志设置
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
public interface DeviceLogsettingService extends IService<DeviceLogsettingEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package com.mx.cneeds.server.device.service.impl;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.pager.Query;
import com.mx.cneeds.server.dao.DeviceInfoDao;
import com.mx.cneeds.server.device.service.DeviceInfoService;
import com.mx.cneeds.server.entity.DeviceInfoEntity;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service("deviceInfoService")
public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoDao, DeviceInfoEntity> implements DeviceInfoService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<DeviceInfoEntity> page = this.page(
new Query<DeviceInfoEntity>().getPage(params),
new QueryWrapper<DeviceInfoEntity>()
);
return new PageUtils(page);
}
}
package com.mx.cneeds.server.device.service.impl;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.pager.Query;
import com.mx.cneeds.server.dao.DeviceLogDao;
import com.mx.cneeds.server.device.service.DeviceLogService;
import com.mx.cneeds.server.entity.DeviceLogEntity;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service("deviceLogService")
public class DeviceLogServiceImpl extends ServiceImpl<DeviceLogDao, DeviceLogEntity> implements DeviceLogService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<DeviceLogEntity> page = this.page(
new Query<DeviceLogEntity>().getPage(params),
new QueryWrapper<DeviceLogEntity>()
);
return new PageUtils(page);
}
}
package com.mx.cneeds.server.device.service.impl;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.pager.Query;
import com.mx.cneeds.server.dao.DeviceLogmediaDao;
import com.mx.cneeds.server.device.service.DeviceLogmediaService;
import com.mx.cneeds.server.entity.DeviceLogmediaEntity;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service("deviceLogmediaService")
public class DeviceLogmediaServiceImpl extends ServiceImpl<DeviceLogmediaDao, DeviceLogmediaEntity> implements DeviceLogmediaService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<DeviceLogmediaEntity> page = this.page(
new Query<DeviceLogmediaEntity>().getPage(params),
new QueryWrapper<DeviceLogmediaEntity>()
);
return new PageUtils(page);
}
}
package com.mx.cneeds.server.device.service.impl;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.pager.Query;
import com.mx.cneeds.server.dao.DeviceLogsettingDao;
import com.mx.cneeds.server.device.service.DeviceLogsettingService;
import com.mx.cneeds.server.entity.DeviceLogsettingEntity;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service("deviceLogsettingService")
public class DeviceLogsettingServiceImpl extends ServiceImpl<DeviceLogsettingDao, DeviceLogsettingEntity> implements DeviceLogsettingService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<DeviceLogsettingEntity> page = this.page(
new Query<DeviceLogsettingEntity>().getPage(params),
new QueryWrapper<DeviceLogsettingEntity>()
);
return new PageUtils(page);
}
}
package com.mx.cneeds.server.device.web;
import java.util.Arrays;
import java.util.Map;
//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.result.R;
import com.mx.cneeds.common.validator.ValidatorUtils;
import com.mx.cneeds.server.device.service.DeviceInfoService;
import com.mx.cneeds.server.entity.DeviceInfoEntity;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 设备信息
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@RestController
@RequestMapping("sys/deviceinfo")
public class DeviceInfoController {
@Autowired
private DeviceInfoService deviceInfoService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("sys:deviceinfo:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = deviceInfoService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{deviceId}")
// @RequiresPermissions("sys:deviceinfo:info")
public R info(@PathVariable("deviceId") Long deviceId){
DeviceInfoEntity deviceInfo = deviceInfoService.getById(deviceId);
return R.ok().put("deviceInfo", deviceInfo);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("sys:deviceinfo:save")
public R save(@RequestBody DeviceInfoEntity deviceInfo){
deviceInfoService.save(deviceInfo);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("sys:deviceinfo:update")
public R update(@RequestBody DeviceInfoEntity deviceInfo){
ValidatorUtils.validateEntity(deviceInfo);
deviceInfoService.updateById(deviceInfo);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("sys:deviceinfo:delete")
public R delete(@RequestBody Long[] deviceIds){
deviceInfoService.removeByIds(Arrays.asList(deviceIds));
return R.ok();
}
}
package com.mx.cneeds.server.device.web;
import java.util.Arrays;
import java.util.Map;
//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.result.R;
import com.mx.cneeds.common.validator.ValidatorUtils;
import com.mx.cneeds.server.device.service.DeviceLogService;
import com.mx.cneeds.server.entity.DeviceLogEntity;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 测试上传的日志表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@RestController
@RequestMapping("sys/devicelog")
public class DeviceLogController {
@Autowired
private DeviceLogService deviceLogService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("sys:devicelog:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = deviceLogService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{logId}")
// @RequiresPermissions("sys:devicelog:info")
public R info(@PathVariable("logId") Long logId){
DeviceLogEntity deviceLog = deviceLogService.getById(logId);
return R.ok().put("deviceLog", deviceLog);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("sys:devicelog:save")
public R save(@RequestBody DeviceLogEntity deviceLog){
deviceLogService.save(deviceLog);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("sys:devicelog:update")
public R update(@RequestBody DeviceLogEntity deviceLog){
ValidatorUtils.validateEntity(deviceLog);
deviceLogService.updateById(deviceLog);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("sys:devicelog:delete")
public R delete(@RequestBody Long[] logIds){
deviceLogService.removeByIds(Arrays.asList(logIds));
return R.ok();
}
}
package com.mx.cneeds.server.device.web;
import java.util.Arrays;
import java.util.Map;
//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.result.R;
import com.mx.cneeds.common.validator.ValidatorUtils;
import com.mx.cneeds.server.device.service.DeviceLogmediaService;
import com.mx.cneeds.server.entity.DeviceLogmediaEntity;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 日志音频表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@RestController
@RequestMapping("sys/devicelogmedia")
public class DeviceLogmediaController {
@Autowired
private DeviceLogmediaService deviceLogmediaService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("sys:devicelogmedia:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = deviceLogmediaService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{logmediaId}")
// @RequiresPermissions("sys:devicelogmedia:info")
public R info(@PathVariable("logmediaId") Long logmediaId){
DeviceLogmediaEntity deviceLogmedia = deviceLogmediaService.getById(logmediaId);
return R.ok().put("deviceLogmedia", deviceLogmedia);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("sys:devicelogmedia:save")
public R save(@RequestBody DeviceLogmediaEntity deviceLogmedia){
deviceLogmediaService.save(deviceLogmedia);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("sys:devicelogmedia:update")
public R update(@RequestBody DeviceLogmediaEntity deviceLogmedia){
ValidatorUtils.validateEntity(deviceLogmedia);
deviceLogmediaService.updateById(deviceLogmedia);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("sys:devicelogmedia:delete")
public R delete(@RequestBody Long[] logmediaIds){
deviceLogmediaService.removeByIds(Arrays.asList(logmediaIds));
return R.ok();
}
}
package com.mx.cneeds.server.device.web;
import java.util.Arrays;
import java.util.Map;
//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.result.R;
import com.mx.cneeds.common.validator.ValidatorUtils;
import com.mx.cneeds.server.device.service.DeviceLogsettingService;
import com.mx.cneeds.server.entity.DeviceLogsettingEntity;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 设备日志设置
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@RestController
@RequestMapping("sys/devicelogsetting")
public class DeviceLogsettingController {
@Autowired
private DeviceLogsettingService deviceLogsettingService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("sys:devicelogsetting:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = deviceLogsettingService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{logsettingId}")
// @RequiresPermissions("sys:devicelogsetting:info")
public R info(@PathVariable("logsettingId") Long logsettingId){
DeviceLogsettingEntity deviceLogsetting = deviceLogsettingService.getById(logsettingId);
return R.ok().put("deviceLogsetting", deviceLogsetting);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("sys:devicelogsetting:save")
public R save(@RequestBody DeviceLogsettingEntity deviceLogsetting){
deviceLogsettingService.save(deviceLogsetting);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("sys:devicelogsetting:update")
public R update(@RequestBody DeviceLogsettingEntity deviceLogsetting){
ValidatorUtils.validateEntity(deviceLogsetting);
deviceLogsettingService.updateById(deviceLogsetting);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("sys:devicelogsetting:delete")
public R delete(@RequestBody Long[] logsettingIds){
deviceLogsettingService.removeByIds(Arrays.asList(logsettingIds));
return R.ok();
}
}
eureka:
client:
service-url:
#defaultZone: http://eureka2:8762/eureka/
defaultZone: http://localhost:8761/eureka/
# register-with-eureka: false
fetch-registry: 'false'

# server:
# enable-self-preservation: false
instance:
prefer-ip-address: true
spring:
application:
name: cneeds-server-eureka
server:
port: 8761
\ No newline at end of file
......@@ -17,6 +17,16 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>com.mx.cneeds</groupId>
<artifactId>cneeds-common-utils</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.mx.cneeds</groupId>
<artifactId>cneeds-common-data</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.mx.cneeds.server.user.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.server.entity.SysDeptEntity;
import java.util.Map;
/**
* 部门表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
public interface SysDeptService extends IService<SysDeptEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package com.mx.cneeds.server.user.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.server.entity.SysFuncEntity;
import java.util.Map;
/**
* 功能表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
public interface SysFuncService extends IService<SysFuncEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package com.mx.cneeds.server.user.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.server.entity.SysRoleDeptEntity;
import java.util.Map;
/**
* 部门与角色映射表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
public interface SysRoleDeptService extends IService<SysRoleDeptEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package com.mx.cneeds.server.user.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.server.entity.SysRoleFuncEntity;
import java.util.Map;
/**
* 功能与角色映射表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
public interface SysRoleFuncService extends IService<SysRoleFuncEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package com.mx.cneeds.server.user.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.server.entity.SysRoleEntity;
import java.util.Map;
/**
* 角色表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
public interface SysRoleService extends IService<SysRoleEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package com.mx.cneeds.server.user.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.server.entity.SysUserRoleEntity;
import java.util.Map;
/**
* 角色用户映射表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
public interface SysUserRoleService extends IService<SysUserRoleEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package com.mx.cneeds.server.user.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.server.entity.SysUserEntity;
import java.util.Map;
/**
* 用户信息表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
public interface SysUserService extends IService<SysUserEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package com.mx.cneeds.server.user.service.impl;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.pager.Query;
import com.mx.cneeds.server.dao.SysDeptDao;
import com.mx.cneeds.server.entity.SysDeptEntity;
import com.mx.cneeds.server.user.service.SysDeptService;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service("sysDeptService")
public class SysDeptServiceImpl extends ServiceImpl<SysDeptDao, SysDeptEntity> implements SysDeptService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SysDeptEntity> page = this.page(
new Query<SysDeptEntity>().getPage(params),
new QueryWrapper<SysDeptEntity>()
);
return new PageUtils(page);
}
}
package com.mx.cneeds.server.user.service.impl;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.pager.Query;
import com.mx.cneeds.server.dao.SysFuncDao;
import com.mx.cneeds.server.entity.SysFuncEntity;
import com.mx.cneeds.server.user.service.SysFuncService;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service("sysFuncService")
public class SysFuncServiceImpl extends ServiceImpl<SysFuncDao, SysFuncEntity> implements SysFuncService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SysFuncEntity> page = this.page(
new Query<SysFuncEntity>().getPage(params),
new QueryWrapper<SysFuncEntity>()
);
return new PageUtils(page);
}
}
package com.mx.cneeds.server.user.service.impl;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.pager.Query;
import com.mx.cneeds.server.dao.SysRoleDeptDao;
import com.mx.cneeds.server.entity.SysRoleDeptEntity;
import com.mx.cneeds.server.user.service.SysRoleDeptService;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service("sysRoleDeptService")
public class SysRoleDeptServiceImpl extends ServiceImpl<SysRoleDeptDao, SysRoleDeptEntity> implements SysRoleDeptService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SysRoleDeptEntity> page = this.page(
new Query<SysRoleDeptEntity>().getPage(params),
new QueryWrapper<SysRoleDeptEntity>()
);
return new PageUtils(page);
}
}
package com.mx.cneeds.server.user.service.impl;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.pager.Query;
import com.mx.cneeds.server.dao.SysRoleFuncDao;
import com.mx.cneeds.server.entity.SysRoleFuncEntity;
import com.mx.cneeds.server.user.service.SysRoleFuncService;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service("sysRoleFuncService")
public class SysRoleFuncServiceImpl extends ServiceImpl<SysRoleFuncDao, SysRoleFuncEntity> implements SysRoleFuncService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SysRoleFuncEntity> page = this.page(
new Query<SysRoleFuncEntity>().getPage(params),
new QueryWrapper<SysRoleFuncEntity>()
);
return new PageUtils(page);
}
}
package com.mx.cneeds.server.user.service.impl;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.pager.Query;
import com.mx.cneeds.server.dao.SysRoleDao;
import com.mx.cneeds.server.entity.SysRoleEntity;
import com.mx.cneeds.server.user.service.SysRoleService;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service("sysRoleService")
public class SysRoleServiceImpl extends ServiceImpl<SysRoleDao, SysRoleEntity> implements SysRoleService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SysRoleEntity> page = this.page(
new Query<SysRoleEntity>().getPage(params),
new QueryWrapper<SysRoleEntity>()
);
return new PageUtils(page);
}
}
package com.mx.cneeds.server.user.service.impl;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.pager.Query;
import com.mx.cneeds.server.dao.SysUserRoleDao;
import com.mx.cneeds.server.entity.SysUserRoleEntity;
import com.mx.cneeds.server.user.service.SysUserRoleService;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service("sysUserRoleService")
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleDao, SysUserRoleEntity> implements SysUserRoleService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SysUserRoleEntity> page = this.page(
new Query<SysUserRoleEntity>().getPage(params),
new QueryWrapper<SysUserRoleEntity>()
);
return new PageUtils(page);
}
}
package com.mx.cneeds.server.user.service.impl;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.pager.Query;
import com.mx.cneeds.server.dao.SysUserDao;
import com.mx.cneeds.server.entity.SysUserEntity;
import com.mx.cneeds.server.user.service.SysUserService;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service("sysUserService")
public class SysUserServiceImpl extends ServiceImpl<SysUserDao, SysUserEntity> implements SysUserService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SysUserEntity> page = this.page(
new Query<SysUserEntity>().getPage(params),
new QueryWrapper<SysUserEntity>()
);
return new PageUtils(page);
}
}
package com.mx.cneeds.server.user.web;
import java.util.Arrays;
import java.util.Map;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.result.R;
import com.mx.cneeds.common.validator.ValidatorUtils;
import com.mx.cneeds.server.entity.SysDeptEntity;
//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.mx.cneeds.server.user.service.SysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 部门表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@RestController
@RequestMapping("sys/sysdept")
public class SysDeptController {
@Autowired
private SysDeptService sysDeptService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("sys:sysdept:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = sysDeptService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{deptId}")
// @RequiresPermissions("sys:sysdept:info")
public R info(@PathVariable("deptId") Long deptId){
SysDeptEntity sysDept = sysDeptService.getById(deptId);
return R.ok().put("sysDept", sysDept);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("sys:sysdept:save")
public R save(@RequestBody SysDeptEntity sysDept){
sysDeptService.save(sysDept);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("sys:sysdept:update")
public R update(@RequestBody SysDeptEntity sysDept){
ValidatorUtils.validateEntity(sysDept);
sysDeptService.updateById(sysDept);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("sys:sysdept:delete")
public R delete(@RequestBody Long[] deptIds){
sysDeptService.removeByIds(Arrays.asList(deptIds));
return R.ok();
}
}
package com.mx.cneeds.server.user.web;
import java.util.Arrays;
import java.util.Map;
//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.result.R;
import com.mx.cneeds.common.validator.ValidatorUtils;
import com.mx.cneeds.server.entity.SysFuncEntity;
import com.mx.cneeds.server.user.service.SysFuncService;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 功能表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@RestController
@RequestMapping("sys/sysfunc")
public class SysFuncController {
@Autowired
private SysFuncService sysFuncService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("sys:sysfunc:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = sysFuncService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{funcId}")
// @RequiresPermissions("sys:sysfunc:info")
public R info(@PathVariable("funcId") Long funcId){
SysFuncEntity sysFunc = sysFuncService.getById(funcId);
return R.ok().put("sysFunc", sysFunc);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("sys:sysfunc:save")
public R save(@RequestBody SysFuncEntity sysFunc){
sysFuncService.save(sysFunc);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("sys:sysfunc:update")
public R update(@RequestBody SysFuncEntity sysFunc){
ValidatorUtils.validateEntity(sysFunc);
sysFuncService.updateById(sysFunc);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("sys:sysfunc:delete")
public R delete(@RequestBody Long[] funcIds){
sysFuncService.removeByIds(Arrays.asList(funcIds));
return R.ok();
}
}
package com.mx.cneeds.server.user.web;
import java.util.Arrays;
import java.util.Map;
//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.result.R;
import com.mx.cneeds.common.validator.ValidatorUtils;
import com.mx.cneeds.server.entity.SysRoleEntity;
import com.mx.cneeds.server.user.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 角色表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@RestController
@RequestMapping("sys/sysrole")
public class SysRoleController {
@Autowired
private SysRoleService sysRoleService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("sys:sysrole:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = sysRoleService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{roleId}")
// @RequiresPermissions("sys:sysrole:info")
public R info(@PathVariable("roleId") Long roleId){
SysRoleEntity sysRole = sysRoleService.getById(roleId);
return R.ok().put("sysRole", sysRole);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("sys:sysrole:save")
public R save(@RequestBody SysRoleEntity sysRole){
sysRoleService.save(sysRole);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("sys:sysrole:update")
public R update(@RequestBody SysRoleEntity sysRole){
ValidatorUtils.validateEntity(sysRole);
sysRoleService.updateById(sysRole);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("sys:sysrole:delete")
public R delete(@RequestBody Long[] roleIds){
sysRoleService.removeByIds(Arrays.asList(roleIds));
return R.ok();
}
}
package com.mx.cneeds.server.user.web;
import java.util.Arrays;
import java.util.Map;
//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.result.R;
import com.mx.cneeds.common.validator.ValidatorUtils;
import com.mx.cneeds.server.entity.SysRoleDeptEntity;
import com.mx.cneeds.server.user.service.SysRoleDeptService;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 部门与角色映射表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@RestController
@RequestMapping("sys/sysroledept")
public class SysRoleDeptController {
@Autowired
private SysRoleDeptService sysRoleDeptService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("sys:sysroledept:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = sysRoleDeptService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("sys:sysroledept:info")
public R info(@PathVariable("id") Long id){
SysRoleDeptEntity sysRoleDept = sysRoleDeptService.getById(id);
return R.ok().put("sysRoleDept", sysRoleDept);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("sys:sysroledept:save")
public R save(@RequestBody SysRoleDeptEntity sysRoleDept){
sysRoleDeptService.save(sysRoleDept);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("sys:sysroledept:update")
public R update(@RequestBody SysRoleDeptEntity sysRoleDept){
ValidatorUtils.validateEntity(sysRoleDept);
sysRoleDeptService.updateById(sysRoleDept);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("sys:sysroledept:delete")
public R delete(@RequestBody Long[] ids){
sysRoleDeptService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
package com.mx.cneeds.server.user.web;
import java.util.Arrays;
import java.util.Map;
//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.result.R;
import com.mx.cneeds.common.validator.ValidatorUtils;
import com.mx.cneeds.server.entity.SysRoleFuncEntity;
import com.mx.cneeds.server.user.service.SysRoleFuncService;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 功能与角色映射表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@RestController
@RequestMapping("sys/sysrolefunc")
public class SysRoleFuncController {
@Autowired
private SysRoleFuncService sysRoleFuncService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("sys:sysrolefunc:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = sysRoleFuncService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("sys:sysrolefunc:info")
public R info(@PathVariable("id") Long id){
SysRoleFuncEntity sysRoleFunc = sysRoleFuncService.getById(id);
return R.ok().put("sysRoleFunc", sysRoleFunc);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("sys:sysrolefunc:save")
public R save(@RequestBody SysRoleFuncEntity sysRoleFunc){
sysRoleFuncService.save(sysRoleFunc);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("sys:sysrolefunc:update")
public R update(@RequestBody SysRoleFuncEntity sysRoleFunc){
ValidatorUtils.validateEntity(sysRoleFunc);
sysRoleFuncService.updateById(sysRoleFunc);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("sys:sysrolefunc:delete")
public R delete(@RequestBody Long[] ids){
sysRoleFuncService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
package com.mx.cneeds.server.user.web;
import java.util.Arrays;
import java.util.Map;
//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.result.R;
import com.mx.cneeds.common.validator.ValidatorUtils;
import com.mx.cneeds.server.entity.SysUserEntity;
import com.mx.cneeds.server.user.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 用户信息表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@RestController
@RequestMapping("sys/sysuser")
public class SysUserController {
@Autowired
private SysUserService sysUserService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("sys:sysuser:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = sysUserService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{userId}")
// @RequiresPermissions("sys:sysuser:info")
public R info(@PathVariable("userId") Long userId){
SysUserEntity sysUser = sysUserService.getById(userId);
return R.ok().put("sysUser", sysUser);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("sys:sysuser:save")
public R save(@RequestBody SysUserEntity sysUser){
sysUserService.save(sysUser);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("sys:sysuser:update")
public R update(@RequestBody SysUserEntity sysUser){
ValidatorUtils.validateEntity(sysUser);
sysUserService.updateById(sysUser);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("sys:sysuser:delete")
public R delete(@RequestBody Long[] userIds){
sysUserService.removeByIds(Arrays.asList(userIds));
return R.ok();
}
}
package com.mx.cneeds.server.user.web;
import java.util.Arrays;
import java.util.Map;
//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.result.R;
import com.mx.cneeds.common.validator.ValidatorUtils;
import com.mx.cneeds.server.entity.SysUserRoleEntity;
import com.mx.cneeds.server.user.service.SysUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 角色用户映射表
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-01-09 15:09:01
*/
@RestController
@RequestMapping("sys/sysuserrole")
public class SysUserRoleController {
@Autowired
private SysUserRoleService sysUserRoleService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("sys:sysuserrole:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = sysUserRoleService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("sys:sysuserrole:info")
public R info(@PathVariable("id") Long id){
SysUserRoleEntity sysUserRole = sysUserRoleService.getById(id);
return R.ok().put("sysUserRole", sysUserRole);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("sys:sysuserrole:save")
public R save(@RequestBody SysUserRoleEntity sysUserRole){
sysUserRoleService.save(sysUserRole);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("sys:sysuserrole:update")
public R update(@RequestBody SysUserRoleEntity sysUserRole){
ValidatorUtils.validateEntity(sysUserRole);
sysUserRoleService.updateById(sysUserRole);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("sys:sysuserrole:delete")
public R delete(@RequestBody Long[] ids){
sysUserRoleService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
......@@ -21,6 +21,8 @@
<module>cneeds-server-advice_control</module>
<module>cneeds-server-datashow</module>
<module>cneeds-server-logupload</module>
<module>cneeds-common-data</module>
<module>cneeds-common-utils</module>
</modules>
<properties>
......@@ -47,6 +49,14 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment