注册功能和实名验证功能测试完毕,实名认证还需要定时获取百度智能云的key。

This commit is contained in:
haotianmingyue 2024-10-24 15:53:36 +08:00
parent 0933625913
commit ec8facc3b7
15 changed files with 868 additions and 22 deletions

View File

@ -23,6 +23,8 @@ import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.web.service.SysLoginService;
import com.ruoyi.framework.web.service.SysRegisterService;
//import com.ruoyi.system.domain.UserWork;
import com.ruoyi.system.domain.UserWork;
import com.ruoyi.system.domain.dto.*;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.IUserInfoService;
@ -32,6 +34,7 @@ import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.web.controller.app.baidu.GsonUtils;
import com.ruoyi.web.controller.app.baidu.OcrIdCardBAI;
import com.ruoyi.web.controller.common.CaptchaController;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -148,6 +151,29 @@ public class AppSystemController {
}
//更新密码根据旧密码来更新密码
@PutMapping("/updatePassword")
public AjaxResult updatePassword(@RequestBody UpdatePwdDto updatepwdDto){
String oldPassword = updatepwdDto.getOldPassword();
String newPassword = updatepwdDto.getNewPassword();
String phone = updatepwdDto.getPhone();
SysUser sysUser = sysUserService.selectUserByUserName(phone);
String truePassword = sysUser.getPassword();
if (!SecurityUtils.matchesPassword(oldPassword, truePassword))
{
return error("旧密码错误");
}
if (sysUserService.resetUserPwd(phone, SecurityUtils.encryptPassword(newPassword)) > 0)
{
return success();
}
return error("修改密码异常,请联系管理员");
}
//更新密码
@PutMapping("/updatePwd")
public AjaxResult updatePwd(@RequestBody UpdatePwdDto updatepwdDto)
@ -253,7 +279,9 @@ public class AppSystemController {
}
//-----------------------------实名认证---------------------------------
@PostMapping("/realNameAuthentication")
public AjaxResult realNameAuthentication(@RequestParam("realNameAuthenticationDto") String realNameAuthenticationDtoString
public AjaxResult realNameAuthentication(
@RequestParam("realNameAuthenticationDto") String realNameAuthenticationDtoString
// ,@RequestParam("realNameAuthenticationDto")
,@RequestParam("cardFront") MultipartFile cardFront
,@RequestParam("cardBack") MultipartFile cardBack)
{
@ -332,13 +360,15 @@ public class AppSystemController {
int back = userInfoService.updateUserInfo(userInfo);
if(back==0){
return error("更新用户信息失败");
return error("实名认证失败");
}
else{
return success("实名认证成功");
}
}
// return error("实名认证失败,请再次重试");
}
// 获取用户个人信息
@GetMapping("/getUserInfo/{phone}")
@ -353,9 +383,11 @@ public class AppSystemController {
UserInfo userInfo = userInfoService.selectUserInfoByUserId(sysUserService.selectUserByUserName(phone).getUserId());
String nickName = sysUser.getNickName();
String signature = userInfo.getSignature();
String avatar = sysUser.getAvatar();
AjaxResult ajax = success();
ajax.put("nickName",nickName);
ajax.put("signature",signature);
ajax.put("avatar",avatar);
return ajax;
}
@ -367,10 +399,6 @@ public class AppSystemController {
String signature = updateNickSignDto.getSignature();
System.out.println(username+nickName+signature);
// SysUser sysUser = new SysUser();
// sysUser.setUserName(username);
// sysUser.setNickName(nickName);
boolean f1 = sysUserService.updateNickName(username,nickName);
boolean f2 = userInfoService.updateSignature(username, signature);
@ -378,9 +406,48 @@ public class AppSystemController {
return error("更新昵称和介绍失败");
}
return AjaxResult.success();
}
@PostMapping("/createWork")
public AjaxResult createWork(@RequestParam("userWorkDto") String userWorkDto
,@RequestParam("userWorkFile") MultipartFile userWorkFile)
{
Long userId = SecurityUtils.getUserId();
UserWork userWork = GsonUtils.fromJson(userWorkDto, UserWork.class);
// String workName = userWork.getWorkName();
System.out.println(userWork);
return AjaxResult.success();
}
@GetMapping("/logOut")
public AjaxResult logOut(@RequestHeader(value = "Authorization", required = false) String authHeader)
{
// System.out.println(authHeader);
// String username = SecurityUtils.getAuthentication().getCredentials().toString();
// System.out.println(username);
// 使用indexOf找到空格的位置
int spaceIndex = authHeader.indexOf(" ");
// 检查是否找到了空格
if (spaceIndex != -1) {
// 提取空格后面的字符串
String token = authHeader.substring(spaceIndex + 1);
// 打印结果
System.out.println(token);
if (StringUtils.isNotEmpty(token))
{
tokenService.delLoginUser(token);
}
return AjaxResult.success("退出成功");
} else {
// 如果没有找到空格打印原始字符串或处理错误
System.out.println("No space found in the input string.");
return error("退出失败");
}
}
}

