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

535 lines
21 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.ent.EntRiskSourceMapper">
<resultMap id="BaseResultMap" type="com.rzyc.model.ent.EntRiskSource">
<id column="EntRiskSourceId" jdbcType="VARCHAR" property="entrisksourceid" />
<result column="SysEnterpriseId" jdbcType="VARCHAR" property="sysenterpriseid" />
<result column="SysUnitId" jdbcType="VARCHAR" property="sysunitid" />
<result column="RiskSource" jdbcType="VARCHAR" property="risksource" />
<result column="RiskPosition" jdbcType="VARCHAR" property="riskposition" />
<result column="longitude" jdbcType="DECIMAL" property="longitude" />
<result column="latitude" jdbcType="DECIMAL" property="latitude" />
<result column="RiskType" jdbcType="VARCHAR" property="risktype" />
<result column="IsToxicGas" jdbcType="VARCHAR" property="istoxicgas" />
<result column="IsEffectAround" jdbcType="VARCHAR" property="iseffectaround" />
<result column="Possibility" jdbcType="VARCHAR" property="possibility" />
<result column="Serious" jdbcType="VARCHAR" property="serious" />
<result column="RiskLevel" jdbcType="VARCHAR" property="risklevel" />
<result column="RiskStatus" jdbcType="VARCHAR" property="riskstatus" />
<result column="EntName" jdbcType="VARCHAR" property="entName" />
<result column="CreatedOn" jdbcType="TIMESTAMP" property="createdon" />
<result column="CreatedBy" jdbcType="VARCHAR" property="createdby" />
<result column="ModifiedOn" jdbcType="TIMESTAMP" property="modifiedon" />
<result column="ModifiedBy" jdbcType="VARCHAR" property="modifiedby" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.rzyc.model.ent.EntRiskSourceWithBLOBs">
<result column="RiskContent" jdbcType="LONGVARCHAR" property="riskcontent" />
<result column="RiskRemark" jdbcType="LONGVARCHAR" property="riskremark" />
</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">
EntRiskSourceId, SysEnterpriseId, SysUnitId, RiskSource, RiskPosition, longitude,
latitude, RiskType, IsToxicGas, IsEffectAround, Possibility, Serious, RiskLevel,
RiskStatus, CreatedOn, CreatedBy, ModifiedOn, ModifiedBy
</sql>
<sql id="Blob_Column_List">
RiskContent, RiskRemark
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.rzyc.model.ent.EntRiskSourceExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from EntRiskSource
<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.ent.EntRiskSourceExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from EntRiskSource
<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 EntRiskSource
where EntRiskSourceId = #{entrisksourceid,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from EntRiskSource
where EntRiskSourceId = #{entrisksourceid,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.rzyc.model.ent.EntRiskSourceExample">
delete from EntRiskSource
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.rzyc.model.ent.EntRiskSourceWithBLOBs">
insert into EntRiskSource (EntRiskSourceId, SysEnterpriseId,
SysUnitId, RiskSource, RiskPosition,
longitude, latitude, RiskType,
IsToxicGas, IsEffectAround, Possibility,
Serious, RiskLevel, RiskStatus,
CreatedOn, CreatedBy, ModifiedOn,
ModifiedBy, RiskContent, RiskRemark
)
values (#{entrisksourceid,jdbcType=VARCHAR}, #{sysenterpriseid,jdbcType=VARCHAR},
#{sysunitid,jdbcType=VARCHAR}, #{risksource,jdbcType=VARCHAR}, #{riskposition,jdbcType=VARCHAR},
#{longitude,jdbcType=DECIMAL}, #{latitude,jdbcType=DECIMAL}, #{risktype,jdbcType=VARCHAR},
#{istoxicgas,jdbcType=VARCHAR}, #{iseffectaround,jdbcType=VARCHAR}, #{possibility,jdbcType=VARCHAR},
#{serious,jdbcType=VARCHAR}, #{risklevel,jdbcType=VARCHAR}, #{riskstatus,jdbcType=VARCHAR},
#{createdon,jdbcType=TIMESTAMP}, #{createdby,jdbcType=VARCHAR}, #{modifiedon,jdbcType=TIMESTAMP},
#{modifiedby,jdbcType=VARCHAR}, #{riskcontent,jdbcType=LONGVARCHAR}, #{riskremark,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.rzyc.model.ent.EntRiskSourceWithBLOBs">
insert into EntRiskSource
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="entrisksourceid != null">
EntRiskSourceId,
</if>
<if test="sysenterpriseid != null">
SysEnterpriseId,
</if>
<if test="sysunitid != null">
SysUnitId,
</if>
<if test="risksource != null">
RiskSource,
</if>
<if test="riskposition != null">
RiskPosition,
</if>
<if test="longitude != null">
longitude,
</if>
<if test="latitude != null">
latitude,
</if>
<if test="risktype != null">
RiskType,
</if>
<if test="istoxicgas != null">
IsToxicGas,
</if>
<if test="iseffectaround != null">
IsEffectAround,
</if>
<if test="possibility != null">
Possibility,
</if>
<if test="serious != null">
Serious,
</if>
<if test="risklevel != null">
RiskLevel,
</if>
<if test="riskstatus != null">
RiskStatus,
</if>
<if test="createdon != null">
CreatedOn,
</if>
<if test="createdby != null">
CreatedBy,
</if>
<if test="modifiedon != null">
ModifiedOn,
</if>
<if test="modifiedby != null">
ModifiedBy,
</if>
<if test="riskcontent != null">
RiskContent,
</if>
<if test="riskremark != null">
RiskRemark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="entrisksourceid != null">
#{entrisksourceid,jdbcType=VARCHAR},
</if>
<if test="sysenterpriseid != null">
#{sysenterpriseid,jdbcType=VARCHAR},
</if>
<if test="sysunitid != null">
#{sysunitid,jdbcType=VARCHAR},
</if>
<if test="risksource != null">
#{risksource,jdbcType=VARCHAR},
</if>
<if test="riskposition != null">
#{riskposition,jdbcType=VARCHAR},
</if>
<if test="longitude != null">
#{longitude,jdbcType=DECIMAL},
</if>
<if test="latitude != null">
#{latitude,jdbcType=DECIMAL},
</if>
<if test="risktype != null">
#{risktype,jdbcType=VARCHAR},
</if>
<if test="istoxicgas != null">
#{istoxicgas,jdbcType=VARCHAR},
</if>
<if test="iseffectaround != null">
#{iseffectaround,jdbcType=VARCHAR},
</if>
<if test="possibility != null">
#{possibility,jdbcType=VARCHAR},
</if>
<if test="serious != null">
#{serious,jdbcType=VARCHAR},
</if>
<if test="risklevel != null">
#{risklevel,jdbcType=VARCHAR},
</if>
<if test="riskstatus != null">
#{riskstatus,jdbcType=VARCHAR},
</if>
<if test="createdon != null">
#{createdon,jdbcType=TIMESTAMP},
</if>
<if test="createdby != null">
#{createdby,jdbcType=VARCHAR},
</if>
<if test="modifiedon != null">
#{modifiedon,jdbcType=TIMESTAMP},
</if>
<if test="modifiedby != null">
#{modifiedby,jdbcType=VARCHAR},
</if>
<if test="riskcontent != null">
#{riskcontent,jdbcType=LONGVARCHAR},
</if>
<if test="riskremark != null">
#{riskremark,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.rzyc.model.ent.EntRiskSourceExample" resultType="java.lang.Long">
select count(*) from EntRiskSource
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update EntRiskSource
<set>
<if test="record.entrisksourceid != null">
EntRiskSourceId = #{record.entrisksourceid,jdbcType=VARCHAR},
</if>
<if test="record.sysenterpriseid != null">
SysEnterpriseId = #{record.sysenterpriseid,jdbcType=VARCHAR},
</if>
<if test="record.sysunitid != null">
SysUnitId = #{record.sysunitid,jdbcType=VARCHAR},
</if>
<if test="record.risksource != null">
RiskSource = #{record.risksource,jdbcType=VARCHAR},
</if>
<if test="record.riskposition != null">
RiskPosition = #{record.riskposition,jdbcType=VARCHAR},
</if>
<if test="record.longitude != null">
longitude = #{record.longitude,jdbcType=DECIMAL},
</if>
<if test="record.latitude != null">
latitude = #{record.latitude,jdbcType=DECIMAL},
</if>
<if test="record.risktype != null">
RiskType = #{record.risktype,jdbcType=VARCHAR},
</if>
<if test="record.istoxicgas != null">
IsToxicGas = #{record.istoxicgas,jdbcType=VARCHAR},
</if>
<if test="record.iseffectaround != null">
IsEffectAround = #{record.iseffectaround,jdbcType=VARCHAR},
</if>
<if test="record.possibility != null">
Possibility = #{record.possibility,jdbcType=VARCHAR},
</if>
<if test="record.serious != null">
Serious = #{record.serious,jdbcType=VARCHAR},
</if>
<if test="record.risklevel != null">
RiskLevel = #{record.risklevel,jdbcType=VARCHAR},
</if>
<if test="record.riskstatus != null">
RiskStatus = #{record.riskstatus,jdbcType=VARCHAR},
</if>
<if test="record.createdon != null">
CreatedOn = #{record.createdon,jdbcType=TIMESTAMP},
</if>
<if test="record.createdby != null">
CreatedBy = #{record.createdby,jdbcType=VARCHAR},
</if>
<if test="record.modifiedon != null">
ModifiedOn = #{record.modifiedon,jdbcType=TIMESTAMP},
</if>
<if test="record.modifiedby != null">
ModifiedBy = #{record.modifiedby,jdbcType=VARCHAR},
</if>
<if test="record.riskcontent != null">
RiskContent = #{record.riskcontent,jdbcType=LONGVARCHAR},
</if>
<if test="record.riskremark != null">
RiskRemark = #{record.riskremark,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update EntRiskSource
set EntRiskSourceId = #{record.entrisksourceid,jdbcType=VARCHAR},
SysEnterpriseId = #{record.sysenterpriseid,jdbcType=VARCHAR},
SysUnitId = #{record.sysunitid,jdbcType=VARCHAR},
RiskSource = #{record.risksource,jdbcType=VARCHAR},
RiskPosition = #{record.riskposition,jdbcType=VARCHAR},
longitude = #{record.longitude,jdbcType=DECIMAL},
latitude = #{record.latitude,jdbcType=DECIMAL},
RiskType = #{record.risktype,jdbcType=VARCHAR},
IsToxicGas = #{record.istoxicgas,jdbcType=VARCHAR},
IsEffectAround = #{record.iseffectaround,jdbcType=VARCHAR},
Possibility = #{record.possibility,jdbcType=VARCHAR},
Serious = #{record.serious,jdbcType=VARCHAR},
RiskLevel = #{record.risklevel,jdbcType=VARCHAR},
RiskStatus = #{record.riskstatus,jdbcType=VARCHAR},
CreatedOn = #{record.createdon,jdbcType=TIMESTAMP},
CreatedBy = #{record.createdby,jdbcType=VARCHAR},
ModifiedOn = #{record.modifiedon,jdbcType=TIMESTAMP},
ModifiedBy = #{record.modifiedby,jdbcType=VARCHAR},
RiskContent = #{record.riskcontent,jdbcType=LONGVARCHAR},
RiskRemark = #{record.riskremark,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update EntRiskSource
set EntRiskSourceId = #{record.entrisksourceid,jdbcType=VARCHAR},
SysEnterpriseId = #{record.sysenterpriseid,jdbcType=VARCHAR},
SysUnitId = #{record.sysunitid,jdbcType=VARCHAR},
RiskSource = #{record.risksource,jdbcType=VARCHAR},
RiskPosition = #{record.riskposition,jdbcType=VARCHAR},
longitude = #{record.longitude,jdbcType=DECIMAL},
latitude = #{record.latitude,jdbcType=DECIMAL},
RiskType = #{record.risktype,jdbcType=VARCHAR},
IsToxicGas = #{record.istoxicgas,jdbcType=VARCHAR},
IsEffectAround = #{record.iseffectaround,jdbcType=VARCHAR},
Possibility = #{record.possibility,jdbcType=VARCHAR},
Serious = #{record.serious,jdbcType=VARCHAR},
RiskLevel = #{record.risklevel,jdbcType=VARCHAR},
RiskStatus = #{record.riskstatus,jdbcType=VARCHAR},
CreatedOn = #{record.createdon,jdbcType=TIMESTAMP},
CreatedBy = #{record.createdby,jdbcType=VARCHAR},
ModifiedOn = #{record.modifiedon,jdbcType=TIMESTAMP},
ModifiedBy = #{record.modifiedby,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.rzyc.model.ent.EntRiskSourceWithBLOBs">
update EntRiskSource
<set>
<if test="sysenterpriseid != null">
SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR},
</if>
<if test="sysunitid != null">
SysUnitId = #{sysunitid,jdbcType=VARCHAR},
</if>
<if test="risksource != null">
RiskSource = #{risksource,jdbcType=VARCHAR},
</if>
<if test="riskposition != null">
RiskPosition = #{riskposition,jdbcType=VARCHAR},
</if>
<if test="longitude != null">
longitude = #{longitude,jdbcType=DECIMAL},
</if>
<if test="latitude != null">
latitude = #{latitude,jdbcType=DECIMAL},
</if>
<if test="risktype != null">
RiskType = #{risktype,jdbcType=VARCHAR},
</if>
<if test="istoxicgas != null">
IsToxicGas = #{istoxicgas,jdbcType=VARCHAR},
</if>
<if test="iseffectaround != null">
IsEffectAround = #{iseffectaround,jdbcType=VARCHAR},
</if>
<if test="possibility != null">
Possibility = #{possibility,jdbcType=VARCHAR},
</if>
<if test="serious != null">
Serious = #{serious,jdbcType=VARCHAR},
</if>
<if test="risklevel != null">
RiskLevel = #{risklevel,jdbcType=VARCHAR},
</if>
<if test="riskstatus != null">
RiskStatus = #{riskstatus,jdbcType=VARCHAR},
</if>
<if test="createdon != null">
CreatedOn = #{createdon,jdbcType=TIMESTAMP},
</if>
<if test="createdby != null">
CreatedBy = #{createdby,jdbcType=VARCHAR},
</if>
<if test="modifiedon != null">
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
</if>
<if test="modifiedby != null">
ModifiedBy = #{modifiedby,jdbcType=VARCHAR},
</if>
<if test="riskcontent != null">
RiskContent = #{riskcontent,jdbcType=LONGVARCHAR},
</if>
<if test="riskremark != null">
RiskRemark = #{riskremark,jdbcType=LONGVARCHAR},
</if>
</set>
where EntRiskSourceId = #{entrisksourceid,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.rzyc.model.ent.EntRiskSourceWithBLOBs">
update EntRiskSource
set SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR},
SysUnitId = #{sysunitid,jdbcType=VARCHAR},
RiskSource = #{risksource,jdbcType=VARCHAR},
RiskPosition = #{riskposition,jdbcType=VARCHAR},
longitude = #{longitude,jdbcType=DECIMAL},
latitude = #{latitude,jdbcType=DECIMAL},
RiskType = #{risktype,jdbcType=VARCHAR},
IsToxicGas = #{istoxicgas,jdbcType=VARCHAR},
IsEffectAround = #{iseffectaround,jdbcType=VARCHAR},
Possibility = #{possibility,jdbcType=VARCHAR},
Serious = #{serious,jdbcType=VARCHAR},
RiskLevel = #{risklevel,jdbcType=VARCHAR},
RiskStatus = #{riskstatus,jdbcType=VARCHAR},
CreatedOn = #{createdon,jdbcType=TIMESTAMP},
CreatedBy = #{createdby,jdbcType=VARCHAR},
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
ModifiedBy = #{modifiedby,jdbcType=VARCHAR},
RiskContent = #{riskcontent,jdbcType=LONGVARCHAR},
RiskRemark = #{riskremark,jdbcType=LONGVARCHAR}
where EntRiskSourceId = #{entrisksourceid,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.rzyc.model.ent.EntRiskSource">
update EntRiskSource
set SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR},
SysUnitId = #{sysunitid,jdbcType=VARCHAR},
RiskSource = #{risksource,jdbcType=VARCHAR},
RiskPosition = #{riskposition,jdbcType=VARCHAR},
longitude = #{longitude,jdbcType=DECIMAL},
latitude = #{latitude,jdbcType=DECIMAL},
RiskType = #{risktype,jdbcType=VARCHAR},
IsToxicGas = #{istoxicgas,jdbcType=VARCHAR},
IsEffectAround = #{iseffectaround,jdbcType=VARCHAR},
Possibility = #{possibility,jdbcType=VARCHAR},
Serious = #{serious,jdbcType=VARCHAR},
RiskLevel = #{risklevel,jdbcType=VARCHAR},
RiskStatus = #{riskstatus,jdbcType=VARCHAR},
CreatedOn = #{createdon,jdbcType=TIMESTAMP},
CreatedBy = #{createdby,jdbcType=VARCHAR},
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
ModifiedBy = #{modifiedby,jdbcType=VARCHAR}
where EntRiskSourceId = #{entrisksourceid,jdbcType=VARCHAR}
</update>
<!--重大危险源列表-->
<select id="riskSourceList" resultMap="ResultMapWithBLOBs">
SELECT se.`EntName`,er.* FROM EntRiskSource er
LEFT JOIN SysEnterprise se ON er.`SysEnterpriseId` = se.SysEnterpriseId
ORDER BY er.`CreatedOn` DESC
</select>
</mapper>