| 
						
						
						
					 | 
				
				 | 
				
					@ -1,39 +1,32 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					package org.jeecg.modules.demo.appuser.controller; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					package org.jeecg.modules.sysMiniapp.appuser.controller; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.Arrays; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.HashMap; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.List; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.Map; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.stream.Collectors; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.io.IOException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.io.UnsupportedEncodingException; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.net.URLDecoder; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import javax.servlet.http.HttpServletRequest; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import javax.servlet.http.HttpServletResponse; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import cn.hutool.core.util.StrUtil; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jeecg.common.api.vo.Result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jeecg.common.constant.CacheConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jeecg.common.system.query.QueryGenerator; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jeecg.common.system.query.QueryRuleEnum; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jeecg.common.util.PasswordUtil; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jeecg.common.util.oConvertUtils; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jeecg.modules.demo.appuser.entity.AppUser; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jeecg.modules.demo.appuser.service.IAppUserService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jeecg.modules.sysMiniapp.appuser.entity.AppUser; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jeecg.modules.sysMiniapp.appuser.service.IAppUserService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.baomidou.mybatisplus.core.metadata.IPage; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import lombok.extern.slf4j.Slf4j; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jeecgframework.poi.excel.ExcelImportUtil; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jeecgframework.poi.excel.def.NormalExcelConstants; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jeecgframework.poi.excel.entity.ExportParams; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jeecgframework.poi.excel.entity.ImportParams; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jeecg.common.system.base.controller.JeecgController; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.beans.factory.annotation.Autowired; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.cache.annotation.CacheEvict; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.cache.annotation.Cacheable; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.web.bind.annotation.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.web.multipart.MultipartFile; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.web.multipart.MultipartHttpServletRequest; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.springframework.web.servlet.ModelAndView; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.alibaba.fastjson.JSON; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import io.swagger.annotations.Api; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import io.swagger.annotations.ApiOperation; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import org.jeecg.common.aspect.annotation.AutoLog; | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -52,7 +45,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					public class AppUserController extends JeecgController<AppUser, IAppUserService> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						private IAppUserService appUserService; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						/** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * 分页列表查询 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -78,7 +71,7 @@ public class AppUserController extends JeecgController<AppUser, IAppUserService> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							IPage<AppUser> pageList = appUserService.page(page, queryWrapper); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return Result.OK(pageList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						/** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 *   添加 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -90,10 +83,14 @@ public class AppUserController extends JeecgController<AppUser, IAppUserService> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@RequiresPermissions("appuser:app_user:add") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@PostMapping(value = "/add") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						public Result<String> add(@RequestBody AppUser appUser) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							String salt = oConvertUtils.randomGen(8); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							appUser.setPasswordSalt(salt); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							String passwordEncode = PasswordUtil.encrypt(appUser.getNickName(), appUser.getPassword(), salt); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							appUser.setPassword(passwordEncode); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							appUserService.save(appUser); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return Result.OK("添加成功!"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						/** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 *  编辑 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -103,12 +100,18 @@ public class AppUserController extends JeecgController<AppUser, IAppUserService> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@AutoLog(value = "应用用户表-编辑") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@ApiOperation(value="应用用户表-编辑", notes="应用用户表-编辑") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@RequiresPermissions("appuser:app_user:edit") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@CacheEvict(value={CacheConstant.SYS_USERS_CACHE}, allEntries=true) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						public Result<String> edit(@RequestBody AppUser appUser) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							// 修改密码 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if (StrUtil.isNotBlank(appUser.getPassword()) || StrUtil.isNotBlank(appUser.getNickName())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								String passwordEncode = PasswordUtil.encrypt(appUser.getNickName(), appUser.getPassword(), appUser.getPasswordSalt()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								appUser.setPassword(passwordEncode); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							appUserService.updateById(appUser); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return Result.OK("编辑成功!"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						/** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 *   通过id删除 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -123,7 +126,7 @@ public class AppUserController extends JeecgController<AppUser, IAppUserService> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							appUserService.removeById(id); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return Result.OK("删除成功!"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						/** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 *  批量删除 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -138,7 +141,7 @@ public class AppUserController extends JeecgController<AppUser, IAppUserService> | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							this.appUserService.removeByIds(Arrays.asList(ids.split(","))); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return Result.OK("批量删除成功!"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						/** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * 通过id查询 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						 * |