品类错误修改

This commit is contained in:
YY
2025-06-27 14:43:25 +08:00
parent 22f899f6ce
commit 2707a6784a
9 changed files with 59 additions and 11 deletions

View File

@ -49,4 +49,8 @@ public interface CoscoCategoryConstant {
* 锁定类型(0.未锁定、1.锁定) * 锁定类型(0.未锁定、1.锁定)
*/ */
public static final Long LOCK_TYPE_YES = 1L; public static final Long LOCK_TYPE_YES = 1L;
/**
* 最高级 0
*/
public static final String LEVEL_TOP = "0";
} }

View File

@ -16,4 +16,8 @@ public interface ErrorMessageConstant {
* "请选择上级品类" * "请选择上级品类"
*/ */
public static final String PLEASE_SELECT_SUPERIOR_CATEGORY = "请选择上级品类"; public static final String PLEASE_SELECT_SUPERIOR_CATEGORY = "请选择上级品类";
/**
* "请选择正确的父级分类"
*/
public static final String PLEASE_SELECT_THE_CORRECT_PARENT_CATEGORY = "请选择正确的父级分类";
} }

View File

@ -70,9 +70,9 @@ public class CoscoCategoryController extends BaseController {
* 新增品类库_品类 * 新增品类库_品类
*/ */
@PostMapping @PostMapping
public BaseResponse<Integer> add(@RequestBody CoscoCategory coscoCategory) { public BaseResponse add(@RequestBody CoscoCategory coscoCategory) {
if(coscoCategory.getParentId()==null){ 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)); return BaseResponse.success(coscoCategoryService.insertCoscoCategory(coscoCategory));
} }

View File

@ -68,9 +68,6 @@
<if test="orderBy != null "> <if test="orderBy != null ">
and cc.order_by = #{orderBy} and cc.order_by = #{orderBy}
</if> </if>
<if test="ancestors != null and ancestors != ''">
and cc.ancestors = #{ancestors}
</if>
<if test="lastUpdateTime != null "> <if test="lastUpdateTime != null ">
and cc.last_update_time = #{lastUpdateTime} and cc.last_update_time = #{lastUpdateTime}
</if> </if>
@ -103,6 +100,19 @@
where id = #{id} where id = #{id}
</select> </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" <insert id="insertCoscoCategory"
parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategory"> parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategory">
insert into cosco_category insert into cosco_category

View File

@ -46,7 +46,7 @@ public class CoscoCategory extends CoscoBaseEntity {
/** /**
* 祖级节点数组(包含本级) * 祖级节点数组(包含本级)
*/ */
private String ancestors; private String ancestors="0";
/** /**
* 删除标识(normal.正常、deleted.已删除) * 删除标识(normal.正常、deleted.已删除)

View File

@ -83,4 +83,11 @@ public interface ICoscoCategoryService extends IBaseService<CoscoCategory> {
* @return * @return
*/ */
List<CoscoCategoryVO> selectCategoryTreeNoSuperior(CoscoCategory coscoCategory); List<CoscoCategoryVO> selectCategoryTreeNoSuperior(CoscoCategory coscoCategory);
/**
* 获取所有级别名称
* @param id
* @return
*/
String getCategoryNameById(String id);
} }

View File

@ -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.base.service.impl.BaseServiceImpl;
import com.chinaunicom.mall.ebtp.common.util.PropertyUtils; 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.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.dao.*;
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategory; import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.entity.CoscoCategory;
import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.service.ICoscoCategoryService; import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.service.ICoscoCategoryService;
@ -63,17 +65,15 @@ public class CoscoCategoryServiceImpl extends BaseServiceImpl<CoscoCategoryMappe
@Override @Override
public int insertCoscoCategory(CoscoCategory coscoCategory) { public int insertCoscoCategory(CoscoCategory coscoCategory) {
coscoCategory.setId(PropertyUtils.getSnowflakeId()); coscoCategory.setId(PropertyUtils.getSnowflakeId());
if (!coscoCategory.getParentId().equals("0")) { if (!coscoCategory.getParentId().equals(CoscoCategoryConstant.LEVEL_TOP)) {
CoscoCategory coscoCategory1 = coscoCategoryMapper.selectCoscoCategoryById(coscoCategory.getParentId()); CoscoCategory coscoCategory1 = coscoCategoryMapper.selectCoscoCategoryById(coscoCategory.getParentId());
if (coscoCategory1.getType().equals(1L)) { if (coscoCategory1.getType().equals(1L)) {
throw new RuntimeException("请选择正确的父级分类"); throw new RuntimeException(ErrorMessageConstant.ENABLE_DISABLE_TEMPLATE_NOT_MODIFY);
} }
coscoCategory.setAncestors(coscoCategory1.getAncestors() + "," + coscoCategory.getId()); coscoCategory.setAncestors(coscoCategory1.getAncestors() + "," + coscoCategory.getId());
} else {
coscoCategory.setAncestors("0");
} }
coscoCategory.setCreateTime(new Date()); coscoCategory.setCreateTime(new Date());
coscoCategory.setCreateBy("1"); coscoCategory.setCreateBy(SupplierUserConstant.USER_NAME);
coscoCategory.setDelFlag(CoscoCategoryConstant.DELETE_FLAG_YES); coscoCategory.setDelFlag(CoscoCategoryConstant.DELETE_FLAG_YES);
return coscoCategoryMapper.insertCoscoCategory(coscoCategory); return coscoCategoryMapper.insertCoscoCategory(coscoCategory);
} }
@ -141,6 +141,16 @@ public class CoscoCategoryServiceImpl extends BaseServiceImpl<CoscoCategoryMappe
return selectCategoryTree(coscoCategory); return selectCategoryTree(coscoCategory);
} }
/**
* 获取所有级别名称
* @param id
* @return
*/
@Override
public String getCategoryNameById(String id) {
return coscoCategoryMapper.selectCategoryNameById(id);
}
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()

View File

@ -351,6 +351,12 @@
cet.end_time as endTime, cet.end_time as endTime,
cet.status, cet.status,
cet.dept_id as deptId, 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 case
when cet.status = 0 then '待评价' when cet.status = 0 then '待评价'
when cet.status = 1 then '评价中' when cet.status = 1 then '评价中'

View File

@ -47,6 +47,13 @@ public class TaskPageVo implements Serializable {
*/ */
private String userId; private String userId;
private String approveStatus;
/**
* 审核名称
*/
private String approveName;
@ApiModelProperty(value = "分页对象信息") @ApiModelProperty(value = "分页对象信息")
private BasePageRequest basePageRequest; private BasePageRequest basePageRequest;