View File

@ -7,14 +7,14 @@ import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.model.AppRegisterUser;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.google.code.kaptcha.Producer;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.CacheConstants;
@ -25,6 +25,9 @@ import com.ruoyi.common.utils.sign.Base64;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.service.ISysConfigService;
import static com.ruoyi.common.core.domain.AjaxResult.error;
import static com.ruoyi.common.core.domain.AjaxResult.success;
/**
* 验证码操作处理
*
@ -117,9 +120,43 @@ public class CaptchaController {
// }
// 保存验证码信息
// String uuid = IdUtils.simpleUUID();
//发送验证码
sendCacheCode(phone);
return AjaxResult.success(phone);
}
@PostMapping("/registerCheckPhone")
public AjaxResult registerCheckPhone(@RequestBody AppRegisterUser user){
String username = user.getUsername();
int i = sysUserService.checkUserPhone(username);
if (i > 0) {
return error("该手机号已经注册");
}
else{
sendCacheCode(username);
return success("验证码已发送");
}
}
@PostMapping("/verifyRegisterSms")
public AjaxResult verifyRegisterSMS(@RequestBody AppRegisterUser user) {
String username = user.getUsername();
String code = user.getCode();
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(username, "");
String captcha = redisCache.getCacheObject(verifyKey);
// String backCode = redisCache.getCacheObject(username);
if (captcha == null) {
return error("验证码已过期");
}
else if (!code.equalsIgnoreCase(captcha)){
return error("验证码错误");
}
else{
redisCache.deleteObject(verifyKey);
return success("验证码正确");
}
// return success("验证码正确");
}
// @GetMapping("/appUpdatePasswordCaptchaCode/{phone}")
// public AjaxResult getUpdatePasswordCode(@PathVariable String phone) throws IOException {
// AjaxResult ajax = AjaxResult.success();

View File

@ -96,8 +96,8 @@ token:
header: Authorization
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认30分钟
expireTime: 30
# 令牌有效期默认30分钟1440 = 60*24
expireTime: 1440
# MyBatis配置
mybatis:

View File

@ -37,6 +37,10 @@ public class SysUser extends BaseEntity
@Excel(name = "用户名称")
private String nickName;
/** 用户昵称 */
@Excel(name = "用户类型")
private String userType;
/** 用户邮箱 */
@Excel(name = "用户邮箱")
private String email;
@ -154,6 +158,9 @@ public class SysUser extends BaseEntity
this.userName = userName;
}
public String getUserType(){return userType;}
public void setUserType(String userType){this.userType = userType;}
@Email(message = "邮箱格式不正确")
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
public String getEmail()

View File

