Commit 39fc1461 by qwmqiuwenmin

fix

parent 855fef35
...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.api.dto; ...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.api.dto;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
public class StaffDTO implements Serializable{ public class StaffDTO implements Serializable{
...@@ -36,6 +37,8 @@ public class StaffDTO implements Serializable{ ...@@ -36,6 +37,8 @@ public class StaffDTO implements Serializable{
private String departmentIds; private String departmentIds;
private String headImg; private String headImg;
private List<DepartmentDTO> departmentList;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -169,5 +172,13 @@ public class StaffDTO implements Serializable{ ...@@ -169,5 +172,13 @@ public class StaffDTO implements Serializable{
this.headImg = headImg; this.headImg = headImg;
} }
public List<DepartmentDTO> getDepartmentList() {
return departmentList;
}
public void setDepartmentList(List<DepartmentDTO> departmentList) {
this.departmentList = departmentList;
}
} }
package com.gic.haoban.manage.api.service; package com.gic.haoban.manage.api.service;
import java.util.List;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
public interface StaffApiService { public interface StaffApiService {
...@@ -11,4 +16,8 @@ public interface StaffApiService { ...@@ -11,4 +16,8 @@ public interface StaffApiService {
public HaobanResponse add(StaffDTO staff, String departmentIds); public HaobanResponse add(StaffDTO staff, String departmentIds);
public List<StaffDepartmentRelatedDTO> listStaffDepartmentByStaffId(String staffId);
public Page<StaffDTO> pageStaff(String departmentId, Integer activeFlag, String keyword, BasePageInfo pageInfo);
} }
...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.dao.mapper; ...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.dao.mapper;
import java.util.List; import java.util.List;
import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
...@@ -23,4 +24,8 @@ public interface StaffDepartmentRelatedMapper { ...@@ -23,4 +24,8 @@ public interface StaffDepartmentRelatedMapper {
TabHaobanStaffDepartmentRelated getOneByClerkCode(String clerkCode); TabHaobanStaffDepartmentRelated getOneByClerkCode(String clerkCode);
void deleteCode(StaffDepartmentRelatedDTO dto); 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.dao.mapper; package com.gic.haoban.manage.service.dao.mapper;
import java.util.Set;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.github.pagehelper.Page;
public interface StaffMapper { public interface StaffMapper {
int deleteByPrimaryKey(String staffId); int deleteByPrimaryKey(String staffId);
...@@ -16,4 +21,6 @@ public interface StaffMapper { ...@@ -16,4 +21,6 @@ public interface StaffMapper {
int updateByPrimaryKey(TabHaobanStaff record); int updateByPrimaryKey(TabHaobanStaff record);
TabHaobanStaff selectByNationcodeAndPhoneNumber(String wxEnterpriseId, String nationcode, String phoneNumber); TabHaobanStaff selectByNationcodeAndPhoneNumber(String wxEnterpriseId, String nationcode, String phoneNumber);
Page<TabHaobanStaff> pageStaff(@Param("staffIds")Set<String> staffIds, @Param("activeFlag")Integer activeFlag, @Param("keyword")String keyword);
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.service; ...@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.service;
import java.util.List; import java.util.List;
import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
...@@ -11,4 +12,7 @@ public interface StaffDepartmentRelatedService { ...@@ -11,4 +12,7 @@ public interface StaffDepartmentRelatedService {
String add(StaffDepartmentRelatedDTO related); String add(StaffDepartmentRelatedDTO related);
List<TabHaobanStaffDepartmentRelated> listStaffDepartmentByStaffId(String staffId);
} }
package com.gic.haoban.manage.service.service; package com.gic.haoban.manage.service.service;
import java.util.Set;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.github.pagehelper.Page;
public interface StaffService { public interface StaffService {
...@@ -10,4 +13,6 @@ public interface StaffService { ...@@ -10,4 +13,6 @@ public interface StaffService {
String add(TabHaobanStaff tab); String add(TabHaobanStaff tab);
Page<TabHaobanStaff> pageStaff(Set<String> staffIds, Integer activeFlag, String keyword);
} }
...@@ -7,6 +7,7 @@ import org.apache.commons.lang.StringUtils; ...@@ -7,6 +7,7 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.StringUtil; import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
...@@ -37,6 +38,12 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated ...@@ -37,6 +38,12 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated
mapper.insert(tab); mapper.insert(tab);
return related.getStaffDepartmentRelatedId(); return related.getStaffDepartmentRelatedId();
} }
@Override
public List<TabHaobanStaffDepartmentRelated> listStaffDepartmentByStaffId(String staffId) {
return mapper.listStaffDepartmentByStaffId(staffId);
}
} }
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.impl;
import java.util.Date; import java.util.Date;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -9,6 +10,7 @@ import com.gic.haoban.common.utils.StringUtil; ...@@ -9,6 +10,7 @@ import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper; import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.service.StaffService; import com.gic.haoban.manage.service.service.StaffService;
import com.github.pagehelper.Page;
@Service @Service
public class StaffServiceImpl implements StaffService { public class StaffServiceImpl implements StaffService {
...@@ -37,4 +39,10 @@ public class StaffServiceImpl implements StaffService { ...@@ -37,4 +39,10 @@ public class StaffServiceImpl implements StaffService {
return tab.getStaffId(); return tab.getStaffId();
} }
@Override
public Page<TabHaobanStaff> pageStaff(Set<String> staffIds, Integer activeFlag, String keyword) {
return mapper.pageStaff(staffIds,activeFlag,keyword);
}
} }
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService; import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import com.gic.haoban.manage.service.service.StaffService; import com.gic.haoban.manage.service.service.StaffService;
import com.github.pagehelper.PageHelper;
@Service @Service
public class StaffApiServiceImpl implements StaffApiService { public class StaffApiServiceImpl implements StaffApiService {
...@@ -64,4 +74,22 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -64,4 +74,22 @@ public class StaffApiServiceImpl implements StaffApiService {
return hr; return hr;
} }
@Override
public List<StaffDepartmentRelatedDTO> listStaffDepartmentByStaffId(String staffId) {
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listStaffDepartmentByStaffId(staffId);
return EntityUtil.changeEntityListByJSON(StaffDepartmentRelatedDTO.class, list);
}
@Override
public Page<StaffDTO> pageStaff(String departmentId, Integer activeFlag, String keyword, BasePageInfo pageInfo) {
PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize());
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listByDepartmentId(departmentId);
Set<String> staffIds = new HashSet<String>();
for (TabHaobanStaffDepartmentRelated tabHaobanStaffDepartmentRelated : list) {
staffIds.add(tabHaobanStaffDepartmentRelated.getStaffId());
}
return PageUtil.changePageHelperToCurrentPage(staffService.pageStaff(staffIds, activeFlag, keyword),StaffDTO.class);
}
} }
...@@ -229,8 +229,8 @@ ...@@ -229,8 +229,8 @@
<if test="recycleFlag != null"> <if test="recycleFlag != null">
and recycle_flag = #{recycleFlag} and recycle_flag = #{recycleFlag}
</if> </if>
<if test="storeFlag != null"> <if test="departmentId != null and departmentId != ''">
and is_store = #{storeFlag} and department_id = #{departmentId}
</if> </if>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -185,6 +185,12 @@ ...@@ -185,6 +185,12 @@
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR} where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
</update> </update>
<select id="listStaffDepartmentByStaffId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff_department_related
where staff_id = #{staffId,jdbcType=VARCHAR}
and status_flag = 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -206,4 +206,23 @@ ...@@ -206,4 +206,23 @@
and wx_enterprise_id = #{wxEnterpriseId} and wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1 and status_flag = 1
</select> </select>
<select id="pageStaff" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff
where status_flag = 1
<if test="keyword != null and keyword != ''">
and staff_name like CONCAT('%',#{keyWord},'%')
</if>
<if test="activeFlag != null">
and active_flag = #{activeFlag}
</if>
<if test="staffIds != null and staffIds.size() > 0">
and staff_id IN
<foreach collection="staffIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
package com.gic.haoban.manage.web.controller; package com.gic.haoban.manage.web.controller;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.HaobanResponse; 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.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.StaffApiService;
import com.gic.haoban.manage.web.auth.AuthRequestUtil; import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
...@@ -17,6 +25,8 @@ public class StaffController extends WebBaseController{ ...@@ -17,6 +25,8 @@ public class StaffController extends WebBaseController{
@Autowired @Autowired
private StaffApiService staffApiService; private StaffApiService staffApiService;
@Autowired
private DepartmentApiService departmentApiService;
@RequestMapping("staff-add") @RequestMapping("staff-add")
public HaobanResponse staffAdd(StaffDTO staffDTO,String departmentIds){ public HaobanResponse staffAdd(StaffDTO staffDTO,String departmentIds){
...@@ -40,9 +50,21 @@ public class StaffController extends WebBaseController{ ...@@ -40,9 +50,21 @@ public class StaffController extends WebBaseController{
@RequestMapping("staff-sel") @RequestMapping("staff-sel")
public HaobanResponse staffSel(String staffId,String staffDepartmentRelatedId){ public HaobanResponse staffSel(String staffId,String staffDepartmentRelatedId){
StaffDTO staff = staffApiService.selectById(staffId); StaffDTO staff = staffApiService.selectById(staffId);
// HaobanResponse hr = staffApiService.add(staff,departmentIds); List<StaffDepartmentRelatedDTO> list = staffApiService.listStaffDepartmentByStaffId(staffId);
List<DepartmentDTO> departmentList = new ArrayList<DepartmentDTO>();
return resultResponse(HaoBanErrCode.ERR_1); for (StaffDepartmentRelatedDTO staffDepartmentRelatedDTO : list) {
DepartmentDTO dto = departmentApiService.selectById(staffDepartmentRelatedDTO.getDepartmentId());
departmentList.add(dto);
}
staff.setDepartmentList(departmentList);
return resultResponse(HaoBanErrCode.ERR_1,staff);
}
@RequestMapping("staff-list")
public HaobanResponse staffList(String departmentId,Integer activeFlag,String keyword,BasePageInfo pageInfo){
Page<StaffDTO> page = staffApiService.pageStaff(departmentId,activeFlag,keyword,pageInfo);
return resultResponse(HaoBanErrCode.ERR_1,page);
} }
} }
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