|
|
@ -1,13 +1,10 @@
|
|
|
|
package com.ruoyi.web.controller.system.system;
|
|
|
|
package com.ruoyi.web.controller.system.system;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
import com.ruoyi.common.config.RuoYiConfig;
|
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
|
import com.ruoyi.common.exception.file.InvalidExtensionException;
|
|
|
|
import cn.hutool.extra.pinyin.PinyinUtil;
|
|
|
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
|
|
|
|
|
|
|
import com.ruoyi.common.utils.file.MimeTypeUtils;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
@ -45,8 +42,7 @@ import com.ruoyi.system.service.ISysUserService;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Controller
|
|
|
|
@Controller
|
|
|
|
@RequestMapping("/system/user")
|
|
|
|
@RequestMapping("/system/user")
|
|
|
|
public class SysUserController extends BaseController
|
|
|
|
public class SysUserController extends BaseController {
|
|
|
|
{
|
|
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(SysUserController.class);
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(SysUserController.class);
|
|
|
|
private String prefix = "system/user";
|
|
|
|
private String prefix = "system/user";
|
|
|
|
|
|
|
|
|
|
|
@ -67,16 +63,14 @@ public class SysUserController extends BaseController
|
|
|
|
|
|
|
|
|
|
|
|
@RequiresPermissions("system:user:view")
|
|
|
|
@RequiresPermissions("system:user:view")
|
|
|
|
@GetMapping()
|
|
|
|
@GetMapping()
|
|
|
|
public String user()
|
|
|
|
public String user() {
|
|
|
|
{
|
|
|
|
|
|
|
|
return prefix + "/user";
|
|
|
|
return prefix + "/user";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequiresPermissions("system:user:list")
|
|
|
|
@RequiresPermissions("system:user:list")
|
|
|
|
@PostMapping("/list")
|
|
|
|
@PostMapping("/list")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public TableDataInfo list(SysUser user)
|
|
|
|
public TableDataInfo list(SysUser user) {
|
|
|
|
{
|
|
|
|
|
|
|
|
startPage();
|
|
|
|
startPage();
|
|
|
|
List<SysUser> list = userService.selectUserList(user);
|
|
|
|
List<SysUser> list = userService.selectUserList(user);
|
|
|
|
return getDataTable(list);
|
|
|
|
return getDataTable(list);
|
|
|
@ -86,8 +80,7 @@ public class SysUserController extends BaseController
|
|
|
|
@RequiresPermissions("system:user:export")
|
|
|
|
@RequiresPermissions("system:user:export")
|
|
|
|
@PostMapping("/export")
|
|
|
|
@PostMapping("/export")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public AjaxResult export(SysUser user)
|
|
|
|
public AjaxResult export(SysUser user) {
|
|
|
|
{
|
|
|
|
|
|
|
|
List<SysUser> list = userService.selectUserList(user);
|
|
|
|
List<SysUser> list = userService.selectUserList(user);
|
|
|
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
|
|
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
|
|
|
return util.exportExcel(list, "用户数据");
|
|
|
|
return util.exportExcel(list, "用户数据");
|
|
|
@ -97,8 +90,7 @@ public class SysUserController extends BaseController
|
|
|
|
@RequiresPermissions("system:user:import")
|
|
|
|
@RequiresPermissions("system:user:import")
|
|
|
|
@PostMapping("/importData")
|
|
|
|
@PostMapping("/importData")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
|
|
|
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
|
|
|
|
{
|
|
|
|
|
|
|
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
|
|
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
|
|
|
List<SysUser> userList = util.importExcel(file.getInputStream());
|
|
|
|
List<SysUser> userList = util.importExcel(file.getInputStream());
|
|
|
|
String message = userService.importUser(userList, updateSupport, getLoginName());
|
|
|
|
String message = userService.importUser(userList, updateSupport, getLoginName());
|
|
|
@ -108,8 +100,7 @@ public class SysUserController extends BaseController
|
|
|
|
@RequiresPermissions("system:user:view")
|
|
|
|
@RequiresPermissions("system:user:view")
|
|
|
|
@GetMapping("/importTemplate")
|
|
|
|
@GetMapping("/importTemplate")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public AjaxResult importTemplate()
|
|
|
|
public AjaxResult importTemplate() {
|
|
|
|
{
|
|
|
|
|
|
|
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
|
|
|
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
|
|
|
return util.importTemplateExcel("用户数据");
|
|
|
|
return util.importTemplateExcel("用户数据");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -118,8 +109,7 @@ public class SysUserController extends BaseController
|
|
|
|
* 新增用户
|
|
|
|
* 新增用户
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@GetMapping("/add")
|
|
|
|
@GetMapping("/add")
|
|
|
|
public String add(ModelMap mmap)
|
|
|
|
public String add(ModelMap mmap) {
|
|
|
|
{
|
|
|
|
|
|
|
|
mmap.put("roles", roleService.selectRoleAll().stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
|
|
|
mmap.put("roles", roleService.selectRoleAll().stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
|
|
|
mmap.put("posts", postService.selectPostAll());
|
|
|
|
mmap.put("posts", postService.selectPostAll());
|
|
|
|
return prefix + "/add";
|
|
|
|
return prefix + "/add";
|
|
|
@ -133,16 +123,11 @@ public class SysUserController extends BaseController
|
|
|
|
@PostMapping("/add")
|
|
|
|
@PostMapping("/add")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public AjaxResult addSave(@Validated SysUser user) {
|
|
|
|
public AjaxResult addSave(@Validated SysUser user) {
|
|
|
|
if (!userService.checkLoginNameUnique(user))
|
|
|
|
if (!userService.checkLoginNameUnique(user)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
|
|
|
|
return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
|
|
|
|
}
|
|
|
|
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
|
|
|
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
|
|
|
return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
|
|
|
}
|
|
|
|
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
|
|
|
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
|
|
|
return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
user.setSalt(ShiroUtils.randomSalt());
|
|
|
|
user.setSalt(ShiroUtils.randomSalt());
|
|
|
@ -156,8 +141,7 @@ public class SysUserController extends BaseController
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@RequiresPermissions("system:user:edit")
|
|
|
|
@RequiresPermissions("system:user:edit")
|
|
|
|
@GetMapping("/edit/{userId}")
|
|
|
|
@GetMapping("/edit/{userId}")
|
|
|
|
public String edit(@PathVariable("userId") Long userId, ModelMap mmap)
|
|
|
|
public String edit(@PathVariable("userId") Long userId, ModelMap mmap) {
|
|
|
|
{
|
|
|
|
|
|
|
|
userService.checkUserDataScope(userId);
|
|
|
|
userService.checkUserDataScope(userId);
|
|
|
|
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
|
|
|
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
|
|
|
mmap.put("user", userService.selectUserById(userId));
|
|
|
|
mmap.put("user", userService.selectUserById(userId));
|
|
|
@ -173,20 +157,14 @@ public class SysUserController extends BaseController
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
|
|
|
@PostMapping("/edit")
|
|
|
|
@PostMapping("/edit")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public AjaxResult editSave(@Validated SysUser user)
|
|
|
|
public AjaxResult editSave(@Validated SysUser user) {
|
|
|
|
{
|
|
|
|
|
|
|
|
userService.checkUserAllowed(user);
|
|
|
|
userService.checkUserAllowed(user);
|
|
|
|
userService.checkUserDataScope(user.getUserId());
|
|
|
|
userService.checkUserDataScope(user.getUserId());
|
|
|
|
if (!userService.checkLoginNameUnique(user))
|
|
|
|
if (!userService.checkLoginNameUnique(user)) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return error("修改用户'" + user.getLoginName() + "'失败,登录账号已存在");
|
|
|
|
return error("修改用户'" + user.getLoginName() + "'失败,登录账号已存在");
|
|
|
|
}
|
|
|
|
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
|
|
|
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
|
|
|
return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在");
|
|
|
|
}
|
|
|
|
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
|
|
|
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
|
|
|
return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
user.setUpdateBy(getLoginName());
|
|
|
|
user.setUpdateBy(getLoginName());
|
|
|
@ -196,8 +174,7 @@ public class SysUserController extends BaseController
|
|
|
|
|
|
|
|
|
|
|
|
@RequiresPermissions("system:user:resetPwd")
|
|
|
|
@RequiresPermissions("system:user:resetPwd")
|
|
|
|
@GetMapping("/resetPwd/{userId}")
|
|
|
|
@GetMapping("/resetPwd/{userId}")
|
|
|
|
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
|
|
|
|
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap) {
|
|
|
|
{
|
|
|
|
|
|
|
|
mmap.put("user", userService.selectUserById(userId));
|
|
|
|
mmap.put("user", userService.selectUserById(userId));
|
|
|
|
return prefix + "/resetPwd";
|
|
|
|
return prefix + "/resetPwd";
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -206,16 +183,13 @@ public class SysUserController extends BaseController
|
|
|
|
@Log(title = "重置密码", businessType = BusinessType.RESET)
|
|
|
|
@Log(title = "重置密码", businessType = BusinessType.RESET)
|
|
|
|
@PostMapping("/resetPwd")
|
|
|
|
@PostMapping("/resetPwd")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public AjaxResult resetPwdSave(SysUser user)
|
|
|
|
public AjaxResult resetPwdSave(SysUser user) {
|
|
|
|
{
|
|
|
|
|
|
|
|
userService.checkUserAllowed(user);
|
|
|
|
userService.checkUserAllowed(user);
|
|
|
|
userService.checkUserDataScope(user.getUserId());
|
|
|
|
userService.checkUserDataScope(user.getUserId());
|
|
|
|
user.setSalt(ShiroUtils.randomSalt());
|
|
|
|
user.setSalt(ShiroUtils.randomSalt());
|
|
|
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
|
|
|
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
|
|
|
|
if (userService.resetUserPwd(user) > 0)
|
|
|
|
if (userService.resetUserPwd(user) > 0) {
|
|
|
|
{
|
|
|
|
if (ShiroUtils.getUserId().longValue() == user.getUserId().longValue()) {
|
|
|
|
if (ShiroUtils.getUserId().longValue() == user.getUserId().longValue())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
setSysUser(userService.selectUserById(user.getUserId()));
|
|
|
|
setSysUser(userService.selectUserById(user.getUserId()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return success();
|
|
|
|
return success();
|
|
|
@ -227,8 +201,7 @@ public class SysUserController extends BaseController
|
|
|
|
* 进入授权角色页
|
|
|
|
* 进入授权角色页
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@GetMapping("/authRole/{userId}")
|
|
|
|
@GetMapping("/authRole/{userId}")
|
|
|
|
public String authRole(@PathVariable("userId") Long userId, ModelMap mmap)
|
|
|
|
public String authRole(@PathVariable("userId") Long userId, ModelMap mmap) {
|
|
|
|
{
|
|
|
|
|
|
|
|
SysUser user = userService.selectUserById(userId);
|
|
|
|
SysUser user = userService.selectUserById(userId);
|
|
|
|
// 获取用户所属的角色列表
|
|
|
|
// 获取用户所属的角色列表
|
|
|
|
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
|
|
|
List<SysRole> roles = roleService.selectRolesByUserId(userId);
|
|
|
@ -244,8 +217,7 @@ public class SysUserController extends BaseController
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.GRANT)
|
|
|
|
@PostMapping("/authRole/insertAuthRole")
|
|
|
|
@PostMapping("/authRole/insertAuthRole")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
|
|
|
|
public AjaxResult insertAuthRole(Long userId, Long[] roleIds) {
|
|
|
|
{
|
|
|
|
|
|
|
|
userService.checkUserDataScope(userId);
|
|
|
|
userService.checkUserDataScope(userId);
|
|
|
|
userService.insertUserAuth(userId, roleIds);
|
|
|
|
userService.insertUserAuth(userId, roleIds);
|
|
|
|
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
|
|
|
AuthorizationUtils.clearAllCachedAuthorizationInfo();
|
|
|
@ -256,10 +228,8 @@ public class SysUserController extends BaseController
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
|
|
|
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
|
|
|
@PostMapping("/remove")
|
|
|
|
@PostMapping("/remove")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public AjaxResult remove(String ids)
|
|
|
|
public AjaxResult remove(String ids) {
|
|
|
|
{
|
|
|
|
if (ArrayUtils.contains(Convert.toLongArray(ids), getUserId())) {
|
|
|
|
if (ArrayUtils.contains(Convert.toLongArray(ids), getUserId()))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return error("当前用户不能删除");
|
|
|
|
return error("当前用户不能删除");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return toAjax(userService.deleteUserByIds(ids));
|
|
|
|
return toAjax(userService.deleteUserByIds(ids));
|
|
|
@ -270,8 +240,7 @@ public class SysUserController extends BaseController
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@PostMapping("/checkLoginNameUnique")
|
|
|
|
@PostMapping("/checkLoginNameUnique")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public boolean checkLoginNameUnique(SysUser user)
|
|
|
|
public boolean checkLoginNameUnique(SysUser user) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return userService.checkLoginNameUnique(user);
|
|
|
|
return userService.checkLoginNameUnique(user);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -280,8 +249,7 @@ public class SysUserController extends BaseController
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@PostMapping("/checkPhoneUnique")
|
|
|
|
@PostMapping("/checkPhoneUnique")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public boolean checkPhoneUnique(SysUser user)
|
|
|
|
public boolean checkPhoneUnique(SysUser user) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return userService.checkPhoneUnique(user);
|
|
|
|
return userService.checkPhoneUnique(user);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -290,8 +258,7 @@ public class SysUserController extends BaseController
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@PostMapping("/checkEmailUnique")
|
|
|
|
@PostMapping("/checkEmailUnique")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public boolean checkEmailUnique(SysUser user)
|
|
|
|
public boolean checkEmailUnique(SysUser user) {
|
|
|
|
{
|
|
|
|
|
|
|
|
return userService.checkEmailUnique(user);
|
|
|
|
return userService.checkEmailUnique(user);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -302,8 +269,7 @@ public class SysUserController extends BaseController
|
|
|
|
@RequiresPermissions("system:user:edit")
|
|
|
|
@RequiresPermissions("system:user:edit")
|
|
|
|
@PostMapping("/changeStatus")
|
|
|
|
@PostMapping("/changeStatus")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public AjaxResult changeStatus(SysUser user)
|
|
|
|
public AjaxResult changeStatus(SysUser user) {
|
|
|
|
{
|
|
|
|
|
|
|
|
userService.checkUserAllowed(user);
|
|
|
|
userService.checkUserAllowed(user);
|
|
|
|
userService.checkUserDataScope(user.getUserId());
|
|
|
|
userService.checkUserDataScope(user.getUserId());
|
|
|
|
return toAjax(userService.changeStatus(user));
|
|
|
|
return toAjax(userService.changeStatus(user));
|
|
|
@ -315,8 +281,7 @@ public class SysUserController extends BaseController
|
|
|
|
@RequiresPermissions("system:user:list")
|
|
|
|
@RequiresPermissions("system:user:list")
|
|
|
|
@GetMapping("/deptTreeData")
|
|
|
|
@GetMapping("/deptTreeData")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public List<Ztree> deptTreeData()
|
|
|
|
public List<Ztree> deptTreeData() {
|
|
|
|
{
|
|
|
|
|
|
|
|
List<Ztree> ztrees = deptService.selectDeptTree(new SysDept());
|
|
|
|
List<Ztree> ztrees = deptService.selectDeptTree(new SysDept());
|
|
|
|
return ztrees;
|
|
|
|
return ztrees;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -328,12 +293,26 @@ public class SysUserController extends BaseController
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@RequiresPermissions("system:user:list")
|
|
|
|
@RequiresPermissions("system:user:list")
|
|
|
|
@GetMapping("/selectDeptTree/{deptId}")
|
|
|
|
@GetMapping("/selectDeptTree/{deptId}")
|
|
|
|
public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap)
|
|
|
|
public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap) {
|
|
|
|
{
|
|
|
|
|
|
|
|
mmap.put("dept", deptService.selectDeptById(deptId));
|
|
|
|
mmap.put("dept", deptService.selectDeptById(deptId));
|
|
|
|
return prefix + "/deptTree";
|
|
|
|
return prefix + "/deptTree";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getPinyin")
|
|
|
|
|
|
|
|
@ResponseBody
|
|
|
|
|
|
|
|
public AjaxResult getPinyin(@RequestParam String name) {
|
|
|
|
|
|
|
|
return AjaxResult.success(getFirstLetter(name));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 中文转拼音
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param columnName
|
|
|
|
|
|
|
|
* @return java.lang.String
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public String getFirstLetter(String columnName) {
|
|
|
|
|
|
|
|
return PinyinUtil.getFirstLetter(columnName, "") + RandomUtil.randomNumbers(4);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|