产品类型
parent
c9b8f214b0
commit
13b0f99443
|
|
@ -5,3 +5,4 @@
|
|||
/**/.DS_Store
|
||||
/**/.back*
|
||||
db-model/*/
|
||||
接口文档
|
||||
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
Loading…
Reference in New Issue