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
| @RequestMapping("/selectUserData") @ResponseBody public String selectUserDataByUserId(int type,int status,int userId,int userRole,String userCompany) throws Exception { String res = userPlatService.selectUserData(type,status,userId,userRole,userCompany); return res; }
@Override public String selectUserData(int type,int status,int userId,int userRole,String userCompany) { List<UserPlatformModel> loginList = new ArrayList<UserPlatformModel>(); if(userRole == 0) { loginList = userPlatMapper.selectUserData(type,status); }else { loginList = userPlatMapper.selectUserDataByUserCompany(type,status,userCompany); } if(userId != 1) { for(UserPlatformModel plat:loginList) { plat.setPlatformRemark(""); } } JSONObject jsonObject = new JSONObject(); jsonObject.put("total", loginList.size()); jsonObject.put("rows", JSONArray.fromObject(loginList).toString()); return jsonObject.toString(); }
<select id="selectUserData" resultType="UserPlatformModel"> SELECT * FROM t_login_user LEFT JOIN t_user_platform ON t_login_user.userid = t_user_platform.userid LEFT JOIN t_platform ON t_platform.PlatformId = t_user_platform.PlatformId where 1=1 <if test="type != 10"> and t_platform.PlatformType = #{type} </if> <if test="status != 10"> and t_login_user.UserStatus = #{status} </if> GROUP BY t_login_user.UserId ORDER BY UserCreateTime DESC </select>
<select id="selectUserDataByUserCompany" resultType="UserPlatformModel"> SELECT * FROM t_login_user LEFT JOIN t_user_platform ON t_login_user.userid = t_user_platform.userid LEFT JOIN t_platform ON t_platform.PlatformId = t_user_platform.PlatformId where 1=1 and t_login_user.UserCompany = #{userCompany} <if test="type != 10"> and t_platform.PlatformType = #{type} </if> <if test="status != 10"> and t_login_user.UserStatus = #{status} </if> GROUP BY t_login_user.UserId ORDER BY UserCreateTime DESC </select>
@RequestMapping("/selectUserByNameOrPhoneOrPlatOrPlatName") @ResponseBody public String selectUserByNameOrPhoneOrPlatOrPlatName(int userRole,String userCompany,String val) throws Exception { String res = userPlatService.selectUserByNameOrPhoneOrPlatOrPlatName(userRole,userCompany,val); return res; }
@Override public String selectUserByNameOrPhoneOrPlatOrPlatName(int userRole,String userCompany,String val) { List<UserPlatformModel> loginList = null; if(userRole == 0) { loginList = userPlatMapper.selectUserByNameOrPhoneOrPlatOrPlatName(val); }else { try {
loginList = userPlatMapper.selectUserByNameOrPhoneOrPlatOrPlatNameAndCompany(userCompany,val); } catch (Exception e) { String a=""; } } if(userRole != 0) { for(UserPlatformModel plat:loginList) { plat.setPlatformRemark(""); } } JSONObject jsonObject = new JSONObject(); jsonObject.put("total", loginList.size()); jsonObject.put("rows", JSONArray.fromObject(loginList).toString()); return jsonObject.toString(); }
select id="selectUserByNameOrPhoneOrPlatOrPlatName" resultType="UserPlatformModel"> SELECT * FROM t_login_user LEFT JOIN t_user_platform ON t_login_user.userid = t_user_platform.userid LEFT JOIN t_platform ON t_platform.PlatformId = t_user_platform.PlatformId WHERE userPhone = #{val} or userName =#{val} or t_platform.PlatformCode =#{val} or t_platform.PlatformName = #{val} GROUP BY t_login_user.UserId ORDER BY UserCreateTime DESC </select>
<select id="selectUserByNameOrPhoneOrPlatOrPlatNameAndCompany" resultType="UserPlatformModel"> SELECT t_login_user.userId, t_login_user.userPhone, t_login_user.userPassword, t_login_user.userName, t_login_user.userCompany, t_login_user.userRole, t_login_user.userStatus, t_login_user.userOpenId, t_login_user.userCreateTime, t_login_user.userBluetooth, t_login_user.userBluetoothTime, t_login_user.userCheck, t_login_user.userCheckTime, t_login_user.userRemark, t_user_platform.loginName, t_user_platform.loginPassword FROM t_login_user LEFT JOIN t_user_platform ON t_login_user.userid = t_user_platform.userid LEFT JOIN t_platform ON t_platform.PlatformId = t_user_platform.PlatformId WHERE userCompany like '%${userCompany}%' and ( userPhone = #{val} or userName =#{val} or t_platform.PlatformCode =#{val} or t_platform.PlatformName = #{val} ) GROUP BY t_login_user.UserId ORDER BY UserCreateTime DESC </select>
|