添加品类库品类选择接口
This commit is contained in:
@ -45,6 +45,14 @@ public class CoscoCategoryController extends BaseController {
|
|||||||
return BaseResponse.success(coscoCategoryService.selectCategoryTree(coscoCategory));
|
return BaseResponse.success(coscoCategoryService.selectCategoryTree(coscoCategory));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品类查询去除上级锁定列表
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/categoryTreeNoSuperior")
|
||||||
|
public BaseResponse categoryTreeNoSuperior(CoscoCategory coscoCategory) {
|
||||||
|
return BaseResponse.success(coscoCategoryService.selectCategoryTreeNoSuperior(coscoCategory));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,4 +75,5 @@ public class CoscoCategoryLibraryContainController extends BaseController {
|
|||||||
public BaseResponse lock(@RequestBody List<CoscoCategoryLibraryContain> coscoCategoryLibraryContain) {
|
public BaseResponse lock(@RequestBody List<CoscoCategoryLibraryContain> coscoCategoryLibraryContain) {
|
||||||
return BaseResponse.success(coscoCategoryLibraryContainService.updateList(coscoCategoryLibraryContain));
|
return BaseResponse.success(coscoCategoryLibraryContainService.updateList(coscoCategoryLibraryContain));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,26 +40,54 @@
|
|||||||
<select id="selectCoscoCategoryList"
|
<select id="selectCoscoCategoryList"
|
||||||
parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategory"
|
parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategory"
|
||||||
resultMap="CoscoCategoryResult">
|
resultMap="CoscoCategoryResult">
|
||||||
<include refid="selectCoscoCategoryVo"/>
|
select cc.id,
|
||||||
|
cc.category_name,
|
||||||
|
cc.parent_id,
|
||||||
|
cc.type,
|
||||||
|
cc.order_by,
|
||||||
|
cc.ancestors,
|
||||||
|
cc.remark,
|
||||||
|
cc.del_flag,
|
||||||
|
cc.create_by,
|
||||||
|
cc.create_time,
|
||||||
|
cc.update_by,
|
||||||
|
cc.update_time,
|
||||||
|
cc.last_update_time
|
||||||
|
from cosco_category cc
|
||||||
<where>
|
<where>
|
||||||
and del_flag = 'normal'
|
and cc.del_flag = 'normal'
|
||||||
<if test="categoryName != null and categoryName != ''">
|
<if test="categoryName != null and categoryName != ''">
|
||||||
and category_name like concat('%', #{categoryName}, '%')
|
and cc.category_name like concat('%', #{categoryName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="parentId != null and parentId != ''">
|
<if test="parentId != null and parentId != ''">
|
||||||
and parent_id = #{parentId}
|
and cc.parent_id = #{parentId}
|
||||||
</if>
|
</if>
|
||||||
<if test="type != null ">
|
<if test="type != null ">
|
||||||
and type = #{type}
|
and cc.type = #{type}
|
||||||
</if>
|
</if>
|
||||||
<if test="orderBy != null ">
|
<if test="orderBy != null ">
|
||||||
and order_by = #{orderBy}
|
and cc.order_by = #{orderBy}
|
||||||
</if>
|
</if>
|
||||||
<if test="ancestors != null and ancestors != ''">
|
<if test="ancestors != null and ancestors != ''">
|
||||||
and ancestors = #{ancestors}
|
and cc.ancestors = #{ancestors}
|
||||||
</if>
|
</if>
|
||||||
<if test="lastUpdateTime != null ">
|
<if test="lastUpdateTime != null ">
|
||||||
and last_update_time = #{lastUpdateTime}
|
and cc.last_update_time = #{lastUpdateTime}
|
||||||
|
</if>
|
||||||
|
<if test="deptIds!=null and deptIds.size>0">
|
||||||
|
and cc.id not in (
|
||||||
|
SELECT
|
||||||
|
cclc.category_id
|
||||||
|
FROM
|
||||||
|
cosco_category_library ccl
|
||||||
|
JOIN cosco_category_library_contain cclc on ccl.id=cclc.category_library_id
|
||||||
|
where ccl.dept_id in (
|
||||||
|
<foreach item="deptId" index="index" collection="deptIds" separator=",">
|
||||||
|
#{deptId}
|
||||||
|
</foreach>
|
||||||
|
) and ccl.approve_status=1 and cclc.lock_type=1
|
||||||
|
)
|
||||||
|
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
@ -6,6 +6,7 @@ import lombok.Data;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 品类库_品类对象 cosco_category
|
* 品类库_品类对象 cosco_category
|
||||||
@ -59,5 +60,9 @@ public class CoscoCategory extends CoscoBaseEntity {
|
|||||||
private LocalDateTime lastUpdateTime;
|
private LocalDateTime lastUpdateTime;
|
||||||
|
|
||||||
private String remark;
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 上级部门列表集合
|
||||||
|
*/
|
||||||
|
private List<String> deptIds;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -76,4 +76,11 @@ public interface ICoscoCategoryService extends IBaseService<CoscoCategory> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<CoscoCategoryVO> selectCategoryTree(CoscoCategory coscoCategory);
|
List<CoscoCategoryVO> selectCategoryTree(CoscoCategory coscoCategory);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询品类树(无上级品类)
|
||||||
|
* @param coscoCategory
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<CoscoCategoryVO> selectCategoryTreeNoSuperior(CoscoCategory coscoCategory);
|
||||||
}
|
}
|
||||||
|
@ -130,6 +130,17 @@ public class CoscoCategoryServiceImpl extends BaseServiceImpl<CoscoCategoryMappe
|
|||||||
return buildTree(cosco);
|
return buildTree(cosco);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CoscoCategoryVO> selectCategoryTreeNoSuperior(CoscoCategory coscoCategory) {
|
||||||
|
/**
|
||||||
|
* 获取全部上级部门id
|
||||||
|
*/
|
||||||
|
List<String> deptIds=new ArrayList<>();
|
||||||
|
deptIds.add("dep01");
|
||||||
|
coscoCategory.setDeptIds(deptIds);
|
||||||
|
return selectCategoryTree(coscoCategory);
|
||||||
|
}
|
||||||
|
|
||||||
private List<CoscoCategoryVO> buildTree(List<CoscoCategoryVO> categories) {
|
private List<CoscoCategoryVO> buildTree(List<CoscoCategoryVO> categories) {
|
||||||
// 获取所有顶级节点 (parentId = "0")
|
// 获取所有顶级节点 (parentId = "0")
|
||||||
List<CoscoCategoryVO> rootNodes = categories.stream()
|
List<CoscoCategoryVO> rootNodes = categories.stream()
|
||||||
|
Reference in New Issue
Block a user