ganzi-api/inventory-dao/src/main/resources/mapper/ListQuotaMapper.xml
2022-09-16 15:07:17 +08:00

179 lines
6.3 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.rzyc.mapper.ListQuotaMapper">
<resultMap id="BaseResultMap" type="com.rzyc.model.ListQuota">
<result column="quota_id" jdbcType="VARCHAR" property="quotaId" />
<result column="list_work_id" jdbcType="VARCHAR" property="listWorkId" />
<result column="quota_type" jdbcType="INTEGER" property="quotaType" />
<result column="quota_check" jdbcType="INTEGER" property="quotaCheck" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
quota_id, list_work_id, quota_type, quota_check
</sql>
<select id="selectByExample" parameterType="com.rzyc.model.ListQuotaExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from list_quota
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<delete id="deleteByExample" parameterType="com.rzyc.model.ListQuotaExample">
delete from list_quota
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.rzyc.model.ListQuota">
insert into list_quota (quota_id, list_work_id, quota_type,
quota_check)
values (#{quotaId,jdbcType=VARCHAR}, #{listWorkId,jdbcType=VARCHAR}, #{quotaType,jdbcType=INTEGER},
#{quotaCheck,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.rzyc.model.ListQuota">
insert into list_quota
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="quotaId != null">
quota_id,
</if>
<if test="listWorkId != null">
list_work_id,
</if>
<if test="quotaType != null">
quota_type,
</if>
<if test="quotaCheck != null">
quota_check,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="quotaId != null">
#{quotaId,jdbcType=VARCHAR},
</if>
<if test="listWorkId != null">
#{listWorkId,jdbcType=VARCHAR},
</if>
<if test="quotaType != null">
#{quotaType,jdbcType=INTEGER},
</if>
<if test="quotaCheck != null">
#{quotaCheck,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.rzyc.model.ListQuotaExample" resultType="java.lang.Long">
select count(*) from list_quota
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update list_quota
<set>
<if test="record.quotaId != null">
quota_id = #{record.quotaId,jdbcType=VARCHAR},
</if>
<if test="record.listWorkId != null">
list_work_id = #{record.listWorkId,jdbcType=VARCHAR},
</if>
<if test="record.quotaType != null">
quota_type = #{record.quotaType,jdbcType=INTEGER},
</if>
<if test="record.quotaCheck != null">
quota_check = #{record.quotaCheck,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update list_quota
set quota_id = #{record.quotaId,jdbcType=VARCHAR},
list_work_id = #{record.listWorkId,jdbcType=VARCHAR},
quota_type = #{record.quotaType,jdbcType=INTEGER},
quota_check = #{record.quotaCheck,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<delete id="deleteById">
delete from list_quota
where list_work_id = #{listWorkId}
</delete>
</mapper>