29 changed files with 303 additions and 47 deletions
@ -0,0 +1,59 @@ |
|||||
|
package com.qs.serve.modules.bms.common; |
||||
|
|
||||
|
import cn.hutool.core.collection.CollUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.qs.serve.common.framework.redis.RedisService; |
||||
|
import com.qs.serve.common.util.AuthContextUtils; |
||||
|
import com.qs.serve.common.util.JsonUtil; |
||||
|
import com.qs.serve.common.util.SpringUtils; |
||||
|
import com.qs.serve.modules.bms.entity.BmsAccount; |
||||
|
import com.qs.serve.modules.bms.entity.BmsAccountUser; |
||||
|
import com.qs.serve.modules.bms.mapper.BmsAccountUserMapper; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2024/4/18 |
||||
|
*/ |
||||
|
public class BookAccountUtil { |
||||
|
|
||||
|
public static final String USER_CACHE_BOOK_PREFIX = ""; |
||||
|
|
||||
|
public static List<String> getCurrentUserAccount(){ |
||||
|
String userId = AuthContextUtils.getSysUserId(); |
||||
|
BmsAccountUserMapper mapper = SpringUtils.getBean(BmsAccountUserMapper.class); |
||||
|
List<String> bookAccList = mapper.selectList(new LambdaQueryWrapper<BmsAccountUser>() |
||||
|
.eq(BmsAccountUser::getUserId,userId)).stream().map(BmsAccountUser::getBookCode).collect(Collectors.toList()); |
||||
|
if(CollUtil.isEmpty(bookAccList)){ |
||||
|
bookAccList = new ArrayList<>(); |
||||
|
bookAccList.add("0"); |
||||
|
} |
||||
|
return bookAccList; |
||||
|
// String userId = AuthContextUtils.getSysUserId();
|
||||
|
// RedisService redisService = SpringUtils.getBean(RedisService.class);
|
||||
|
// String json = redisService.getString(USER_CACHE_BOOK_PREFIX+userId);
|
||||
|
// if(json==null){
|
||||
|
// List<String> bookAccList = new ArrayList<>();
|
||||
|
// bookAccList.add("-999");
|
||||
|
// return bookAccList;
|
||||
|
// }
|
||||
|
// return JsonUtil.jsonToList(json,String.class);
|
||||
|
} |
||||
|
|
||||
|
// public static void setCache(String userId){
|
||||
|
// RedisService redisService = SpringUtils.getBean(RedisService.class);
|
||||
|
// BmsAccountUserMapper mapper = SpringUtils.getBean(BmsAccountUserMapper.class);
|
||||
|
// List<String> bookAccList = mapper.selectList(new LambdaQueryWrapper<BmsAccountUser>()
|
||||
|
// .eq(BmsAccountUser::getUserId,userId)).stream().map(BmsAccountUser::getBookCode).collect(Collectors.toList());
|
||||
|
// if(CollUtil.isEmpty(bookAccList)){
|
||||
|
// bookAccList = new ArrayList<>();
|
||||
|
// bookAccList.add("-999");
|
||||
|
// }
|
||||
|
// String json = JsonUtil.objectToJson(bookAccList);
|
||||
|
// redisService.set(USER_CACHE_BOOK_PREFIX+userId,json);
|
||||
|
// }
|
||||
|
|
||||
|
} |
@ -0,0 +1,84 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper |
||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.qs.serve.modules.goods.mapper.GoodsCustomerPriceMapper"> |
||||
|
|
||||
|
<resultMap id="goodsCustomerPriceMap" type="com.qs.serve.modules.goods.entity.GoodsCustomerPrice" > |
||||
|
<result property="id" column="id"/> |
||||
|
<result property="supplierId" column="supplier_id"/> |
||||
|
<result property="supplierCode" column="supplier_code"/> |
||||
|
<result property="supplierName" column="supplier_name"/> |
||||
|
<result property="skuCode" column="sku_code"/> |
||||
|
<result property="skuId" column="sku_id"/> |
||||
|
<result property="skuName" column="sku_name"/> |
||||
|
<result property="skuUnit" column="sku_unit"/> |
||||
|
<result property="initPrice" column="init_price"/> |
||||
|
<result property="realPrice" column="real_price"/> |
||||
|
<result property="maker" column="maker"/> |
||||
|
<result property="makerCode" column="maker_code"/> |
||||
|
<result property="markTime" column="mark_time"/> |
||||
|
<result property="createTime" column="create_time"/> |
||||
|
<result property="createBy" column="create_by"/> |
||||
|
<result property="updateTime" column="update_time"/> |
||||
|
<result property="updateBy" column="update_by"/> |
||||
|
<result property="tenantId" column="tenant_id"/> |
||||
|
<result property="delFlag" column="del_flag"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
<sql id="goodsCustomerPriceSql"> |
||||
|
goods_customer_price.`id`, |
||||
|
goods_customer_price.`supplier_id`, |
||||
|
goods_customer_price.`supplier_code`, |
||||
|
goods_customer_price.`supplier_name`, |
||||
|
goods_customer_price.`sku_code`, |
||||
|
goods_customer_price.`sku_id`, |
||||
|
goods_customer_price.`sku_name`, |
||||
|
goods_customer_price.`sku_unit`, |
||||
|
goods_customer_price.`init_price`, |
||||
|
goods_customer_price.`real_price`, |
||||
|
goods_customer_price.`maker`, |
||||
|
goods_customer_price.`maker_code`, |
||||
|
goods_customer_price.`mark_time` </sql> |
||||
|
|
||||
|
<select id="selectGoodsCustomerPriceList" parameterType="com.qs.serve.modules.goods.entity.GoodsCustomerPrice" resultMap="goodsCustomerPriceMap"> |
||||
|
SELECT <include refid="goodsCustomerPriceSql"/>, |
||||
|
goods_sku.book_belong, |
||||
|
goods_sku.book_name |
||||
|
FROM `goods_customer_price` `goods_customer_price` |
||||
|
left join goods_sku on goods_customer_price.sku_id = goods_sku.id |
||||
|
<where> |
||||
|
and goods_sku.del_flag = 0 |
||||
|
and `goods_customer_price`.`del_flag` = 0 |
||||
|
<if test="query.id != null"> and `goods_customer_price`.`id` = #{query.id}</if> |
||||
|
<if test="query.supplierId != null"> and `goods_customer_price`.`supplier_id` = #{query.supplierId}</if> |
||||
|
<if test="query.supplierCode != null"> and `goods_customer_price`.`supplier_code` = #{query.supplierCode}</if> |
||||
|
<if test="query.supplierName != null and query.supplierName != ''"> and `goods_customer_price`.`supplier_name` = #{query.supplierName}</if> |
||||
|
<if test="query.skuCode != null and query.skuCode != ''"> and `goods_customer_price`.`sku_code` = #{query.skuCode}</if> |
||||
|
<if test="query.skuId != null and query.skuId != ''"> and `goods_customer_price`.`sku_id` = #{query.skuId}</if> |
||||
|
<if test="query.skuName != null and query.skuName != ''"> and `goods_customer_price`.`sku_name` = #{query.skuName}</if> |
||||
|
<if test="query.skuUnit != null and query.skuUnit != ''"> and `goods_customer_price`.`sku_unit` = #{query.skuUnit}</if> |
||||
|
<if test="query.initPrice != null"> and `goods_customer_price`.`init_price` = #{query.initPrice}</if> |
||||
|
<if test="query.realPrice != null"> and `goods_customer_price`.`real_price` = #{query.realPrice}</if> |
||||
|
<if test="query.maker != null and query.maker != ''"> and `goods_customer_price`.`maker` = #{query.maker}</if> |
||||
|
<if test="query.makerCode != null and query.makerCode != ''"> and `goods_customer_price`.`maker_code` = #{query.makerCode}</if> |
||||
|
<if test="query.markTime != null"> and `goods_customer_price`.`mark_time` = #{query.markTime}</if> |
||||
|
<if test="query.createTime != null"> and `goods_customer_price`.`create_time` = #{query.createTime}</if> |
||||
|
<if test="query.createBy != null and query.createBy != ''"> and `goods_customer_price`.`create_by` = #{query.createBy}</if> |
||||
|
<if test="query.updateTime != null"> and `goods_customer_price`.`update_time` = #{query.updateTime}</if> |
||||
|
<if test="query.updateBy != null and query.updateBy != ''"> and `goods_customer_price`.`update_by` = #{query.updateBy}</if> |
||||
|
<if test="query.tenantId != null and query.tenantId != ''"> and `goods_customer_price`.`tenant_id` = #{query.tenantId}</if> |
||||
|
<if test="query.delFlag != null"> and `goods_customer_price`.`del_flag` = #{query.delFlag}</if> |
||||
|
|
||||
|
|
||||
|
<if test="query.bookCodeList!=null and query.bookCodeList.size > 0"> |
||||
|
and `goods_sku`.`book_belong` in |
||||
|
<foreach collection="query.bookCodeList" item ="selectId" index="i" open="(" close=")" separator=","> |
||||
|
#{selectId} |
||||
|
</foreach> |
||||
|
</if> |
||||
|
|
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue