orcal—Mybatis—梳理

orcal

杂项
/**模糊查询**/
and EBOARD_CERTIFICATECODE like '%${certificateCode}%'
and regexp_like(EBOARD_CERTIFICATECODE ,#{certificateCode},'i')
/**截取字符串0-6:(列值)**/
substr(SMP_MATERIALBATCH, 0, 6)
/**系统日期:(列值)**/
SYSDATE
/**聚集函数**/

XML文件:头
<!--xml文件:头-->
<?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.gwm.lms.asm.outStockGuid.mapper.GuidProductStockMapper">

</mapper>
Mybatis基本用法
<!--xml文件:返回 Map-->
<resultMap id="BatchVo" type="com.gwm.lms.asm.outStockGuid.entity.BatchVo">
    <result column="SMP_MATERIALNAME" jdbcType="VARCHAR" property="productName" />
    <result column="SMP_MATERIALNUM" jdbcType="DECIMAL" property="alreadyNumber" />
</resultMap>
<!--xml文件:查询 列 -->
<sql id="Select_Field">
    SMP_MATERIALNAME,
    SMP_MATERIALNUM
</sql>
<!--xml文件:查询条件 -->
<sql id="Base_Where_Clause">
    <where>
        <trim prefixOverrides="and">
            <if test="id!= null ">
                and BOARD_ID = #{id}
            </if>
            <if test="batchCode!=null and batchCode!=''">
                and BOARD_BATCHCODE = #{batchCode}
            </if>
        </trim>
    </where>
</sql>
<!--xml文件:查询 -->
<select id="select" resultMap="GzDetailMap" parameterType="com.gwm.lms.asm.stock.entity.GzDetailEntity">
    SELECT GZ02_ID
    FROM GZ02_DETAIL LEFT JOIN GZ01_TYPE ON GZ02_DETAIL.GZ01_ID = GZ01_TYPE.GZ01_ID
    <include refid="Base_Where_Clause" />
</select>
<!--xml文件:更新 -->
<update id="updateById" parameterType="com.gwm.lms.asm.stock.entity.GzDetailEntity">
    update 表名
    <set>
        <if test="id!= null">
            GZ02_ID = #{id},
        </if>
    </set>
</update>
<!--xml文件:插入 -->
<insert id="insert" parameterType="com.gwm.lms.asm.stock.entity.GzDetailEntity">
    INSERT INTO GZ02_DETAIL
    <trim prefix="(" suffix=")" suffixOverrides=",">
        <if test="id!= null">
            GZ02_ID,
        </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
        <if test="id!= null">
            #{id},
        </if>
    </trim>
</insert>
<!--xml文件:删除 -->
<delete id="deleteById" parameterType="java.lang.String">
    DELETE
    FROM GZ02_DETAIL
    WHERE GZ02_ID = #{id}
</delete>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值