正在显示
18 个修改的文件
包含
190 行增加
和
40 行删除
| @@ -3,6 +3,7 @@ package com.zhonglai.luhui.admin.service; | @@ -3,6 +3,7 @@ package com.zhonglai.luhui.admin.service; | ||
| 3 | import com.ruoyi.common.constant.Constants; | 3 | import com.ruoyi.common.constant.Constants; |
| 4 | import com.ruoyi.system.domain.entity.UserConstants; | 4 | import com.ruoyi.system.domain.entity.UserConstants; |
| 5 | import com.ruoyi.system.domain.entity.SysUser; | 5 | import com.ruoyi.system.domain.entity.SysUser; |
| 6 | +import com.ruoyi.system.domain.tool.SysLogininforType; | ||
| 6 | import com.zhonglai.luhui.admin.model.RegisterBody; | 7 | import com.zhonglai.luhui.admin.model.RegisterBody; |
| 7 | import com.ruoyi.common.core.redis.RedisCache; | 8 | import com.ruoyi.common.core.redis.RedisCache; |
| 8 | import com.ruoyi.common.exception.user.CaptchaException; | 9 | import com.ruoyi.common.exception.user.CaptchaException; |
| @@ -83,7 +84,7 @@ public class SysRegisterService | @@ -83,7 +84,7 @@ public class SysRegisterService | ||
| 83 | } | 84 | } |
| 84 | else | 85 | else |
| 85 | { | 86 | { |
| 86 | - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.REGISTER, | 87 | + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, SysLogininforType.lhAdmin, Constants.REGISTER, |
| 87 | MessageUtils.message("user.register.success"))); | 88 | MessageUtils.message("user.register.success"))); |
| 88 | } | 89 | } |
| 89 | } | 90 | } |
| @@ -50,7 +50,6 @@ public class IotDeviceControlController { | @@ -50,7 +50,6 @@ public class IotDeviceControlController { | ||
| 50 | @ApiImplicitParam(value = "主机imei",name = "imei"), | 50 | @ApiImplicitParam(value = "主机imei",name = "imei"), |
| 51 | @ApiImplicitParam(value = "版本号",name = "firmwareVersion") | 51 | @ApiImplicitParam(value = "版本号",name = "firmwareVersion") |
| 52 | }) | 52 | }) |
| 53 | - @PreAuthorize("@ss.hasPermi('iot:iotDeviceControl:firmwareUp')") | ||
| 54 | @Log(title = "设备控制", businessType = BusinessType.UPDATE) | 53 | @Log(title = "设备控制", businessType = BusinessType.UPDATE) |
| 55 | @ResponseBody | 54 | @ResponseBody |
| 56 | @PostMapping("/firmwareUp/{imei}") | 55 | @PostMapping("/firmwareUp/{imei}") |
| @@ -75,7 +74,6 @@ public class IotDeviceControlController { | @@ -75,7 +74,6 @@ public class IotDeviceControlController { | ||
| 75 | @ApiImplicitParam(value = "主机imei",name = "imei"), | 74 | @ApiImplicitParam(value = "主机imei",name = "imei"), |
| 76 | @ApiImplicitParam(value = "restart 1重启,2复位,3恢复出厂值",name = "restart"), | 75 | @ApiImplicitParam(value = "restart 1重启,2复位,3恢复出厂值",name = "restart"), |
| 77 | }) | 76 | }) |
| 78 | - @PreAuthorize("@ss.hasPermi('iot:iotDeviceControl:restart')") | ||
| 79 | @Log(title = "设备控制", businessType = BusinessType.UPDATE) | 77 | @Log(title = "设备控制", businessType = BusinessType.UPDATE) |
| 80 | @ResponseBody | 78 | @ResponseBody |
| 81 | @PostMapping("/restart/{imei}/{restart}") | 79 | @PostMapping("/restart/{imei}/{restart}") |
| @@ -185,7 +183,6 @@ public class IotDeviceControlController { | @@ -185,7 +183,6 @@ public class IotDeviceControlController { | ||
| 185 | @ApiImplicitParam(value = "传感器编号(0,1_1,10_1)",name = "sensor_number"), | 183 | @ApiImplicitParam(value = "传感器编号(0,1_1,10_1)",name = "sensor_number"), |
| 186 | @ApiImplicitParam(value = "属性集合(id1,id2,id3)",name = "attributes"), | 184 | @ApiImplicitParam(value = "属性集合(id1,id2,id3)",name = "attributes"), |
| 187 | }) | 185 | }) |
| 188 | - @PreAuthorize("@ss.hasPermi('iot:iotDeviceControl:upSummary')") | ||
| 189 | @Log(title = "设备控制", businessType = BusinessType.UPDATE) | 186 | @Log(title = "设备控制", businessType = BusinessType.UPDATE) |
| 190 | @ResponseBody | 187 | @ResponseBody |
| 191 | @PostMapping("/readAttribute/{imei}/{sensor_number}") | 188 | @PostMapping("/readAttribute/{imei}/{sensor_number}") |
| @@ -216,7 +213,6 @@ public class IotDeviceControlController { | @@ -216,7 +213,6 @@ public class IotDeviceControlController { | ||
| 216 | @ApiImplicitParam(value = "主机imei",name = "imei"), | 213 | @ApiImplicitParam(value = "主机imei",name = "imei"), |
| 217 | @ApiImplicitParam(value = "自定义数据json字符串",name = "summary") | 214 | @ApiImplicitParam(value = "自定义数据json字符串",name = "summary") |
| 218 | }) | 215 | }) |
| 219 | - @PreAuthorize("@ss.hasPermi('iot:iotDeviceControl:upSummary')") | ||
| 220 | @Log(title = "设备控制", businessType = BusinessType.UPDATE) | 216 | @Log(title = "设备控制", businessType = BusinessType.UPDATE) |
| 221 | @ResponseBody | 217 | @ResponseBody |
| 222 | @PostMapping("/upSummary/{imei}") | 218 | @PostMapping("/upSummary/{imei}") |
| @@ -245,7 +241,6 @@ public class IotDeviceControlController { | @@ -245,7 +241,6 @@ public class IotDeviceControlController { | ||
| 245 | @ApiImplicitParam(value = "终端编号(如:1_1)",name = "number"), | 241 | @ApiImplicitParam(value = "终端编号(如:1_1)",name = "number"), |
| 246 | @ApiImplicitParam(value = "配置参数json字符串",name = "config") | 242 | @ApiImplicitParam(value = "配置参数json字符串",name = "config") |
| 247 | }) | 243 | }) |
| 248 | - @PreAuthorize("@ss.hasPermi('iot:iotDeviceControl:upTerminalConfig')") | ||
| 249 | @Log(title = "设备控制", businessType = BusinessType.UPDATE) | 244 | @Log(title = "设备控制", businessType = BusinessType.UPDATE) |
| 250 | @ResponseBody | 245 | @ResponseBody |
| 251 | @PostMapping("/upTerminalConfig/{imei}/{number}") | 246 | @PostMapping("/upTerminalConfig/{imei}/{number}") |
| @@ -280,7 +275,6 @@ public class IotDeviceControlController { | @@ -280,7 +275,6 @@ public class IotDeviceControlController { | ||
| 280 | " }\n" + | 275 | " }\n" + |
| 281 | "}") | 276 | "}") |
| 282 | @ApiImplicitParam(value = "批量数据json字符串",name = "map") | 277 | @ApiImplicitParam(value = "批量数据json字符串",name = "map") |
| 283 | - @PreAuthorize("@ss.hasPermi('iot:iotDeviceControl:batchUpTerminalConfig')") | ||
| 284 | @Log(title = "设备控制", businessType = BusinessType.UPDATE) | 278 | @Log(title = "设备控制", businessType = BusinessType.UPDATE) |
| 285 | @ResponseBody | 279 | @ResponseBody |
| 286 | @PostMapping("/batchUpTerminalConfig/{imei}") | 280 | @PostMapping("/batchUpTerminalConfig/{imei}") |
| @@ -39,9 +39,7 @@ public class IotTerminalController extends BaseController | @@ -39,9 +39,7 @@ public class IotTerminalController extends BaseController | ||
| 39 | 39 | ||
| 40 | @Autowired | 40 | @Autowired |
| 41 | private IUserTerminalGroupRelationService userTerminalGroupRelationService; | 41 | private IUserTerminalGroupRelationService userTerminalGroupRelationService; |
| 42 | - | ||
| 43 | @ApiOperation("查询终端列表") | 42 | @ApiOperation("查询终端列表") |
| 44 | - @PreAuthorize("@ss.hasPermi('iot:IotTerminal:list')") | ||
| 45 | @GetMapping("/list") | 43 | @GetMapping("/list") |
| 46 | public TableDataInfo list(IotTerminal iotTerminal) | 44 | public TableDataInfo list(IotTerminal iotTerminal) |
| 47 | { | 45 | { |
| @@ -52,7 +50,6 @@ public class IotTerminalController extends BaseController | @@ -52,7 +50,6 @@ public class IotTerminalController extends BaseController | ||
| 52 | 50 | ||
| 53 | @ApiOperation("获取终端详细信息") | 51 | @ApiOperation("获取终端详细信息") |
| 54 | @ApiImplicitParam(value = "终端id",name = "id") | 52 | @ApiImplicitParam(value = "终端id",name = "id") |
| 55 | - @PreAuthorize("@ss.hasPermi('iot:IotTerminal:getInfo')") | ||
| 56 | @GetMapping(value = "/{id}") | 53 | @GetMapping(value = "/{id}") |
| 57 | public AjaxResult getInfo(@PathVariable("id") String id) | 54 | public AjaxResult getInfo(@PathVariable("id") String id) |
| 58 | { | 55 | { |
| @@ -61,7 +58,6 @@ public class IotTerminalController extends BaseController | @@ -61,7 +58,6 @@ public class IotTerminalController extends BaseController | ||
| 61 | 58 | ||
| 62 | @ApiOperation("根据网关获取未分配终端") | 59 | @ApiOperation("根据网关获取未分配终端") |
| 63 | @ApiImplicitParam(value = "网关id",name = "imei") | 60 | @ApiImplicitParam(value = "网关id",name = "imei") |
| 64 | - @PreAuthorize("@ss.hasPermi('iot:IotTerminal:getListByDevice')") | ||
| 65 | @GetMapping(value = "/getListByDevice{imei}") | 61 | @GetMapping(value = "/getListByDevice{imei}") |
| 66 | public AjaxResult getListByDevice(@PathVariable("imei") String imei) | 62 | public AjaxResult getListByDevice(@PathVariable("imei") String imei) |
| 67 | { | 63 | { |
| @@ -74,7 +70,6 @@ public class IotTerminalController extends BaseController | @@ -74,7 +70,6 @@ public class IotTerminalController extends BaseController | ||
| 74 | @ApiImplicitParam(value = "终端id",name = "id"), | 70 | @ApiImplicitParam(value = "终端id",name = "id"), |
| 75 | @ApiImplicitParam(value = "终端名称",name = "name"), | 71 | @ApiImplicitParam(value = "终端名称",name = "name"), |
| 76 | }) | 72 | }) |
| 77 | - @PreAuthorize("@ss.hasPermi('iot:IotTerminal:editName')") | ||
| 78 | @Log(title = "终端", businessType = BusinessType.UPDATE) | 73 | @Log(title = "终端", businessType = BusinessType.UPDATE) |
| 79 | @PostMapping("/editName") | 74 | @PostMapping("/editName") |
| 80 | public AjaxResult editName(String id,String name) | 75 | public AjaxResult editName(String id,String name) |
| @@ -91,7 +86,6 @@ public class IotTerminalController extends BaseController | @@ -91,7 +86,6 @@ public class IotTerminalController extends BaseController | ||
| 91 | @ApiImplicitParam(value = "终端id集合",name = "ids"), | 86 | @ApiImplicitParam(value = "终端id集合",name = "ids"), |
| 92 | @ApiImplicitParam(value = "分组id",name = "iot_terminal_group_id"), | 87 | @ApiImplicitParam(value = "分组id",name = "iot_terminal_group_id"), |
| 93 | }) | 88 | }) |
| 94 | - @PreAuthorize("@ss.hasPermi('iot:IotTerminal:groupTerminal')") | ||
| 95 | @Log(title = "终端", businessType = BusinessType.UPDATE) | 89 | @Log(title = "终端", businessType = BusinessType.UPDATE) |
| 96 | @PostMapping("/groupTerminal") | 90 | @PostMapping("/groupTerminal") |
| 97 | public AjaxResult groupTerminal(Integer iot_terminal_group_id,@RequestBody List<String> ids) | 91 | public AjaxResult groupTerminal(Integer iot_terminal_group_id,@RequestBody List<String> ids) |
| @@ -45,7 +45,6 @@ public class UserTerminalGroupController extends BaseController | @@ -45,7 +45,6 @@ public class UserTerminalGroupController extends BaseController | ||
| 45 | * 查询终端分组列表 | 45 | * 查询终端分组列表 |
| 46 | */ | 46 | */ |
| 47 | @ApiOperation("查询终端分组列表") | 47 | @ApiOperation("查询终端分组列表") |
| 48 | - @PreAuthorize("@ss.hasPermi('user:UserTerminalGroup:list')") | ||
| 49 | @GetMapping("/list") | 48 | @GetMapping("/list") |
| 50 | public TableDataInfo list(UserTerminalGroup userTerminalGroup) | 49 | public TableDataInfo list(UserTerminalGroup userTerminalGroup) |
| 51 | { | 50 | { |
| @@ -60,7 +59,6 @@ public class UserTerminalGroupController extends BaseController | @@ -60,7 +59,6 @@ public class UserTerminalGroupController extends BaseController | ||
| 60 | * 获取终端分组详细信息 | 59 | * 获取终端分组详细信息 |
| 61 | */ | 60 | */ |
| 62 | @ApiOperation("获取终端分组详细信息") | 61 | @ApiOperation("获取终端分组详细信息") |
| 63 | - @PreAuthorize("@ss.hasPermi('user:UserTerminalGroup:query')") | ||
| 64 | @GetMapping(value = "/{id}") | 62 | @GetMapping(value = "/{id}") |
| 65 | public AjaxResult getInfo(@PathVariable("id") Integer id) | 63 | public AjaxResult getInfo(@PathVariable("id") Integer id) |
| 66 | { | 64 | { |
| @@ -71,7 +69,6 @@ public class UserTerminalGroupController extends BaseController | @@ -71,7 +69,6 @@ public class UserTerminalGroupController extends BaseController | ||
| 71 | * 新增终端分组 | 69 | * 新增终端分组 |
| 72 | */ | 70 | */ |
| 73 | @ApiOperation("新增终端分组") | 71 | @ApiOperation("新增终端分组") |
| 74 | - @PreAuthorize("@ss.hasPermi('user:UserTerminalGroup:add')") | ||
| 75 | @Log(title = "终端分组", businessType = BusinessType.INSERT) | 72 | @Log(title = "终端分组", businessType = BusinessType.INSERT) |
| 76 | @PostMapping | 73 | @PostMapping |
| 77 | public AjaxResult add(@RequestBody UserTerminalGroup userTerminalGroup) | 74 | public AjaxResult add(@RequestBody UserTerminalGroup userTerminalGroup) |
| @@ -89,7 +86,6 @@ public class UserTerminalGroupController extends BaseController | @@ -89,7 +86,6 @@ public class UserTerminalGroupController extends BaseController | ||
| 89 | @ApiImplicitParam(value = "分组名称",name = "name"), | 86 | @ApiImplicitParam(value = "分组名称",name = "name"), |
| 90 | @ApiImplicitParam(value = "分组id",name = "id"), | 87 | @ApiImplicitParam(value = "分组id",name = "id"), |
| 91 | }) | 88 | }) |
| 92 | - @PreAuthorize("@ss.hasPermi('user:UserTerminalGroup:edit')") | ||
| 93 | @Log(title = "终端分组", businessType = BusinessType.UPDATE) | 89 | @Log(title = "终端分组", businessType = BusinessType.UPDATE) |
| 94 | @PutMapping | 90 | @PutMapping |
| 95 | public AjaxResult edit(String name,Integer id) | 91 | public AjaxResult edit(String name,Integer id) |
| @@ -104,7 +100,6 @@ public class UserTerminalGroupController extends BaseController | @@ -104,7 +100,6 @@ public class UserTerminalGroupController extends BaseController | ||
| 104 | * 删除终端分组 | 100 | * 删除终端分组 |
| 105 | */ | 101 | */ |
| 106 | @ApiOperation("删除终端分组") | 102 | @ApiOperation("删除终端分组") |
| 107 | - @PreAuthorize("@ss.hasPermi('user:UserTerminalGroup:remove')") | ||
| 108 | @Log(title = "终端分组", businessType = BusinessType.DELETE) | 103 | @Log(title = "终端分组", businessType = BusinessType.DELETE) |
| 109 | @DeleteMapping("/{ids}") | 104 | @DeleteMapping("/{ids}") |
| 110 | public AjaxResult remove(@PathVariable Integer[] ids) | 105 | public AjaxResult remove(@PathVariable Integer[] ids) |
| @@ -31,6 +31,9 @@ public class SysLogininfor extends BaseEntity | @@ -31,6 +31,9 @@ public class SysLogininfor extends BaseEntity | ||
| 31 | @Excel(name = "登录地址") | 31 | @Excel(name = "登录地址") |
| 32 | private String ipaddr; | 32 | private String ipaddr; |
| 33 | 33 | ||
| 34 | + @Excel(name = "类型") | ||
| 35 | + private String type; | ||
| 36 | + | ||
| 34 | /** 登录地点 */ | 37 | /** 登录地点 */ |
| 35 | @Excel(name = "登录地点") | 38 | @Excel(name = "登录地点") |
| 36 | private String loginLocation; | 39 | private String loginLocation; |
| @@ -141,4 +144,12 @@ public class SysLogininfor extends BaseEntity | @@ -141,4 +144,12 @@ public class SysLogininfor extends BaseEntity | ||
| 141 | { | 144 | { |
| 142 | this.loginTime = loginTime; | 145 | this.loginTime = loginTime; |
| 143 | } | 146 | } |
| 147 | + | ||
| 148 | + public String getType() { | ||
| 149 | + return type; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + public void setType(String type) { | ||
| 153 | + this.type = type; | ||
| 154 | + } | ||
| 144 | } | 155 | } |
| 1 | package com.ruoyi.common.core.domain; | 1 | package com.ruoyi.common.core.domain; |
| 2 | 2 | ||
| 3 | +import com.ruoyi.system.domain.tool.SysLogininforType; | ||
| 3 | import org.springframework.security.core.userdetails.UserDetails; | 4 | import org.springframework.security.core.userdetails.UserDetails; |
| 4 | 5 | ||
| 5 | 6 | ||
| @@ -43,6 +44,11 @@ public abstract class BaseLoginUser implements UserDetails { | @@ -43,6 +44,11 @@ public abstract class BaseLoginUser implements UserDetails { | ||
| 43 | */ | 44 | */ |
| 44 | private String os; | 45 | private String os; |
| 45 | 46 | ||
| 47 | + /** | ||
| 48 | + * 浏览器类型 | ||
| 49 | + */ | ||
| 50 | + private SysLogininforType sysLogininforType; | ||
| 51 | + | ||
| 46 | public Long getUserId() { | 52 | public Long getUserId() { |
| 47 | return userId; | 53 | return userId; |
| 48 | } | 54 | } |
| @@ -108,4 +114,12 @@ public abstract class BaseLoginUser implements UserDetails { | @@ -108,4 +114,12 @@ public abstract class BaseLoginUser implements UserDetails { | ||
| 108 | } | 114 | } |
| 109 | 115 | ||
| 110 | public abstract Object getUser(); | 116 | public abstract Object getUser(); |
| 117 | + | ||
| 118 | + public SysLogininforType getSysLogininforType() { | ||
| 119 | + return sysLogininforType; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + public void setSysLogininforType(SysLogininforType sysLogininforType) { | ||
| 123 | + this.sysLogininforType = sysLogininforType; | ||
| 124 | + } | ||
| 111 | } | 125 | } |
| @@ -44,7 +44,8 @@ public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T> | @@ -44,7 +44,8 @@ public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T> | ||
| 44 | { | 44 | { |
| 45 | return new byte[0]; | 45 | return new byte[0]; |
| 46 | } | 46 | } |
| 47 | - return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(DEFAULT_CHARSET); | 47 | + //SerializerFeature.DisableCircularReferenceDetect解决重复引用的问题 |
| 48 | + return JSON.toJSONString(t, SerializerFeature.WriteClassName,SerializerFeature.DisableCircularReferenceDetect).getBytes(DEFAULT_CHARSET); | ||
| 48 | } | 49 | } |
| 49 | 50 | ||
| 50 | @Override | 51 | @Override |
| @@ -44,7 +44,7 @@ public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler | @@ -44,7 +44,7 @@ public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler | ||
| 44 | // 删除用户缓存记录 | 44 | // 删除用户缓存记录 |
| 45 | tokenService.delLoginUser(loginUser.getToken()); | 45 | tokenService.delLoginUser(loginUser.getToken()); |
| 46 | // 记录用户退出日志 | 46 | // 记录用户退出日志 |
| 47 | - AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGOUT, "退出成功")); | 47 | + AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName,loginUser.getSysLogininforType(), Constants.LOGOUT, "退出成功")); |
| 48 | } | 48 | } |
| 49 | ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(HttpStatus.SUCCESS, "退出成功"))); | 49 | ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(HttpStatus.SUCCESS, "退出成功"))); |
| 50 | } | 50 | } |
| @@ -29,6 +29,11 @@ public class PublicSQL { | @@ -29,6 +29,11 @@ public class PublicSQL { | ||
| 29 | Field[] fields = list.get(0).getClass().getDeclaredFields( ); | 29 | Field[] fields = list.get(0).getClass().getDeclaredFields( ); |
| 30 | for(Field field:fields) | 30 | for(Field field:fields) |
| 31 | { | 31 | { |
| 32 | + PublicSQLConfig publicSQLConfig = field.getAnnotation(PublicSQLConfig.class); | ||
| 33 | + if(null != publicSQLConfig && !publicSQLConfig.isSelect()) | ||
| 34 | + { | ||
| 35 | + continue; | ||
| 36 | + } | ||
| 32 | if(!"".equals(values) ) | 37 | if(!"".equals(values) ) |
| 33 | { | 38 | { |
| 34 | mfStr += ","; | 39 | mfStr += ","; |
| @@ -80,6 +85,11 @@ public class PublicSQL { | @@ -80,6 +85,11 @@ public class PublicSQL { | ||
| 80 | StringBuffer values = new StringBuffer("("); | 85 | StringBuffer values = new StringBuffer("("); |
| 81 | for(Field field:fields) | 86 | for(Field field:fields) |
| 82 | {// | 87 | {// |
| 88 | + PublicSQLConfig publicSQLConfig = field.getAnnotation(PublicSQLConfig.class); | ||
| 89 | + if(null != publicSQLConfig && !publicSQLConfig.isSelect()) | ||
| 90 | + { | ||
| 91 | + continue; | ||
| 92 | + } | ||
| 83 | Method method; | 93 | Method method; |
| 84 | try { | 94 | try { |
| 85 | method = object.getClass().getMethod("get"+com.ruoyi.common.utils.StringUtils.getName(field.getName())); | 95 | method = object.getClass().getMethod("get"+com.ruoyi.common.utils.StringUtils.getName(field.getName())); |
| @@ -133,7 +143,12 @@ public class PublicSQL { | @@ -133,7 +143,12 @@ public class PublicSQL { | ||
| 133 | String values = "("; | 143 | String values = "("; |
| 134 | 144 | ||
| 135 | for(Field field:fields) | 145 | for(Field field:fields) |
| 136 | - {// | 146 | + { |
| 147 | + PublicSQLConfig publicSQLConfig = field.getAnnotation(PublicSQLConfig.class); | ||
| 148 | + if(null != publicSQLConfig && !publicSQLConfig.isSelect()) | ||
| 149 | + { | ||
| 150 | + continue; | ||
| 151 | + } | ||
| 137 | Method method; | 152 | Method method; |
| 138 | try { | 153 | try { |
| 139 | method = object.getClass().getMethod("get"+com.ruoyi.common.utils.StringUtils.getName(field.getName())); | 154 | method = object.getClass().getMethod("get"+com.ruoyi.common.utils.StringUtils.getName(field.getName())); |
| @@ -181,7 +196,15 @@ public class PublicSQL { | @@ -181,7 +196,15 @@ public class PublicSQL { | ||
| 181 | { | 196 | { |
| 182 | Object object = para.get("object"); | 197 | Object object = para.get("object"); |
| 183 | String whereFieldNames = (String) para.get("whereFieldNames"); | 198 | String whereFieldNames = (String) para.get("whereFieldNames"); |
| 184 | - String tableName = changTableNameFromObject(object); | 199 | + if( null != para.get("tablename")) |
| 200 | + { | ||
| 201 | + | ||
| 202 | + } | ||
| 203 | + String tableName = (String) para.get("tablename"); | ||
| 204 | + if(null == tableName) | ||
| 205 | + { | ||
| 206 | + tableName = changTableNameFromObject(object); | ||
| 207 | + } | ||
| 185 | String sql = "update "; | 208 | String sql = "update "; |
| 186 | sql += tableName; | 209 | sql += tableName; |
| 187 | Field[] fields = object.getClass().getDeclaredFields(); | 210 | Field[] fields = object.getClass().getDeclaredFields(); |
| @@ -192,6 +215,11 @@ public class PublicSQL { | @@ -192,6 +215,11 @@ public class PublicSQL { | ||
| 192 | for(int i=0;i<fields.length;i++) | 215 | for(int i=0;i<fields.length;i++) |
| 193 | { | 216 | { |
| 194 | Field field = fields[i]; | 217 | Field field = fields[i]; |
| 218 | + PublicSQLConfig publicSQLConfig = field.getAnnotation(PublicSQLConfig.class); | ||
| 219 | + if(null != publicSQLConfig && !publicSQLConfig.isSelect()) | ||
| 220 | + { | ||
| 221 | + continue; | ||
| 222 | + } | ||
| 195 | try { | 223 | try { |
| 196 | Method method = object.getClass().getMethod("get"+com.ruoyi.common.utils.StringUtils.getName(field.getName())); | 224 | Method method = object.getClass().getMethod("get"+com.ruoyi.common.utils.StringUtils.getName(field.getName())); |
| 197 | Object value = method.invoke(object); | 225 | Object value = method.invoke(object); |
| @@ -386,6 +414,11 @@ public class PublicSQL { | @@ -386,6 +414,11 @@ public class PublicSQL { | ||
| 386 | { | 414 | { |
| 387 | for(Field field:fields) | 415 | for(Field field:fields) |
| 388 | { | 416 | { |
| 417 | + PublicSQLConfig publicSQLConfig = field.getAnnotation(PublicSQLConfig.class); | ||
| 418 | + if(null != publicSQLConfig && !publicSQLConfig.isSelect()) | ||
| 419 | + { | ||
| 420 | + continue; | ||
| 421 | + } | ||
| 389 | try { | 422 | try { |
| 390 | Method method; | 423 | Method method; |
| 391 | method = object.getClass().getMethod("get"+ com.ruoyi.common.utils.StringUtils.getName(field.getName())); | 424 | method = object.getClass().getMethod("get"+ com.ruoyi.common.utils.StringUtils.getName(field.getName())); |
| @@ -490,6 +523,11 @@ public class PublicSQL { | @@ -490,6 +523,11 @@ public class PublicSQL { | ||
| 490 | for(int i=0;i<fields.length;i++) | 523 | for(int i=0;i<fields.length;i++) |
| 491 | { | 524 | { |
| 492 | Field field = fields[i]; | 525 | Field field = fields[i]; |
| 526 | + PublicSQLConfig publicSQLConfig = field.getAnnotation(PublicSQLConfig.class); | ||
| 527 | + if(null != publicSQLConfig && !publicSQLConfig.isSelect()) | ||
| 528 | + { | ||
| 529 | + continue; | ||
| 530 | + } | ||
| 493 | try { | 531 | try { |
| 494 | Method method; | 532 | Method method; |
| 495 | method = object.getClass().getMethod("get"+ com.ruoyi.common.utils.StringUtils.getName(field.getName())); | 533 | method = object.getClass().getMethod("get"+ com.ruoyi.common.utils.StringUtils.getName(field.getName())); |
| @@ -572,6 +610,11 @@ public class PublicSQL { | @@ -572,6 +610,11 @@ public class PublicSQL { | ||
| 572 | String update = ""; | 610 | String update = ""; |
| 573 | for(Field field:fields) | 611 | for(Field field:fields) |
| 574 | {// | 612 | {// |
| 613 | + PublicSQLConfig publicSQLConfig = field.getAnnotation(PublicSQLConfig.class); | ||
| 614 | + if(null != publicSQLConfig && !publicSQLConfig.isSelect()) | ||
| 615 | + { | ||
| 616 | + continue; | ||
| 617 | + } | ||
| 575 | Method method; | 618 | Method method; |
| 576 | try { | 619 | try { |
| 577 | method = object.getClass().getMethod("get"+com.ruoyi.common.utils.StringUtils.getName(field.getName())); | 620 | method = object.getClass().getMethod("get"+com.ruoyi.common.utils.StringUtils.getName(field.getName())); |
| @@ -634,6 +677,11 @@ public class PublicSQL { | @@ -634,6 +677,11 @@ public class PublicSQL { | ||
| 634 | sb.append("("); | 677 | sb.append("("); |
| 635 | for(Field field:fields) | 678 | for(Field field:fields) |
| 636 | { | 679 | { |
| 680 | + PublicSQLConfig publicSQLConfig = field.getAnnotation(PublicSQLConfig.class); | ||
| 681 | + if(null != publicSQLConfig && !publicSQLConfig.isSelect()) | ||
| 682 | + { | ||
| 683 | + continue; | ||
| 684 | + } | ||
| 637 | if(!"".equals(update) ) | 685 | if(!"".equals(update) ) |
| 638 | { | 686 | { |
| 639 | sb.append(","); | 687 | sb.append(","); |
| @@ -652,6 +700,11 @@ public class PublicSQL { | @@ -652,6 +700,11 @@ public class PublicSQL { | ||
| 652 | Field field = fields[j]; | 700 | Field field = fields[j]; |
| 653 | Method method; | 701 | Method method; |
| 654 | try { | 702 | try { |
| 703 | + PublicSQLConfig publicSQLConfig = field.getAnnotation(PublicSQLConfig.class); | ||
| 704 | + if(null != publicSQLConfig && !publicSQLConfig.isSelect()) | ||
| 705 | + { | ||
| 706 | + continue; | ||
| 707 | + } | ||
| 655 | method = object.getClass().getMethod("get"+com.ruoyi.common.utils.StringUtils.getName(field.getName())); | 708 | method = object.getClass().getMethod("get"+com.ruoyi.common.utils.StringUtils.getName(field.getName())); |
| 656 | Object value = method.invoke(object); | 709 | Object value = method.invoke(object); |
| 657 | if(null == value) | 710 | if(null == value) |
| @@ -3,6 +3,7 @@ package com.ruoyi.system.login.dto; | @@ -3,6 +3,7 @@ package com.ruoyi.system.login.dto; | ||
| 3 | import com.ruoyi.common.core.domain.BaseLoginUser; | 3 | import com.ruoyi.common.core.domain.BaseLoginUser; |
| 4 | import com.ruoyi.common.utils.DESUtil; | 4 | import com.ruoyi.common.utils.DESUtil; |
| 5 | import com.ruoyi.common.utils.SecurityUtils; | 5 | import com.ruoyi.common.utils.SecurityUtils; |
| 6 | +import com.ruoyi.system.domain.tool.SysLogininforType; | ||
| 6 | import org.springframework.security.core.GrantedAuthority; | 7 | import org.springframework.security.core.GrantedAuthority; |
| 7 | 8 | ||
| 8 | import java.util.Collection; | 9 | import java.util.Collection; |
| @@ -15,8 +16,36 @@ public class ApiLoginUser extends BaseLoginUser { | @@ -15,8 +16,36 @@ public class ApiLoginUser extends BaseLoginUser { | ||
| 15 | public ApiLoginUser(Yu2leUserInfo yu2leUserInfo,Yu2leUserLogin yu2leUserLogin) { | 16 | public ApiLoginUser(Yu2leUserInfo yu2leUserInfo,Yu2leUserLogin yu2leUserLogin) { |
| 16 | this.yu2leUserLogin = yu2leUserLogin; | 17 | this.yu2leUserLogin = yu2leUserLogin; |
| 17 | this.yu2leUserInfo = yu2leUserInfo; | 18 | this.yu2leUserInfo = yu2leUserInfo; |
| 19 | + this.setUserId(new Long(yu2leUserLogin.getUserId())); | ||
| 18 | } | 20 | } |
| 19 | 21 | ||
| 22 | + /** | ||
| 23 | + * 反序列父类属性 | ||
| 24 | + * @param yu2leUserInfo | ||
| 25 | + * @param yu2leUserLogin | ||
| 26 | + * @param userId | ||
| 27 | + * @param token | ||
| 28 | + * @param loginTime | ||
| 29 | + * @param expireTime | ||
| 30 | + * @param ipaddr | ||
| 31 | + * @param loginLocation | ||
| 32 | + * @param browser | ||
| 33 | + * @param os | ||
| 34 | + * @param sysLogininforType | ||
| 35 | + */ | ||
| 36 | + public ApiLoginUser(Yu2leUserInfo yu2leUserInfo,Yu2leUserLogin yu2leUserLogin,Long userId, String token, Long loginTime, Long expireTime, String ipaddr, String loginLocation, String browser, String os, SysLogininforType sysLogininforType) { | ||
| 37 | + super.setUserId(userId); | ||
| 38 | + super.setToken(token); | ||
| 39 | + super.setLoginTime(loginTime); | ||
| 40 | + super.setExpireTime(expireTime); | ||
| 41 | + super.setIpaddr(ipaddr); | ||
| 42 | + super.setLoginLocation(loginLocation); | ||
| 43 | + super.setBrowser(browser); | ||
| 44 | + super.setOs(os); | ||
| 45 | + super.setSysLogininforType( sysLogininforType); | ||
| 46 | + this.yu2leUserLogin = yu2leUserLogin; | ||
| 47 | + this.yu2leUserInfo = yu2leUserInfo; | ||
| 48 | + } | ||
| 20 | @Override | 49 | @Override |
| 21 | public Object getUser() { | 50 | public Object getUser() { |
| 22 | return yu2leUserLogin; | 51 | return yu2leUserLogin; |
| @@ -3,6 +3,7 @@ package com.ruoyi.system.login.dto; | @@ -3,6 +3,7 @@ package com.ruoyi.system.login.dto; | ||
| 3 | import com.alibaba.fastjson.annotation.JSONField; | 3 | import com.alibaba.fastjson.annotation.JSONField; |
| 4 | import com.ruoyi.common.core.domain.BaseLoginUser; | 4 | import com.ruoyi.common.core.domain.BaseLoginUser; |
| 5 | import com.ruoyi.system.domain.entity.SysUser; | 5 | import com.ruoyi.system.domain.entity.SysUser; |
| 6 | +import com.ruoyi.system.domain.tool.SysLogininforType; | ||
| 6 | import org.springframework.security.core.GrantedAuthority; | 7 | import org.springframework.security.core.GrantedAuthority; |
| 7 | 8 | ||
| 8 | import java.util.Collection; | 9 | import java.util.Collection; |
| @@ -32,6 +33,33 @@ public class SysLoginUser extends BaseLoginUser | @@ -32,6 +33,33 @@ public class SysLoginUser extends BaseLoginUser | ||
| 32 | */ | 33 | */ |
| 33 | private SysUser user; | 34 | private SysUser user; |
| 34 | 35 | ||
| 36 | + /** | ||
| 37 | + * 反序列父类属性 | ||
| 38 | + * @param user | ||
| 39 | + * @param userId | ||
| 40 | + * @param token | ||
| 41 | + * @param loginTime | ||
| 42 | + * @param expireTime | ||
| 43 | + * @param ipaddr | ||
| 44 | + * @param loginLocation | ||
| 45 | + * @param browser | ||
| 46 | + * @param os | ||
| 47 | + * @param sysLogininforType | ||
| 48 | + */ | ||
| 49 | + public SysLoginUser( Long deptId,Set<String> permissions,SysUser user,Long userId, String token, Long loginTime, Long expireTime, String ipaddr, String loginLocation, String browser, String os, SysLogininforType sysLogininforType) { | ||
| 50 | + super.setUserId(userId); | ||
| 51 | + super.setToken(token); | ||
| 52 | + super.setLoginTime(loginTime); | ||
| 53 | + super.setExpireTime(expireTime); | ||
| 54 | + super.setIpaddr(ipaddr); | ||
| 55 | + super.setLoginLocation(loginLocation); | ||
| 56 | + super.setBrowser(browser); | ||
| 57 | + super.setOs(os); | ||
| 58 | + super.setSysLogininforType( sysLogininforType); | ||
| 59 | + this.user = user; | ||
| 60 | + this.deptId = deptId; | ||
| 61 | + this.permissions = permissions; | ||
| 62 | + } | ||
| 35 | 63 | ||
| 36 | public Long getDeptId() | 64 | public Long getDeptId() |
| 37 | { | 65 | { |
| @@ -9,6 +9,7 @@ import com.ruoyi.common.utils.ip.IpUtils; | @@ -9,6 +9,7 @@ import com.ruoyi.common.utils.ip.IpUtils; | ||
| 9 | import com.ruoyi.common.utils.spring.SpringUtils; | 9 | import com.ruoyi.common.utils.spring.SpringUtils; |
| 10 | import com.ruoyi.system.domain.SysLogininfor; | 10 | import com.ruoyi.system.domain.SysLogininfor; |
| 11 | import com.ruoyi.system.domain.SysOperLog; | 11 | import com.ruoyi.system.domain.SysOperLog; |
| 12 | +import com.ruoyi.system.domain.tool.SysLogininforType; | ||
| 12 | import com.ruoyi.system.service.ISysLogininforService; | 13 | import com.ruoyi.system.service.ISysLogininforService; |
| 13 | import com.ruoyi.system.service.ISysOperLogService; | 14 | import com.ruoyi.system.service.ISysOperLogService; |
| 14 | import eu.bitwalker.useragentutils.UserAgent; | 15 | import eu.bitwalker.useragentutils.UserAgent; |
| @@ -35,7 +36,7 @@ public class AsyncFactory | @@ -35,7 +36,7 @@ public class AsyncFactory | ||
| 35 | * @param args 列表 | 36 | * @param args 列表 |
| 36 | * @return 任务task | 37 | * @return 任务task |
| 37 | */ | 38 | */ |
| 38 | - public static TimerTask recordLogininfor(final String username, final String status, final String message, | 39 | + public static TimerTask recordLogininfor(final String username, final SysLogininforType type, final String status, final String message, |
| 39 | final Object... args) | 40 | final Object... args) |
| 40 | { | 41 | { |
| 41 | final UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); | 42 | final UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); |
| @@ -66,6 +67,7 @@ public class AsyncFactory | @@ -66,6 +67,7 @@ public class AsyncFactory | ||
| 66 | logininfor.setBrowser(browser); | 67 | logininfor.setBrowser(browser); |
| 67 | logininfor.setOs(os); | 68 | logininfor.setOs(os); |
| 68 | logininfor.setMsg(message); | 69 | logininfor.setMsg(message); |
| 70 | + logininfor.setType(type.name()); | ||
| 69 | // 日志状态 | 71 | // 日志状态 |
| 70 | if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER)) | 72 | if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER)) |
| 71 | { | 73 | { |
| @@ -9,10 +9,8 @@ import com.ruoyi.common.exception.user.UserPasswordNotMatchException; | @@ -9,10 +9,8 @@ import com.ruoyi.common.exception.user.UserPasswordNotMatchException; | ||
| 9 | import com.ruoyi.common.utils.*; | 9 | import com.ruoyi.common.utils.*; |
| 10 | import com.ruoyi.common.utils.ip.IpUtils; | 10 | import com.ruoyi.common.utils.ip.IpUtils; |
| 11 | import com.ruoyi.system.domain.entity.SysUser; | 11 | import com.ruoyi.system.domain.entity.SysUser; |
| 12 | -import com.ruoyi.system.login.dto.ApiLoginUser; | ||
| 13 | -import com.ruoyi.system.login.dto.SysLoginUser; | ||
| 14 | -import com.ruoyi.system.login.dto.Yu2leUserLogin; | ||
| 15 | -import com.ruoyi.system.login.dto.Yu2leLoginToken; | 12 | +import com.ruoyi.system.domain.tool.SysLogininforType; |
| 13 | +import com.ruoyi.system.login.dto.*; | ||
| 16 | import com.ruoyi.system.login.manager.AsyncManager; | 14 | import com.ruoyi.system.login.manager.AsyncManager; |
| 17 | import com.ruoyi.system.login.manager.factory.AsyncFactory; | 15 | import com.ruoyi.system.login.manager.factory.AsyncFactory; |
| 18 | import com.ruoyi.system.service.ISysUserService; | 16 | import com.ruoyi.system.service.ISysUserService; |
| @@ -64,9 +62,10 @@ public class LoginService { | @@ -64,9 +62,10 @@ public class LoginService { | ||
| 64 | // validateCaptcha(username, code, uuid); | 62 | // validateCaptcha(username, code, uuid); |
| 65 | // } | 63 | // } |
| 66 | // 用户验证 | 64 | // 用户验证 |
| 67 | - Authentication authentication = userPasswordVerification(username,password); | ||
| 68 | - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("sysuser.login.success"))); | 65 | + Authentication authentication = userPasswordVerification(username,password,SysLogininforType.lhAdmin); |
| 66 | + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username,SysLogininforType.lhAdmin, Constants.LOGIN_SUCCESS, MessageUtils.message("sysuser.login.success"))); | ||
| 69 | SysLoginUser loginUser = (SysLoginUser) authentication.getPrincipal(); | 67 | SysLoginUser loginUser = (SysLoginUser) authentication.getPrincipal(); |
| 68 | + loginUser.setSysLogininforType(SysLogininforType.lhAdmin); | ||
| 70 | recordLoginInfo(loginUser.getUserId()); | 69 | recordLoginInfo(loginUser.getUserId()); |
| 71 | // 生成token | 70 | // 生成token |
| 72 | return tokenService.createToken(loginUser); | 71 | return tokenService.createToken(loginUser); |
| @@ -80,10 +79,15 @@ public class LoginService { | @@ -80,10 +79,15 @@ public class LoginService { | ||
| 80 | */ | 79 | */ |
| 81 | public String apiLoginByPass(String user,String pass) { | 80 | public String apiLoginByPass(String user,String pass) { |
| 82 | // 用户验证 | 81 | // 用户验证 |
| 83 | - Authentication authentication = userPasswordVerification(user,pass); | ||
| 84 | - AsyncManager.me().execute(AsyncFactory.recordLogininfor(user, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); | 82 | + Authentication authentication = userPasswordVerification(user,pass,SysLogininforType.lhApi); |
| 83 | + AsyncManager.me().execute(AsyncFactory.recordLogininfor(user, SysLogininforType.lhApi, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); | ||
| 85 | ApiLoginUser loginUser = (ApiLoginUser) authentication.getPrincipal(); | 84 | ApiLoginUser loginUser = (ApiLoginUser) authentication.getPrincipal(); |
| 86 | - recordLoginInfo(loginUser.getUserId()); | 85 | + loginUser.setSysLogininforType(SysLogininforType.lhApi); |
| 86 | + Yu2leUserInfo yu2leUserInfo = new Yu2leUserInfo(); | ||
| 87 | + yu2leUserInfo.setId(loginUser.getUserId().intValue()); | ||
| 88 | + yu2leUserInfo.setLastLoginIp(IpUtils.getIpAddr(ServletUtils.getRequest())); | ||
| 89 | + yu2leUserInfo.setLastLoginTime(DateUtils.getNowTimeMilly()); | ||
| 90 | + publicService.updateObjectByTable(yu2leUserInfo,"id","`liu_yu_le`.`user_info`"); | ||
| 87 | return tokenService.createToken(loginUser); | 91 | return tokenService.createToken(loginUser); |
| 88 | } | 92 | } |
| 89 | 93 | ||
| @@ -136,17 +140,17 @@ public class LoginService { | @@ -136,17 +140,17 @@ public class LoginService { | ||
| 136 | redisCache.deleteObject(verifyKey); | 140 | redisCache.deleteObject(verifyKey); |
| 137 | if (captcha == null) | 141 | if (captcha == null) |
| 138 | { | 142 | { |
| 139 | - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire"))); | 143 | + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username,SysLogininforType.lhAdmin, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire"))); |
| 140 | throw new CaptchaExpireException(); | 144 | throw new CaptchaExpireException(); |
| 141 | } | 145 | } |
| 142 | if (!code.equalsIgnoreCase(captcha)) | 146 | if (!code.equalsIgnoreCase(captcha)) |
| 143 | { | 147 | { |
| 144 | - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"))); | 148 | + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username,SysLogininforType.lhAdmin, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"))); |
| 145 | throw new CaptchaException(); | 149 | throw new CaptchaException(); |
| 146 | } | 150 | } |
| 147 | } | 151 | } |
| 148 | 152 | ||
| 149 | - private Authentication userPasswordVerification(String username,String password) | 153 | + private Authentication userPasswordVerification(String username,String password,SysLogininforType type) |
| 150 | { | 154 | { |
| 151 | Authentication authentication = null; | 155 | Authentication authentication = null; |
| 152 | try | 156 | try |
| @@ -159,12 +163,12 @@ public class LoginService { | @@ -159,12 +163,12 @@ public class LoginService { | ||
| 159 | { | 163 | { |
| 160 | if (e instanceof BadCredentialsException) | 164 | if (e instanceof BadCredentialsException) |
| 161 | { | 165 | { |
| 162 | - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); | 166 | + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username,type, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); |
| 163 | throw new UserPasswordNotMatchException(); | 167 | throw new UserPasswordNotMatchException(); |
| 164 | } | 168 | } |
| 165 | else | 169 | else |
| 166 | { | 170 | { |
| 167 | - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage())); | 171 | + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username,type, Constants.LOGIN_FAIL, e.getMessage())); |
| 168 | throw new ServiceException(e.getMessage()); | 172 | throw new ServiceException(e.getMessage()); |
| 169 | } | 173 | } |
| 170 | } | 174 | } |
| @@ -44,6 +44,9 @@ public interface PublicMapper { | @@ -44,6 +44,9 @@ public interface PublicMapper { | ||
| 44 | @UpdateProvider(type = PublicSQL.class, method = "updateObject") | 44 | @UpdateProvider(type = PublicSQL.class, method = "updateObject") |
| 45 | int updateObject(@Param("object") Object object, @Param("whereFieldNames") String whereFieldNames); | 45 | int updateObject(@Param("object") Object object, @Param("whereFieldNames") String whereFieldNames); |
| 46 | 46 | ||
| 47 | + @UpdateProvider(type = PublicSQL.class, method = "updateObject") | ||
| 48 | + int updateObjectByTable(@Param("object") Object object, @Param("whereFieldNames") String whereFieldNames, @Param("tablename") String tablename); | ||
| 49 | + | ||
| 47 | /** | 50 | /** |
| 48 | * 自定义sql更新 | 51 | * 自定义sql更新 |
| 49 | * @param sql | 52 | * @param sql |
| @@ -34,6 +34,7 @@ public interface PublicService { | @@ -34,6 +34,7 @@ public interface PublicService { | ||
| 34 | */ | 34 | */ |
| 35 | int updateObject( Object object, String whereFieldNames); | 35 | int updateObject( Object object, String whereFieldNames); |
| 36 | 36 | ||
| 37 | + int updateObjectByTable( Object object, String whereFieldNames,String tablename); | ||
| 37 | /** | 38 | /** |
| 38 | * 自定义sql更新 | 39 | * 自定义sql更新 |
| 39 | * @param sql | 40 | * @param sql |
| @@ -59,6 +59,16 @@ public class PublicServiceImpl implements PublicService { | @@ -59,6 +59,16 @@ public class PublicServiceImpl implements PublicService { | ||
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | /** | 61 | /** |
| 62 | + * 更新对象不为空的属性 | ||
| 63 | + * @param object | ||
| 64 | + * @param whereFieldNames | ||
| 65 | + */ | ||
| 66 | + public int updateObjectByTable(Object object, String whereFieldNames,String tablename) | ||
| 67 | + { | ||
| 68 | + return publicMapper.updateObjectByTable(object,whereFieldNames,tablename); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + /** | ||
| 62 | * 自定义sql更新 | 72 | * 自定义sql更新 |
| 63 | * @param sql | 73 | * @param sql |
| 64 | */ | 74 | */ |
| @@ -14,15 +14,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -14,15 +14,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 14 | <result property="os" column="os" /> | 14 | <result property="os" column="os" /> |
| 15 | <result property="msg" column="msg" /> | 15 | <result property="msg" column="msg" /> |
| 16 | <result property="loginTime" column="login_time" /> | 16 | <result property="loginTime" column="login_time" /> |
| 17 | + <result property="type" column="type" /> | ||
| 17 | </resultMap> | 18 | </resultMap> |
| 18 | 19 | ||
| 19 | <insert id="insertLogininfor" parameterType="SysLogininfor"> | 20 | <insert id="insertLogininfor" parameterType="SysLogininfor"> |
| 20 | - insert into sys_logininfor (user_name, status, ipaddr, login_location, browser, os, msg, login_time) | ||
| 21 | - values (#{userName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, sysdate()) | 21 | + insert into sys_logininfor (user_name,`type`, status, ipaddr, login_location, browser, os, msg, login_time) |
| 22 | + values (#{userName},#{type}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, sysdate()) | ||
| 22 | </insert> | 23 | </insert> |
| 23 | 24 | ||
| 24 | <select id="selectLogininforList" parameterType="SysLogininfor" resultMap="SysLogininforResult"> | 25 | <select id="selectLogininforList" parameterType="SysLogininfor" resultMap="SysLogininforResult"> |
| 25 | - select info_id, user_name, ipaddr, login_location, browser, os, status, msg, login_time from sys_logininfor | 26 | + select info_id, user_name, ipaddr, login_location, browser, os, status, msg, login_time,`type` from sys_logininfor |
| 26 | <where> | 27 | <where> |
| 27 | <if test="ipaddr != null and ipaddr != ''"> | 28 | <if test="ipaddr != null and ipaddr != ''"> |
| 28 | AND ipaddr like concat('%', #{ipaddr}, '%') | 29 | AND ipaddr like concat('%', #{ipaddr}, '%') |
| @@ -33,6 +34,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -33,6 +34,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 33 | <if test="userName != null and userName != ''"> | 34 | <if test="userName != null and userName != ''"> |
| 34 | AND user_name like concat('%', #{userName}, '%') | 35 | AND user_name like concat('%', #{userName}, '%') |
| 35 | </if> | 36 | </if> |
| 37 | + <if test="type != null and type != ''"> | ||
| 38 | + AND `type` like concat('%', #{type}, '%') | ||
| 39 | + </if> | ||
| 36 | <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> | 40 | <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> |
| 37 | and date_format(login_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') | 41 | and date_format(login_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') |
| 38 | </if> | 42 | </if> |
-
请 注册 或 登录 后发表评论