1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
| //授权User @RequestMapping("/shouQuanUser") @ResponseBody public String shouQuanUser(HttpSession session,int userId,int platformId,String login, String pass,String ptlogin,String ptpass,String yingshou,String yslogin, String yspass,int zhanghaoleixing,int lanya,String lanyashouquanriqi,String shouquanren) throws Exception { String res = userPlatService.shouQuanUser(session,userId,platformId,login,pass,ptlogin, ptpass,yingshou,yslogin,yspass,zhanghaoleixing,lanya,lanyashouquanriqi,shouquanren); return res; } @Override public String shouQuanUser(HttpSession session,int userId,int platformId, String login, String pass, String ptlogin, String ptpass, String yingshou, String yslogin, String yspass, int zhanghaoleixing, int lanya, String lanyashouquanriqi, String shouquanren) { String res = ""; try {
int count = userPlatMapper.selectUserAndPlatformCount(userId,platformId); if(count<1) { if("".equals(lanyashouquanriqi)) { lanyashouquanriqi =null; } int i = userPlatMapper.shouQuanUser(userId,zhanghaoleixing,shouquanren,lanya,lanyashouquanriqi); if(zhanghaoleixing == 0 || zhanghaoleixing == 4) { List<UserPlatformModel> platformList = userPlatMapper.selectPlatformAll(); for(UserPlatformModel plat:platformList) { int count2 = userPlatMapper.selectUserAndPlatformCount(userId,plat.getPlatformId()); if(count2 >0) { continue; } plat.setUserId(userId); plat.setPlatformId(plat.getPlatformId()); plat.setLoginName(ptlogin); plat.setLoginPassword(ptpass); plat.setYingshouName(yslogin); plat.setYingshouPassword(yspass); userPlatMapper.saveUserAndPlatform(plat); } }else { UserPlatformModel uap= new UserPlatformModel(); uap.setUserId(userId); uap.setPlatformId(platformId); uap.setLoginName(ptlogin); uap.setLoginPassword(ptpass); uap.setYingshouName(yslogin); uap.setYingshouPassword(yspass); userPlatMapper.saveUserAndPlatform(uap); } res="授权成功"; }else { res="此平台已授权"; } } catch (Exception e) { res="授权失败"; } return res; }
<select id="selectUserAndPlatformCount" resultType="int"> select count(*) from t_user_platform where userId= #{userId} and platformId =#{platformId} </select> <update id="shouQuanUser"> update t_login_user set userStatus = 1, userRole = #{userRole}, userCheck=#{userCheck}, userCheckTime = sysdate(), userBluetooth = #{userBluetooth}, userBluetoothTime=#{userBluetoothTime} where UserId = #{userId} </update> <select id="selectPlatformAll" resultType="UserPlatformModel"> select * from t_platform </select>
//修改授权User @RequestMapping("/updateShouQuanUser") @ResponseBody public String updateShouQuanUser(HttpSession session,int userId,int platformId,String yslogin, String yspass,String lanyashouquanriqi,String shouquanren) throws Exception { String res = userPlatService.updateShouQuanUser(session,userId,platformId, yslogin,yspass,lanyashouquanriqi,shouquanren); return res; } @Override public String updateShouQuanUser(HttpSession session, int userId, int platformId, String yslogin, String yspass, String lanyashouquanriqi, String shouquanren) { String res = ""; try { if("".equals(lanyashouquanriqi)) { lanyashouquanriqi = null; } userPlatMapper.updateUserAndPlatform(userId,platformId,yslogin,yspass); int i = userPlatMapper.updateShouQuanUser(userId,lanyashouquanriqi); res="修改成功"; } catch (Exception e) { res="修改失败"; } return res; } <update id="updateUserAndPlatform"> update t_user_platform set YingshouName = #{yslogin}, YingshouPassword = #{yspass} where UserId = #{userId} </update> <update id="updateShouQuanUser"> update t_login_user set userBluetoothTime=#{userBluetoothTime} where UserId = #{userId} </update>
@RequestMapping("/zhuxiaozhanghao") @ResponseBody public String zhuxiaozhanghao(int userId) throws Exception { String res = userPlatService.zhuxiaozhanghao(userId); return res; } @Override public String zhuxiaozhanghao(int userId) { String res=""; try { userPlatMapper.zhuxiaozhanghaoUser(userId); userPlatMapper.zhuxiaozhanghaoUserAndPlat(userId); res="注销成功"; } catch (Exception e) { res="注销失败"; } return res; } <delete id="zhuxiaozhanghaoUser"> DELETE FROM t_login_user WHERE userid=#{userId} </delete> <delete id="zhuxiaozhanghaoUserAndPlat"> DELETE FROM t_user_platform WHERE userid=#{userId} </delete>
|