提交 4b6b21af 作者: xiaowang

修复bug

上级 ef7b7a9b
......@@ -72,4 +72,8 @@ public interface LeaseGoodsDao {
void removeWareInfo(List<Integer> list);
int feignLeaseGoodsInfoByAddressId(Integer id);
int countLeaseGoodsByApp(LeaseGoodsQO param);
List<LeaseGoodsDO> listLeaseGoodsByApp(LeaseGoodsQO param);
}
......@@ -121,24 +121,36 @@ public class LeaseGoodsServiceImpl implements LeaseGoodsService {
@Override
public ResultBody leaseGoodsList(LeaseGoodsQO param, LoginSuccessDTO loginSuccessDTO) {
if (loginSuccessDTO == null || loginSuccessDTO.getRoleInfo().getSuperAdmin().equals(1)) {
// 小程序和超级管理员获取所有商品信息
return ResultBody.success(getLeaseGoodsInfo(param));
} else {
if (loginSuccessDTO != null && loginSuccessDTO.getRoleInfo().getSuperAdmin().equals(1)) {
// 超级管理员获取所有商品信息
return ResultBody.success(getLeaseGoodsInfo(param, 1));
} else if (loginSuccessDTO != null && !loginSuccessDTO.getRoleInfo().getSuperAdmin().equals(1)) {
// 非超级管理员获取自家的商品信息
param.setUserAccountId(loginSuccessDTO.getUserAccountId());
return ResultBody.success(getLeaseGoodsInfo(param));
return ResultBody.success(getLeaseGoodsInfo(param, 1));
} else {
return ResultBody.success(getLeaseGoodsInfo(param, 0));
}
}
private PageResult getLeaseGoodsInfo(LeaseGoodsQO param) {
int count = leaseGoodsDao.countLeaseGoods(param);
private PageResult getLeaseGoodsInfo(LeaseGoodsQO param, Integer type) {
int count;
if (type.equals(1)) {
count = leaseGoodsDao.countLeaseGoods(param);
} else {
count = leaseGoodsDao.countLeaseGoodsByApp(param);
}
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<LeaseGoodsDO> leaseGoodsDOList = leaseGoodsDao.listLeaseGoods(param);
List<LeaseGoodsDO> leaseGoodsDOList;
if (type.equals(1)) {
leaseGoodsDOList = leaseGoodsDao.listLeaseGoods(param);
} else {
leaseGoodsDOList = leaseGoodsDao.listLeaseGoodsByApp(param);
}
// 转成vo
List<LeaseGoodsVO> leaseGoodsVOList = leaseGoodsDOList.stream().map(LeaseGoodsDO::buildLeaseGoodsVO)
.skip(param.getPageNo()).limit(param.getPageSize()).collect(Collectors.toList());
......
......@@ -141,7 +141,10 @@
logistics_company = #{logisticsCompany},
</if>
<if test="modeOfDelivery != null">
mode_of_delivery = #{modeOfDelivery}
mode_of_delivery = #{modeOfDelivery},
</if>
<if test="showPrice != null">
show_price = #{showPrice}
</if>
</set>
where id = #{id}
......@@ -416,4 +419,72 @@
where ship_address = #{id}
or return_address = #{id}
</select>
<select id="countLeaseGoodsByApp" resultType="java.lang.Integer">
select count(*) from lease_goods
<where>
shelf_status = 1
<if test="tradeName != null and tradeName != ''">
and (trade_name LIKE CONCAT('%',#{tradeName},'%'))
</if>
<if test="productTypeId != null">
and product_type_id = #{productTypeId}
</if>
<if test="brandInfoId != null">
and brand_info_id = #{brandInfoId}
</if>
<if test="userAccountId != null">
and user_account_id = #{userAccountId}
</if>
<if test="districtCode != null and districtCode != ''">
and district_code = #{districtCode}
</if>
</where>
</select>
<select id="listLeaseGoodsByApp" resultType="com.mmc.pms.entity.lease.LeaseGoodsDO">
SELECT
lg.id,
lg.trade_name,
lg.product_type_id,
lg.shelf_status,
lg.selling_point,
lg.product_param,
lg.user_account_id,
lg.show_price,
lg.min_lease_term,
lg.max_lease_term,
lg.create_time,
lgr.id resourceId,
lgr.type,
lgr.url,
lps.cash_pledge,
lps.three_days_rental,
lps.seven_days_rental,
lps.thirty_days_rental,
lps.ninety_days_rental,
lps.max_days_rental,
lps.stock
FROM
lease_goods lg
LEFT JOIN lease_goods_resources lgr ON lgr.lease_goods_id = lg.id
LEFT JOIN lease_price_stock lps ON lps.lease_goods_id = lg.id
<where>
shelf_status = 1
<if test="tradeName != null and tradeName != ''">
and (lg.trade_name LIKE CONCAT('%',#{tradeName},'%'))
</if>
<if test="productTypeId != null">
and lg.product_type_id = #{productTypeId}
</if>
<if test="brandInfoId != null">
and lg.brand_info_id = #{brandInfoId}
</if>
<if test="userAccountId != null">
and lg.user_account_id = #{userAccountId}
</if>
<if test="districtCode != null and districtCode != ''">
and district_code = #{districtCode}
</if>
</where>
order by lg.shelf_status DESC, lg.sort DESC
</select>
</mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论