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
<?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.dy.pipIrrGlobal.daoIr.IrGroupUnitMapper">
    <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoIr.IrGroupUnit">
        <!--@mbg.generated-->
        <!--@Table ir_group_unit-->
        <id column="id" jdbcType="BIGINT" property="id" />
        <result column="group_id" jdbcType="BIGINT" property="groupId" />
        <result column="unit_id" jdbcType="BIGINT" property="unitId" />
        <result column="operator" jdbcType="BIGINT" property="operator" />
        <result column="operate_time" jdbcType="TIMESTAMP" property="operateDt" />
        <result column="deleted" jdbcType="TINYINT" property="deleted" />
    </resultMap>
    <sql id="Base_Column_List">
        <!--@mbg.generated-->
        id, group_id, unit_id, `operator`,
        operate_time, deleted
    </sql>
 
    <!--添加-->
    <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupUnit">
        <!--@mbg.generated-->
        insert into ir_group_unit
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="groupId != null">
                group_id,
            </if>
            <if test="unitId != null">
                unit_id,
            </if>
            <if test="operator != null">
                `operator`,
            </if>
            <if test="operateDt != null">
                operate_time,
            </if>
            <if test="deleted != null">
                deleted,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            <if test="groupId != null">
                #{groupId,jdbcType=BIGINT},
            </if>
            <if test="unitId != null">
                #{unitId,jdbcType=BIGINT},
            </if>
            <if test="operator != null">
                #{operator,jdbcType=BIGINT},
            </if>
            <if test="operateDt != null">
                #{operateDt,jdbcType=TIMESTAMP},
            </if>
            <if test="deleted != null">
                #{deleted,jdbcType=TINYINT},
            </if>
        </trim>
    </insert>
 
    <!--逻辑删除-->
    <delete id="deleteLogicById" parameterType="java.lang.Long">
        <!--@mbg.generated-->
        update ir_group_unit
        set deleted = 1
        where id = #{id,jdbcType=BIGINT}
    </delete>
 
    <delete id="deleteByUnitIdGroupId" parameterType="com.dy.pipIrrGlobal.pojoIr.IrGroupUnit">
        update ir_group_unit
        set deleted = 1,operator = #{operator,jdbcType=BIGINT},operate_time = #{operateDt,jdbcType=TIMESTAMP}
        where group_id = #{groupId,jdbcType=BIGINT} and unit_id = #{unitId,jdbcType=BIGINT}
    </delete>
 
    <delete id="deleteByUnitId">
        update ir_group_unit
        set deleted = 1
        where unit_id = #{unitId,jdbcType=BIGINT}
    </delete>
 
    <delete id="deleteByGroupId">
        update ir_group_unit
        set deleted = 1
        where group_id = #{groupId,jdbcType=BIGINT}
    </delete>
</mapper>