分页查询组织架构
This commit is contained in:
parent
1c1c4b9b59
commit
c3974f79b0
|
|
@ -0,0 +1,119 @@
|
|||
package com.bonus.canteen.core.customer.controller;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bonus.canteen.core.common.base.BaseController;
|
||||
import com.bonus.canteen.core.customer.dto.CustOrgPageDTO;
|
||||
import com.bonus.canteen.core.customer.service.CustOrgService;
|
||||
import com.bonus.canteen.core.customer.vo.CustOrgVO;
|
||||
import com.bonus.common.houqin.utils.AesEncryptUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping({"/custOrg"})
|
||||
@Api("customer-组织机构(部门)控制器")
|
||||
public class CustOrgController extends BaseController {
|
||||
private static final Logger log = LoggerFactory.getLogger(CustOrgController.class);
|
||||
@Autowired
|
||||
@Lazy
|
||||
private CustOrgService custOrgService;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private AesEncryptUtil aesEncryptUtil;
|
||||
|
||||
@ApiOperation("分页查询组织")
|
||||
@PostMapping({"/queryPageCustOrg"})
|
||||
public Page<CustOrgVO> queryPageCustOrg(@RequestBody CustOrgPageDTO content) {
|
||||
Page<CustOrgVO> custOrgVOPage = this.custOrgService.pageCustOrgByParams(new Page(content.getCurrent(), content.getSize()), content);
|
||||
Iterator var4 = custOrgVOPage.getRecords().iterator();
|
||||
|
||||
while(var4.hasNext()) {
|
||||
CustOrgVO custOrgVO = (CustOrgVO)var4.next();
|
||||
custOrgVO.setOrgTel(this.aesEncryptUtil.aesEncrypt(custOrgVO.getOrgTel()));
|
||||
}
|
||||
|
||||
return custOrgVOPage;
|
||||
}
|
||||
|
||||
|
||||
// @RequiresGuest
|
||||
// @ApiOperation("根据id查询组织")
|
||||
// @GetMapping({"/queryCustOrgById"})
|
||||
// public CustOrg queryCustOrgById(LeRequest<String> request) {
|
||||
// Map<String, JSONObject> contentMap = (Map)this.gson.fromJson((String)request.getContent(), Map.class);
|
||||
// return this.custOrgService.getCustOrg(((JSONObject)contentMap.get("object")).getLong("id"));
|
||||
// }
|
||||
//
|
||||
// @RequiresPermissions({"cust:org:add"})
|
||||
// @RequiresAuthentication
|
||||
// @ApiOperation("新增")
|
||||
// @PostMapping({"/addCustOrg"})
|
||||
// public void addCustOrg(@Validated({ValidationGroups.Insert.class}) @RequestBody LeRequest<CustOrg> request) {
|
||||
// CustOrg content = (CustOrg)request.getContent();
|
||||
// content.setOrgTel(this.aesEncryptUtil.aesDecode(content.getOrgTel()));
|
||||
// this.custOrgService.addCustOrg(content);
|
||||
// }
|
||||
//
|
||||
// @RequiresPermissions({"cust:org:edit"})
|
||||
// @ApiOperation("根据id修改")
|
||||
// @PutMapping({"/updateCustOrgById"})
|
||||
// @RequiresAuthentication
|
||||
// public void updateCustOrgById(@Validated({ValidationGroups.Update.class}) @RequestBody LeRequest<CustOrg> request) {
|
||||
// CustOrg content = (CustOrg)request.getContent();
|
||||
// content.setOrgTel(this.aesEncryptUtil.aesDecode(content.getOrgTel()));
|
||||
// this.custOrgService.updateOrg(content);
|
||||
// }
|
||||
//
|
||||
// @RequiresPermissions({"cust:org:del"})
|
||||
// @ApiOperation("根据组织id删除")
|
||||
// @DeleteMapping({"/deleteCustOrgByOrgId"})
|
||||
// @RequiresAuthentication
|
||||
// public void deleteCustOrgByOrgId(@Validated({ValidationGroups.Delete.class}) @RequestBody LeRequest<CustOrg> request) {
|
||||
// this.custOrgService.deleteByOrdId(((CustOrg)request.getContent()).getOrgId());
|
||||
// }
|
||||
//
|
||||
// @ApiOperation("系统组织树")
|
||||
// @GetMapping({"/system/tree"})
|
||||
// @RequiresGuest
|
||||
// public List<Tree<Long>> getSystemOrgTree() {
|
||||
// return this.custOrgService.getSystemOrgTree();
|
||||
// }
|
||||
//
|
||||
// @ApiOperation("商户权限组织树")
|
||||
// @GetMapping({"/tenant/tree"})
|
||||
// @RequiresAuthentication
|
||||
// public List<Tree<Long>> getTenantOrgTree() {
|
||||
// return this.custOrgService.getTenantOrgTree();
|
||||
// }
|
||||
//
|
||||
// @ApiOperation("查询组织下默认就餐地")
|
||||
// @GetMapping({"/query/diningPlace"})
|
||||
// @RequiresGuest
|
||||
// @RequiresAuthentication
|
||||
// public JsonNode queryDiningPlace(@RequestParam("orgId") Long orgId) {
|
||||
// return this.custOrgService.queryDiningPlaceByOrgId(orgId);
|
||||
// }
|
||||
//
|
||||
// @ApiOperation("根据superId查询懒加载子级组织树")
|
||||
// @PostMapping({"/lazy/org/tree"})
|
||||
// public List<CustOrgVO> getPlaceLazyTree(@RequestBody LeRequest<CustOrgTreeDTO> request) {
|
||||
// return this.custOrgService.getOrgLazyTree((CustOrgTreeDTO)request.getContent());
|
||||
// }
|
||||
//
|
||||
// @ApiOperation("组织树同层级拖动排序")
|
||||
// @PostMapping({"/dragOrgSort"})
|
||||
// public void dragOrgSort(@RequestBody LeRequest<CustOrgTreeDTO> request) {
|
||||
// this.custOrgService.dragOrgSort((CustOrgTreeDTO)request.getContent());
|
||||
// }
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ import com.bonus.canteen.core.customer.dto.CustInfoDTO;
|
|||
import com.bonus.canteen.core.customer.dto.CustInfoParam;
|
||||
import com.bonus.canteen.core.customer.dto.CustPayDTO;
|
||||
import com.bonus.canteen.core.customer.model.CustInfo;
|
||||
import com.bonus.canteen.core.customer.po.CustomerNumByOrgIdMapperPO;
|
||||
import com.bonus.canteen.core.customer.vo.CustInfoForRechargeVO;
|
||||
import com.bonus.canteen.core.customer.vo.CustInfoVo;
|
||||
import com.bonus.canteen.core.customer.vo.CustPayVO;
|
||||
|
|
@ -17,6 +18,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
|
|
@ -61,6 +63,8 @@ public interface CustInfoMapper extends BaseMapper<CustInfo> {
|
|||
|
||||
int updateCustCasual(CustCasual custCasual);
|
||||
|
||||
List<CustomerNumByOrgIdMapperPO> getCustomerNumByOrgIdList(@Param("orgIdList") Collection<Long> orgIdList);
|
||||
|
||||
@LeNiuDataPermission(
|
||||
alias = "ci",
|
||||
permissionType = DataPermissionTypeEnum.PERMISSION_ORG
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package com.bonus.canteen.core.customer.po;
|
||||
|
||||
public class CustomerNumByOrgIdMapperPO {
|
||||
private Long orgId;
|
||||
private Integer customerNum;
|
||||
|
||||
public Long getOrgId() {
|
||||
return this.orgId;
|
||||
}
|
||||
|
||||
public Integer getCustomerNum() {
|
||||
return this.customerNum;
|
||||
}
|
||||
|
||||
public void setOrgId(final Long orgId) {
|
||||
this.orgId = orgId;
|
||||
}
|
||||
|
||||
public void setCustomerNum(final Integer customerNum) {
|
||||
this.customerNum = customerNum;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bonus.canteen.core.customer.constants.*;
|
||||
import com.bonus.canteen.core.customer.po.CustomerNumByOrgIdMapperPO;
|
||||
import com.bonus.canteen.core.customer.vo.PageCustInfoPhotoVO;
|
||||
import com.bonus.common.core.constant.CacheConstants;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
|
|
@ -466,7 +467,8 @@ public class CustInfoServiceImpl extends ServiceImpl<CustInfoMapper, CustInfo> i
|
|||
|
||||
@Override
|
||||
public Map<Long, Integer> getCustomerNumBelongOrg() {
|
||||
return null;
|
||||
List<CustomerNumByOrgIdMapperPO> customerNumByOrgIdList = ((CustInfoMapper)this.baseMapper).getCustomerNumByOrgIdList((Collection)null);
|
||||
return (Map)(CollUtil.isEmpty(customerNumByOrgIdList) ? new HashMap() : (Map)customerNumByOrgIdList.stream().collect(Collectors.toMap(CustomerNumByOrgIdMapperPO::getOrgId, CustomerNumByOrgIdMapperPO::getCustomerNum)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -246,6 +246,24 @@
|
|||
where casual_id = #{casualId}
|
||||
</update>
|
||||
|
||||
<select id="getCustomerNumByOrgIdList" resultType="com.bonus.canteen.core.customer.po.CustomerNumByOrgIdMapperPO">
|
||||
SELECT
|
||||
org_id,
|
||||
COUNT(*) customerNum
|
||||
FROM
|
||||
cust_info
|
||||
<where>
|
||||
cust_state = 1
|
||||
<if test="orgIdList != null and orgIdList.size() > 0">
|
||||
AND org_id in
|
||||
<foreach collection="orgIdList" item="orgId" separator="," open="(" close=")">
|
||||
#{orgId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY org_id
|
||||
</select>
|
||||
|
||||
<select id="pageCustInfoPhoto" resultType="com.bonus.canteen.core.customer.vo.PageCustInfoPhotoVO"
|
||||
parameterType="com.bonus.canteen.core.customer.dto.CustInfoParam">
|
||||
SELECT
|
||||
|
|
|
|||
Loading…
Reference in New Issue