产品详情

master
lzq 2026-01-21 14:59:48 +08:00
parent a93c0588c0
commit 9650d2144e
5 changed files with 50 additions and 42 deletions

View File

@ -58,7 +58,7 @@ public class GoodsController {
*
*/
@GetMapping("/detail")
public R<GoodsEntity> detail(@RequestParam("id") Long id) {
public R<SearchGoodsResult> detail(@RequestParam("id") Long id) {
return R.success(goodsService.detail(id));
}

View File

@ -16,6 +16,8 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public interface GoodsMapper extends BaseMapper<GoodsEntity> {
IPage<SearchGoodsResult> paging(Page<Object> page, @Param("ew") QueryWrapper<Object> ew);
SearchGoodsResult detail(@Param("ew") QueryWrapper<Object> ew);
}

View File

@ -22,7 +22,7 @@ public interface GoodsService extends IService<GoodsEntity> {
void del(List<Long> ids);
GoodsEntity detail(Long id);
SearchGoodsResult detail(Long id);
PageResult<SearchGoodsResult> paging(PageParam pageParam, GoodsEntity goodsEntity);

View File

@ -85,11 +85,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, GoodsEntity> impl
}
@Override
public GoodsEntity detail(Long id) {
GoodsEntity goodsEntity = this.getById(id);
goodsEntity.setExpenseItem(expenseItemService.getOne(Wrappers.<ExpenseItemEntity>lambdaQuery()
.eq(ExpenseItemEntity::getGoodsId, id)));
return this.getById(id);
public SearchGoodsResult detail(Long id) {
return baseMapper.detail(Wrappers.query().eq("a.id", id));
}
@Override

View File

@ -24,43 +24,52 @@
<result property="goodsScope" column="goods_scope" typeHandler="com.njzscloud.common.mp.support.handler.j.JsonTypeHandler"/>
</association>
</resultMap>
<select id="paging" resultMap="SearchGoodsResultMap">
<sql id="SearchGoodsResultSql">
SELECT a.id,
a.goods_category_id,
a.sn,
a.goods_name,
a.spec_params,
a.picture,
a.unit,
a.sort,
a.canuse,
a.memo,
a.create_time,
b.biz_type,
b.category_name,
b.picture b_picture,
b.sort b_sort,
b.create_time b_create_time,
c.id c_id,
c.expense_item_category,
c.expense_item_name,
c.expense_strategy,
c.unit c_unit,
c.tax_rate,
c.payer,
c.unit_price,
c.initial_price,
c.initial_quantity,
c.every_quantity,
c.user_scope,
c.station_scope,
c.goods_scope,
c.canuse c_canuse,
c.memo c_memo,
c.create_time c_create_time
a.goods_category_id,
a.sn,
a.goods_name,
a.spec_params,
a.picture,
a.unit,
a.sort,
a.canuse,
a.memo,
a.create_time,
b.biz_type,
b.category_name,
b.picture b_picture,
b.sort b_sort,
b.create_time b_create_time,
c.id c_id,
c.expense_item_category,
c.expense_item_name,
c.expense_strategy,
c.unit c_unit,
c.tax_rate,
c.payer,
c.unit_price,
c.initial_price,
c.initial_quantity,
c.every_quantity,
c.user_scope,
c.station_scope,
c.goods_scope,
c.canuse c_canuse,
c.memo c_memo,
c.create_time c_create_time
FROM gds_goods a
INNER JOIN gds_goods_category b ON a.goods_category_id = b.id
LEFT JOIN fin_expense_item c ON c.goods_id = a.id
INNER JOIN gds_goods_category b ON a.goods_category_id = b.id
LEFT JOIN fin_expense_item c ON c.goods_id = a.id
</sql>
<select id="paging" resultMap="SearchGoodsResultMap">
<include refid="SearchGoodsResultSql"/>
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>
</select>
<select id="detail" resultMap="SearchGoodsResultMap">
<include refid="SearchGoodsResultSql"/>
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
${ew.customSqlSegment}
</if>