郑永安
2023-06-19 7a6abd05683528032687c75e80e0bd2030a3e46c
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
<?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.gkhy.safePlatform.specialWork.repository.WorkMaterialCheckRepository">
 
    <resultMap type="com.gkhy.safePlatform.specialWork.entity.WorkMaterialCheckInfo" id="MaterialCheckMap">
        <result property="id" column="id" jdbcType="BIGINT"/>
        <result property="materialName" column="material_name" jdbcType="VARCHAR"/>
        <result property="configurationLevel" column="configuration_level" jdbcType="TINYINT"/>
        <result property="useCount" column="use_count" jdbcType="INTEGER"/>
        <result property="sceneCount" column="scene_count" jdbcType="INTEGER"/>
        <result property="workApplyId" column="work_apply_id" jdbcType="BIGINT"/>
        <result property="wpcId" column="wpc_id" jdbcType="BIGINT"/>
    </resultMap>
 
 
 
    <!--查询数据-->
    <select id="getListByWpcIds" resultMap="MaterialCheckMap">
        select id, material_name, configuration_level, use_count, scene_count, work_apply_id, wpc_id
        from work_material_check
        where wpc_id in
        <foreach collection="wpcIds" item="wpcId" open="(" close=")" separator=",">
            #{wpcId}
        </foreach>
    </select>
 
    <!--新增所有列-->
    <insert id="insertOne" >
        insert into material_detail(id, material_name,  configuration_level, use_count, scene_count, work_apply_id, wpc_id)
        values (#{id},#{materialName}, #{configurationLevel}, #{useCount}, #{sceneCount}, #{workApplyId}, #{wpcId})
    </insert>
 
    <!--批量插入-->
    <insert id="saveMaterialCheckBatch" >
        insert into material_detail(id, material_name,  configuration_level, use_count, scene_count, work_apply_id, wpc_id)
        values
        <foreach collection="entities" item="entity" separator=",">
            (#{entity.id},#{entity.materialName}, #{entity.configurationLevel}, #{entity.useCount}, #{entity.sceneCount}, #{entity.workApplyId}, #{entity.wpcId})
        </foreach>
    </insert>
 
</mapper>