6 changed files with 158 additions and 2 deletions
@ -0,0 +1,47 @@ |
|||||
|
package com.zdxt.enforcementcode.controller.app.enterprise; |
||||
|
|
||||
|
|
||||
|
import com.zdxt.enforcementcode.service.enterprise.IAppEnterpriseMineService; |
||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse; |
||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.dromara.system.domain.vo.SysUserVo; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
/** |
||||
|
* 企业端-我的-设置 |
||||
|
*/ |
||||
|
@Tag(name = "企业端-我的-设置") |
||||
|
@Validated |
||||
|
@RequiredArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/app-ent/mine") |
||||
|
public class AppEnterpriseMineController { |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
private IAppEnterpriseMineService appEnterpriseMineService; |
||||
|
/** |
||||
|
* 企业端-查询用户信息 |
||||
|
*/ |
||||
|
@ApiResponse(description = "企业端-查询用户信息") |
||||
|
@GetMapping("/userMine") |
||||
|
public SysUserVo userMine(String userId) { |
||||
|
return appEnterpriseMineService.queryLoginUserId(userId); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 企业端-修改联系电话 |
||||
|
* @return |
||||
|
*/ |
||||
|
@ApiResponse(description = "企业端-修改用户联系电话") |
||||
|
@PostMapping("/updatePhone") |
||||
|
public int updatePhone(String userId, String phone) { |
||||
|
return appEnterpriseMineService.updateUserPhone(userId, phone); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
package com.zdxt.enforcementcode.mapper.enterprise; |
||||
|
|
||||
|
|
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
||||
|
import org.dromara.system.domain.SysUser; |
||||
|
import org.dromara.system.domain.vo.SysUserVo; |
||||
|
|
||||
|
public interface AppEnterpriseMineMapper extends BaseMapperPlus<SysUser, SysUserVo> { |
||||
|
|
||||
|
/** |
||||
|
* 企业端-根据用户ID查询用户信息 |
||||
|
* |
||||
|
* @param userId 用户ID |
||||
|
* @return 用户信息 |
||||
|
*/ |
||||
|
SysUserVo queryLoginUserId(@Param("userId") String userId); |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.zdxt.enforcementcode.service.enterprise; |
||||
|
|
||||
|
import org.dromara.system.domain.vo.SysUserVo; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 企业执法-我的Service接口 |
||||
|
*/ |
||||
|
public interface IAppEnterpriseMineService { |
||||
|
|
||||
|
/** |
||||
|
* 企业端-根据用户ID查询用户信息 |
||||
|
* |
||||
|
* @param userId 用户ID |
||||
|
* @return 用户信息 |
||||
|
*/ |
||||
|
SysUserVo queryLoginUserId(String userId); |
||||
|
|
||||
|
/** |
||||
|
* 企业端-修改用户联系电话 |
||||
|
*/ |
||||
|
int updateUserPhone(String userId, String phone); |
||||
|
} |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.zdxt.enforcementcode.service.enterprise.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||
|
import com.zdxt.enforcementcode.mapper.enterprise.AppEnterpriseMineMapper; |
||||
|
import com.zdxt.enforcementcode.service.enterprise.IAppEnterpriseMineService; |
||||
|
import org.dromara.system.domain.SysUser; |
||||
|
import org.dromara.system.domain.vo.SysUserVo; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
@Service |
||||
|
public class AppEnterpriseMineServiceImpl implements IAppEnterpriseMineService { |
||||
|
|
||||
|
@Autowired |
||||
|
private AppEnterpriseMineMapper appEnterpriseMineMapper; |
||||
|
/** |
||||
|
* 企业端-获取用户信息 |
||||
|
* @param userId 用户ID |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public SysUserVo queryLoginUserId(String userId) { |
||||
|
SysUserVo sysUserVo = appEnterpriseMineMapper.queryLoginUserId(userId); |
||||
|
return sysUserVo; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 企业端-修改用户联系电话 |
||||
|
* @param userId |
||||
|
* @param phone |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public int updateUserPhone(String userId, String phone) { |
||||
|
LambdaUpdateWrapper<SysUser> updateWrapper = new LambdaUpdateWrapper<>(); |
||||
|
updateWrapper.eq(SysUser::getUserId, Long.parseLong(userId)) |
||||
|
.set(SysUser::getPhonenumber, phone); |
||||
|
return appEnterpriseMineMapper.update(null, updateWrapper); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
<?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.zdxt.enforcementcode.mapper.enterprise.AppEnterpriseMineMapper"> |
||||
|
|
||||
|
<!-- 企业端-根据用户ID查询用户信息 --> |
||||
|
<select id="queryLoginUserId" resultType="org.dromara.system.domain.vo.SysUserVo"> |
||||
|
select |
||||
|
t1.user_id as userId, |
||||
|
t1.user_name as userName, |
||||
|
t1.email as email, |
||||
|
t1.avatar as avatar, |
||||
|
t1.phonenumber as phonenumber, |
||||
|
t1.dept_id as deptId, |
||||
|
t2.dept_name as deptName |
||||
|
from |
||||
|
sys_user t1 |
||||
|
left join sys_dept t2 |
||||
|
on |
||||
|
t1.dept_id = t2.dept_id |
||||
|
<where> |
||||
|
<if test="userId!=null and userId!=''"> |
||||
|
and t1.user_id=#{userId} |
||||
|
</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
</mapper> |
||||
Loading…
Reference in new issue