@ -119,7 +119,12 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求
.authorizeRequests()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/register", "/captchaImage","/appLoginCaptchaCode/**","/appCaptchaCode/**","/appUpdatePasswordCaptchaCode/**","/app/system/**").permitAll()
.antMatchers("/login", "/register", "/captchaImage","/appLoginCaptchaCode/**","/appCaptchaCode/**","/appUpdatePasswordCaptchaCode/**"
,"/app/system/loginPassword","/app/system/register", "/app/system/loginSms"
,"/registerCheckPhone"
// , "/verifyRegisterSms"
// ,"/app/system/**"
).permitAll()
// 静态资源可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

View File

@ -4,6 +4,7 @@ import java.util.Date;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.AppRegisterUser;
import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.system.domain.UserInfo;
import com.ruoyi.system.service.IUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
@ -133,6 +134,9 @@ public class SysRegisterService
SysUser sysUser = new SysUser();
sysUser.setUserName(username);
sysUser.setPhonenumber(username);
sysUser.setAvatar("D:\\ruoyi\\uploadPath\\avatar\\default.png");
sysUser.setUserType("01");
UserInfo userInfo = new UserInfo();
@ -171,13 +175,17 @@ public class SysRegisterService
{
sysUser.setNickName(registerBody.getNickname());
sysUser.setPassword(SecurityUtils.encryptPassword(password));
String ip = IpUtils.getIpAddr();
sysUser.setLoginIp(ip);
// 注册账号
boolean regFlag = userService.registerUser(sysUser);
if (!regFlag)
{
msg = "注册失败,请联系系统管理人员";
msg = "账号注册失败,请联系系统管理人员";
}
else
{

View File

@ -0,0 +1,104 @@
package com.ruoyi.system.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.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.system.domain.UserWork;
import com.ruoyi.system.service.IUserWorkService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 用户作品Controller
*
* @author haotian
* @date 2024-10-23
*/
@RestController
@RequestMapping("/system/work")
public class UserWorkController extends BaseController
{
@Autowired
private IUserWorkService userWorkService;
/**
* 查询用户作品列表
*/
@PreAuthorize("@ss.hasPermi('system:work:list')")
@GetMapping("/list")
public TableDataInfo list(UserWork userWork)
{
startPage();
List<UserWork> list = userWorkService.selectUserWorkList(userWork);
return getDataTable(list);
}
/**
* 导出用户作品列表
*/
@PreAuthorize("@ss.hasPermi('system:work:export')")
@Log(title = "用户作品", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, UserWork userWork)
{
List<UserWork> list = userWorkService.selectUserWorkList(userWork);
ExcelUtil<UserWork> util = new ExcelUtil<UserWork>(UserWork.class);
util.exportExcel(response, list, "用户作品数据");
}
/**
* 获取用户作品详细信息
*/
@PreAuthorize("@ss.hasPermi('system:work:query')")
@GetMapping(value = "/{workId}")
public AjaxResult getInfo(@PathVariable("workId") Long workId)
{
return success(userWorkService.selectUserWorkByWorkId(workId));
}
/**
* 新增用户作品
*/
@PreAuthorize("@ss.hasPermi('system:work:add')")
@Log(title = "用户作品", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody UserWork userWork)
{
return toAjax(userWorkService.insertUserWork(userWork));
}
/**
* 修改用户作品
*/
@PreAuthorize("@ss.hasPermi('system:work:edit')")
@Log(title = "用户作品", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody UserWork userWork)
{
return toAjax(userWorkService.updateUserWork(userWork));
}
/**
* 删除用户作品
*/
@PreAuthorize("@ss.hasPermi('system:work:remove')")
@Log(title = "用户作品", businessType = BusinessType.DELETE)
@DeleteMapping("/{workIds}")
public AjaxResult remove(@PathVariable Long[] workIds)
{
return toAjax(userWorkService.deleteUserWorkByWorkIds(workIds));
}
}

View File

