Commit 324534e0 authored by hanfeng's avatar hanfeng

优化app用户会员表

parent ab6e6898
......@@ -194,4 +194,24 @@ public class AppUserManageBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
}
return appUserManageVos.get(0);
}
public PageInfo<AppUserManageVo> getAllAppUsers(AppUserManageDTO appUserManageDTO) {
PageHelper.startPage(appUserManageDTO.getPage(), appUserManageDTO.getLimit());
List<AppUserManageVo> appUserManageVos = mapper.selectAppUser(appUserManageDTO);
PageInfo<AppUserManageVo> pageInfo = PageInfo.of(appUserManageVos);
if (pageInfo.getList()==null||pageInfo.getList().size()==0) {
return pageInfo;
}
return getAppUserManageVoPageInfo(pageInfo);
}
public PageInfo<AppUserManageVo> getAllAppUsersAndCity(AppUserManageDTO appUserManageDTO) {
PageHelper.startPage(appUserManageDTO.getPage(), appUserManageDTO.getLimit());
List<AppUserManageVo> appUserManageVos = mapper.selectAppUser(appUserManageDTO);
if (CollectionUtils.isEmpty(appUserManageVos)) {
return new PageInfo<AppUserManageVo>();
}
PageInfo<AppUserManageVo> pageInfo = PageInfo.of(appUserManageVos);
return getAppUserManageVoPageInfo(pageInfo);
}
}
......@@ -22,5 +22,6 @@ public interface AppUserDetailMapper extends Mapper<AppUserDetail> {
List<Integer> getUserIdByUsername(@Param("keywords") String keywords);
AppUserVo getUserVo();
List<AppUserManageVo> selectAppUser(AppUserManageDTO appUserManageDTO);
}
\ No newline at end of file
......@@ -46,7 +46,7 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
private Integer ALL_PERMISSIONS=1;
/**
* 查询所有
* 查询所有,获取详细信息
* @return
*/
@PostMapping("/findAll")
......@@ -66,6 +66,27 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
return ObjectRestResponse.succ(baseBiz.findAllByQueryAndCity(appUserManageDTO));
}
/**
* 查询所有,获取具体信息
* @return
*/
@PostMapping("/all")
public ObjectRestResponse<PageInfo<AppUserManageVo>> getAllAppUsers(@RequestBody AppUserManageDTO appUserManageDTO) throws Exception {
String token = userAuthConfig.getToken(request);
ObjectRestResponse objectRestResponse = publicController.userinfoByToken(token);
User user = (User) objectRestResponse.getData();
if (user==null){
throw new BaseException("User error!");
}
if (ALL_PERMISSIONS.equals(user.getDataAll())) {
return ObjectRestResponse.succ(baseBiz.getAllAppUsers(appUserManageDTO));
}
ObjectRestResponse<Set<Integer>> setObjectRestResponse = vehicleFeign.corporationCity(user.getDataZone(), user.getDataCompany());
Set<Integer> cityList = setObjectRestResponse.getData();
appUserManageDTO.setCitySet(cityList);
return ObjectRestResponse.succ(baseBiz.getAllAppUsersAndCity(appUserManageDTO));
}
@GetMapping("/user_info/{id}")
public ObjectRestResponse<AppUserManageVo> findUserInfo(@PathVariable(value = "id") Integer userId){
AppUserManageVo appUserManageVo = baseBiz.findUserInfoById(userId);
......
......@@ -60,26 +60,26 @@
</select>
<!-- &lt;!&ndash; 获取用户信息 &ndash;&gt;-->
<!-- <select id="getUserVo" resultMap="AppUserVoMap">-->
<!-- select l.im_userid,l.username,l.wx_openid,l.unionid,l.openid,l.status,l.id_number,l.certification_status,d.*,p.name as jobTitle,buml.name as memberName from app_user_login l-->
<!-- left join app_user_detail d-->
<!-- on d.userid = l.id-->
<!-- left join base_user_member bum-->
<!-- on bum.user_id=l.id-->
<!-- left join base_user_member_level buml-->
<!-- on bum.member_level = buml.level-->
<!-- left join app_user_position p-->
<!-- on d.position_id=p.id-->
<!-- where-->
<!-- p.is_del=0-->
<!-- and-->
<!-- buml.isdel=0-->
<!-- and-->
<!-- bum.is_del=0-->
<!-- and-->
<!-- d.userid = #{userId} limit 1-->
<!-- </select>-->
<!-- &lt;!&ndash; 获取用户信息 &ndash;&gt;-->
<!-- <select id="getUserVo" resultMap="AppUserVoMap">-->
<!-- select l.im_userid,l.username,l.wx_openid,l.unionid,l.openid,l.status,l.id_number,l.certification_status,d.*,p.name as jobTitle,buml.name as memberName from app_user_login l-->
<!-- left join app_user_detail d-->
<!-- on d.userid = l.id-->
<!-- left join base_user_member bum-->
<!-- on bum.user_id=l.id-->
<!-- left join base_user_member_level buml-->
<!-- on bum.member_level = buml.level-->
<!-- left join app_user_position p-->
<!-- on d.position_id=p.id-->
<!-- where-->
<!-- p.is_del=0-->
<!-- and-->
<!-- buml.isdel=0-->
<!-- and-->
<!-- bum.is_del=0-->
<!-- and-->
<!-- d.userid = #{userId} limit 1-->
<!-- </select>-->
<select id="getUserIdByUsername" resultType="java.lang.Integer" parameterType="java.lang.String">
......@@ -203,12 +203,12 @@
and d.source = #{source}
</if>
<if test="userId!=null">
and l.id=#{userId}
and l.id=#{userId}
</if>
<if test="citySet != null ">
and d.city_code in
<foreach collection="citySet" item="item" index="index" open="(" separator="," close=")" >
#{item}
<foreach collection="citySet" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
order by l.id ASC
......@@ -216,8 +216,125 @@
<update id="updateUserMemberStatusByUserId">
update `app_user_detail` set `is_member`={status} where `userid`=#{userId}
</update>
</update>
<update id="updateUserPositionByUserId">
update `app_user_detail` set `position_id`=#{positionId} where `userid`=#{userId}
</update>
<select id="selectAppUserManage" parameterType="com.github.wxiaoqi.security.admin.dto.AppUserManageDTO"
resultType="com.github.wxiaoqi.security.admin.vo.AppUserManageVo">
select
l.id As userid,
l.username,
d.channel,
d.is_member,
d.realname,
d.source,
d.province_code as provinceCode,
d.city_code as cityCode,
d.sex,
d.headimgurl,
d.email,
m.member_level as memberLevel,
m.valid_time as validTime,
m.buy_count as buyCount,
m.total_number as totalNumber,
m.rent_free_days as rentFreeDays,
m.crt_time as timeOfMembership,
m.recent_recharge as recentRecharge,
m.name as memberName,
aup.name as `positionName`,
p.nameOfSuperior,
p.username AS superiorMobileNumber,
p.parent_id as parentId
from
app_user_login l
inner join
(select * from app_user_detail where 1=1
<if test="postionState != null">
<choose>
<when test="postionState == 6">
and `position_id`=#{postionState}
</when>
<otherwise>
and <![CDATA[`position_id`<>6]]>
</otherwise>
</choose>
</if>
) d
on
d.userid = l.id
left join
app_user_login ul
on
ul.id=d.inviter_account
left join
(
select
b.*,
ml.name
from
base_user_member b
left join
base_user_member_level ml
on
ml.level = b.member_level
where ml.isdel = 0
) m
on
l.id = m.user_id
left join
`app_user_position` as aup
on aup.id = d.position_id
left join (
SELECT
r.user_id,
r.parent_id,
l.username,
IFNULL(d.realname,d.nickname) as nameOfSuperior
FROM
app_user_relation r
LEFT JOIN app_user_login l ON r.parent_id = l.id
LEFT JOIN app_user_detail d ON l.id = d.userid
WHERE
l.isdel = 0
AND
r.is_del = 0
) p
on
l.id=p.user_id
where l.isdel = 0
<if test="mobile !=null and mobile !='' ">
and l.username like CONCAT('%',#{mobile},'%')
</if>
<if test="channel !=null ">
and d.channel=#{channel}
</if>
<if test="memberLevel !=null and memberLevel != -1">
and m.member_level = #{memberLevel}
</if>
<if test="memberLevel == -1">
and m.member_level in (select level from base_user_member_level)
</if>
<if test="registrationTimeBegin !=null ">
and l.createtime &gt;= #{registrationTimeBegin}
</if>
<if test="registrationTimeEnd !=null ">
and l.createtime &lt;= #{registrationTimeEnd}
</if>
<if test="source !=null ">
and d.source = #{source}
</if>
<if test="userId!=null">
and l.id=#{userId}
</if>
<if test="citySet != null ">
and d.city_code in
<foreach collection="citySet" item="item" index="index" open="(" separator="," close=")" >
#{item}
</foreach>
</if>
order by l.id ASC
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment