无关风月
2025-02-28 2f8e70ad2884d2b6b7443dfae0af11ae9cfc8b99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?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.jilongda.manage.mapper.TLensGoodsMapper">
 
 
    <select id="lensReceiptList" resultType="com.jilongda.manage.vo.TLensGoodsVO">
select o.* from
 
        (select t1.seriesId,
        t1.id,
        t1.storeId,
        t1.refractiveIndex,
        t1.`status`,
        t1.lensType,
        t2.name as series,
        t4.name as storeName,
        t2.sphere as sphere,
        t2.asphericSurface as asphericSurface,
        t2.type as type,
        t2.doubleNon as doubleNon,
        t6.name as brand,t7.frameThreshold,
        sum(t1.total) as total
        from
        t_lens_goods t1
        inner join t_lens_series t2 on t1.seriesId=t2.id
        inner join t_store t4 on t1.storeId = t4.id
        inner join t_brand t6 on t2.brandId=t6.id
        inner join sec_setting t7 on 1=1
        <where>
            <if test="query.brandId != null ">
                and t2.brandId = #{query.brandId}
            </if>
            <if test="query.seriesId != null ">
                and t2.id = #{query.seriesId}
            </if>
            <if test="query.lensType != null ">
                and t1.lensType = #{query.lensType}
            </if>
            <if test="query.storeId != null ">
                and t1.storeId = #{query.storeId}
            </if>
            <if test="query.refractiveIndex != null and query.refractiveIndex != ''">
                and t1.refractiveIndex = #{query.refractiveIndex}
            </if>
            <if test="query.type != null ">
                and t2.type = #{query.type}
            </if>
 
            and t1.isDelete = 0
        </where>
        group by
        seriesId,
        refractiveIndex,
        lensType
        order by t1.id) o
        where 1=1
        <if test="query.isWarning !=null and query.isWarning==1">
            and o.total &lt;= t7.lensThreshold
        </if>
        <if test="query.isWarning !=null and query.isWarning ==2">
            and o.total >= t7.lensThreshold
        </if>
 
    </select>
</mapper>