93 lines
3.1 KiB
XML
93 lines
3.1 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.ho.business.mapper.ConvertMapper">
|
||
|
|
|
||
|
|
<resultMap id="BaseResultMap" type="com.ho.business.entity.Convert">
|
||
|
|
<id property="id" column="id" jdbcType="INTEGER"/>
|
||
|
|
<result property="stationId" column="station_id" jdbcType="INTEGER"/>
|
||
|
|
<result property="srcId" column="src_id" jdbcType="INTEGER"/>
|
||
|
|
<result property="col" column="col" jdbcType="VARCHAR"/>
|
||
|
|
<result property="colName" column="col_name" jdbcType="VARCHAR"/>
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<sql id="Base_Column_List">
|
||
|
|
id
|
||
|
|
,station_id,src_id,
|
||
|
|
col,col_name
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.ho.business.entity.Convert"
|
||
|
|
useGeneratedKeys="true">
|
||
|
|
insert into `convert`
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="srcId != null">src_id,</if>
|
||
|
|
<if test="stationId != null">station_id,</if>
|
||
|
|
<if test="col != null">col,</if>
|
||
|
|
<if test="colName != null">col_name,</if>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="srcId != null">#{srcId,jdbcType=INTEGER},</if>
|
||
|
|
<if test="stationId != null">#{stationId,jdbcType=INTEGER},</if>
|
||
|
|
<if test="col != null">#{col},</if>
|
||
|
|
<if test="colName != null">#{colName},</if>
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<delete id="delete">
|
||
|
|
delete
|
||
|
|
from `convert`
|
||
|
|
where id = #{id,jdbcType=INTEGER}
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<select id="selectByStationIdAndCol" resultType="com.ho.business.entity.Convert">
|
||
|
|
SELECT
|
||
|
|
<include refid="Base_Column_List"/>
|
||
|
|
from `convert`
|
||
|
|
<where>
|
||
|
|
<if test="stationId != null ">
|
||
|
|
station_id = #{stationId}
|
||
|
|
</if>
|
||
|
|
<if test="col != null">
|
||
|
|
and col = #{col}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectByParam" resultType="com.ho.business.entity.Convert">
|
||
|
|
SELECT
|
||
|
|
<include refid="Base_Column_List"/>
|
||
|
|
from `convert`
|
||
|
|
<where>
|
||
|
|
<if test="stationId != null ">
|
||
|
|
station_id = #{stationId}
|
||
|
|
</if>
|
||
|
|
<if test="name != null">
|
||
|
|
and col_name LIKE concat('%',#{name},'%')
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectByCols" resultType="java.lang.String">
|
||
|
|
SELECT
|
||
|
|
col
|
||
|
|
from `convert`
|
||
|
|
<where>
|
||
|
|
<if test="stationId != null ">
|
||
|
|
station_id = #{stationId}
|
||
|
|
</if>
|
||
|
|
<if test="srcId != null ">
|
||
|
|
and src_id = #{srcId}
|
||
|
|
</if>
|
||
|
|
<if test="cols != null and cols.size != 0 ">
|
||
|
|
and col in
|
||
|
|
<foreach collection="cols" open="(" close=")" separator="," item="item">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
|
||
|
|
</select>
|
||
|
|
</mapper>
|