Commit a86ca16b by qwmqiuwenmin

fix

parent e088c87a
......@@ -15,6 +15,8 @@ public class DepartmentDTO implements Serializable {
private String chainId;
private String chainName;
private Integer isStore;
private Integer statusFlag;
......@@ -147,6 +149,14 @@ public class DepartmentDTO implements Serializable {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getChainName() {
return chainName;
}
public void setChainName(String chainName) {
this.chainName = chainName;
}
}
......@@ -38,6 +38,8 @@ public class StaffDTO implements Serializable{
private String headImg;
private Integer sort;
private List<DepartmentDTO> departmentList;
private static final long serialVersionUID = 1L;
......@@ -180,5 +182,13 @@ public class StaffDTO implements Serializable{
this.departmentList = departmentList;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
}
......@@ -69,5 +69,11 @@ public interface DepartmentApiService {
* @param departmentId
*/
HaobanResponse repairRecycle(String departmentId);
/**
* 获取根节点
* @param wxEnterpriseId
* @return
*/
DepartmentDTO getRootByEnterpriseId(String wxEnterpriseId);
}
......@@ -31,4 +31,6 @@ public interface DepartmentMapper {
Page<TabHaobanDepartment> pageDepartmentByParams(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("keyword")String keyword,
@Param("storeFlag")Integer storeFlag, @Param("recycleFlag")Integer recycleFlag);
TabHaobanDepartment getRootByEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId);
}
\ No newline at end of file
......@@ -14,6 +14,8 @@ public class TabHaobanDepartment implements Serializable {
private String chainId;
private String chainName;
private Integer isStore;
private Integer statusFlag;
......@@ -146,5 +148,13 @@ public class TabHaobanDepartment implements Serializable {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getChainName() {
return chainName;
}
public void setChainName(String chainName) {
this.chainName = chainName;
}
}
\ No newline at end of file
......@@ -34,6 +34,8 @@ public class TabHaobanStaff implements Serializable {
private String headImg;
private Integer sort;
private static final long serialVersionUID = 1L;
public String getStaffId() {
......@@ -156,5 +158,13 @@ public class TabHaobanStaff implements Serializable {
this.headImg = headImg;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
}
\ No newline at end of file
......@@ -26,4 +26,6 @@ public interface DepartmentService {
void repairRecycle(String departmentId);
DepartmentDTO getRootByEnterpriseId(String wxEnterpriseId);
}
......@@ -104,4 +104,10 @@ public class DepartmentServiceImpl implements DepartmentService {
}
@Override
public DepartmentDTO getRootByEnterpriseId(String wxEnterpriseId) {
TabHaobanDepartment tab = mapper.getRootByEnterpriseId(wxEnterpriseId);
return EntityUtil.changeEntityByJSON(DepartmentDTO.class, tab);
}
}
......@@ -150,4 +150,10 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
return EntityUtil.changeEntityListByJSON(DepartmentDTO.class, list);
}
@Override
public DepartmentDTO getRootByEnterpriseId(String wxEnterpriseId) {
return departmentService.getRootByEnterpriseId(wxEnterpriseId);
}
}
......@@ -7,6 +7,7 @@
<result column="parent_department_id" property="parentDepartmentId" jdbcType="VARCHAR" />
<result column="related_id" property="relatedId" jdbcType="VARCHAR" />
<result column="chain_id" property="chainId" jdbcType="VARCHAR" />
<result column="chain_name" property="chainName" jdbcType="VARCHAR" />
<result column="is_store" property="isStore" jdbcType="INTEGER" />
<result column="status_flag" property="statusFlag" jdbcType="INTEGER" />
<result column="recycle_flag" property="recycleFlag" jdbcType="INTEGER" />
......@@ -19,7 +20,7 @@
</resultMap>
<sql id="Base_Column_List" >
department_id, department_name, parent_department_id, related_id, chain_id, is_store,
status_flag, recycle_flag, create_time, update_time,wx_department_id,sort,level,wx_enterprise_id
status_flag, recycle_flag, create_time, update_time,wx_department_id,sort,level,wx_enterprise_id,chain_name
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
......@@ -35,11 +36,11 @@
insert into tab_haoban_department (department_id, department_name, parent_department_id,
related_id, chain_id, is_store,
status_flag, recycle_flag, create_time,
update_time,wx_department_id,sort,level,wx_enterprise_id)
update_time,wx_department_id,sort,level,wx_enterprise_id,chain_name)
values (#{departmentId,jdbcType=VARCHAR}, #{departmentName,jdbcType=VARCHAR}, #{parentDepartmentId,jdbcType=VARCHAR},
#{relatedId,jdbcType=VARCHAR}, #{chainId,jdbcType=VARCHAR}, #{isStore,jdbcType=INTEGER},
#{statusFlag,jdbcType=INTEGER}, #{recycleFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},#{wxDepartmentId},#{sort},#{level},#{wxEnterpriseId})
#{updateTime,jdbcType=TIMESTAMP},#{wxDepartmentId},#{sort},#{level},#{wxEnterpriseId},#{chainName})
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanDepartment" >
insert into tab_haoban_department
......@@ -59,6 +60,9 @@
<if test="chainId != null" >
chain_id,
</if>
<if test="chainName != null" >
chain_name,
</if>
<if test="isStore != null" >
is_store,
</if>
......@@ -100,6 +104,9 @@
<if test="chainId != null" >
#{chainId,jdbcType=VARCHAR},
</if>
<if test="chainName != null" >
#{chainName,jdbcType=VARCHAR},
</if>
<if test="isStore != null" >
#{isStore,jdbcType=INTEGER},
</if>
......@@ -141,6 +148,9 @@
<if test="chainId != null" >
chain_id = #{chainId,jdbcType=VARCHAR},
</if>
<if test="chainName != null" >
chain_name = #{chainName,jdbcType=VARCHAR},
</if>
<if test="isStore != null" >
is_store = #{isStore,jdbcType=INTEGER},
</if>
......@@ -177,6 +187,7 @@
parent_department_id = #{parentDepartmentId,jdbcType=VARCHAR},
related_id = #{relatedId,jdbcType=VARCHAR},
chain_id = #{chainId,jdbcType=VARCHAR},
chain_name = #{chainName,jdbcType=VARCHAR},
wx_department_id = #{wxDepartmentId,jdbcType=VARCHAR},
is_store = #{isStore,jdbcType=INTEGER},
status_flag = #{statusFlag,jdbcType=INTEGER},
......@@ -248,4 +259,12 @@
</if>
</select>
<select id="getRootByEnterpriseId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_department
where level = 0
and wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
</select>
</mapper>
\ No newline at end of file
......@@ -13,6 +13,7 @@
<result column="head_img" property="headImg" jdbcType="VARCHAR" />
<result column="postion" property="postion" jdbcType="VARCHAR" />
<result column="active_flag" property="activeFlag" jdbcType="INTEGER" />
<result column="sort" property="sort" jdbcType="INTEGER" />
<result column="extend_postion" property="extendPostion" jdbcType="VARCHAR" />
<result column="status_flag" property="statusFlag" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
......@@ -20,7 +21,7 @@
</resultMap>
<sql id="Base_Column_List" >
staff_id, wx_user_id, phone_number, staff_name, nation_code, nick_name, sex, postion,
active_flag, extend_postion, status_flag, create_time, update_time,wx_enterprise_id,head_img
active_flag, extend_postion, status_flag, create_time, update_time,wx_enterprise_id,head_img,sort
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
......@@ -37,12 +38,12 @@
staff_name, nation_code, nick_name,
sex, postion, active_flag,
extend_postion, status_flag, create_time,
update_time,wx_enterprise_id,head_img)
update_time,wx_enterprise_id,head_img,sort)
values (#{staffId,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR}, #{phoneNumber,jdbcType=VARCHAR},
#{staffName,jdbcType=VARCHAR}, #{nationCode,jdbcType=VARCHAR}, #{nickName,jdbcType=VARCHAR},
#{sex,jdbcType=INTEGER}, #{postion,jdbcType=VARCHAR}, #{activeFlag,jdbcType=INTEGER},
#{extendPostion,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},#{wxEnterpriseId},#{headImg})
#{updateTime,jdbcType=TIMESTAMP},#{wxEnterpriseId},#{headImg},#{sort})
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff" >
insert into tab_haoban_staff
......@@ -92,6 +93,9 @@
<if test="updateTime != null" >
update_time,
</if>
<if test="sort != null" >
sort,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="staffId != null" >
......@@ -139,6 +143,9 @@
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="sort != null" >
#{sort,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaff" >
......@@ -186,6 +193,9 @@
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="sort != null" >
sort = #{sort,jdbcType=INTEGER},
</if>
</set>
where staff_id = #{staffId,jdbcType=VARCHAR}
</update>
......@@ -204,7 +214,8 @@
head_img = #{headImg,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
update_time = #{updateTime,jdbcType=TIMESTAMP},
sort = #{sort}
where staff_id = #{staffId,jdbcType=VARCHAR}
</update>
......
......@@ -14,7 +14,7 @@ import com.gic.enterprise.api.dto.GicTreeDTO;
import com.gic.enterprise.api.service.StoreGroupService;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.Constant;
import com.gic.haoban.common.utils.AuthRequestUtil;
import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService;
......@@ -33,7 +33,15 @@ public class DepartmentContoller extends WebBaseController{
@RequestMapping("department-list")
public HaobanResponse departmentList(String parentId) {
LoginVO login = (LoginVO) AuthRequestUtil.getAppLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId();
List<DepartmentDTO> list = departmentApiService.listByParentId(parentId);
if(StringUtils.isNotBlank(parentId)) {
list = departmentApiService.listByParentId(parentId);
}else {
DepartmentDTO dto = departmentApiService.getRootByEnterpriseId(wxEnterpriseId);
list.add(dto);
}
return resultResponse(HaoBanErrCode.ERR_1,list);
......@@ -122,6 +130,7 @@ public class DepartmentContoller extends WebBaseController{
department.setWxDepartmentId(dto.getWxDepartmentId());
department.setDepartmentName(departmentAddQO.getDepartmentName());
department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId());
department.setChainName(dto.getChainName() + Constant.NAME_SEPARATOR + dto.getDepartmentName());
department.setIsStore(0);
department.setIsStore(departmentAddQO.getStoreFlag());
department.setLevel(dto.getLevel() + 1);
......@@ -150,7 +159,10 @@ public class DepartmentContoller extends WebBaseController{
department.setParentDepartmentId(parentId);
department.setDepartmentName(departmentQO.getDepartmentName());
department.setChainId(parent.getChainId() + Constant.ID_SEPARATOR + parent.getDepartmentId());
department.setChainName(parent.getChainName() + Constant.NAME_SEPARATOR + parent.getDepartmentName());
department.setLevel(parent.getLevel() + 1);
handerSonDepartment(departmentQO.getCurrDepartment());
HaobanResponse hr = departmentApiService.edit(department);
}
......@@ -176,6 +188,25 @@ public class DepartmentContoller extends WebBaseController{
}
/**
* 修改子孙部门
* @param departmentId
*/
private void handerSonDepartment(String departmentId) {
DepartmentDTO department = departmentApiService.selectById(departmentId);
List<DepartmentDTO> list = departmentApiService.listByParentId(departmentId);
if(!list.isEmpty()) {
for (DepartmentDTO departmentDTO : list) {
departmentDTO.setChainId(department.getChainId() + Constant.ID_SEPARATOR + department.getDepartmentId());
departmentDTO.setChainName(department.getChainName() + Constant.NAME_SEPARATOR + department.getDepartmentName());
departmentDTO.setLevel(department.getLevel());
departmentApiService.edit(departmentDTO);
}
}
}
@RequestMapping("unbind-department-list")
public HaobanResponse unbindDepartmentList(String departmentId,String enterpriseId,Integer type) {
List<String> list = new ArrayList<String>();
......@@ -221,7 +252,11 @@ public class DepartmentContoller extends WebBaseController{
}
/**
* 处理子节点
* @param sonDepartment
* @param parentId
*/
private void handler(String sonDepartment, String parentId) {
if(StringUtils.isNotBlank(sonDepartment)) {
List<DepartmentAddQO> list = JSONArray.parseArray(sonDepartment, DepartmentAddQO.class);
......@@ -243,6 +278,7 @@ public class DepartmentContoller extends WebBaseController{
department.setWxEnterpriseId(dto.getWxEnterpriseId());
department.setDepartmentName(departmentAddQO.getDepartmentName());
department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId());
department.setChainName(dto.getChainName() + Constant.NAME_SEPARATOR + dto.getDepartmentName());
department.setIsStore(0);
department.setIsStore(departmentAddQO.getStoreFlag());
department.setLevel(dto.getLevel() + 1);
......@@ -263,6 +299,7 @@ public class DepartmentContoller extends WebBaseController{
department.setParentDepartmentId(parentId);
department.setDepartmentName(departmentAddQO.getDepartmentName());
department.setChainId(dto.getChainId() + Constant.ID_SEPARATOR + dto.getDepartmentId());
department.setChainName(dto.getChainName() + Constant.NAME_SEPARATOR + dto.getDepartmentName());
HaobanResponse hr = departmentApiService.edit(department);
if(hr.getErrorCode() != 1) {
continue;
......
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