Commit 9368d5ae by zzrdark

1.增加持久层代码

2.增加utils
3.修改项目间依赖关系
4.增加service、controller
parent ac0a8a52
...@@ -7,8 +7,10 @@ ...@@ -7,8 +7,10 @@
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" /> <outputRelativeToContentRoot value="true" />
<module name="cneeds-server-advice_control" /> <module name="cneeds-server-advice_control" />
<module name="cneeds-common-utils" />
<module name="cneeds-server-datashow" /> <module name="cneeds-server-datashow" />
<module name="cneeds-server-logupload" /> <module name="cneeds-server-logupload" />
<module name="cneeds-common-data" />
<module name="cneeds-server-device_activate" /> <module name="cneeds-server-device_activate" />
<module name="cneeds-server-user" /> <module name="cneeds-server-user" />
<module name="cneeds-server-device" /> <module name="cneeds-server-device" />
...@@ -20,6 +22,8 @@ ...@@ -20,6 +22,8 @@
</component> </component>
<component name="JavacSettings"> <component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE"> <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-advice_control" options="-parameters" />
<module name="cneeds-server-datashow" options="-parameters" /> <module name="cneeds-server-datashow" options="-parameters" />
<module name="cneeds-server-device" options="-parameters" /> <module name="cneeds-server-device" options="-parameters" />
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
<project version="4"> <project version="4">
<component name="Encoding"> <component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" /> <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-advice_control" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/cneeds-server-datashow" 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" /> <file url="file://$PROJECT_DIR$/cneeds-server-device" charset="UTF-8" />
......
<?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());
}
}
}
/**
* 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 @@ ...@@ -16,6 +16,12 @@
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.mx.cneeds</groupId>
<artifactId>cneeds-common-data</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
</project> </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.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; 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 @@ ...@@ -17,6 +17,16 @@
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency> </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> </dependencies>
</project> </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 @@ ...@@ -17,6 +17,16 @@
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency> </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> </dependencies>
</project> </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 @@ ...@@ -21,6 +21,8 @@
<module>cneeds-server-advice_control</module> <module>cneeds-server-advice_control</module>
<module>cneeds-server-datashow</module> <module>cneeds-server-datashow</module>
<module>cneeds-server-logupload</module> <module>cneeds-server-logupload</module>
<module>cneeds-common-data</module>
<module>cneeds-common-utils</module>
</modules> </modules>
<properties> <properties>
...@@ -47,6 +49,14 @@ ...@@ -47,6 +49,14 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId> <artifactId>spring-boot-starter</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </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