@ -0,0 +1,259 @@
package com.ruoyi.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 用户作品对象 user_work
*
* @author haotian
* @date 2024-10-23
*/
public class UserWork extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 作品ID */
private Long workId;
/** 用户id */
@Excel(name = "用户id")
private Long userId;
/** 作品名称 */
@Excel(name = "作品名称")
private String workName;
/** 作品存放地址 */
@Excel(name = "作品存放地址")
private String workAddress;
/** 坐标 */
@Excel(name = "坐标")
private String coordinate;
/** 发布日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "发布日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date postTime;
/** 创建日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "发布日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date createTime;
/** 状态 */
@Excel(name = "状态")
private String workStatus;
/** 审核意见 */
@Excel(name = "审核意见")
private String auditOpinion;
/** 资源位ID */
@Excel(name = "资源位ID")
private String sourceId;
/** 标价 */
@Excel(name = "标价")
private Long price;
/** 收到火箭数 */
@Excel(name = "收到火箭数")
private Long receiveRockets;
/** 详情 */
@Excel(name = "详情")
private String detail;
/** 删除标志 */
@Excel(name = "删除标志")
private String deleteFlag;
/** 景区 */
@Excel(name = "景区")
private String scenic;
/** 分区 */
@Excel(name = "分区")
private String part;
/** 城市 */
@Excel(name = "城市")
private String city;
public void setWorkId(Long workId)
{
this.workId = workId;
}
public Long getWorkId()
{
return workId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setWorkName(String workName)
{
this.workName = workName;
}
public String getWorkName()
{
return workName;
}
public void setWorkAddress(String workAddress)
{
this.workAddress = workAddress;
}
public String getWorkAddress()
{
return workAddress;
}
public void setCoordinate(String coordinate)
{
this.coordinate = coordinate;
}
public String getCoordinate()
{
return coordinate;
}
public void setPostTime(Date postTime)
{
this.postTime = postTime;
}
public Date getPostTime()
{
return postTime;
}
public void setWorkStatus(String workStatus)
{
this.workStatus = workStatus;
}
public Date getCreateTime(){return createTime;}
public void setCreateTime(Date createTime){this.createTime=createTime;}
public String getWorkStatus()
{
return workStatus;
}
public void setAuditOpinion(String auditOpinion)
{
this.auditOpinion = auditOpinion;
}
public String getAuditOpinion()
{
return auditOpinion;
}
public void setSourceId(String sourceId)
{
this.sourceId = sourceId;
}
public String getSourceId()
{
return sourceId;
}
public void setPrice(Long price)
{
this.price = price;
}
public Long getPrice()
{
return price;
}
public void setReceiveRockets(Long receiveRockets)
{
this.receiveRockets = receiveRockets;
}
public Long getReceiveRockets()
{
return receiveRockets;
}
public void setDetail(String detail)
{
this.detail = detail;
}
public String getDetail()
{
return detail;
}
public void setDeleteFlag(String deleteFlag)
{
this.deleteFlag = deleteFlag;
}
public String getDeleteFlag()
{
return deleteFlag;
}
public void setScenic(String scenic)
{
this.scenic = scenic;
}
public String getScenic()
{
return scenic;
}
public void setPart(String part)
{
this.part = part;
}
public String getPart()
{
return part;
}
public void setCity(String city)
{
this.city = city;
}
public String getCity()
{
return city;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("workId", getWorkId())
.append("userId", getUserId())
.append("workName", getWorkName())
.append("workAddress", getWorkAddress())
.append("coordinate", getCoordinate())
.append("createTime", getCreateTime())
.append("postTime", getPostTime())
.append("workStatus", getWorkStatus())
.append("auditOpinion", getAuditOpinion())
.append("sourceId", getSourceId())
.append("price", getPrice())
.append("receiveRockets", getReceiveRockets())
.append("detail", getDetail())
.append("deleteFlag", getDeleteFlag())
.append("scenic", getScenic())
.append("part", getPart())
.append("city", getCity())
.toString();
}
}

View File

