cloudroam
2025-03-10 c306cba52bcc3e2c423f77d4a52c35ad04c52038
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?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.jsh.erp.datasource.mappers.SupplierMapperEx">
    <select id="selectByConditionSupplier" parameterType="com.jsh.erp.datasource.entities.SupplierExample" resultMap="com.jsh.erp.datasource.mappers.SupplierMapper.BaseResultMap">
        select *
        FROM jsh_supplier
        where 1=1
        <if test="supplier != null and supplier !=''">
            <bind name="bindSupplier" value="'%'+supplier+'%'"/>
            and supplier like #{bindSupplier}
        </if>
        <if test="type != null and type !=''">
            and type=#{type}
        </if>
        <if test="phonenum != null and phonenum !=''">
            <bind name="bindPhoneNum" value="'%'+phonenum+'%'"/>
            and phone_num like #{bindPhoneNum}
        </if>
        <if test="telephone != null and telephone !=''">
            <bind name="bindTelephone" value="'%'+telephone+'%'"/>
            and telephone like #{bindTelephone}
        </if>
        <if test="creatorArray != null">
            and creator in (
            <foreach collection="creatorArray" item="creator" separator=",">
                #{creator}
            </foreach>
            )
        </if>
        and ifnull(delete_flag,'0') !='1'
        order by sort asc, id desc
        <if test="offset != null and rows != null">
            limit #{offset},#{rows}
        </if>
    </select>
    <select id="countsBySupplier" resultType="java.lang.Long">
        SELECT
        COUNT(id)
        FROM jsh_supplier
        WHERE 1=1
        <if test="supplier != null and supplier !=''">
            <bind name="bindSupplier" value="'%'+supplier+'%'"/>
            and supplier like #{bindSupplier}
        </if>
        <if test="type != null and type !=''">
            and type=#{type}
        </if>
        <if test="phonenum != null and phonenum !=''">
            <bind name="bindPhoneNum" value="'%'+phonenum+'%'"/>
            and phone_num like #{bindPhoneNum}
        </if>
        <if test="telephone != null and telephone !=''">
            <bind name="bindTelephone" value="'%'+telephone+'%'"/>
            and telephone like #{bindTelephone}
        </if>
        <if test="creatorArray != null">
            and creator in (
            <foreach collection="creatorArray" item="creator" separator=",">
                #{creator}
            </foreach>
            )
        </if>
        and ifnull(delete_flag,'0') !='1'
    </select>
 
    <select id="findByAll" parameterType="com.jsh.erp.datasource.entities.SupplierExample" resultMap="com.jsh.erp.datasource.mappers.SupplierMapper.BaseResultMap">
        select *
        FROM jsh_supplier
        where 1=1
        <if test="supplier != null and supplier !=''">
            <bind name="bindSupplier" value="'%'+supplier+'%'"/>
            and supplier like #{bindSupplier}
        </if>
        <if test="type != null and type !=''">
            and type=#{type}
        </if>
        <if test="phonenum != null and phonenum !=''">
            <bind name="bindPhoneNum" value="'%'+phonenum+'%'"/>
            and phone_num like #{bindPhoneNum}
        </if>
        <if test="telephone != null and telephone !=''">
            <bind name="bindTelephone" value="'%'+telephone+'%'"/>
            and telephone like #{bindTelephone}
        </if>
        and ifnull(delete_flag,'0') !='1'
        order by sort asc, id desc
    </select>
 
    <update id="batchDeleteSupplierByIds">
        update jsh_supplier
        set delete_flag='1'
        where 1=1
        and id in (
        <foreach collection="ids" item="id" separator=",">
            #{id}
        </foreach>
        )
    </update>
 
    <select id="getSupplierByNameAndType" resultType="com.jsh.erp.datasource.entities.Supplier">
        select *
        from jsh_supplier
        where supplier = #{supplier} and type = #{type}
        and ifnull(delete_flag,'0') !='1'
    </select>
</mapper>