You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udiwms-java/api-admin/src/main/resources/mybatis/mapper/inventory/InvCountCodesDao.xml

141 lines
5.6 KiB
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.glxp.api.admin.dao.inventory.InvCountCodesDao">
<resultMap id="BaseResultMap" type="com.glxp.api.admin.entity.inventory.InvCountCodes">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="orderIdFk" jdbcType="VARCHAR" property="orderIdFk"/>
<result column="productId" jdbcType="VARCHAR" property="productId"/>
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="status" jdbcType="BOOLEAN" property="status"/>
</resultMap>
<sql id="Base_Column_List">
id,
orderIdFk,
productId,
code,
`status`
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from inv_count_codes
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete
from inv_count_codes
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id"
parameterType="com.glxp.api.admin.entity.inventory.InvCountCodes" useGeneratedKeys="true">
insert into inv_count_codes (orderIdFk, productId, code,
`status`)
values (#{orderIdFk,jdbcType=VARCHAR}, #{productId,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR},
#{status,jdbcType=BOOLEAN})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id"
parameterType="com.glxp.api.admin.entity.inventory.InvCountCodes" useGeneratedKeys="true">
insert into inv_count_codes
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderIdFk != null">
orderIdFk,
</if>
<if test="productId != null">
productId,
</if>
<if test="code != null">
code,
</if>
<if test="status != null">
`status`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderIdFk != null">
#{orderIdFk,jdbcType=VARCHAR},
</if>
<if test="productId != null">
#{productId,jdbcType=VARCHAR},
</if>
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=BOOLEAN},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.glxp.api.admin.entity.inventory.InvCountCodes">
update inv_count_codes
<set>
<if test="orderIdFk != null">
orderIdFk = #{orderIdFk,jdbcType=VARCHAR},
</if>
<if test="productId != null">
productId = #{productId,jdbcType=VARCHAR},
</if>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=BOOLEAN},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glxp.api.admin.entity.inventory.InvCountCodes">
update inv_count_codes
set orderIdFk = #{orderIdFk,jdbcType=VARCHAR},
productId = #{productId,jdbcType=VARCHAR},
code = #{code,jdbcType=VARCHAR},
`status` = #{status,jdbcType=BOOLEAN}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateBatch" parameterType="java.util.List">
update inv_count_codes
<trim prefix="set" suffixOverrides=",">
<trim prefix="orderIdFk = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.orderIdFk,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="productId = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.productId,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="code = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.code,jdbcType=VARCHAR}
</foreach>
</trim>
<trim prefix="`status` = case" suffix="end,">
<foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=BOOLEAN}
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id,jdbcType=INTEGER}
</foreach>
</update>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
insert into inv_count_codes
(orderIdFk, productId, code, `status`)
values
<foreach collection="list" item="item" separator=",">
(#{item.orderIdFk,jdbcType=VARCHAR}, #{item.productId,jdbcType=VARCHAR}, #{item.code,jdbcType=VARCHAR},
#{item.status,jdbcType=BOOLEAN})
</foreach>
</insert>
</mapper>