正在显示
11 个修改的文件
包含
312 行增加
和
48 行删除
| @@ -24,8 +24,6 @@ public class UserLogin extends BaseEntity | @@ -24,8 +24,6 @@ public class UserLogin extends BaseEntity | ||
| 24 | @ApiModelProperty(value="用户主键id") | 24 | @ApiModelProperty(value="用户主键id") |
| 25 | private Integer userId; | 25 | private Integer userId; |
| 26 | 26 | ||
| 27 | - @ApiModelProperty(value="用户主键id") | ||
| 28 | - private String loginName; | ||
| 29 | 27 | ||
| 30 | /** 用户密码 */ | 28 | /** 用户密码 */ |
| 31 | @ApiModelProperty(value="用户密码") | 29 | @ApiModelProperty(value="用户密码") |
| @@ -72,14 +70,6 @@ public class UserLogin extends BaseEntity | @@ -72,14 +70,6 @@ public class UserLogin extends BaseEntity | ||
| 72 | return userLoginPassKey; | 70 | return userLoginPassKey; |
| 73 | } | 71 | } |
| 74 | 72 | ||
| 75 | - public String getLoginName() { | ||
| 76 | - return loginName; | ||
| 77 | - } | ||
| 78 | - | ||
| 79 | - public void setLoginName(String loginName) { | ||
| 80 | - this.loginName = loginName; | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | @Override | 73 | @Override |
| 84 | public String toString() { | 74 | public String toString() { |
| 85 | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | 75 | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| @@ -18,7 +18,7 @@ public interface UserLoginMapper | @@ -18,7 +18,7 @@ public interface UserLoginMapper | ||
| 18 | * @return 用户登录 | 18 | * @return 用户登录 |
| 19 | */ | 19 | */ |
| 20 | public UserLogin selectUserLoginById(Integer id); | 20 | public UserLogin selectUserLoginById(Integer id); |
| 21 | - | 21 | + public UserLogin selectUserLoginByUserId(Integer userId); |
| 22 | /** | 22 | /** |
| 23 | * 查询用户登录列表 | 23 | * 查询用户登录列表 |
| 24 | * | 24 | * |
| @@ -19,6 +19,7 @@ public interface IUserLoginService | @@ -19,6 +19,7 @@ public interface IUserLoginService | ||
| 19 | */ | 19 | */ |
| 20 | public UserLogin selectUserLoginById(Integer id); | 20 | public UserLogin selectUserLoginById(Integer id); |
| 21 | 21 | ||
| 22 | + public UserLogin selectUserLoginByUserId(Integer userId); | ||
| 22 | /** | 23 | /** |
| 23 | * 查询用户登录列表 | 24 | * 查询用户登录列表 |
| 24 | * | 25 | * |
| @@ -35,6 +35,11 @@ public class UserLoginServiceImpl implements IUserLoginService | @@ -35,6 +35,11 @@ public class UserLoginServiceImpl implements IUserLoginService | ||
| 35 | return userLoginMapper.selectUserLoginById(id); | 35 | return userLoginMapper.selectUserLoginById(id); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | + @Override | ||
| 39 | + public UserLogin selectUserLoginByUserId(Integer userId) | ||
| 40 | + { | ||
| 41 | + return userLoginMapper.selectUserLoginByUserId(userId); | ||
| 42 | + } | ||
| 38 | 43 | ||
| 39 | @Override | 44 | @Override |
| 40 | public UserLogin selectUserLoginByLoginName(String loginName) | 45 | public UserLogin selectUserLoginByLoginName(String loginName) |
| @@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 7 | <resultMap type="UserBaseInfo" id="UserBaseInfoResult"> | 7 | <resultMap type="UserBaseInfo" id="UserBaseInfoResult"> |
| 8 | <result property="id" column="id" /> | 8 | <result property="id" column="id" /> |
| 9 | <result property="name" column="name" /> | 9 | <result property="name" column="name" /> |
| 10 | + <result property="loginName" column="login_name" /> | ||
| 10 | <result property="nickname" column="nickname" /> | 11 | <result property="nickname" column="nickname" /> |
| 11 | <result property="gender" column="gender" /> | 12 | <result property="gender" column="gender" /> |
| 12 | <result property="phone" column="phone" /> | 13 | <result property="phone" column="phone" /> |
| @@ -16,7 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -16,7 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 16 | </resultMap> | 17 | </resultMap> |
| 17 | 18 | ||
| 18 | <sql id="selectUserBaseInfoVo"> | 19 | <sql id="selectUserBaseInfoVo"> |
| 19 | - select id, name, nickname, gender, phone, email, img_url, FROM_UNIXTIME(create_time) AS create_time from user_base_info | 20 | + select id,login_name, `name`, nickname, gender, phone, email, img_url, FROM_UNIXTIME(create_time) AS create_time from user_base_info |
| 20 | </sql> | 21 | </sql> |
| 21 | 22 | ||
| 22 | <select id="selectUserBaseInfoList" parameterType="UserBaseInfo" resultMap="UserBaseInfoResult"> | 23 | <select id="selectUserBaseInfoList" parameterType="UserBaseInfo" resultMap="UserBaseInfoResult"> |
| @@ -40,7 +41,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -40,7 +41,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 40 | <insert id="insertUserBaseInfo" parameterType="UserBaseInfo" useGeneratedKeys="true" keyProperty="id"> | 41 | <insert id="insertUserBaseInfo" parameterType="UserBaseInfo" useGeneratedKeys="true" keyProperty="id"> |
| 41 | insert into user_base_info | 42 | insert into user_base_info |
| 42 | <trim prefix="(" suffix=")" suffixOverrides=","> | 43 | <trim prefix="(" suffix=")" suffixOverrides=","> |
| 43 | - <if test="name != null">name,</if> | 44 | + <if test="loginName != null">loginName,</if> |
| 45 | + <if test="name != null">`name`,</if> | ||
| 44 | <if test="nickname != null">nickname,</if> | 46 | <if test="nickname != null">nickname,</if> |
| 45 | <if test="gender != null">gender,</if> | 47 | <if test="gender != null">gender,</if> |
| 46 | <if test="phone != null">phone,</if> | 48 | <if test="phone != null">phone,</if> |
| @@ -49,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -49,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 49 | <if test="createTime != null">create_time,</if> | 51 | <if test="createTime != null">create_time,</if> |
| 50 | </trim> | 52 | </trim> |
| 51 | <trim prefix="values (" suffix=")" suffixOverrides=","> | 53 | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| 54 | + <if test="loginName != null">#{loginName},</if> | ||
| 52 | <if test="name != null">#{name},</if> | 55 | <if test="name != null">#{name},</if> |
| 53 | <if test="nickname != null">#{nickname},</if> | 56 | <if test="nickname != null">#{nickname},</if> |
| 54 | <if test="gender != null">#{gender},</if> | 57 | <if test="gender != null">#{gender},</if> |
| @@ -62,7 +65,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -62,7 +65,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 62 | <update id="updateUserBaseInfo" parameterType="UserBaseInfo"> | 65 | <update id="updateUserBaseInfo" parameterType="UserBaseInfo"> |
| 63 | update user_base_info | 66 | update user_base_info |
| 64 | <trim prefix="SET" suffixOverrides=","> | 67 | <trim prefix="SET" suffixOverrides=","> |
| 65 | - <if test="name != null">name = #{name},</if> | 68 | + <if test="loginName != null">login_name = #{loginName},</if> |
| 69 | + <if test="name != null">`name` = #{name},</if> | ||
| 66 | <if test="nickname != null">nickname = #{nickname},</if> | 70 | <if test="nickname != null">nickname = #{nickname},</if> |
| 67 | <if test="gender != null">gender = #{gender},</if> | 71 | <if test="gender != null">gender = #{gender},</if> |
| 68 | <if test="phone != null">phone = #{phone},</if> | 72 | <if test="phone != null">phone = #{phone},</if> |
| @@ -7,13 +7,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -7,13 +7,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 7 | <resultMap type="UserLogin" id="UserLoginResult"> | 7 | <resultMap type="UserLogin" id="UserLoginResult"> |
| 8 | <result property="id" column="id" /> | 8 | <result property="id" column="id" /> |
| 9 | <result property="userId" column="user_id" /> | 9 | <result property="userId" column="user_id" /> |
| 10 | - <result property="loginName" column="login_name" /> | ||
| 11 | <result property="loginPass" column="login_pass" /> | 10 | <result property="loginPass" column="login_pass" /> |
| 12 | <result property="userLoginPassKey" column="user_login_pass_key" /> | 11 | <result property="userLoginPassKey" column="user_login_pass_key" /> |
| 13 | </resultMap> | 12 | </resultMap> |
| 14 | 13 | ||
| 15 | <sql id="selectUserLoginVo"> | 14 | <sql id="selectUserLoginVo"> |
| 16 | - select id, user_id, login_name, login_pass, user_login_pass_key from user_login | 15 | + select id, user_id, login_pass, user_login_pass_key from user_login |
| 17 | </sql> | 16 | </sql> |
| 18 | 17 | ||
| 19 | <select id="selectUserLoginList" parameterType="UserLogin" resultMap="UserLoginResult"> | 18 | <select id="selectUserLoginList" parameterType="UserLogin" resultMap="UserLoginResult"> |
| @@ -21,7 +20,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -21,7 +20,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 21 | <where> | 20 | <where> |
| 22 | <if test="id != null "> and id = #{id}</if> | 21 | <if test="id != null "> and id = #{id}</if> |
| 23 | <if test="userId != null "> and user_id = #{userId}</if> | 22 | <if test="userId != null "> and user_id = #{userId}</if> |
| 24 | - <if test="loginName != null and loginName != ''"> and login_name like concat('%', #{loginName}, '%')</if> | ||
| 25 | <if test="loginPass != null and loginPass != ''"> and login_pass = #{loginPass}</if> | 23 | <if test="loginPass != null and loginPass != ''"> and login_pass = #{loginPass}</if> |
| 26 | <if test="userLoginPassKey != null and userLoginPassKey != ''"> and user_login_pass_key = #{userLoginPassKey}</if> | 24 | <if test="userLoginPassKey != null and userLoginPassKey != ''"> and user_login_pass_key = #{userLoginPassKey}</if> |
| 27 | </where> | 25 | </where> |
| @@ -31,7 +29,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -31,7 +29,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 31 | SELECT | 29 | SELECT |
| 32 | a.id , | 30 | a.id , |
| 33 | a.user_id , | 31 | a.user_id , |
| 34 | - a.login_name, | ||
| 35 | a.login_pass, | 32 | a.login_pass, |
| 36 | a.user_login_pass_key | 33 | a.user_login_pass_key |
| 37 | 34 | ||
| @@ -39,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -39,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 39 | LEFT JOIN user_base_info b ON a.user_id = b.id | 36 | LEFT JOIN user_base_info b ON a.user_id = b.id |
| 40 | <where> | 37 | <where> |
| 41 | b.phone = #{loginName} | 38 | b.phone = #{loginName} |
| 42 | - OR a.login_name = #{loginName} | 39 | + OR b.login_name = #{loginName} |
| 43 | OR b.email = #{loginName} | 40 | OR b.email = #{loginName} |
| 44 | </where> | 41 | </where> |
| 45 | LIMIT 1 | 42 | LIMIT 1 |
| @@ -49,18 +46,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -49,18 +46,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 49 | <include refid="selectUserLoginVo"/> | 46 | <include refid="selectUserLoginVo"/> |
| 50 | where id = #{id} | 47 | where id = #{id} |
| 51 | </select> | 48 | </select> |
| 52 | - | 49 | + |
| 50 | + <select id="selectUserLoginByUserId" parameterType="Integer" resultMap="UserLoginResult"> | ||
| 51 | + <include refid="selectUserLoginVo"/> | ||
| 52 | + where user_id = #{userId} | ||
| 53 | + </select> | ||
| 54 | + | ||
| 53 | <insert id="insertUserLogin" parameterType="UserLogin" useGeneratedKeys="true" keyProperty="id"> | 55 | <insert id="insertUserLogin" parameterType="UserLogin" useGeneratedKeys="true" keyProperty="id"> |
| 54 | insert into user_login | 56 | insert into user_login |
| 55 | <trim prefix="(" suffix=")" suffixOverrides=","> | 57 | <trim prefix="(" suffix=")" suffixOverrides=","> |
| 56 | <if test="userId != null">user_id,</if> | 58 | <if test="userId != null">user_id,</if> |
| 57 | - <if test="loginName != null and loginName != ''">login_name,</if> | ||
| 58 | <if test="loginPass != null and loginPass != ''">login_pass,</if> | 59 | <if test="loginPass != null and loginPass != ''">login_pass,</if> |
| 59 | <if test="userLoginPassKey != null and userLoginPassKey != ''">user_login_pass_key,</if> | 60 | <if test="userLoginPassKey != null and userLoginPassKey != ''">user_login_pass_key,</if> |
| 60 | </trim> | 61 | </trim> |
| 61 | <trim prefix="values (" suffix=")" suffixOverrides=","> | 62 | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| 62 | <if test="userId != null">#{userId},</if> | 63 | <if test="userId != null">#{userId},</if> |
| 63 | - <if test="loginName != null and loginName != ''">#{loginName},</if> | ||
| 64 | <if test="loginPass != null and loginPass != ''">#{loginPass},</if> | 64 | <if test="loginPass != null and loginPass != ''">#{loginPass},</if> |
| 65 | <if test="userLoginPassKey != null and userLoginPassKey != ''">#{userLoginPassKey},</if> | 65 | <if test="userLoginPassKey != null and userLoginPassKey != ''">#{userLoginPassKey},</if> |
| 66 | </trim> | 66 | </trim> |
| @@ -70,7 +70,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -70,7 +70,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 70 | update user_login | 70 | update user_login |
| 71 | <trim prefix="SET" suffixOverrides=","> | 71 | <trim prefix="SET" suffixOverrides=","> |
| 72 | <if test="userId != null">user_id = #{userId},</if> | 72 | <if test="userId != null">user_id = #{userId},</if> |
| 73 | - <if test="loginName != null and loginName != ''">login_name = #{loginName},</if> | ||
| 74 | <if test="loginPass != null and loginPass != ''">login_pass = #{loginPass},</if> | 73 | <if test="loginPass != null and loginPass != ''">login_pass = #{loginPass},</if> |
| 75 | <if test="userLoginPassKey != null and userLoginPassKey != ''">user_login_pass_key = #{userLoginPassKey},</if> | 74 | <if test="userLoginPassKey != null and userLoginPassKey != ''">user_login_pass_key = #{userLoginPassKey},</if> |
| 76 | </trim> | 75 | </trim> |
lh-jar/lh-jar-sys-service/src/main/java/com/zhonglai/luhui/sys/service/impl/AreaService.java
0 → 100644
| 1 | +package com.zhonglai.luhui.sys.service.impl; | ||
| 2 | + | ||
| 3 | +import com.zhonglai.luhui.dao.service.PublicService; | ||
| 4 | +import com.zhonglai.luhui.dao.service.PublicTemplateService; | ||
| 5 | +import com.zhonglai.luhui.sys.mapper.SysDictDataMapper; | ||
| 6 | +import org.apache.commons.lang3.StringUtils; | ||
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | +import org.springframework.stereotype.Service; | ||
| 9 | + | ||
| 10 | +import java.util.List; | ||
| 11 | +import java.util.Map; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 地区业务 | ||
| 15 | + * @author zhonglai | ||
| 16 | + * | ||
| 17 | + */ | ||
| 18 | +@Service("areaService") | ||
| 19 | +public class AreaService { | ||
| 20 | + | ||
| 21 | + @Autowired | ||
| 22 | + private PublicService publicService; | ||
| 23 | + | ||
| 24 | + public List<Map<String,Object>> getChildrenAddressList(String parentId) | ||
| 25 | + { | ||
| 26 | + String select = "id,name"; | ||
| 27 | + String order = "id asc"; | ||
| 28 | + String where = ""; | ||
| 29 | + if(null==parentId || "0".equals(parentId) || "".equals(parentId)) //查询省 | ||
| 30 | + { | ||
| 31 | + where += " and type=0 "; | ||
| 32 | + }else{ | ||
| 33 | + | ||
| 34 | + if((parentId.length()-12)!=0) | ||
| 35 | + { | ||
| 36 | + parentId = StringUtils.rightPad(parentId,12,'0'); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + if(parentId.substring(2, 4).equals("00")) //查询市 | ||
| 40 | + { | ||
| 41 | + where += " and type=1 and id like '"+parentId.substring(0,2)+"%'"; | ||
| 42 | + } | ||
| 43 | + else if(parentId.substring(4, 6).equals("00")){ //查询县 | ||
| 44 | + where += " and type=2 and id like '"+parentId.substring(0,4)+"%'"; | ||
| 45 | + }else if(parentId.substring(6, 8).equals("00")){ //街道 | ||
| 46 | + where += " and type=3 and id like '"+parentId.substring(0,6)+"%'"; | ||
| 47 | + }else if(parentId.substring(8, 12).equals("0000")){ //居委会 | ||
| 48 | + where += " and type=4 and id like '"+parentId.substring(0,8)+"%'"; | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + return publicService.getObjectListBySQL("select "+select + " from liu_yu_le.sys_area where 1=1 "+where + " order by " + order); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | +} |
lh-modules/lh-admin/src/main/java/com/zhonglai/luhui/admin/controller/system/SysAreaController.java
0 → 100644
| 1 | +package com.zhonglai.luhui.admin.controller.system; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.common.core.domain.AjaxResult; | ||
| 4 | +import com.zhonglai.luhui.sys.service.impl.AreaService; | ||
| 5 | +import io.swagger.annotations.Api; | ||
| 6 | +import io.swagger.annotations.ApiOperation; | ||
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | +import org.springframework.web.bind.annotation.PathVariable; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 11 | +import org.springframework.web.bind.annotation.RestController; | ||
| 12 | + | ||
| 13 | +@Api(tags = "后台地区选择") | ||
| 14 | +@RequestMapping(value = "/mapper/system/area") | ||
| 15 | +@RestController | ||
| 16 | +public class SysAreaController { | ||
| 17 | + | ||
| 18 | + @Autowired | ||
| 19 | + private AreaService sysAreaService; | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 中国id-0 | ||
| 23 | + * 根据父类获取子类 | ||
| 24 | + * @param parentId | ||
| 25 | + * @return | ||
| 26 | + */ | ||
| 27 | + @ApiOperation("根据父类获取子类") | ||
| 28 | + @RequestMapping(value = "getChildrenAddressList/{parentId}", method = RequestMethod.GET) | ||
| 29 | + public AjaxResult getChildrenAddressList(@PathVariable("parentId") String parentId) { | ||
| 30 | + return AjaxResult.success(sysAreaService.getChildrenAddressList(parentId)); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | +} |
| 1 | package com.zhonglai.luhui.admin.controller.user; | 1 | package com.zhonglai.luhui.admin.controller.user; |
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | + | ||
| 5 | +import com.ruoyi.common.utils.DESUtil; | ||
| 6 | +import com.ruoyi.common.utils.StringUtils; | ||
| 7 | +import com.zhonglai.luhui.admin.dto.AddAllUserDto; | ||
| 4 | import com.zhonglai.luhui.datasource.enums.DataSource; | 8 | import com.zhonglai.luhui.datasource.enums.DataSource; |
| 5 | import com.zhonglai.luhui.datasource.enums.DataSourceType; | 9 | import com.zhonglai.luhui.datasource.enums.DataSourceType; |
| 6 | import javax.servlet.http.HttpServletResponse; | 10 | import javax.servlet.http.HttpServletResponse; |
| 7 | 11 | ||
| 12 | +import com.zhonglai.luhui.user.domain.*; | ||
| 8 | import com.zhonglai.luhui.user.service.IUserBaseInfoService; | 13 | import com.zhonglai.luhui.user.service.IUserBaseInfoService; |
| 14 | +import com.zhonglai.luhui.user.service.IUserLoginService; | ||
| 9 | import io.swagger.annotations.Api; | 15 | import io.swagger.annotations.Api; |
| 10 | import io.swagger.annotations.ApiOperation; | 16 | import io.swagger.annotations.ApiOperation; |
| 11 | import org.springframework.security.access.prepost.PreAuthorize; | 17 | import org.springframework.security.access.prepost.PreAuthorize; |
| @@ -23,7 +29,6 @@ import com.zhonglai.luhui.action.BaseController; | @@ -23,7 +29,6 @@ import com.zhonglai.luhui.action.BaseController; | ||
| 23 | import com.ruoyi.common.core.domain.AjaxResult; | 29 | import com.ruoyi.common.core.domain.AjaxResult; |
| 24 | import com.ruoyi.common.enums.BusinessType; | 30 | import com.ruoyi.common.enums.BusinessType; |
| 25 | import com.zhonglai.luhui.dao.service.PublicTemplateService; | 31 | import com.zhonglai.luhui.dao.service.PublicTemplateService; |
| 26 | -import com.zhonglai.luhui.user.domain.UserBaseInfo; | ||
| 27 | import com.zhonglai.luhui.sys.utils.ExcelUtil; | 32 | import com.zhonglai.luhui.sys.utils.ExcelUtil; |
| 28 | 33 | ||
| 29 | import com.ruoyi.common.core.page.TableDataInfo; | 34 | import com.ruoyi.common.core.page.TableDataInfo; |
| @@ -40,7 +45,9 @@ import com.ruoyi.common.core.page.TableDataInfo; | @@ -40,7 +45,9 @@ import com.ruoyi.common.core.page.TableDataInfo; | ||
| 40 | public class UserBaseInfoController extends BaseController | 45 | public class UserBaseInfoController extends BaseController |
| 41 | { | 46 | { |
| 42 | @Autowired | 47 | @Autowired |
| 43 | - private IUserBaseInfoService publicTemplateService; | 48 | + private IUserBaseInfoService userBaseInfoService; |
| 49 | + @Autowired | ||
| 50 | + private PublicTemplateService publicTemplateService; | ||
| 44 | 51 | ||
| 45 | @ApiOperation(value ="查询基础用户信息列表",notes="\n" + | 52 | @ApiOperation(value ="查询基础用户信息列表",notes="\n" + |
| 46 | "公共参数描述:\n" + | 53 | "公共参数描述:\n" + |
| @@ -59,7 +66,7 @@ public class UserBaseInfoController extends BaseController | @@ -59,7 +66,7 @@ public class UserBaseInfoController extends BaseController | ||
| 59 | public TableDataInfo list(UserBaseInfo userBaseInfo) | 66 | public TableDataInfo list(UserBaseInfo userBaseInfo) |
| 60 | { | 67 | { |
| 61 | startPage(); | 68 | startPage(); |
| 62 | - List<UserBaseInfo> list = publicTemplateService.selectUserBaseInfoList(userBaseInfo); | 69 | + List<UserBaseInfo> list = userBaseInfoService.selectUserBaseInfoList(userBaseInfo); |
| 63 | return getDataTable(list); | 70 | return getDataTable(list); |
| 64 | } | 71 | } |
| 65 | 72 | ||
| @@ -70,7 +77,7 @@ public class UserBaseInfoController extends BaseController | @@ -70,7 +77,7 @@ public class UserBaseInfoController extends BaseController | ||
| 70 | @PostMapping("/export") | 77 | @PostMapping("/export") |
| 71 | public void export(HttpServletResponse response, UserBaseInfo userBaseInfo) | 78 | public void export(HttpServletResponse response, UserBaseInfo userBaseInfo) |
| 72 | { | 79 | { |
| 73 | - List<UserBaseInfo> list = publicTemplateService.selectUserBaseInfoList(userBaseInfo); | 80 | + List<UserBaseInfo> list = userBaseInfoService.selectUserBaseInfoList(userBaseInfo); |
| 74 | ExcelUtil<UserBaseInfo> util = new ExcelUtil<UserBaseInfo>(UserBaseInfo.class); | 81 | ExcelUtil<UserBaseInfo> util = new ExcelUtil<UserBaseInfo>(UserBaseInfo.class); |
| 75 | util.exportExcel(response, list, "基础用户信息数据"); | 82 | util.exportExcel(response, list, "基础用户信息数据"); |
| 76 | } | 83 | } |
| @@ -81,17 +88,7 @@ public class UserBaseInfoController extends BaseController | @@ -81,17 +88,7 @@ public class UserBaseInfoController extends BaseController | ||
| 81 | @GetMapping(value = "/{id}") | 88 | @GetMapping(value = "/{id}") |
| 82 | public AjaxResult getInfo(@PathVariable("id") Integer id) | 89 | public AjaxResult getInfo(@PathVariable("id") Integer id) |
| 83 | { | 90 | { |
| 84 | - return success(publicTemplateService.selectUserBaseInfoById(id)); | ||
| 85 | - } | ||
| 86 | - | ||
| 87 | - @ApiOperation("新增基础用户信息") | ||
| 88 | - @DataSource(DataSourceType.SLAVE) | ||
| 89 | - @PreAuthorize("@ss.hasPermi('user:base_info:add')") | ||
| 90 | - @Log(title = "基础用户信息", businessType = BusinessType.INSERT) | ||
| 91 | - @PostMapping | ||
| 92 | - public AjaxResult add(@RequestBody UserBaseInfo userBaseInfo) | ||
| 93 | - { | ||
| 94 | - return toAjax(publicTemplateService.insertUserBaseInfo(userBaseInfo)); | 91 | + return success(userBaseInfoService.selectUserBaseInfoById(id)); |
| 95 | } | 92 | } |
| 96 | 93 | ||
| 97 | @ApiOperation("修改基础用户信息") | 94 | @ApiOperation("修改基础用户信息") |
| @@ -101,7 +98,7 @@ public class UserBaseInfoController extends BaseController | @@ -101,7 +98,7 @@ public class UserBaseInfoController extends BaseController | ||
| 101 | @PutMapping | 98 | @PutMapping |
| 102 | public AjaxResult edit(@RequestBody UserBaseInfo userBaseInfo) | 99 | public AjaxResult edit(@RequestBody UserBaseInfo userBaseInfo) |
| 103 | { | 100 | { |
| 104 | - return toAjax(publicTemplateService.updateUserBaseInfo((userBaseInfo))); | 101 | + return toAjax(userBaseInfoService.updateUserBaseInfo((userBaseInfo))); |
| 105 | } | 102 | } |
| 106 | 103 | ||
| 107 | @ApiOperation("删除基础用户信息") | 104 | @ApiOperation("删除基础用户信息") |
| @@ -111,6 +108,61 @@ public class UserBaseInfoController extends BaseController | @@ -111,6 +108,61 @@ public class UserBaseInfoController extends BaseController | ||
| 111 | @DeleteMapping("/{ids}") | 108 | @DeleteMapping("/{ids}") |
| 112 | public AjaxResult remove(@PathVariable Integer[] ids) | 109 | public AjaxResult remove(@PathVariable Integer[] ids) |
| 113 | { | 110 | { |
| 114 | - return toAjax(publicTemplateService.deleteUserBaseInfoByIds(ids)); | 111 | + return toAjax(userBaseInfoService.deleteUserBaseInfoByIds(ids)); |
| 112 | + } | ||
| 113 | + | ||
| 114 | + @ApiOperation("新增全量用户信息") | ||
| 115 | + @DataSource(DataSourceType.SLAVE) | ||
| 116 | + @PreAuthorize("@ss.hasPermi('user:base_info:add')") | ||
| 117 | + @Log(title = "基础用户信息", businessType = BusinessType.INSERT) | ||
| 118 | + @PostMapping | ||
| 119 | + public AjaxResult addAll(@RequestBody AddAllUserDto addAllUserDto) | ||
| 120 | + { | ||
| 121 | + UserBaseInfo userBaseInfo = addAllUserDto.getUserBaseInfo(); | ||
| 122 | + userBaseInfoService.insertUserBaseInfo(userBaseInfo); | ||
| 123 | + if (null != addAllUserDto.getUserAccountInfo()) | ||
| 124 | + { | ||
| 125 | + addAllUserDto.getUserAccountInfo().setId(userBaseInfo.getId()); | ||
| 126 | + publicTemplateService.add(addAllUserDto.getUserAccountInfo()); | ||
| 127 | + } | ||
| 128 | + if (null != addAllUserDto.getUserAddressInfo()) | ||
| 129 | + { | ||
| 130 | + addAllUserDto.getUserAddressInfo().setId(userBaseInfo.getId()); | ||
| 131 | + publicTemplateService.add(addAllUserDto.getUserAddressInfo()); | ||
| 132 | + } | ||
| 133 | + if (null != addAllUserDto.getUserAuthInfo()) | ||
| 134 | + { | ||
| 135 | + addAllUserDto.getUserAuthInfo().setId(userBaseInfo.getId()); | ||
| 136 | + publicTemplateService.add(addAllUserDto.getUserAuthInfo()); | ||
| 137 | + } | ||
| 138 | + if (null != addAllUserDto.getUserExtraInfo()) | ||
| 139 | + { | ||
| 140 | + addAllUserDto.getUserExtraInfo().setId(userBaseInfo.getId()); | ||
| 141 | + publicTemplateService.add(addAllUserDto.getUserExtraInfo()); | ||
| 142 | + } | ||
| 143 | + if (null != addAllUserDto.getUserLogin() && StringUtils.isNotEmpty(addAllUserDto.getUserLogin().getLoginPass())) | ||
| 144 | + { | ||
| 145 | + addAllUserDto.getUserLogin().setUserId(userBaseInfo.getId()); | ||
| 146 | + String userLoginPassKey = DESUtil.randomString(9); | ||
| 147 | + addAllUserDto.getUserLogin().setLoginPass(DESUtil.encode(addAllUserDto.getUserLogin().getLoginPass(), userLoginPassKey)); | ||
| 148 | + addAllUserDto.getUserLogin().setUserLoginPassKey(userLoginPassKey); | ||
| 149 | + publicTemplateService.add(addAllUserDto.getUserLogin()); | ||
| 150 | + } | ||
| 151 | + if (null != addAllUserDto.getUserLoginInfo()) | ||
| 152 | + { | ||
| 153 | + addAllUserDto.getUserLoginInfo().setId(userBaseInfo.getId()); | ||
| 154 | + publicTemplateService.add(addAllUserDto.getUserLoginInfo()); | ||
| 155 | + } | ||
| 156 | + if (null != addAllUserDto.getUserOfficialInfo()) | ||
| 157 | + { | ||
| 158 | + addAllUserDto.getUserOfficialInfo().setId(userBaseInfo.getId()); | ||
| 159 | + publicTemplateService.add(addAllUserDto.getUserOfficialInfo()); | ||
| 160 | + } | ||
| 161 | + if (null != addAllUserDto.getUserSocialInfo()) | ||
| 162 | + { | ||
| 163 | + addAllUserDto.getUserSocialInfo().setId(userBaseInfo.getId()); | ||
| 164 | + publicTemplateService.add(addAllUserDto.getUserSocialInfo()); | ||
| 165 | + } | ||
| 166 | + return AjaxResult.success(addAllUserDto); | ||
| 115 | } | 167 | } |
| 116 | } | 168 | } |
| 1 | package com.zhonglai.luhui.admin.controller.user; | 1 | package com.zhonglai.luhui.admin.controller.user; |
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | + | ||
| 5 | +import com.ruoyi.common.utils.DESUtil; | ||
| 4 | import com.zhonglai.luhui.datasource.enums.DataSource; | 6 | import com.zhonglai.luhui.datasource.enums.DataSource; |
| 5 | import com.zhonglai.luhui.datasource.enums.DataSourceType; | 7 | import com.zhonglai.luhui.datasource.enums.DataSourceType; |
| 6 | import javax.servlet.http.HttpServletResponse; | 8 | import javax.servlet.http.HttpServletResponse; |
| 7 | 9 | ||
| 10 | +import com.zhonglai.luhui.security.dto.LoginToken; | ||
| 11 | +import com.zhonglai.luhui.user.domain.UserBaseInfo; | ||
| 12 | +import com.zhonglai.luhui.user.domain.UserExtraInfo; | ||
| 13 | +import com.zhonglai.luhui.user.service.IUserBaseInfoService; | ||
| 14 | +import com.zhonglai.luhui.user.service.IUserExtraInfoService; | ||
| 8 | import com.zhonglai.luhui.user.service.IUserLoginService; | 15 | import com.zhonglai.luhui.user.service.IUserLoginService; |
| 9 | import io.swagger.annotations.Api; | 16 | import io.swagger.annotations.Api; |
| 17 | +import io.swagger.annotations.ApiImplicitParam; | ||
| 18 | +import io.swagger.annotations.ApiImplicitParams; | ||
| 10 | import io.swagger.annotations.ApiOperation; | 19 | import io.swagger.annotations.ApiOperation; |
| 11 | import org.springframework.security.access.prepost.PreAuthorize; | 20 | import org.springframework.security.access.prepost.PreAuthorize; |
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 21 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | -import org.springframework.web.bind.annotation.GetMapping; | ||
| 14 | -import org.springframework.web.bind.annotation.PostMapping; | ||
| 15 | -import org.springframework.web.bind.annotation.PutMapping; | ||
| 16 | -import org.springframework.web.bind.annotation.DeleteMapping; | ||
| 17 | -import org.springframework.web.bind.annotation.PathVariable; | ||
| 18 | -import org.springframework.web.bind.annotation.RequestBody; | ||
| 19 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 20 | -import org.springframework.web.bind.annotation.RestController; | 22 | +import org.springframework.web.bind.annotation.*; |
| 21 | import com.ruoyi.common.annotation.Log; | 23 | import com.ruoyi.common.annotation.Log; |
| 22 | import com.zhonglai.luhui.action.BaseController; | 24 | import com.zhonglai.luhui.action.BaseController; |
| 23 | import com.ruoyi.common.core.domain.AjaxResult; | 25 | import com.ruoyi.common.core.domain.AjaxResult; |
| @@ -42,6 +44,12 @@ public class UserLoginController extends BaseController | @@ -42,6 +44,12 @@ public class UserLoginController extends BaseController | ||
| 42 | @Autowired | 44 | @Autowired |
| 43 | private IUserLoginService publicTemplateService; | 45 | private IUserLoginService publicTemplateService; |
| 44 | 46 | ||
| 47 | + @Autowired | ||
| 48 | + private IUserBaseInfoService userBaseInfoService; | ||
| 49 | + | ||
| 50 | + @Autowired | ||
| 51 | + private IUserExtraInfoService userExtraInfoService; | ||
| 52 | + | ||
| 45 | @ApiOperation(value ="查询用户登录列表",notes="\n" + | 53 | @ApiOperation(value ="查询用户登录列表",notes="\n" + |
| 46 | "公共参数描述:\n" + | 54 | "公共参数描述:\n" + |
| 47 | "条件参数:\n" + | 55 | "条件参数:\n" + |
| @@ -113,4 +121,33 @@ public class UserLoginController extends BaseController | @@ -113,4 +121,33 @@ public class UserLoginController extends BaseController | ||
| 113 | { | 121 | { |
| 114 | return toAjax(publicTemplateService.deleteUserLoginByIds(ids)); | 122 | return toAjax(publicTemplateService.deleteUserLoginByIds(ids)); |
| 115 | } | 123 | } |
| 124 | + | ||
| 125 | + @ApiOperation("查看密码") | ||
| 126 | + @DataSource(DataSourceType.SLAVE) | ||
| 127 | + @PreAuthorize("@ss.hasPermi('user:login:getpass')") | ||
| 128 | + @GetMapping(value = "getpass/{id}") | ||
| 129 | + public AjaxResult getpass(@PathVariable("id") Integer id) | ||
| 130 | + { | ||
| 131 | + UserLogin userLogin = publicTemplateService.selectUserLoginById(id); | ||
| 132 | + return success(DESUtil.decode( userLogin.getLoginPass(),userLogin.getUserLoginPassKey())); | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + @ApiOperation("获取用户长期token") | ||
| 136 | + @ApiImplicitParams({ | ||
| 137 | + @ApiImplicitParam(value = "用户id",name = "userInfoId"), | ||
| 138 | + }) | ||
| 139 | + @RequestMapping(value = "getLongToken/{userInfoId}", method = RequestMethod.GET) | ||
| 140 | + public AjaxResult getLongToken(@PathVariable Integer userInfoId) | ||
| 141 | + { | ||
| 142 | + UserLogin userLogin = publicTemplateService.selectUserLoginByUserId(userInfoId); | ||
| 143 | + if(null == userLogin) | ||
| 144 | + { | ||
| 145 | + return AjaxResult.error("用户不存在"); | ||
| 146 | + } | ||
| 147 | + UserExtraInfo userExtraInfo = userExtraInfoService.selectUserExtraInfoById(userInfoId); | ||
| 148 | + UserBaseInfo userBaseInfo = userBaseInfoService.selectUserBaseInfoById(userInfoId); | ||
| 149 | + LoginToken loginToken = new LoginToken(userLogin.getUserId(),userBaseInfo.getLoginName(),userBaseInfo.getNickname(),null == userExtraInfo?"0":userExtraInfo.getUserType()+""); | ||
| 150 | + loginToken.setCreateTime(-1); | ||
| 151 | + return AjaxResult.success("获取成功",loginToken.get()); | ||
| 152 | + } | ||
| 116 | } | 153 | } |
| 1 | +package com.zhonglai.luhui.admin.dto; | ||
| 2 | + | ||
| 3 | +import com.zhonglai.luhui.user.domain.*; | ||
| 4 | +import io.swagger.annotations.ApiModel; | ||
| 5 | + | ||
| 6 | +@ApiModel("用户全量添加") | ||
| 7 | +public class AddAllUserDto { | ||
| 8 | + private UserAccountInfo userAccountInfo; | ||
| 9 | + private UserAddressInfo userAddressInfo; | ||
| 10 | + private UserAuthInfo userAuthInfo; | ||
| 11 | + private UserBaseInfo userBaseInfo; | ||
| 12 | + private UserExtraInfo userExtraInfo; | ||
| 13 | + private UserLogin userLogin; | ||
| 14 | + private UserLoginInfo userLoginInfo; | ||
| 15 | + private UserOfficialInfo userOfficialInfo; | ||
| 16 | + private UserSocialInfo userSocialInfo; | ||
| 17 | + | ||
| 18 | + public UserAccountInfo getUserAccountInfo() { | ||
| 19 | + return userAccountInfo; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + public void setUserAccountInfo(UserAccountInfo userAccountInfo) { | ||
| 23 | + this.userAccountInfo = userAccountInfo; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public UserAddressInfo getUserAddressInfo() { | ||
| 27 | + return userAddressInfo; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public void setUserAddressInfo(UserAddressInfo userAddressInfo) { | ||
| 31 | + this.userAddressInfo = userAddressInfo; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public UserAuthInfo getUserAuthInfo() { | ||
| 35 | + return userAuthInfo; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public void setUserAuthInfo(UserAuthInfo userAuthInfo) { | ||
| 39 | + this.userAuthInfo = userAuthInfo; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public UserBaseInfo getUserBaseInfo() { | ||
| 43 | + return userBaseInfo; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public void setUserBaseInfo(UserBaseInfo userBaseInfo) { | ||
| 47 | + this.userBaseInfo = userBaseInfo; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + public UserExtraInfo getUserExtraInfo() { | ||
| 51 | + return userExtraInfo; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + public void setUserExtraInfo(UserExtraInfo userExtraInfo) { | ||
| 55 | + this.userExtraInfo = userExtraInfo; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + public UserLogin getUserLogin() { | ||
| 59 | + return userLogin; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public void setUserLogin(UserLogin userLogin) { | ||
| 63 | + this.userLogin = userLogin; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + public UserLoginInfo getUserLoginInfo() { | ||
| 67 | + return userLoginInfo; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + public void setUserLoginInfo(UserLoginInfo userLoginInfo) { | ||
| 71 | + this.userLoginInfo = userLoginInfo; | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + public UserOfficialInfo getUserOfficialInfo() { | ||
| 75 | + return userOfficialInfo; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + public void setUserOfficialInfo(UserOfficialInfo userOfficialInfo) { | ||
| 79 | + this.userOfficialInfo = userOfficialInfo; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + public UserSocialInfo getUserSocialInfo() { | ||
| 83 | + return userSocialInfo; | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + public void setUserSocialInfo(UserSocialInfo userSocialInfo) { | ||
| 87 | + this.userSocialInfo = userSocialInfo; | ||
| 88 | + } | ||
| 89 | +} |
-
请 注册 或 登录 后发表评论