产品类型

localizer
ljw 2025-09-19 18:04:39 +08:00
parent c9b8f214b0
commit 13b0f99443
6 changed files with 107 additions and 9 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
/**/.DS_Store
/**/.back*
db-model/*/
接口文档

View File

@ -57,6 +57,15 @@ public class GoodsCategoryController {
return R.success(goodsCategoryService.detail(id));
}
/**
* /
*/
@GetMapping("/enable")
public R<?> enable(@RequestParam Long id, @RequestParam Boolean enable) {
goodsCategoryService.enable(id, enable);
return R.success();
}
/**
*
*/

View File

@ -1,8 +1,10 @@
package com.njzscloud.supervisory.goods.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njzscloud.supervisory.goods.pojo.entity.GoodsCategoryEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
*
@ -10,4 +12,9 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface GoodsCategoryMapper extends BaseMapper<GoodsCategoryEntity> {
/**
*
*/
IPage<GoodsCategoryEntity> pagingWithStationName(IPage<GoodsCategoryEntity> page, @Param("entity") GoodsCategoryEntity entity);
}

View File

@ -69,4 +69,32 @@ public class GoodsCategoryEntity {
@TableLogic
private Boolean deleted;
/**
* 0--> 1-->
*/
private Boolean enable;
/**
* 0--> 1-->
*/
private Boolean inventoryType;
/**
* 0--> 1-->
*/
private Boolean businessType;
/**
*
*/
private Integer weight;
/**
* id
*/
private String stationId;
@TableField(exist = false)
private String stationName;
}

View File

@ -1,15 +1,14 @@
package com.njzscloud.supervisory.goods.service;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.supervisory.biz.pojo.entity.BizDriverEntity;
import com.njzscloud.supervisory.biz.pojo.entity.BizCompanyEntity;
import com.njzscloud.supervisory.biz.service.BizCompanyService;
import com.njzscloud.supervisory.goods.mapper.GoodsCategoryMapper;
import com.njzscloud.supervisory.goods.pojo.entity.GoodsCategoryEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -20,12 +19,16 @@ import java.util.List;
*/
@Slf4j
@Service
public class GoodsCategoryService extends ServiceImpl<GoodsCategoryMapper, GoodsCategoryEntity> implements IService<GoodsCategoryEntity> {
public class GoodsCategoryService extends ServiceImpl<GoodsCategoryMapper, GoodsCategoryEntity> {
@Autowired
private BizCompanyService bizCompanyService;
/**
*
*/
public void add(GoodsCategoryEntity goodsCategoryEntity) {
goodsCategoryEntity.setEnable(true);
this.save(goodsCategoryEntity);
}
@ -48,16 +51,31 @@ public class GoodsCategoryService extends ServiceImpl<GoodsCategoryMapper, Goods
*
*/
public GoodsCategoryEntity detail(Long id) {
return this.getById(id);
GoodsCategoryEntity entity = this.getById(id);
if (null != entity) {
BizCompanyEntity companyEntity = bizCompanyService.getById(entity.getStationId());
if (null != companyEntity) {
entity.setStationName(companyEntity.getCompanyName());
}
}
return entity;
}
/**
*
*/
public PageResult<GoodsCategoryEntity> paging(PageParam pageParam, GoodsCategoryEntity goodsCategoryEntity) {
return PageResult.of(this.page(pageParam.toPage(), Wrappers.<GoodsCategoryEntity>lambdaQuery()
.like(StrUtil.isNotBlank(goodsCategoryEntity.getCategoryName()), GoodsCategoryEntity::getCategoryName,
goodsCategoryEntity.getCategoryName())));
return PageResult.of(this.baseMapper.pagingWithStationName(pageParam.toPage(), goodsCategoryEntity));
}
/**
* /
*/
public void enable(Long id, Boolean enable) {
GoodsCategoryEntity entity = new GoodsCategoryEntity();
entity.setId(id);
entity.setEnable(enable);
this.updateById(entity);
}
}

View File

@ -3,4 +3,39 @@
<mapper namespace="com.njzscloud.supervisory.goods.mapper.GoodsCategoryMapper">
<select id="pagingWithStationName" resultType="com.njzscloud.supervisory.goods.pojo.entity.GoodsCategoryEntity">
SELECT
gc.id,
gc.category_name,
gc.picture,
gc.sort,
gc.creator_id,
gc.modifier_id,
gc.create_time,
gc.modify_time,
gc.deleted,
gc.enable,
gc.inventory_type,
gc.business_type,
gc.weight,
gc.station_id,
bc.company_name as station_name
FROM goods_category gc
LEFT JOIN biz_company bc ON gc.station_id = bc.id AND bc.station = 1 AND bc.deleted = 0
WHERE gc.deleted = 0
<if test="entity.categoryName != null and entity.categoryName != ''">
AND gc.category_name LIKE CONCAT('%', #{entity.categoryName}, '%')
</if>
<if test="entity.enable != null">
AND gc.enable = #{entity.enable}
</if>
<if test="entity.inventoryType != null">
AND gc.inventory_type = #{entity.inventoryType}
</if>
<if test="entity.businessType != null">
AND gc.business_type = #{entity.businessType}
</if>
ORDER BY gc.sort ASC, gc.create_time DESC
</select>
</mapper>