rt-sim-training-service/src/main/resources/mybatis/mapper/CommandDefinitionDAO.xml

276 lines
10 KiB
XML
Raw Normal View History

2020-11-19 10:07:10 +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.joylink.ms.dao.CommandDefinitionDAO">
<resultMap id="BaseResultMap" type="com.joylink.ms.entity.CommandDefinition">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="line_code" jdbcType="VARCHAR" property="lineCode" />
<result column="prd_type" jdbcType="VARCHAR" property="prdType" />
<result column="simulation_role" jdbcType="VARCHAR" property="simulationRole" />
<result column="control_mode" jdbcType="VARCHAR" property="controlMode" />
<result column="operate_object" jdbcType="VARCHAR" property="operateObject" />
<result column="operate" jdbcType="VARCHAR" property="operate" />
<result column="conditions" jdbcType="VARCHAR" property="conditions" />
<result column="params" jdbcType="VARCHAR" property="params" />
</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">
id, line_code, prd_type, simulation_role, control_mode, operate_object, operate,
conditions, params
</sql>
<select id="selectByExample" parameterType="com.joylink.ms.entity.CommandDefinitionExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from command_definition
<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.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from command_definition
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from command_definition
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.joylink.ms.entity.CommandDefinitionExample">
delete from command_definition
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.joylink.ms.entity.CommandDefinition" useGeneratedKeys="true">
insert into command_definition (line_code, prd_type, simulation_role,
control_mode, operate_object, operate,
conditions, params)
values (#{lineCode,jdbcType=VARCHAR}, #{prdType,jdbcType=VARCHAR}, #{simulationRole,jdbcType=VARCHAR},
#{controlMode,jdbcType=VARCHAR}, #{operateObject,jdbcType=VARCHAR}, #{operate,jdbcType=VARCHAR},
#{conditions,jdbcType=VARCHAR}, #{params,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.joylink.ms.entity.CommandDefinition" useGeneratedKeys="true">
insert into command_definition
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="lineCode != null">
line_code,
</if>
<if test="prdType != null">
prd_type,
</if>
<if test="simulationRole != null">
simulation_role,
</if>
<if test="controlMode != null">
control_mode,
</if>
<if test="operateObject != null">
operate_object,
</if>
<if test="operate != null">
operate,
</if>
<if test="conditions != null">
conditions,
</if>
<if test="params != null">
params,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="lineCode != null">
#{lineCode,jdbcType=VARCHAR},
</if>
<if test="prdType != null">
#{prdType,jdbcType=VARCHAR},
</if>
<if test="simulationRole != null">
#{simulationRole,jdbcType=VARCHAR},
</if>
<if test="controlMode != null">
#{controlMode,jdbcType=VARCHAR},
</if>
<if test="operateObject != null">
#{operateObject,jdbcType=VARCHAR},
</if>
<if test="operate != null">
#{operate,jdbcType=VARCHAR},
</if>
<if test="conditions != null">
#{conditions,jdbcType=VARCHAR},
</if>
<if test="params != null">
#{params,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.joylink.ms.entity.CommandDefinitionExample" resultType="java.lang.Long">
select count(*) from command_definition
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update command_definition
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.lineCode != null">
line_code = #{record.lineCode,jdbcType=VARCHAR},
</if>
<if test="record.prdType != null">
prd_type = #{record.prdType,jdbcType=VARCHAR},
</if>
<if test="record.simulationRole != null">
simulation_role = #{record.simulationRole,jdbcType=VARCHAR},
</if>
<if test="record.controlMode != null">
control_mode = #{record.controlMode,jdbcType=VARCHAR},
</if>
<if test="record.operateObject != null">
operate_object = #{record.operateObject,jdbcType=VARCHAR},
</if>
<if test="record.operate != null">
operate = #{record.operate,jdbcType=VARCHAR},
</if>
<if test="record.conditions != null">
conditions = #{record.conditions,jdbcType=VARCHAR},
</if>
<if test="record.params != null">
params = #{record.params,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update command_definition
set id = #{record.id,jdbcType=BIGINT},
line_code = #{record.lineCode,jdbcType=VARCHAR},
prd_type = #{record.prdType,jdbcType=VARCHAR},
simulation_role = #{record.simulationRole,jdbcType=VARCHAR},
control_mode = #{record.controlMode,jdbcType=VARCHAR},
operate_object = #{record.operateObject,jdbcType=VARCHAR},
operate = #{record.operate,jdbcType=VARCHAR},
conditions = #{record.conditions,jdbcType=VARCHAR},
params = #{record.params,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.joylink.ms.entity.CommandDefinition">
update command_definition
<set>
<if test="lineCode != null">
line_code = #{lineCode,jdbcType=VARCHAR},
</if>
<if test="prdType != null">
prd_type = #{prdType,jdbcType=VARCHAR},
</if>
<if test="simulationRole != null">
simulation_role = #{simulationRole,jdbcType=VARCHAR},
</if>
<if test="controlMode != null">
control_mode = #{controlMode,jdbcType=VARCHAR},
</if>
<if test="operateObject != null">
operate_object = #{operateObject,jdbcType=VARCHAR},
</if>
<if test="operate != null">
operate = #{operate,jdbcType=VARCHAR},
</if>
<if test="conditions != null">
conditions = #{conditions,jdbcType=VARCHAR},
</if>
<if test="params != null">
params = #{params,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.joylink.ms.entity.CommandDefinition">
update command_definition
set line_code = #{lineCode,jdbcType=VARCHAR},
prd_type = #{prdType,jdbcType=VARCHAR},
simulation_role = #{simulationRole,jdbcType=VARCHAR},
control_mode = #{controlMode,jdbcType=VARCHAR},
operate_object = #{operateObject,jdbcType=VARCHAR},
operate = #{operate,jdbcType=VARCHAR},
conditions = #{conditions,jdbcType=VARCHAR},
params = #{params,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>