品类错误修改
This commit is contained in:
@ -49,4 +49,8 @@ public interface CoscoCategoryConstant {
|
||||
* 锁定类型(0.未锁定、1.锁定)
|
||||
*/
|
||||
public static final Long LOCK_TYPE_YES = 1L;
|
||||
/**
|
||||
* 最高级 0
|
||||
*/
|
||||
public static final String LEVEL_TOP = "0";
|
||||
}
|
||||
|
@ -16,4 +16,8 @@ public interface ErrorMessageConstant {
|
||||
* "请选择上级品类"
|
||||
*/
|
||||
public static final String PLEASE_SELECT_SUPERIOR_CATEGORY = "请选择上级品类";
|
||||
/**
|
||||
* "请选择正确的父级分类"
|
||||
*/
|
||||
public static final String PLEASE_SELECT_THE_CORRECT_PARENT_CATEGORY = "请选择正确的父级分类";
|
||||
}
|
||||
|
@ -70,9 +70,9 @@ public class CoscoCategoryController extends BaseController {
|
||||
* 新增品类库_品类
|
||||
*/
|
||||
@PostMapping
|
||||
public BaseResponse<Integer> add(@RequestBody CoscoCategory coscoCategory) {
|
||||
public BaseResponse add(@RequestBody CoscoCategory coscoCategory) {
|
||||
if(coscoCategory.getParentId()==null){
|
||||
BaseResponse.fail(ErrorMessageConstant.PLEASE_SELECT_SUPERIOR_CATEGORY);
|
||||
return BaseResponse.fail(ErrorMessageConstant.PLEASE_SELECT_SUPERIOR_CATEGORY);
|
||||
}
|
||||
return BaseResponse.success(coscoCategoryService.insertCoscoCategory(coscoCategory));
|
||||
}
|
||||
|
@ -68,9 +68,6 @@
|
||||
<if test="orderBy != null ">
|
||||
and cc.order_by = #{orderBy}
|
||||
</if>
|
||||
<if test="ancestors != null and ancestors != ''">
|
||||
and cc.ancestors = #{ancestors}
|
||||
</if>
|
||||
<if test="lastUpdateTime != null ">
|
||||
and cc.last_update_time = #{lastUpdateTime}
|
||||
</if>
|
||||
@ -103,6 +100,19 @@
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectCategoryNameById" parameterType="string" resultType="string">
|
||||
SELECT
|
||||
GROUP_CONCAT(c2.category_name ORDER BY FIND_IN_SET(c2.id, CONCAT(c1.ancestors, ',', c1.id)) SEPARATOR '-') AS full_path
|
||||
FROM
|
||||
cosco_category c1
|
||||
JOIN
|
||||
cosco_category c2
|
||||
ON
|
||||
FIND_IN_SET(c2.id, CONCAT(c1.ancestors, ',', c1.id))
|
||||
WHERE
|
||||
c1.id = #{id};
|
||||
</select>
|
||||
|
||||
<insert id="insertCoscoCategory"
|
||||
parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategory">
|
||||
insert into cosco_category
|
||||
|
@ -46,7 +46,7 @@ public class CoscoCategory extends CoscoBaseEntity {
|
||||
/**
|
||||
* 祖级节点数组(包含本级)
|
||||
*/
|
||||
private String ancestors;
|
||||
private String ancestors="0";
|
||||
|
||||
/**
|
||||
* 删除标识(normal.正常、deleted.已删除)
|
||||
|
@ -83,4 +83,11 @@ public interface ICoscoCategoryService extends IBaseService<CoscoCategory> {
|
||||
* @return
|
||||
*/
|
||||
List<CoscoCategoryVO> selectCategoryTreeNoSuperior(CoscoCategory coscoCategory);
|
||||
|
||||
/**
|
||||
* 获取所有级别名称
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
String getCategoryNameById(String id);
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl;
|
||||
import com.chinaunicom.mall.ebtp.common.util.PropertyUtils;
|
||||
import com.chinaunicom.zyhy.ebtp.supplier.base.constant.CoscoCategoryConstant;
|
||||
import com.chinaunicom.zyhy.ebtp.supplier.base.constant.ErrorMessageConstant;
|
||||
import com.chinaunicom.zyhy.ebtp.supplier.base.constant.SupplierUserConstant;
|
||||
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.dao.*;
|
||||
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategory;
|
||||
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.service.ICoscoCategoryService;
|
||||
@ -63,17 +65,15 @@ public class CoscoCategoryServiceImpl extends BaseServiceImpl<CoscoCategoryMappe
|
||||
@Override
|
||||
public int insertCoscoCategory(CoscoCategory coscoCategory) {
|
||||
coscoCategory.setId(PropertyUtils.getSnowflakeId());
|
||||
if (!coscoCategory.getParentId().equals("0")) {
|
||||
if (!coscoCategory.getParentId().equals(CoscoCategoryConstant.LEVEL_TOP)) {
|
||||
CoscoCategory coscoCategory1 = coscoCategoryMapper.selectCoscoCategoryById(coscoCategory.getParentId());
|
||||
if (coscoCategory1.getType().equals(1L)) {
|
||||
throw new RuntimeException("请选择正确的父级分类");
|
||||
throw new RuntimeException(ErrorMessageConstant.ENABLE_DISABLE_TEMPLATE_NOT_MODIFY);
|
||||
}
|
||||
coscoCategory.setAncestors(coscoCategory1.getAncestors() + "," + coscoCategory.getId());
|
||||
} else {
|
||||
coscoCategory.setAncestors("0");
|
||||
}
|
||||
coscoCategory.setCreateTime(new Date());
|
||||
coscoCategory.setCreateBy("1");
|
||||
coscoCategory.setCreateBy(SupplierUserConstant.USER_NAME);
|
||||
coscoCategory.setDelFlag(CoscoCategoryConstant.DELETE_FLAG_YES);
|
||||
return coscoCategoryMapper.insertCoscoCategory(coscoCategory);
|
||||
}
|
||||
@ -141,6 +141,16 @@ public class CoscoCategoryServiceImpl extends BaseServiceImpl<CoscoCategoryMappe
|
||||
return selectCategoryTree(coscoCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有级别名称
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getCategoryNameById(String id) {
|
||||
return coscoCategoryMapper.selectCategoryNameById(id);
|
||||
}
|
||||
|
||||
private List<CoscoCategoryVO> buildTree(List<CoscoCategoryVO> categories) {
|
||||
// 获取所有顶级节点 (parentId = "0")
|
||||
List<CoscoCategoryVO> rootNodes = categories.stream()
|
||||
|
@ -351,6 +351,12 @@
|
||||
cet.end_time as endTime,
|
||||
cet.status,
|
||||
cet.dept_id as deptId,
|
||||
cet.approve_status as approveStatus,
|
||||
case
|
||||
when cet.approve_status = 0 then '审批中'
|
||||
when cet.approve_status = 1 then '通过'
|
||||
when cet.approve_status = 2 then '驳回'
|
||||
else '未审批' end as approveName,
|
||||
case
|
||||
when cet.status = 0 then '待评价'
|
||||
when cet.status = 1 then '评价中'
|
||||
|
@ -47,6 +47,13 @@ public class TaskPageVo implements Serializable {
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
private String approveStatus;
|
||||
|
||||
/**
|
||||
* 审核名称
|
||||
*/
|
||||
private String approveName;
|
||||
|
||||
@ApiModelProperty(value = "分页对象信息")
|
||||
private BasePageRequest basePageRequest;
|
||||
|
||||
|
Reference in New Issue
Block a user