@ -1,18 +1,18 @@
package com.ruoyi.system.domain.dto;
public class UpdatePwdDto {
// private String oldPassword;
private String oldPassword;
private String newPassword;
private String phone;
private String code;
// public String getOldPassword() {
// return oldPassword;
// }
//
// public void setOldPassword(String oldPassword) {
// this.oldPassword = oldPassword;
// }
public String getOldPassword() {
return oldPassword;
}
public void setOldPassword(String oldPassword) {
this.oldPassword = oldPassword;
}
public String getNewPassword() {
return newPassword;

View File

@ -0,0 +1,8 @@
package com.ruoyi.system.domain.dto;
public class UserWorkDto {
private String workName;
private String detail;
private String workType;
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.UserWork;
/**
* 用户作品Mapper接口
*
* @author haotian
* @date 2024-10-23
*/
public interface UserWorkMapper
{
/**
* 查询用户作品
*
* @param workId 用户作品主键
* @return 用户作品
*/
public UserWork selectUserWorkByWorkId(Long workId);
/**
* 查询用户作品列表
*
* @param userWork 用户作品
* @return 用户作品集合
*/
public List<UserWork> selectUserWorkList(UserWork userWork);
/**
* 新增用户作品
*
* @param userWork 用户作品
* @return 结果
*/
public int insertUserWork(UserWork userWork);
/**
* 修改用户作品
*
* @param userWork 用户作品
* @return 结果
*/
public int updateUserWork(UserWork userWork);
/**
* 删除用户作品
*
* @param workId 用户作品主键
* @return 结果
*/
public int deleteUserWorkByWorkId(Long workId);
/**
* 批量删除用户作品
*
* @param workIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteUserWorkByWorkIds(Long[] workIds);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.UserWork;
/**
* 用户作品Service接口
*
* @author haotian
* @date 2024-10-23
*/
public interface IUserWorkService
{
/**
* 查询用户作品
*
* @param workId 用户作品主键
* @return 用户作品
*/
public UserWork selectUserWorkByWorkId(Long workId);
/**
* 查询用户作品列表
*
* @param userWork 用户作品
* @return 用户作品集合
*/
public List<UserWork> selectUserWorkList(UserWork userWork);
/**
* 新增用户作品
*
* @param userWork 用户作品
* @return 结果
*/
public int insertUserWork(UserWork userWork);
/**
* 修改用户作品
*
* @param userWork 用户作品
* @return 结果
*/
public int updateUserWork(UserWork userWork);
/**
* 批量删除用户作品
*
* @param workIds 需要删除的用户作品主键集合
* @return 结果
*/
public int deleteUserWorkByWorkIds(Long[] workIds);
/**
* 删除用户作品信息
*
* @param workId 用户作品主键
* @return 结果
*/
public int deleteUserWorkByWorkId(Long workId);
}

View File

@ -0,0 +1,95 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.UserWorkMapper;
import com.ruoyi.system.domain.UserWork;
import com.ruoyi.system.service.IUserWorkService;
/**
* 用户作品Service业务层处理
*
* @author haotian
* @date 2024-10-23
*/
@Service
public class UserWorkServiceImpl implements IUserWorkService
{
@Autowired
private UserWorkMapper userWorkMapper;
/**
* 查询用户作品
*
* @param workId 用户作品主键
* @return 用户作品
*/
@Override
public UserWork selectUserWorkByWorkId(Long workId)
{
return userWorkMapper.selectUserWorkByWorkId(workId);
}
/**
* 查询用户作品列表
*
* @param userWork 用户作品
* @return 用户作品
*/
@Override
public List<UserWork> selectUserWorkList(UserWork userWork)
{
return userWorkMapper.selectUserWorkList(userWork);
}
/**
* 新增用户作品
*
* @param userWork 用户作品
* @return 结果
*/
@Override
public int insertUserWork(UserWork userWork)
{
userWork.setCreateTime(DateUtils.getNowDate());
return userWorkMapper.insertUserWork(userWork);
}
/**
* 修改用户作品
*
* @param userWork 用户作品
* @return 结果
*/
@Override
public int updateUserWork(UserWork userWork)
{
return userWorkMapper.updateUserWork(userWork);
}
/**
* 批量删除用户作品
*
* @param workIds 需要删除的用户作品主键
* @return 结果
*/
@Override
public int deleteUserWorkByWorkIds(Long[] workIds)
{
return userWorkMapper.deleteUserWorkByWorkIds(workIds);
}
/**
* 删除用户作品信息
*
* @param workId 用户作品主键
* @return 结果
*/
@Override
public int deleteUserWorkByWorkId(Long workId)
{
return userWorkMapper.deleteUserWorkByWorkId(workId);
}
}

View File

@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deptId" column="dept_id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="userType" column="user_type" />
<result property="email" column="email" />
<result property="phonenumber" column="phonenumber" />
<result property="sex" column="sex" />
@ -156,6 +157,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="nickName != null and nickName != ''">nick_name,</if>
<if test="userType != null and userType != ''">user_type,</if>
<if test="email != null and email != ''">email,</if>
<if test="avatar != null and avatar != ''">avatar,</if>
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
@ -170,6 +172,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="userType != null and userType != ''">#{userType},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if>
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
@ -188,6 +191,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="userType != null and userType != ''">user_type = #{userType},</if>
<if test="email != null ">email = #{email},</if>
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
<if test="sex != null and sex != ''">sex = #{sex},</if>

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.UserWorkMapper">
<resultMap type="UserWork" id="UserWorkResult">
<result property="workId" column="work_id" />
<result property="userId" column="user_id" />
<result property="workName" column="work_name" />
<result property="workAddress" column="work_address" />
<result property="coordinate" column="coordinate" />
<result property="createTime" column="create_time" />
<result property="postTime" column="post_time" />
<result property="workStatus" column="work_status" />
<result property="auditOpinion" column="audit_opinion" />
<result property="sourceId" column="source_id" />
<result property="price" column="price" />
<result property="receiveRockets" column="receive_rockets" />
<result property="detail" column="detail" />
<result property="deleteFlag" column="delete_flag" />
<result property="scenic" column="scenic" />
<result property="part" column="part" />
<result property="city" column="city" />
</resultMap>
<sql id="selectUserWorkVo">
select work_id, user_id, work_name, work_address, coordinate, create_time, post_time, work_status, audit_opinion, source_id, price, receive_rockets, detail, delete_flag, scenic, part, city from user_work
</sql>
<select id="selectUserWorkList" parameterType="UserWork" resultMap="UserWorkResult">
<include refid="selectUserWorkVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="workName != null and workName != ''"> and work_name like concat('%', #{workName}, '%')</if>
<if test="workAddress != null and workAddress != ''"> and work_address = #{workAddress}</if>
<if test="coordinate != null and coordinate != ''"> and coordinate = #{coordinate}</if>
<if test="postTime != null "> and post_time = #{postTime}</if>
<if test="workStatus != null and workStatus != ''"> and work_status = #{workStatus}</if>
<if test="auditOpinion != null and auditOpinion != ''"> and audit_opinion = #{auditOpinion}</if>
<if test="sourceId != null and sourceId != ''"> and source_id = #{sourceId}</if>
<if test="price != null "> and price = #{price}</if>
<if test="receiveRockets != null "> and receive_rockets = #{receiveRockets}</if>
<if test="detail != null and detail != ''"> and detail = #{detail}</if>
<if test="deleteFlag != null and deleteFlag != ''"> and delete_flag = #{deleteFlag}</if>
<if test="scenic != null and scenic != ''"> and scenic = #{scenic}</if>
<if test="part != null and part != ''"> and part = #{part}</if>
<if test="city != null and city != ''"> and city = #{city}</if>
</where>
</select>
<select id="selectUserWorkByWorkId" parameterType="Long" resultMap="UserWorkResult">
<include refid="selectUserWorkVo"/>
where work_id = #{workId}
</select>
<insert id="insertUserWork" parameterType="UserWork" useGeneratedKeys="true" keyProperty="workId">
insert into user_work
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="workName != null">work_name,</if>
<if test="workAddress != null">work_address,</if>
<if test="coordinate != null and coordinate != ''">coordinate,</if>
<if test="createTime != null">create_time,</if>
<if test="postTime != null">post_time,</if>
<if test="workStatus != null">work_status,</if>
<if test="auditOpinion != null">audit_opinion,</if>
<if test="sourceId != null">source_id,</if>
<if test="price != null">price,</if>
<if test="receiveRockets != null">receive_rockets,</if>
<if test="detail != null">detail,</if>
<if test="deleteFlag != null">delete_flag,</if>
<if test="scenic != null">scenic,</if>
<if test="part != null">part,</if>
<if test="city != null">city,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="workName != null">#{workName},</if>
<if test="workAddress != null">#{workAddress},</if>
<if test="coordinate != null and coordinate != ''">#{coordinate},</if>
<if test="createTime != null">#{createTime},</if>
<if test="postTime != null">#{postTime},</if>
<if test="workStatus != null">#{workStatus},</if>
<if test="auditOpinion != null">#{auditOpinion},</if>
<if test="sourceId != null">#{sourceId},</if>
<if test="price != null">#{price},</if>
<if test="receiveRockets != null">#{receiveRockets},</if>
<if test="detail != null">#{detail},</if>
<if test="deleteFlag != null">#{deleteFlag},</if>
<if test="scenic != null">#{scenic},</if>
<if test="part != null">#{part},</if>
<if test="city != null">#{city},</if>
</trim>
</insert>
<update id="updateUserWork" parameterType="UserWork">
update user_work
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="workName != null">work_name = #{workName},</if>
<if test="workAddress != null">work_address = #{workAddress},</if>
<if test="coordinate != null and coordinate != ''">coordinate = #{coordinate},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="postTime != null">post_time = #{postTime},</if>
<if test="workStatus != null">work_status = #{workStatus},</if>
<if test="auditOpinion != null">audit_opinion = #{auditOpinion},</if>
<if test="sourceId != null">source_id = #{sourceId},</if>
<if test="price != null">price = #{price},</if>
<if test="receiveRockets != null">receive_rockets = #{receiveRockets},</if>
<if test="detail != null">detail = #{detail},</if>
<if test="deleteFlag != null">delete_flag = #{deleteFlag},</if>
<if test="scenic != null">scenic = #{scenic},</if>
<if test="part != null">part = #{part},</if>
<if test="city != null">city = #{city},</if>
</trim>
where work_id = #{workId}
</update>
<delete id="deleteUserWorkByWorkId" parameterType="Long">
delete from user_work where work_id = #{workId}
</delete>
<delete id="deleteUserWorkByWorkIds" parameterType="String">
delete from user_work where work_id in
<foreach item="workId" collection="array" open="(" separator="," close=")">
#{workId}
</foreach>
</delete>
</mapper>