Commit 6edbc700 authored by hezhen's avatar hezhen

修改店铺商品总数

parent 0d19de01
package com.github.wxiaoqi.security.admin.dto;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Set;
/**
* 用户信息表
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AppUserRelationDTO extends PageParam {
private String name;
private Integer userId;
private Integer parentId;
}
package com.github.wxiaoqi.security.admin.vo;
import com.github.wxiaoqi.security.admin.entity.AppUserRelation;
import lombok.Data;
import javax.persistence.Column;
/**
* 用户信息表
*/
@Data
public class AppUserRelationVo extends AppUserRelation {
private String nickname;
private String realname;
private String headimgurl;
private String username;
}
......@@ -2,12 +2,16 @@ package com.github.wxiaoqi.security.admin.biz;
import com.ace.cache.annotation.Cache;
import com.ace.cache.annotation.CacheClear;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.bo.InviteMemberBO;
import com.github.wxiaoqi.security.admin.bo.UserBo;
import com.github.wxiaoqi.security.admin.dto.AppUserRelationDTO;
import com.github.wxiaoqi.security.admin.dto.UserRelationDTO;
import com.github.wxiaoqi.security.admin.entity.*;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.admin.mapper.AppUserRelationMapper;
import com.github.wxiaoqi.security.admin.vo.AppUserRelationVo;
import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.admin.vo.InviteMemberVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
......@@ -475,5 +479,16 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper, AppUserRe
public void updateParentIdByUserId(Integer leaderId, Integer userId) {
mapper.updateParentIdByUserId(leaderId,userId, Instant.now().toEpochMilli());
}
public PageDataVO<AppUserRelationVo> selectList(AppUserRelationDTO userRelationDTO) {
PageHelper.startPage(userRelationDTO.getPage(), userRelationDTO.getLimit());
PageInfo<AppUserRelationVo> branchCompanyPageInfo = new PageInfo<>(getList(userRelationDTO));
return PageDataVO.pageInfo(branchCompanyPageInfo);
}
public List<AppUserRelationVo> getList(AppUserRelationDTO userRelationDTO){
return mapper.selectByParentId(userRelationDTO);
}
}
package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.bo.UserBo;
import com.github.wxiaoqi.security.admin.dto.AppUserRelationDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserRelation;
import com.github.wxiaoqi.security.admin.vo.AppUserRelationVo;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
......@@ -19,6 +21,9 @@ public interface AppUserRelationMapper extends Mapper<AppUserRelation> {
List<AppUserRelation> selectByLeaderId(Integer leaderId);
List<AppUserRelationVo> selectByParentId(AppUserRelationDTO userRelationDTO);
//获取有效的下级
public int countByParentId(@Param("parentId")Integer parentId,@Param("bindTime")Long bindTime);
......
package com.github.wxiaoqi.security.admin.rest.admin;
import com.github.wxiaoqi.security.admin.biz.AppUserRelationBiz;
import com.github.wxiaoqi.security.admin.dto.AppUserRelationDTO;
import com.github.wxiaoqi.security.admin.dto.UserRelationDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserRelation;
import com.github.wxiaoqi.security.admin.vo.InviteMemberVo;
import com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("relation/admin")
public class AdminUserRelationController extends BaseController<AppUserRelationBiz,AppUserRelation> {
public class
AdminUserRelationController extends BaseController<AppUserRelationBiz,AppUserRelation> {
@RequestMapping(value = "/bind",method = RequestMethod.POST)
......@@ -26,4 +33,10 @@ public class AdminUserRelationController extends BaseController<AppUserRelationB
}
@ApiOperation("用户下线")
@GetMapping("/pages")
public ObjectRestResponse<InviteMemberVo> findInviteMemberByActivitState(AppUserRelationDTO userRelationDTO) {
return ObjectRestResponse.succ(baseBiz.selectList(userRelationDTO));
}
}
\ No newline at end of file
......@@ -41,4 +41,31 @@
<select id="updateParentIdByUserId">
update `app_user_relation` set `parent_id`=#{leaderId},`upd_time`=#{updTime} where user_id=#{userId}
</select>
<select id="selectByParentId" parameterType="com.github.wxiaoqi.security.admin.dto.AppUserRelationDTO" resultType="com.github.wxiaoqi.security.admin.vo.AppUserRelationVo">
select
r.*,
d.nickname,
d.realname,
d.headimgurl,
l.username
from app_user_relation r
left join app_user_detail d on r.user_id = d.userid
left join app_user_login l on r.user_id = l.id
<where>
r.is_del = 0
<if test="parentId != null and parentId > 0">
and r.parent_id = #{parentId}
</if>
<if test="userId != null and userId > 0">
and r.user_id = #{userId}
</if>
<if test="name != null and name != '' ">
and ( d.nickname like concat('%',#{name},'%') or d.realname like concat('%',#{name},'%') )
</if>
</where>
group c.user_id
order by c.bind_time desc
</select>
</mapper>
\ No newline at end of file
......@@ -1826,6 +1826,16 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
return mapper.countByCompamyId(companyId);
}
public Long countByStatus(Integer companyId,Integer status){
Long count;
if (status != null && status == 1){
count = mapper.countByCompamyId(companyId);
}else {
count = mapper.countByManageCompamyId(companyId);
}
return count;
}
public int setState(String vehicleId,Integer state){
return mapper.setState(vehicleId,state);
}
......
......@@ -68,6 +68,9 @@ public interface VehicleMapper extends Mapper<Vehicle> {
@Select("SELECT COUNT(*) FROM vehicle WHERE is_del=0 and subordinate_branch = #{commpanyId}")
Long countByCompamyId(@Param("commpanyId") Integer commpanyId);
@Select("SELECT COUNT(*) FROM vehicle WHERE is_del=0 and manage_company_id = #{commpanyId}")
Long countByManageCompamyId(@Param("commpanyId") Integer commpanyId);
List<VehicleVO> appSelectList(VehicleFindAppDTO vehicleFindAppDTO);
......
......@@ -74,14 +74,15 @@ public class AppVehicleController extends BaseController<VehicleBiz> {
@GetMapping("app/unauth/countByCompamyId")
@ApiModelProperty("商品数量")
@IgnoreUserToken
public ObjectRestResponse countByCompamyId(@RequestParam(value = "id",defaultValue = "0") Integer id ) {
public ObjectRestResponse countByCompamyId(@RequestParam(value = "id",defaultValue = "0") Integer id ,
@RequestParam(value = "type",defaultValue = "0") Integer type) {
if (id == null || id == 0){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
id=companyIds.get(0);
}
}
return ObjectRestResponse.succ(baseBiz.countByCompanyId(id));
return ObjectRestResponse.succ(baseBiz.countByStatus(id,type));
}
......
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