Commit 8248b4d8 by huang

111

parent b2067254
......@@ -11,6 +11,12 @@ public interface DepartmentApiService {
List<DepartmentDTO> listByParentId(String parentId);
/**
* 查门店/部门列表
* @param parentId
* @return
*/
List<DepartmentDTO> listByDepartmentIds(List<String> departmentIds,int storeFlag);
/**
* 根据部门id查询部门
* @param departmentId
* @return
......
......@@ -8,6 +8,8 @@ public interface StaffDepartmentRelatedApiService {
List<StaffDepartmentRelatedDTO> listByDepartmentId(String departmentId);
List<StaffDepartmentRelatedDTO> listByStaffId(String staffId);
void updateById(StaffDepartmentRelatedDTO dto);
StaffDepartmentRelatedDTO getOneByClerkCode(String clerkCode);
......
......@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.dao.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.xpath.operations.Bool;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.github.pagehelper.Page;
......@@ -25,7 +26,9 @@ public interface DepartmentMapper {
int selectMaxSort(@Param("parentDepartmentId")String parentDepartmentId);
TabHaobanDepartment selectByRelatedId(@Param("relatedId")String relatedId);
List<TabHaobanDepartment> listByDepartmentIds(@Param("departmentIds")List<String> departmentIds,@Param("storeFlag")int storeFlag);
Page<TabHaobanDepartment> pageDepartmentByParams(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("keyword")String keyword,
@Param("storeFlag")Integer storeFlag, @Param("recycleFlag")Integer recycleFlag);
}
\ No newline at end of file
......@@ -26,6 +26,6 @@ public interface StaffDepartmentRelatedMapper {
void deleteCode(StaffDepartmentRelatedDTO dto);
List<TabHaobanStaffDepartmentRelated> listStaffDepartmentByStaffId(String staffId);
Page<TabHaobanStaffDepartmentRelated> pageStaff(String departmentId, Integer activeFlag, String keyword);
}
\ No newline at end of file
package com.gic.haoban.manage.service.service.out.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -15,6 +16,7 @@ import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.service.dao.mapper.DepartmentMapper;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.service.DepartmentService;
......@@ -28,7 +30,10 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
private DepartmentService departmentService;
@Autowired
private StaffDepartmentRelatedService staffDepartmentService;
@Autowired
private DepartmentMapper departmentMapper;
@Override
public List<DepartmentDTO> listByParentId(String parentId) {
List<TabHaobanDepartment> list = departmentService.listByParentId(parentId);
......@@ -135,4 +140,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
}
@Override
public List<DepartmentDTO> listByDepartmentIds(List<String> departmentIds,
int storeFlag) {
List<TabHaobanDepartment> list= departmentMapper.listByDepartmentIds(departmentIds, storeFlag);
if(list==null){
return new ArrayList<DepartmentDTO>();
}
return EntityUtil.changeEntityListByJSON(DepartmentDTO.class, list);
}
}
package com.gic.haoban.manage.service.service.out.impl;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import cn.hutool.core.collection.CollectionUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.api.dto.ApplicationDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
......@@ -52,6 +55,16 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
return dto;
}
@Override
public List<StaffDepartmentRelatedDTO> listByStaffId(String staffId) {
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedMapper.listStaffDepartmentByStaffId(staffId);
if(CollectionUtil.isEmpty(list)){
return new ArrayList<StaffDepartmentRelatedDTO>();
}
List<StaffDepartmentRelatedDTO> resultList = EntityUtil.changeEntityListByJSON(StaffDepartmentRelatedDTO.class, list);
return resultList;
}
}
......@@ -233,4 +233,19 @@
and department_id = #{departmentId}
</if>
</select>
<select id="listByDepartmentIds" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where status_flag = 1
and is_store = #{storeFlag,jdbcType=INTEGER}
<if test="staffIds != null and staffIds.size() > 0">
and department_id IN
<foreach collection="departmentIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
package com.gic.haoban.manage.web.controller;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.hutool.core.collection.CollectionUtil;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.ClerkVo;
@RestController
public class StoreController extends WebBaseController{
@Autowired
private ClerkService clerkService;
@Autowired
private StaffApiService staffApiService;
@Autowired
private DepartmentApiService departmentApiService;
@Autowired
private StaffDepartmentRelatedApiService staffDepartmentRelatedApiService;
//门店列表
@RequestMapping("/store-list")
public HaobanResponse storeList(String staffId) {
List<DepartmentDTO> storeList = new ArrayList<DepartmentDTO>();
List<StaffDepartmentRelatedDTO> list = staffDepartmentRelatedApiService.listByStaffId(staffId);
if(CollectionUtil.isEmpty(list)){
return resultResponse(HaoBanErrCode.ERR_1,storeList);
}
List<String> departmentIds = list.stream().map(s->s.getDepartmentId()).collect(Collectors.toList());
List<DepartmentDTO> resultList = departmentApiService.listByDepartmentIds(departmentIds, 1);
return resultResponse(HaoBanErrCode.ERR_1,resultList);
}
}
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