小程序端接口
This commit is contained in:
		
							parent
							
								
									333fbe21d5
								
							
						
					
					
						commit
						b065c25b24
					
				| @ -1,25 +1,18 @@ | ||||
| package com.ruoyi.abuwx.controller; | ||||
| 
 | ||||
| import java.util.List; | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import org.springframework.security.access.prepost.PreAuthorize; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.PostMapping; | ||||
| import org.springframework.web.bind.annotation.PutMapping; | ||||
| import org.springframework.web.bind.annotation.DeleteMapping; | ||||
| import org.springframework.web.bind.annotation.PathVariable; | ||||
| import org.springframework.web.bind.annotation.RequestBody; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| import com.ruoyi.abuwx.service.IAbucoderWxuserService; | ||||
| import com.ruoyi.common.annotation.Log; | ||||
| import com.ruoyi.common.core.controller.BaseController; | ||||
| import com.ruoyi.common.core.domain.AjaxResult; | ||||
| import com.ruoyi.common.enums.BusinessType; | ||||
| import com.ruoyi.abuwx.domain.AbucoderWxuser; | ||||
| import com.ruoyi.abuwx.service.IAbucoderWxuserService; | ||||
| import com.ruoyi.common.utils.poi.ExcelUtil; | ||||
| import com.ruoyi.common.core.domain.entity.AbucoderWxuser; | ||||
| import com.ruoyi.common.core.page.TableDataInfo; | ||||
| import com.ruoyi.common.enums.BusinessType; | ||||
| import com.ruoyi.common.utils.poi.ExcelUtil; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| 
 | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| import java.util.List; | ||||
| 
 | ||||
