chenlu
2024-06-07 2f640b1038fa331954f78ed1f4317212cf5bb34d
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
<?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.example.erp.mapper.mm.MaterialStoreMapper">
 
    <select id="getSelectMaterialStore">
        select
        *
        from
        mm.material_store m
        <where>
            <if test="materialStore.id != null and materialStore.id != ''">
                and m.id regexp #{materialStore.id}
            </if>
            <if test="materialStore.type != null and materialStore.type != ''">
                and m.type regexp #{materialStore.type}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
 
    <select id="getSelectMaterialStoreById">
        select * from mm.material_store m where id=#{id}
    </select>
 
    <select id="getSelectMaterialStorePageTotal">
        select
        CEILING(count(id)/#{pageSize}) as 'pageTotal',
        count(id) as 'total'
        from
        mm.material_store m
        <where>
            <if test="materialStore.id != null and materialStore.id != ''">
                and m.id regexp #{materialStore.id}
            </if>
            <if test="materialStore.type != null and materialStore.type != ''">
                and m.type regexp #{materialStore.type}
            </if>
        </where>
        limit #{offset},#{pageSize};
    </select>
 
    <insert id="insertMaterialStore"  useGeneratedKeys="true"  >
        insert into mm.material_store (type,json,create_time
        )
        values (
                   #{type},#{json},now()
               )
    </insert>
 
    <update id="updateMaterialStore" >
        update mm.material_store set json=#{json} where id=#{id}
    </update>
 
    <delete id="deleteMaterialStore" >
        delete from mm.material_store where id=#{id}
    </delete>
 
 
 
 
</mapper>