ganzi-api/inventory-dao/src/main/resources/mapper/SysCodeMapper.xml

374 lines
14 KiB
XML
Raw Normal View History

2022-09-16 15:07:17 +08:00
<?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.SysCodeMapper">
<resultMap id="BaseResultMap" type="com.rzyc.model.SysCode">
<id column="SysCodeId" jdbcType="CHAR" property="syscodeid" />
<result column="EnglishName" jdbcType="VARCHAR" property="englishname" />
<result column="ChinaName" jdbcType="VARCHAR" property="chinaname" />
<result column="SortId" jdbcType="INTEGER" property="sortid" />
<result column="CodeValue" jdbcType="VARCHAR" property="codevalue" />
<result column="CodeText" jdbcType="VARCHAR" property="codetext" />
<result column="CreatedBy" jdbcType="VARCHAR" property="createdby" />
<result column="CreatedOn" jdbcType="TIMESTAMP" property="createdon" />
<result column="ModifiedBy" jdbcType="VARCHAR" property="modifiedby" />
<result column="ModifiedOn" jdbcType="TIMESTAMP" property="modifiedon" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.rzyc.model.SysCode">
<result column="Comments" jdbcType="LONGVARCHAR" property="comments" />
</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">
SysCodeId, EnglishName, ChinaName, SortId, CodeValue, CodeText, CreatedBy, CreatedOn,
ModifiedBy, ModifiedOn
</sql>
<sql id="Blob_Column_List">
Comments
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.rzyc.model.SysCodeExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from SysCode
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="com.rzyc.model.SysCodeExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from SysCode
<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>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from SysCode
where SysCodeId = #{syscodeid,jdbcType=CHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from SysCode
where SysCodeId = #{syscodeid,jdbcType=CHAR}
</delete>
<delete id="deleteByExample" parameterType="com.rzyc.model.SysCodeExample">
delete from SysCode
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.rzyc.model.SysCode">
insert into SysCode (SysCodeId, EnglishName, ChinaName,
SortId, CodeValue, CodeText,
CreatedBy, CreatedOn, ModifiedBy,
ModifiedOn, Comments)
values (#{syscodeid,jdbcType=CHAR}, #{englishname,jdbcType=VARCHAR}, #{chinaname,jdbcType=VARCHAR},
#{sortid,jdbcType=INTEGER}, #{codevalue,jdbcType=VARCHAR}, #{codetext,jdbcType=VARCHAR},
#{createdby,jdbcType=VARCHAR}, #{createdon,jdbcType=TIMESTAMP}, #{modifiedby,jdbcType=VARCHAR},
#{modifiedon,jdbcType=TIMESTAMP}, #{comments,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.rzyc.model.SysCode">
insert into SysCode
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="syscodeid != null">
SysCodeId,
</if>
<if test="englishname != null">
EnglishName,
</if>
<if test="chinaname != null">
ChinaName,
</if>
<if test="sortid != null">
SortId,
</if>
<if test="codevalue != null">
CodeValue,
</if>
<if test="codetext != null">
CodeText,
</if>
<if test="createdby != null">
CreatedBy,
</if>
<if test="createdon != null">
CreatedOn,
</if>
<if test="modifiedby != null">
ModifiedBy,
</if>
<if test="modifiedon != null">
ModifiedOn,
</if>
<if test="comments != null">
Comments,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="syscodeid != null">
#{syscodeid,jdbcType=CHAR},
</if>
<if test="englishname != null">
#{englishname,jdbcType=VARCHAR},
</if>
<if test="chinaname != null">
#{chinaname,jdbcType=VARCHAR},
</if>
<if test="sortid != null">
#{sortid,jdbcType=INTEGER},
</if>
<if test="codevalue != null">
#{codevalue,jdbcType=VARCHAR},
</if>
<if test="codetext != null">
#{codetext,jdbcType=VARCHAR},
</if>
<if test="createdby != null">
#{createdby,jdbcType=VARCHAR},
</if>
<if test="createdon != null">
#{createdon,jdbcType=TIMESTAMP},
</if>
<if test="modifiedby != null">
#{modifiedby,jdbcType=VARCHAR},
</if>
<if test="modifiedon != null">
#{modifiedon,jdbcType=TIMESTAMP},
</if>
<if test="comments != null">
#{comments,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.rzyc.model.SysCodeExample" resultType="java.lang.Long">
select count(*) from SysCode
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update SysCode
<set>
<if test="record.syscodeid != null">
SysCodeId = #{record.syscodeid,jdbcType=CHAR},
</if>
<if test="record.englishname != null">
EnglishName = #{record.englishname,jdbcType=VARCHAR},
</if>
<if test="record.chinaname != null">
ChinaName = #{record.chinaname,jdbcType=VARCHAR},
</if>
<if test="record.sortid != null">
SortId = #{record.sortid,jdbcType=INTEGER},
</if>
<if test="record.codevalue != null">
CodeValue = #{record.codevalue,jdbcType=VARCHAR},
</if>
<if test="record.codetext != null">
CodeText = #{record.codetext,jdbcType=VARCHAR},
</if>
<if test="record.createdby != null">
CreatedBy = #{record.createdby,jdbcType=VARCHAR},
</if>
<if test="record.createdon != null">
CreatedOn = #{record.createdon,jdbcType=TIMESTAMP},
</if>
<if test="record.modifiedby != null">
ModifiedBy = #{record.modifiedby,jdbcType=VARCHAR},
</if>
<if test="record.modifiedon != null">
ModifiedOn = #{record.modifiedon,jdbcType=TIMESTAMP},
</if>
<if test="record.comments != null">
Comments = #{record.comments,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update SysCode
set SysCodeId = #{record.syscodeid,jdbcType=CHAR},
EnglishName = #{record.englishname,jdbcType=VARCHAR},
ChinaName = #{record.chinaname,jdbcType=VARCHAR},
SortId = #{record.sortid,jdbcType=INTEGER},
CodeValue = #{record.codevalue,jdbcType=VARCHAR},
CodeText = #{record.codetext,jdbcType=VARCHAR},
CreatedBy = #{record.createdby,jdbcType=VARCHAR},
CreatedOn = #{record.createdon,jdbcType=TIMESTAMP},
ModifiedBy = #{record.modifiedby,jdbcType=VARCHAR},
ModifiedOn = #{record.modifiedon,jdbcType=TIMESTAMP},
Comments = #{record.comments,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update SysCode
set SysCodeId = #{record.syscodeid,jdbcType=CHAR},
EnglishName = #{record.englishname,jdbcType=VARCHAR},
ChinaName = #{record.chinaname,jdbcType=VARCHAR},
SortId = #{record.sortid,jdbcType=INTEGER},
CodeValue = #{record.codevalue,jdbcType=VARCHAR},
CodeText = #{record.codetext,jdbcType=VARCHAR},
CreatedBy = #{record.createdby,jdbcType=VARCHAR},
CreatedOn = #{record.createdon,jdbcType=TIMESTAMP},
ModifiedBy = #{record.modifiedby,jdbcType=VARCHAR},
ModifiedOn = #{record.modifiedon,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.rzyc.model.SysCode">
update SysCode
<set>
<if test="englishname != null">
EnglishName = #{englishname,jdbcType=VARCHAR},
</if>
<if test="chinaname != null">
ChinaName = #{chinaname,jdbcType=VARCHAR},
</if>
<if test="sortid != null">
SortId = #{sortid,jdbcType=INTEGER},
</if>
<if test="codevalue != null">
CodeValue = #{codevalue,jdbcType=VARCHAR},
</if>
<if test="codetext != null">
CodeText = #{codetext,jdbcType=VARCHAR},
</if>
<if test="createdby != null">
CreatedBy = #{createdby,jdbcType=VARCHAR},
</if>
<if test="createdon != null">
CreatedOn = #{createdon,jdbcType=TIMESTAMP},
</if>
<if test="modifiedby != null">
ModifiedBy = #{modifiedby,jdbcType=VARCHAR},
</if>
<if test="modifiedon != null">
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
</if>
<if test="comments != null">
Comments = #{comments,jdbcType=LONGVARCHAR},
</if>
</set>
where SysCodeId = #{syscodeid,jdbcType=CHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.rzyc.model.SysCode">
update SysCode
set EnglishName = #{englishname,jdbcType=VARCHAR},
ChinaName = #{chinaname,jdbcType=VARCHAR},
SortId = #{sortid,jdbcType=INTEGER},
CodeValue = #{codevalue,jdbcType=VARCHAR},
CodeText = #{codetext,jdbcType=VARCHAR},
CreatedBy = #{createdby,jdbcType=VARCHAR},
CreatedOn = #{createdon,jdbcType=TIMESTAMP},
ModifiedBy = #{modifiedby,jdbcType=VARCHAR},
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
Comments = #{comments,jdbcType=LONGVARCHAR}
where SysCodeId = #{syscodeid,jdbcType=CHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.rzyc.model.SysCode">
update SysCode
set EnglishName = #{englishname,jdbcType=VARCHAR},
ChinaName = #{chinaname,jdbcType=VARCHAR},
SortId = #{sortid,jdbcType=INTEGER},
CodeValue = #{codevalue,jdbcType=VARCHAR},
CodeText = #{codetext,jdbcType=VARCHAR},
CreatedBy = #{createdby,jdbcType=VARCHAR},
CreatedOn = #{createdon,jdbcType=TIMESTAMP},
ModifiedBy = #{modifiedby,jdbcType=VARCHAR},
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP}
where SysCodeId = #{syscodeid,jdbcType=CHAR}
</update>
<!--通过类型分类查询类型列表-->
<select id="findByName" resultMap="BaseResultMap">
SELECT * FROM `SysCode` sc
WHERE sc.`EnglishName` = #{name}
ORDER BY sc.`SortId` ASC
</select>
</mapper>