| /** | ||||
|  * 微信用户Controller | ||||
| @ -37,7 +30,6 @@ public class AbucoderWxuserController extends BaseController | ||||
|     /** | ||||
|      * 查询微信用户列表 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:wxuser:list')") | ||||
|     @GetMapping("/list") | ||||
|     public TableDataInfo list(AbucoderWxuser abucoderWxuser) | ||||
|     { | ||||
| @ -49,7 +41,6 @@ public class AbucoderWxuserController extends BaseController | ||||
|     /** | ||||
|      * 导出微信用户列表 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:wxuser:export')") | ||||
|     @Log(title = "微信用户", businessType = BusinessType.EXPORT) | ||||
|     @PostMapping("/export") | ||||
|     public void export(HttpServletResponse response, AbucoderWxuser abucoderWxuser) | ||||
| @ -62,7 +53,6 @@ public class AbucoderWxuserController extends BaseController | ||||
|     /** | ||||
|      * 获取微信用户详细信息 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:wxuser:query')") | ||||
|     @GetMapping(value = "/{id}") | ||||
|     public AjaxResult getInfo(@PathVariable("id") Long id) | ||||
|     { | ||||
| @ -72,7 +62,6 @@ public class AbucoderWxuserController extends BaseController | ||||
|     /** | ||||
|      * 新增微信用户 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:wxuser:add')") | ||||
|     @Log(title = "微信用户", businessType = BusinessType.INSERT) | ||||
|     @PostMapping | ||||
|     public AjaxResult add(@RequestBody AbucoderWxuser abucoderWxuser) | ||||
| @ -83,7 +72,6 @@ public class AbucoderWxuserController extends BaseController | ||||
|     /** | ||||
|      * 修改微信用户 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:wxuser:edit')") | ||||
|     @Log(title = "微信用户", businessType = BusinessType.UPDATE) | ||||
|     @PutMapping | ||||
|     public AjaxResult edit(@RequestBody AbucoderWxuser abucoderWxuser) | ||||
| @ -94,7 +82,6 @@ public class AbucoderWxuserController extends BaseController | ||||
|     /** | ||||
|      * 删除微信用户 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:wxuser:remove')") | ||||
|     @Log(title = "微信用户", businessType = BusinessType.DELETE) | ||||
| 	@DeleteMapping("/{ids}") | ||||
|     public AjaxResult remove(@PathVariable Long[] ids) | ||||
|  | ||||
| @ -9,7 +9,6 @@ import com.ruoyi.common.core.page.TableDataInfo; | ||||
| import com.ruoyi.common.enums.BusinessType; | ||||
| import com.ruoyi.common.utils.poi.ExcelUtil; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.security.access.prepost.PreAuthorize; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| 
 | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| @ -31,7 +30,6 @@ public class WbMaintenanceInformationController extends BaseController | ||||
|     /** | ||||
|      * 查询维保记录列表 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:information:list')") | ||||
|     @GetMapping("/list") | ||||
|     public TableDataInfo list(WbMaintenanceInformation wbMaintenanceInformation) | ||||
|     { | ||||
| @ -43,7 +41,6 @@ public class WbMaintenanceInformationController extends BaseController | ||||
|     /** | ||||
|      * 导出维保记录列表 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:information:export')") | ||||
|     @Log(title = "维保记录", businessType = BusinessType.EXPORT) | ||||
|     @PostMapping("/export") | ||||
|     public void export(HttpServletResponse response, WbMaintenanceInformation wbMaintenanceInformation) | ||||
| @ -56,7 +53,6 @@ public class WbMaintenanceInformationController extends BaseController | ||||
|     /** | ||||
|      * 获取维保记录详细信息 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:information:query')") | ||||
|     @GetMapping(value = "/{id}") | ||||
|     public AjaxResult getInfo(@PathVariable("id") Long id) | ||||
|     { | ||||
| @ -66,7 +62,6 @@ public class WbMaintenanceInformationController extends BaseController | ||||
|     /** | ||||
|      * 新增维保记录 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:information:add')") | ||||
|     @Log(title = "维保记录", businessType = BusinessType.INSERT) | ||||
|     @PostMapping | ||||
|     public AjaxResult add(@RequestBody WbMaintenanceInformation wbMaintenanceInformation) | ||||
| @ -77,7 +72,6 @@ public class WbMaintenanceInformationController extends BaseController | ||||
|     /** | ||||
|      * 修改维保记录 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:information:edit')") | ||||
|     @Log(title = "维保记录", businessType = BusinessType.UPDATE) | ||||
|     @PutMapping | ||||
|     public AjaxResult edit(@RequestBody WbMaintenanceInformation wbMaintenanceInformation) | ||||
| @ -88,7 +82,6 @@ public class WbMaintenanceInformationController extends BaseController | ||||
|     /** | ||||
|      * 删除维保记录 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:information:remove')") | ||||
|     @Log(title = "维保记录", businessType = BusinessType.DELETE) | ||||
| 	@DeleteMapping("/{ids}") | ||||
|     public AjaxResult remove(@PathVariable Long[] ids) | ||||
|  | ||||
| @ -9,7 +9,6 @@ import com.ruoyi.common.core.page.TableDataInfo; | ||||
| import com.ruoyi.common.enums.BusinessType; | ||||
| import com.ruoyi.common.utils.poi.ExcelUtil; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.security.access.prepost.PreAuthorize; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| 
 | ||||
| import javax.servlet.http.HttpServletResponse; | ||||
| @ -31,7 +30,6 @@ public class WbProjectController extends BaseController | ||||
|     /** | ||||
|      * 查询项目管理列表 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:project:list')") | ||||
|     @GetMapping("/list") | ||||
|     public TableDataInfo list(WbProject wbProject) | ||||
|     { | ||||
| @ -43,7 +41,6 @@ public class WbProjectController extends BaseController | ||||
|     /** | ||||
|      * 导出项目管理列表 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:project:export')") | ||||
|     @Log(title = "项目管理", businessType = BusinessType.EXPORT) | ||||
|     @PostMapping("/export") | ||||
|     public void export(HttpServletResponse response, WbProject wbProject) | ||||
| @ -56,7 +53,6 @@ public class WbProjectController extends BaseController | ||||
|     /** | ||||
|      * 获取项目管理详细信息 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:project:query')") | ||||
|     @GetMapping(value = "/{id}") | ||||
|     public AjaxResult getInfo(@PathVariable("id") Long id) | ||||
|     { | ||||
| @ -66,7 +62,6 @@ public class WbProjectController extends BaseController | ||||
|     /** | ||||
|      * 新增项目管理 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:project:add')") | ||||
|     @Log(title = "项目管理", businessType = BusinessType.INSERT) | ||||
|     @PostMapping | ||||
|     public AjaxResult add(@RequestBody WbProject wbProject) | ||||
| @ -77,7 +72,6 @@ public class WbProjectController extends BaseController | ||||
|     /** | ||||
|      * 修改项目管理 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:project:edit')") | ||||
|     @Log(title = "项目管理", businessType = BusinessType.UPDATE) | ||||
|     @PutMapping | ||||
|     public AjaxResult edit(@RequestBody WbProject wbProject) | ||||
| @ -88,7 +82,6 @@ public class WbProjectController extends BaseController | ||||
|     /** | ||||
|      * 删除项目管理 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('abuwx:project:remove')") | ||||
|     @Log(title = "项目管理", businessType = BusinessType.DELETE) | ||||
| 	@DeleteMapping("/{ids}") | ||||
|     public AjaxResult remove(@PathVariable Long[] ids) | ||||
|  | ||||
| @ -1,5 +1,6 @@ | ||||
| package com.ruoyi.abuwx.domain; | ||||
| 
 | ||||
| import lombok.Data; | ||||
| import org.apache.commons.lang3.builder.ToStringBuilder; | ||||
| import org.apache.commons.lang3.builder.ToStringStyle; | ||||
| import com.ruoyi.common.annotation.Excel; | ||||
| @ -11,6 +12,7 @@ import com.ruoyi.common.core.domain.BaseEntity; | ||||
|  * @author ruoyi | ||||
|  * @date 2024-04-09 | ||||
|  */ | ||||
| @Data | ||||
| public class WbMaintenanceInformation extends BaseEntity | ||||
| { | ||||
|     private static final long serialVersionUID = 1L; | ||||
| @ -26,6 +28,10 @@ public class WbMaintenanceInformation extends BaseEntity | ||||
|     @Excel(name = "项目名称") | ||||
|     private String projectName; | ||||
| 
 | ||||
|     /** 维保类型 */ | ||||
|     @Excel(name = "维保类型") | ||||
|     private String maintenanceType; | ||||
| 
 | ||||
|     /** 图片 */ | ||||
|     @Excel(name = "图片") | ||||
|     private String imageUrl; | ||||
| @ -86,6 +92,7 @@ public class WbMaintenanceInformation extends BaseEntity | ||||
|             .append("id", getId()) | ||||
|             .append("projectId", getProjectId()) | ||||
|             .append("projectName", getProjectName()) | ||||
|             .append("maintenanceType", getMaintenanceType()) | ||||
|             .append("imageUrl", getImageUrl()) | ||||
|             .append("fileUrl", getFileUrl()) | ||||
|             .append("createBy", getCreateBy()) | ||||
|  | ||||
| @ -65,6 +65,11 @@ public class WbProject extends BaseEntity | ||||
|             .append("id", getId()) | ||||
|             .append("projectName", getProjectName()) | ||||
|             .append("projectOverview", getProjectOverview()) | ||||
|             .append("createBy", getCreateBy()) | ||||
|             .append("createTime", getCreateTime()) | ||||
|             .append("updateBy", getUpdateBy()) | ||||
|             .append("updateTime", getUpdateTime()) | ||||
|             .append("remark", getRemark()) | ||||
|             .toString(); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| package com.ruoyi.abuwx.mapper; | ||||
| 
 | ||||
| import com.ruoyi.abuwx.domain.AbucoderWxuser; | ||||
| import com.ruoyi.common.core.domain.entity.AbucoderWxuser; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
|  | ||||
| @ -1,5 +1,6 @@ | ||||
| package com.ruoyi.abuwx.mapper; | ||||
| 
 | ||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||||
| import com.ruoyi.abuwx.domain.WbMaintenanceInformation; | ||||
| 
 | ||||
| import java.util.List; | ||||
| @ -10,7 +11,7 @@ import java.util.List; | ||||
|  * @author ruoyi | ||||
|  * @date 2024-04-09 | ||||
|  */ | ||||
| public interface WbMaintenanceInformationMapper | ||||
| public interface WbMaintenanceInformationMapper extends BaseMapper<WbMaintenanceInformation> | ||||
| { | ||||
|     /** | ||||
|      * 查询维保记录 | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| package com.ruoyi.abuwx.service; | ||||
| 
 | ||||
| import com.ruoyi.abuwx.domain.AbucoderWxuser; | ||||
| import com.ruoyi.common.core.domain.entity.AbucoderWxuser; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
|  | ||||
| @ -1,5 +1,6 @@ | ||||
| package com.ruoyi.abuwx.service; | ||||
| 
 | ||||
| import com.baomidou.mybatisplus.extension.service.IService; | ||||
| import com.ruoyi.abuwx.domain.WbMaintenanceInformation; | ||||
| 
 | ||||
| import java.util.List; | ||||
| @ -10,7 +11,7 @@ import java.util.List; | ||||
|  * @author ruoyi | ||||
|  * @date 2024-04-09 | ||||
|  */ | ||||
| public interface IWbMaintenanceInformationService | ||||
| public interface IWbMaintenanceInformationService extends IService<WbMaintenanceInformation> | ||||
| { | ||||
|     /** | ||||
|      * 查询维保记录 | ||||
| @ -59,4 +60,12 @@ public interface IWbMaintenanceInformationService | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     public int deleteWbMaintenanceInformationById(Long id); | ||||
| 
 | ||||
|     /** | ||||
|      * 根据项目id查询维保记录列表 | ||||
|      * | ||||
|      * @param projectId 项目id | ||||
|      * @return 维保记录集合 | ||||
|      */ | ||||
|     public List<WbMaintenanceInformation> selectWbMaintenanceInformationListByProjectId(Long projectId); | ||||
| } | ||||
|  | ||||
| @ -1,12 +1,13 @@ | ||||
| package com.ruoyi.abuwx.service.impl; | ||||
| 
 | ||||
| import java.util.List; | ||||
| import com.ruoyi.abuwx.mapper.AbucoderWxuserMapper; | ||||
| import com.ruoyi.abuwx.service.IAbucoderWxuserService; | ||||
| import com.ruoyi.common.core.domain.entity.AbucoderWxuser; | ||||
| import com.ruoyi.common.utils.DateUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| import com.ruoyi.abuwx.mapper.AbucoderWxuserMapper; | ||||
| import com.ruoyi.abuwx.domain.AbucoderWxuser; | ||||
| import com.ruoyi.abuwx.service.IAbucoderWxuserService; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| /** | ||||
|  * 微信用户Service业务层处理 | ||||
|  | ||||
| @ -1,5 +1,6 @@ | ||||
| package com.ruoyi.abuwx.service.impl; | ||||
| 
 | ||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||
| import com.ruoyi.abuwx.domain.WbMaintenanceInformation; | ||||
| import com.ruoyi.abuwx.mapper.WbMaintenanceInformationMapper; | ||||
| import com.ruoyi.abuwx.service.IWbMaintenanceInformationService; | ||||
| @ -8,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| 
 | ||||
| import java.util.List; | ||||
| import java.util.stream.Collectors; | ||||
| 
 | ||||
| /** | ||||
|  * 维保记录Service业务层处理 | ||||
| @ -16,11 +18,15 @@ import java.util.List; | ||||
|  * @date 2024-04-09 | ||||
|  */ | ||||
| @Service | ||||
| public class WbMaintenanceInformationServiceImpl implements IWbMaintenanceInformationService | ||||
| public class WbMaintenanceInformationServiceImpl extends ServiceImpl<WbMaintenanceInformationMapper, WbMaintenanceInformation> | ||||
|         implements IWbMaintenanceInformationService | ||||
| { | ||||
|     @Autowired | ||||
|     private WbMaintenanceInformationMapper wbMaintenanceInformationMapper; | ||||
| 
 | ||||
|     @Autowired | ||||
|     private IWbMaintenanceInformationService iWbMaintenanceInformationService; | ||||
| 
 | ||||
|     /** | ||||
|      * 查询维保记录 | ||||
|      * | ||||
| @ -94,4 +100,18 @@ public class WbMaintenanceInformationServiceImpl implements IWbMaintenanceInform | ||||
|     { | ||||
|         return wbMaintenanceInformationMapper.deleteWbMaintenanceInformationById(id); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 根据项目id查询维保记录列表 | ||||
|      * | ||||
|      * @param projectId 项目id | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     @Override | ||||
|     public List<WbMaintenanceInformation> selectWbMaintenanceInformationListByProjectId(Long projectId) { | ||||
|         List<WbMaintenanceInformation> list = iWbMaintenanceInformationService.list(); | ||||
|         List<WbMaintenanceInformation> collect = list.stream().filter(data -> data.getProjectId() != null | ||||
|                 && data.getProjectId().equals(projectId)).collect(Collectors.toList()); | ||||
|         return collect; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -3,6 +3,7 @@ package com.ruoyi.abuwx.service.impl; | ||||
| import com.ruoyi.abuwx.domain.WbProject; | ||||
| import com.ruoyi.abuwx.mapper.WbProjectMapper; | ||||
| import com.ruoyi.abuwx.service.IWbProjectService; | ||||
| import com.ruoyi.common.utils.DateUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| 
 | ||||
| @ -53,6 +54,7 @@ public class WbProjectServiceImpl implements IWbProjectService | ||||
|     @Override | ||||
|     public int insertWbProject(WbProject wbProject) | ||||
|     { | ||||
|         wbProject.setCreateTime(DateUtils.getNowDate()); | ||||
|         return wbProjectMapper.insertWbProject(wbProject); | ||||
|     } | ||||
| 
 | ||||
| @ -65,6 +67,7 @@ public class WbProjectServiceImpl implements IWbProjectService | ||||
|     @Override | ||||
|     public int updateWbProject(WbProject wbProject) | ||||
|     { | ||||
|         wbProject.setUpdateTime(DateUtils.getNowDate()); | ||||
|         return wbProjectMapper.updateWbProject(wbProject); | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -3,24 +3,42 @@ package com.ruoyi.abuwxapi; | ||||
| import cn.hutool.core.util.StrUtil; | ||||
| import com.alibaba.fastjson2.JSON; | ||||
| import com.alibaba.fastjson2.JSONObject; | ||||
| import com.ruoyi.abuwx.domain.AbucoderWxuser; | ||||
| import com.ruoyi.abuwx.domain.WbMaintenanceInformation; | ||||
| import com.ruoyi.abuwx.domain.WbProject; | ||||
| import com.ruoyi.abuwx.service.IAbucoderWxappConfigService; | ||||
| import com.ruoyi.abuwx.service.IAbucoderWxuserService; | ||||
| import com.ruoyi.abuwx.service.IWbMaintenanceInformationService; | ||||
| import com.ruoyi.abuwx.service.IWbProjectService; | ||||
| import com.ruoyi.common.config.RuoYiConfig; | ||||
| import com.ruoyi.common.constant.HttpStatus; | ||||
| import com.ruoyi.common.core.controller.BaseController; | ||||
| import com.ruoyi.common.core.domain.AjaxResult; | ||||
| import com.ruoyi.common.core.domain.entity.AbucoderWxuser; | ||||
| import com.ruoyi.common.core.domain.entity.SysRole; | ||||
| import com.ruoyi.common.core.domain.entity.SysUser; | ||||
| import com.ruoyi.common.core.domain.model.LoginUser; | ||||
| import com.ruoyi.common.core.page.TableDataInfo; | ||||
| import com.ruoyi.common.utils.DateUtils; | ||||
| import com.ruoyi.common.utils.SecurityUtils; | ||||
| import com.ruoyi.common.utils.file.FileUploadUtils; | ||||
| import com.ruoyi.common.utils.file.FileUtils; | ||||
| import com.ruoyi.common.utils.http.HttpUtils; | ||||
| import com.ruoyi.framework.config.ServerConfig; | ||||
| import com.ruoyi.framework.web.service.TokenService; | ||||
| import com.ruoyi.system.mapper.SysUserMapper; | ||||
| import com.ruoyi.system.service.ISysUserService; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.util.StringUtils; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| import org.springframework.web.multipart.MultipartFile; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import java.util.stream.Collectors; | ||||
| 
 | ||||
| @RestController | ||||
| @RequestMapping("/wxapi/") | ||||
| public class WxLoginController { | ||||
| public class WxLoginController extends BaseController { | ||||
| 
 | ||||
|     /** | ||||
|      * 测试接口 | ||||
| @ -28,7 +46,7 @@ public class WxLoginController { | ||||
|      */ | ||||
|     @GetMapping("test") | ||||
|     public AjaxResult test(){ | ||||
|         return AjaxResult.success("小程序api调试成功!~"); | ||||
|         return success("小程序api调试成功!~"); | ||||
|     } | ||||
| 
 | ||||
|     @Autowired | ||||
| @ -40,15 +58,29 @@ public class WxLoginController { | ||||
|     @Autowired | ||||
|     private ServerConfig serverConfig; | ||||
| 
 | ||||
|     @Autowired | ||||
|     private TokenService tokenService; | ||||
| 
 | ||||
|     @Autowired | ||||
|     private IWbMaintenanceInformationService wbMaintenanceInformationService; | ||||
| 
 | ||||
|     @Autowired | ||||
|     private ISysUserService iSysUserService; | ||||
| 
 | ||||
|     @Autowired | ||||
|     private SysUserMapper userMapper; | ||||
| 
 | ||||
|     @Autowired | ||||
|     private IWbProjectService iWbProjectService; | ||||
|     /** | ||||
|      * 你自己的微信小程序APPID | ||||
|      */ | ||||
| 
 | ||||
|     private final static String AppID = "wxeda4365eac6838c5"; | ||||
|     private final static String AppID = "wxd193ba95e7ce382b"; | ||||
|     /** | ||||
|      * 你自己的微信APP密钥 | ||||
|      */ | ||||
|     private final static String AppSecret = "5005219596b2fa77ad930d06101102b1"; | ||||
|     private final static String AppSecret = "7ba02f4a9abb58dc2862f8a2762e8b85"; | ||||
| 
 | ||||
|     /** | ||||
|      * 登录时获取的 code(微信官方提供的临时凭证) | ||||
| @ -73,22 +105,21 @@ public class WxLoginController { | ||||
|         JSONObject jsonObject = JSON.parseObject(res); | ||||
|         String openid = (String) jsonObject.get("openid"); | ||||
|         if (StrUtil.isEmpty(openid)) { | ||||
|             return AjaxResult.error("未获取到openid"); | ||||
|             return error("未获取到openid"); | ||||
|         } | ||||
|         /**先通过openid来查询是否存在*/ | ||||
|         AbucoderWxuser abucoderWxuser = iAbucoderWxuserService.selectAbucoderWxuserOpenID(openid); | ||||
|         if (abucoderWxuser == null){ | ||||
|             /**如果不存在就插入到我们的数据库里*/ | ||||
|             AbucoderWxuser  wxuser = new AbucoderWxuser(); | ||||
|             wxuser.setOpenid(openid); | ||||
|             wxuser.setCreateTime(DateUtils.getNowDate()); | ||||
|             iAbucoderWxuserService.insertAbucoderWxuser(wxuser); | ||||
|             abucoderWxuser = new AbucoderWxuser(); | ||||
|             abucoderWxuser.setOpenid(openid); | ||||
|             abucoderWxuser.setCreateTime(DateUtils.getNowDate()); | ||||
|             iAbucoderWxuserService.insertAbucoderWxuser(abucoderWxuser); | ||||
|             /**返回结果集到前段*/ | ||||
|            return AjaxResult.success(wxuser); | ||||
|         }else { | ||||
|             /**返回结果集到前段*/ | ||||
|             return AjaxResult.success(abucoderWxuser); | ||||
| 
 | ||||
|         } | ||||
|         return success(abucoderWxuser).put("token", getToken(abucoderWxuser)); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     @PostMapping("/upload") | ||||
| @ -103,7 +134,7 @@ public class WxLoginController { | ||||
|             // 上传并返回新文件名称 | ||||
|             String fileName = FileUploadUtils.upload(filePath, file); | ||||
|             String url = serverConfig.getUrl() + fileName; | ||||
|             AjaxResult ajax = AjaxResult.success(); | ||||
|             AjaxResult ajax = success(); | ||||
|             ajax.put("url", url); | ||||
|             ajax.put("fileName", fileName); | ||||
|             ajax.put("newFileName", FileUtils.getName(fileName)); | ||||
| @ -112,7 +143,7 @@ public class WxLoginController { | ||||
|         } | ||||
|         catch (Exception e) | ||||
|         { | ||||
|             return AjaxResult.error(e.getMessage()); | ||||
|             return error(e.getMessage()); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| @ -136,6 +167,102 @@ public class WxLoginController { | ||||
|         abucoderWxuser.setUpdateTime(DateUtils.getNowDate()); | ||||
|         iAbucoderWxuserService.updateAbucoderWxuser(abucoderWxuser); | ||||
|         //返回前段需要的数据 | ||||
|         return AjaxResult.success(abucoderWxuser); | ||||
|         return success(abucoderWxuser); | ||||
|     } | ||||
| 
 | ||||
|     private String getToken(AbucoderWxuser wxuser){ | ||||
|         LoginUser loginUser = new LoginUser(); | ||||
|         loginUser.setWxuser(wxuser); | ||||
|         return tokenService.createToken(loginUser); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * | ||||
|      * | ||||
|      * 根据项目id获取维保记录列表 | ||||
|      */ | ||||
|     @RequestMapping("/informationList") | ||||
|     public AjaxResult getInformationList(@RequestParam Long projectId) | ||||
|     { | ||||
|         return success(wbMaintenanceInformationService.selectWbMaintenanceInformationListByProjectId(projectId)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 获取维保记录详细信息 | ||||
|      */ | ||||
|     @RequestMapping(value = "/infoId") | ||||
|     public AjaxResult getInformation(@RequestParam Long id) | ||||
|     { | ||||
|         return success(wbMaintenanceInformationService.selectWbMaintenanceInformationById(id)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 绑定维保用户 | ||||
|      */ | ||||
|     @PostMapping("/bindWbuser") | ||||
|     public AjaxResult bindWbuser(@RequestBody SysUser sysUser){ | ||||
|         String username = sysUser.getUserName(); | ||||
|         String password = sysUser.getPassword(); | ||||
|         String openid = sysUser.getOpenid(); | ||||
|         //校验传递的用户名、密码、openid都不为空 | ||||
|         if(StringUtils.isEmpty(username) || StringUtils.isEmpty(password) || StringUtils.isEmpty(openid)){ | ||||
|             return error(); | ||||
|         } | ||||
|         //根据传递的用户名获取用户信息 | ||||
|         SysUser user = iSysUserService.selectUserByUserName(username); | ||||
|         if(user == null){ | ||||
|             return error("账号或密码错误!"); | ||||
|         } | ||||
|         if(!StringUtils.isEmpty(user.getOpenid())){ | ||||
|             return error("账号已绑定!"); | ||||
|         } | ||||
|         //校验密码是否正确 | ||||
|         boolean b = SecurityUtils.matchesPassword(user.getPassword(), password); | ||||
|         if (!SecurityUtils.matchesPassword(user.getPassword(), password)) { | ||||
|             user.setOpenid(openid); | ||||
|             userMapper.updateUser(user); | ||||
|         } | ||||
|         return success(user); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 新增维保记录 | ||||
|      */ | ||||
|     @PostMapping("/addWbMaintenanceInformation") | ||||
|     public AjaxResult addWbMaintenanceInformation(@RequestBody WbMaintenanceInformation wbMaintenanceInformation) | ||||
|     { | ||||
|         return success(wbMaintenanceInformationService.insertWbMaintenanceInformation(wbMaintenanceInformation)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 根据openid查询当前微信用户角色 | ||||
|      */ | ||||
|     @RequestMapping("/selectWXuserRole") | ||||
|     public AjaxResult selectWXuserRole(@RequestParam String openid){ | ||||
|         //获取当前用户信息 | ||||
|         SysUser user = iSysUserService.selectUserByopenid(openid); | ||||
|         if(user == null){ | ||||
|             //return success("roleIds",0); | ||||
|             List<Object> data = new ArrayList<>(); | ||||
|             data.add(0); | ||||
|             return new AjaxResult(HttpStatus.SUCCESS,"roleIds",data); | ||||
|         } | ||||
|         SysUser newUser = iSysUserService.selectUserById(user.getUserId()); | ||||
| //        List<SysRole> roles = user.getRoles(); | ||||
| //        List<Long> collect = roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()); | ||||
| //        return  success("roleIds",collect); | ||||
|         //return success("roleIds", newUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); | ||||
|         return new AjaxResult(HttpStatus.SUCCESS,"roleIds", newUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 小程序分页查询查询项目管理列表 | ||||
|      */ | ||||
|     @GetMapping("/projectList") | ||||
|     public TableDataInfo list(WbProject wbProject) | ||||
|     { | ||||
|         startPage(); | ||||
|         List<WbProject> list = iWbProjectService.selectWbProjectList(wbProject); | ||||
|         return getDataTable(list); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|         <result property="id"    column="id"    /> | ||||
|         <result property="projectId"    column="project_id"    /> | ||||
|         <result property="projectName"    column="project_name"    /> | ||||
|         <result property="maintenanceType"    column="maintenance_type"    /> | ||||
|         <result property="imageUrl"    column="image_url"    /> | ||||
|         <result property="fileUrl"    column="file_url"    /> | ||||
|         <result property="createBy"    column="create_by"    /> | ||||
| @ -18,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|     </resultMap> | ||||
| 
 | ||||
|     <sql id="selectWbMaintenanceInformationVo"> | ||||
|         select id, project_id, project_name, image_url, file_url, create_by, create_time, update_by, update_time, remark from wb_maintenance_information | ||||
|         select id, project_id, project_name, maintenance_type, image_url, file_url, create_by, create_time, update_by, update_time, remark from wb_maintenance_information | ||||
|     </sql> | ||||
| 
 | ||||
|     <select id="selectWbMaintenanceInformationList" parameterType="WbMaintenanceInformation" resultMap="WbMaintenanceInformationResult"> | ||||
| @ -26,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|         <where> | ||||
|             <if test="projectId != null "> and project_id = #{projectId}</if> | ||||
|             <if test="projectName != null  and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if> | ||||
|             <if test="maintenanceType != null  and maintenanceType != ''"> and maintenance_type = #{maintenanceType}</if> | ||||
|             <if test="imageUrl != null  and imageUrl != ''"> and image_url = #{imageUrl}</if> | ||||
|             <if test="fileUrl != null  and fileUrl != ''"> and file_url = #{fileUrl}</if> | ||||
|         </where> | ||||
| @ -41,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|         <trim prefix="(" suffix=")" suffixOverrides=","> | ||||
|             <if test="projectId != null">project_id,</if> | ||||
|             <if test="projectName != null">project_name,</if> | ||||
|             <if test="maintenanceType != null">maintenance_type,</if> | ||||
|             <if test="imageUrl != null">image_url,</if> | ||||
|             <if test="fileUrl != null">file_url,</if> | ||||
|             <if test="createBy != null">create_by,</if> | ||||
| @ -52,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|         <trim prefix="values (" suffix=")" suffixOverrides=","> | ||||
|             <if test="projectId != null">#{projectId},</if> | ||||
|             <if test="projectName != null">#{projectName},</if> | ||||
|             <if test="maintenanceType != null">#{maintenanceType},</if> | ||||
|             <if test="imageUrl != null">#{imageUrl},</if> | ||||
|             <if test="fileUrl != null">#{fileUrl},</if> | ||||
|             <if test="createBy != null">#{createBy},</if> | ||||
| @ -67,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|         <trim prefix="SET" suffixOverrides=","> | ||||
|             <if test="projectId != null">project_id = #{projectId},</if> | ||||
|             <if test="projectName != null">project_name = #{projectName},</if> | ||||
|             <if test="maintenanceType != null">maintenance_type = #{maintenanceType},</if> | ||||
|             <if test="imageUrl != null">image_url = #{imageUrl},</if> | ||||
|             <if test="fileUrl != null">file_url = #{fileUrl},</if> | ||||
|             <if test="createBy != null">create_by = #{createBy},</if> | ||||
|  | ||||
| @ -9,10 +9,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|         <result property="projectName"    column="project_name"    /> | ||||
|         <result property="projectOverview"    column="project_overview"    /> | ||||
|         <result property="fileUrl"    column="file_url"    /> | ||||
|         <result property="createBy"    column="create_by"    /> | ||||
|         <result property="createTime"    column="create_time"    /> | ||||
|         <result property="updateBy"    column="update_by"    /> | ||||
|         <result property="updateTime"    column="update_time"    /> | ||||
|         <result property="remark"    column="remark"    /> | ||||
|     </resultMap> | ||||
| 
 | ||||
|     <sql id="selectWbProjectVo"> | ||||
|         select id, project_name, project_overview, file_url from wb_project | ||||
|         select id, project_name, project_overview, file_url, create_by, create_time, update_by, update_time, remark from wb_project | ||||
|     </sql> | ||||
| 
 | ||||
|     <select id="selectWbProjectList" parameterType="WbProject" resultMap="WbProjectResult"> | ||||
| @ -35,11 +40,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|             <if test="projectName != null">project_name,</if> | ||||
|             <if test="projectOverview != null">project_overview,</if> | ||||
|             <if test="fileUrl != null">file_url,</if> | ||||
|             <if test="createBy != null">create_by,</if> | ||||
|             <if test="createTime != null">create_time,</if> | ||||
|             <if test="updateBy != null">update_by,</if> | ||||
|             <if test="updateTime != null">update_time,</if> | ||||
|             <if test="remark != null">remark,</if> | ||||
|          </trim> | ||||
|         <trim prefix="values (" suffix=")" suffixOverrides=","> | ||||
|             <if test="projectName != null">#{projectName},</if> | ||||
|             <if test="projectOverview != null">#{projectOverview},</if> | ||||
|             <if test="fileUrl != null">#{fileUrl},</if> | ||||
|             <if test="createBy != null">#{createBy},</if> | ||||
|             <if test="createTime != null">#{createTime},</if> | ||||
|             <if test="updateBy != null">#{updateBy},</if> | ||||
|             <if test="updateTime != null">#{updateTime},</if> | ||||
|             <if test="remark != null">#{remark},</if> | ||||
|          </trim> | ||||
|     </insert> | ||||
| 
 | ||||
| @ -49,6 +64,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|             <if test="projectName != null">project_name = #{projectName},</if> | ||||
|             <if test="projectOverview != null">project_overview = #{projectOverview},</if> | ||||
|             <if test="fileUrl != null">file_url = #{fileUrl},</if> | ||||
|             <if test="createBy != null">create_by = #{createBy},</if> | ||||
|             <if test="createTime != null">create_time = #{createTime},</if> | ||||
|             <if test="updateBy != null">update_by = #{updateBy},</if> | ||||
|             <if test="updateTime != null">update_time = #{updateTime},</if> | ||||
|             <if test="remark != null">remark = #{remark},</if> | ||||
|         </trim> | ||||
|         where id = #{id} | ||||
|     </update> | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| package com.ruoyi.abuwx.domain; | ||||
| package com.ruoyi.common.core.domain.entity; | ||||
| 
 | ||||
| import org.apache.commons.lang3.builder.ToStringBuilder; | ||||
| import org.apache.commons.lang3.builder.ToStringStyle; | ||||
| @ -1,9 +1,11 @@ | ||||
| package com.ruoyi.common.core.domain.model; | ||||
| 
 | ||||
| import com.alibaba.fastjson2.annotation.JSONField; | ||||
| import com.ruoyi.common.core.domain.entity.AbucoderWxuser; | ||||
| import com.ruoyi.common.core.domain.entity.SysUser; | ||||
| import org.springframework.security.core.GrantedAuthority; | ||||
| import org.springframework.security.core.userdetails.UserDetails; | ||||
| 
 | ||||
| import java.util.Collection; | ||||
| import java.util.Set; | ||||
| 
 | ||||
| @ -71,6 +73,11 @@ public class LoginUser implements UserDetails | ||||
|      */ | ||||
|     private SysUser user; | ||||
| 
 | ||||
|     /** | ||||
|      * 微信登录信息 | ||||
|      */ | ||||
|     private AbucoderWxuser wxuser; | ||||
| 
 | ||||
|     public LoginUser() | ||||
|     { | ||||
|     } | ||||
| @ -129,6 +136,9 @@ public class LoginUser implements UserDetails | ||||
|     @Override | ||||
|     public String getUsername() | ||||
|     { | ||||
|         if(wxuser!=null){ | ||||
|             return wxuser.getOpenid(); | ||||
|         } | ||||
|         return user.getUserName(); | ||||
|     } | ||||
| 
 | ||||
| @ -258,6 +268,14 @@ public class LoginUser implements UserDetails | ||||
|         this.user = user; | ||||
|     } | ||||
| 
 | ||||
|     public AbucoderWxuser getWxuser() { | ||||
|         return wxuser; | ||||
|     } | ||||
| 
 | ||||
|     public void setWxuser(AbucoderWxuser wxuser) { | ||||
|         this.wxuser = wxuser; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public Collection<? extends GrantedAuthority> getAuthorities() | ||||
|     { | ||||
|  | ||||
| @ -1,14 +1,5 @@ | ||||
| package com.ruoyi.framework.web.service; | ||||
| 
 | ||||
| import java.util.HashMap; | ||||
| import java.util.Map; | ||||
| import java.util.concurrent.TimeUnit; | ||||
| import javax.servlet.http.HttpServletRequest; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.beans.factory.annotation.Value; | ||||
| import org.springframework.stereotype.Component; | ||||
| import com.ruoyi.common.constant.CacheConstants; | ||||
| import com.ruoyi.common.constant.Constants; | ||||
| import com.ruoyi.common.core.domain.model.LoginUser; | ||||
| @ -22,6 +13,16 @@ import eu.bitwalker.useragentutils.UserAgent; | ||||
| import io.jsonwebtoken.Claims; | ||||
| import io.jsonwebtoken.Jwts; | ||||
| import io.jsonwebtoken.SignatureAlgorithm; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.beans.factory.annotation.Value; | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import javax.servlet.http.HttpServletRequest; | ||||
| import java.util.HashMap; | ||||
| import java.util.Map; | ||||
| import java.util.concurrent.TimeUnit; | ||||
| 
 | ||||
| /** | ||||
|  * token验证处理 | ||||
|  | ||||
| @ -1,8 +1,9 @@ | ||||
| package com.ruoyi.system.mapper; | ||||
| 
 | ||||
| import java.util.List; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
| import com.ruoyi.common.core.domain.entity.SysUser; | ||||
| import org.apache.ibatis.annotations.Param; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| /** | ||||
|  * 用户表 数据层 | ||||
| @ -11,6 +12,12 @@ import com.ruoyi.common.core.domain.entity.SysUser; | ||||
|  */ | ||||
| public interface SysUserMapper | ||||
| { | ||||
|     /** | ||||
|      *查询用户列表 | ||||
|      * @return | ||||
|      */ | ||||
|     public List<SysUser> selectList(); | ||||
| 
 | ||||
|     /** | ||||
|      * 根据条件分页查询用户列表 | ||||
|      * | ||||
|  | ||||
| @ -1,8 +1,9 @@ | ||||
| package com.ruoyi.system.service; | ||||
| 
 | ||||
| import java.util.List; | ||||
| import com.ruoyi.common.core.domain.entity.SysUser; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| /** | ||||
|  * 用户 业务层 | ||||
|  * | ||||
| @ -203,4 +204,16 @@ public interface ISysUserService | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName); | ||||
| 
 | ||||
|     /** | ||||
|      * 根据openid获取用户信息 | ||||
|      * @return | ||||
|      */ | ||||
|     public SysUser selectUserByopenid(String openid); | ||||
| 
 | ||||
|     /** | ||||
|      * 获取用户信息列表 | ||||
|      * @return | ||||
|      */ | ||||
|     public List<SysUser> selectList(); | ||||
| } | ||||
|  | ||||
| @ -1,15 +1,5 @@ | ||||
| package com.ruoyi.system.service.impl; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import java.util.stream.Collectors; | ||||
| import javax.validation.Validator; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | ||||
| import org.springframework.util.CollectionUtils; | ||||
| import com.ruoyi.common.annotation.DataScope; | ||||
| import com.ruoyi.common.constant.UserConstants; | ||||
| import com.ruoyi.common.core.domain.entity.SysRole; | ||||
| @ -22,13 +12,20 @@ import com.ruoyi.common.utils.spring.SpringUtils; | ||||
| import com.ruoyi.system.domain.SysPost; | ||||
| import com.ruoyi.system.domain.SysUserPost; | ||||
| import com.ruoyi.system.domain.SysUserRole; | ||||
| import com.ruoyi.system.mapper.SysPostMapper; | ||||
| import com.ruoyi.system.mapper.SysRoleMapper; | ||||
| import com.ruoyi.system.mapper.SysUserMapper; | ||||
| import com.ruoyi.system.mapper.SysUserPostMapper; | ||||
| import com.ruoyi.system.mapper.SysUserRoleMapper; | ||||
| import com.ruoyi.system.mapper.*; | ||||
| import com.ruoyi.system.service.ISysConfigService; | ||||
| import com.ruoyi.system.service.ISysUserService; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | ||||
| import org.springframework.util.CollectionUtils; | ||||
| 
 | ||||
| import javax.validation.Validator; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| import java.util.stream.Collectors; | ||||
| 
 | ||||
| /** | ||||
|  * 用户 业务层处理 | ||||
| @ -61,6 +58,9 @@ public class SysUserServiceImpl implements ISysUserService | ||||
|     @Autowired | ||||
|     protected Validator validator; | ||||
| 
 | ||||
|     @Autowired | ||||
|     private  ISysUserService iSysUserService; | ||||
| 
 | ||||
|     /** | ||||
|      * 根据条件分页查询用户列表 | ||||
|      * | ||||
| @ -541,4 +541,31 @@ public class SysUserServiceImpl implements ISysUserService | ||||
|         } | ||||
|         return successMsg.toString(); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 根据openid获取用户信息 | ||||
|      * @param openid | ||||
|      * @return | ||||
|      */ | ||||
|     @Override | ||||
|     public SysUser selectUserByopenid(String openid) { | ||||
|         List<SysUser> userList = iSysUserService.selectList(); | ||||
|         List<SysUser> collect = userList.stream().filter(data -> data.getOpenid() != null && data.getOpenid().equals(openid)).collect(Collectors.toList()); | ||||
|         if(collect.size() > 0){ | ||||
|             SysUser user = collect.get(0); | ||||
|             return user; | ||||
|         }else { | ||||
|             return null; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 获取用户列表 | ||||
|      * @return | ||||
|      */ | ||||
|     @Override | ||||
|     public List<SysUser> selectList() { | ||||
|         List<SysUser> userList = userMapper.selectList(); | ||||
|         return userList; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -143,6 +143,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
| 		select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1 | ||||
| 	</select> | ||||
| 
 | ||||
| 	<select id="selectList" resultType="com.ruoyi.common.core.domain.entity.SysUser"> | ||||
| 		select * from sys_user | ||||
| 	</select> | ||||
| 
 | ||||
| 	<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId"> | ||||
|  		insert into sys_user( | ||||
|  			<if test="userId != null and userId != 0">user_id,</if> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user