master
wanghao 1 month ago
parent 67f8d20a93
commit fcc9b9cf39

@ -1,7 +1,11 @@
package com.ruoyi.web.controller.system;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.service.ConfigService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
@ -13,12 +17,9 @@ import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.service.ConfigService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
@ -61,6 +62,7 @@ public class SysLoginController extends BaseController
try
{
subject.login(token);
System.out.println(token.toString());
return success();
}
catch (AuthenticationException e)

@ -6,7 +6,7 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/no_power_control?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://119.45.202.115:3306/no_power_control?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: haiwei@123
# 从库数据源

@ -114,11 +114,11 @@ shiro:
cipherKey:
session:
# Session超时时间-1代表永不过期默认30分钟
expireTime: 30
expireTime: -1
# 同步session到数据库的周期默认1分钟
dbSyncPeriod: 1
# 相隔多久检查一次session的有效性默认就是10分钟
validationInterval: 10
validationInterval: 10000
# 同一个用户最大会话数比如2的意思是同一个账号允许最多同时两个人登录默认-1不限制
maxSession: -1
# 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户

@ -1,9 +1,9 @@
package com.ruoyi.device.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* device_base_info
@ -46,7 +46,28 @@ public class BaseInfo extends BaseEntity
@Excel(name = "开锁密码")
private String openPassword;
private String typeName;
private Double defaultPrice;
/** 默认使用时间 */
@Excel(name = "默认使用时间")
private Double defaultTime;
public Double getDefaultPrice() {
return defaultPrice;
}
public void setDefaultPrice(Double defaultPrice) {
this.defaultPrice = defaultPrice;
}
public Double getDefaultTime() {
return defaultTime;
}
public void setDefaultTime(Double defaultTime) {
this.defaultTime = defaultTime;
}
public String getTypeName() {
return typeName;

@ -17,30 +17,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="openPassword" column="open_password" />
<result property="typeName" column="device_type_name" />
<result property="defaultPrice" column="default_price" />
<result property="defaultTime" column="default_time" />
</resultMap>
<sql id="selectBaseInfoVo">
select obj_id, device_code, device_name, device_type, use_state, device_state, location_name, create_by, create_time, update_by, update_time, open_password from device_base_info
</sql>
<select id="selectBaseInfoList" parameterType="BaseInfo" resultMap="BaseInfoResult">
<sql id="leftSql">
select info.obj_id,
device_code,
device_name,
device_type,
use_state,
device_state,
location_name,
info.create_by,
info.create_time,
info.update_by,
info.update_time,
open_password,
dbt.device_type_name
device_code,
device_name,
device_type,
use_state,
device_state,
location_name,
info.create_by,
info.create_time,
info.update_by,
info.update_time,
open_password,
dbt.device_type_name,
dbt.default_price,
dbt.default_time
from device_base_info info
left join no_power_control.device_base_type dbt on info.device_type = dbt.obj_id
left join device_base_type dbt on info.device_type = dbt.obj_id
</sql>
<select id="selectBaseInfoList" parameterType="BaseInfo" resultMap="BaseInfoResult">
<include refid="leftSql"/>
<where>
<if test="deviceCode != null and deviceCode != ''">and device_code = #{deviceCode}</if>
@ -125,7 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where device_code = #{deviceCode} limit 1
</select>
<select id="selectDeviceInfo" resultMap="BaseInfoResult">
<include refid="selectBaseInfoVo"></include>
<include refid="leftSql"/>
where device_code = #{deviceCode} limit 1
</select>
</mapper>

@ -13,10 +13,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectBaseTypeVo">
select obj_id, device_type_name, default_price, default_time, create_by, create_time, update_by, update_time from device_base_type
select obj_id, device_type_name, default_price, default_time, create_by, create_time, update_by, update_time,remark from device_base_type
</sql>
<select id="selectBaseTypeList" parameterType="BaseType" resultMap="BaseTypeResult">
@ -41,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceTypeName != null">#{deviceTypeName},</if>
@ -50,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
@ -63,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where obj_id = #{objId}
</update>

@ -30,6 +30,14 @@
</div>
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label">注意事项:</label>
<div class="col-sm-8">
<textarea class="form-control" id="remark" name="remark" type="text" ></textarea>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />

@ -1,64 +1,68 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('设备类型维护列表')" />
<th:block th:include="include :: header('设备类型维护列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
设备类型名称:
<input type="text" name="deviceTypeName"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
设备类型名称:
<input name="deviceTypeName" type="text"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="device:base_type:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="device:base_type:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="device:base_type:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="device:base_type:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="device:base_type:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()"
shiro:hasPermission="device:base_type:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
shiro:hasPermission="device:base_type:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="device:base_type:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('device:base_type:edit')}]];
var removeFlag = [[${@permission.hasPermi('device:base_type:remove')}]];
var prefix = ctx + "device/base_type";
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('device:base_type:edit')}]];
var removeFlag = [[${@permission.hasPermi('device:base_type:remove')}]];
var prefix = ctx + "device/base_type";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "设备类型维护",
columns: [{
checkbox: true
},
$(function () {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "设备类型维护",
columns: [{
checkbox: true
},
{
field: 'objId',
title: '主键',
@ -76,6 +80,12 @@
field: 'defaultTime',
title: '默认使用时间(小时)'
},
{
field: 'remark',
title: '注意事项'
},
{
field: 'createBy',
title: '创建人'
@ -95,16 +105,16 @@
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.objId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.objId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
};
$.table.init(options);
});
</script>
</body>
</html>

@ -32,6 +32,16 @@
</div>
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label">注意事项:</label>
<div class="col-sm-8">
<textarea class="form-control" name="remark" th:field="*{remark}" type="text"></textarea>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer"/>

@ -1,17 +1,14 @@
package com.ruoyi.pda.controller;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.pda.domain.APKVersion;
import com.ruoyi.pda.service.LoginService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by wangh on 2020/7/17-15:18
@ -25,7 +22,7 @@ public class LoginController {
@GetMapping("/login/finduser")
public String finduser(String name,String pass){
public AjaxResult finduser(String name, String pass){
System.out.println("登录名称= "+name+" pass= "+pass);
return service.login(name,pass);
}

@ -1,5 +1,6 @@
package com.ruoyi.pda.mapper;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.pda.domain.APKVersion;
import com.ruoyi.pda.domain.ApiUser;
import org.apache.ibatis.annotations.Param;
@ -14,7 +15,7 @@ import java.util.List;
public interface LoginMapper {
String login_findSalt(String name);
int login_getUser(@Param("name") String name, @Param("passw") String passw);
SysUser login_getUser(@Param("name") String name, @Param("passw") String passw);
List<String> selectMenuNameByUserID(Integer userID);

@ -1,7 +1,8 @@
package com.ruoyi.pda.service;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.pda.domain.APKVersion;
import com.ruoyi.pda.domain.ApiUser;
import com.ruoyi.pda.mapper.LoginMapper;
@ -11,7 +12,6 @@ import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.List;
/**
* Created by wangh on 2021/4/26-9:27
@ -22,10 +22,10 @@ public class LoginService {
@Autowired
LoginMapper mapper;
public String login(String name, String pass) {
public AjaxResult login(String name, String pass) {
try {
String salt = mapper.login_findSalt(name);
Integer userID = mapper.login_getUser(name, getMD5Str(name + pass + salt));
SysUser userID = mapper.login_getUser(name, getMD5Str(name + pass + salt));
if (userID != null) {
// List<String> menuNameList=name.equals("admin")?
// mapper.selectMenuName():
@ -34,12 +34,12 @@ public class LoginService {
// return "isEmpty";
// }
// return JSONObject.toJSONString(menuNameList);
return "ok";
return AjaxResult.success(userID);
} else {
return "Error";
return AjaxResult.error();
}
}catch (Exception e){
return "Error";
return AjaxResult.error();
}
}

@ -3,8 +3,8 @@
<mapper namespace="com.ruoyi.pda.mapper.LoginMapper">
<!--登陆-->
<select id="login_getUser" resultType="java.lang.Integer">
SELECT user_id FROM sys_user where login_name=#{name} and `password`=#{passw} limit 1;
<select id="login_getUser" resultMap="com.ruoyi.system.mapper.SysUserMapper.SysUserResult">
SELECT user_id,dept_id FROM sys_user where login_name=#{name} and `password`=#{passw} limit 1;
</select>
<select id="login_findSalt" resultType="java.lang.String">

Loading…
Cancel
Save