ustcyc
2025-01-07 de5d55508afd27fb2b47e6d4d6fd9984525c222c
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
<?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.zhitan.model.mapper.CalcFunctionMapper">
 
    <resultMap type="com.zhitan.model.domain.CalcFunction" id="CalcFunctionResult">
        <result property="id" column="id"/>
        <result property="info" column="info"/>
        <result property="funcName" column="func_name"/>
        <result property="funcText" column="func_text"/>
    </resultMap>
 
    <sql id="selectCalcFunctionVo">
        select id, func_name, func_text, info
        from calc_function
    </sql>
 
    <select id="selectCalcFunctionList" parameterType="com.zhitan.model.domain.CalcFunction" resultMap="CalcFunctionResult">
        <include refid="selectCalcFunctionVo"/>
        <where>
            <if test="funcName != null  and funcName != ''">and func_name like concat('%', #{funcName}, '%')</if>
        </where>
    </select>
 
    <select id="selectCalcFunctionById" parameterType="String" resultMap="CalcFunctionResult">
        <include refid="selectCalcFunctionVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertCalcFunction" parameterType="com.zhitan.model.domain.CalcFunction">
        insert into calc_function
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">id,</if>
            <if test="funcName != null  and funcName != ''">func_name,</if>
            <if test="funcText != null  and funcText != ''">func_text,</if>
            <if test="info != null  and info != ''">info,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">#{id},</if>
            <if test="funcName != null  and funcName != ''">#{funcName},</if>
            <if test="funcText != null  and funcText != ''">#{funcText},</if>
            <if test="info != null  and info != ''">#{info},</if>
        </trim>
    </insert>
 
    <update id="updateCalcFunction" parameterType="com.zhitan.model.domain.CalcFunction">
        update calc_function
        <trim prefix="SET" suffixOverrides=",">
            <if test="info != null  and info != ''">info = #{info},</if>
            <if test="funcName != null  and funcName != ''">func_name = #{funcName},</if>
            <if test="funcText != null  and funcText != ''">func_text = #{funcText},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteCalcFunctionById" parameterType="String">
        delete
        from calc_function
        where id = #{id}
    </delete>
 
    <delete id="deleteCalcFunctionByIds" parameterType="String">
        delete from calc_function where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
</mapper>