76 lines
3.8 KiB
XML
76 lines
3.8 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.ruoyi.system.mapper.UnitConversionMapper">
|
|
|
|
<resultMap type="UnitConversion" id="UnitConversionResult">
|
|
<result property="id" column="id" />
|
|
<result property="unitType" column="unit_type" />
|
|
<result property="unitName" column="unit_name" />
|
|
<result property="baseUnit" column="base_unit" />
|
|
<result property="conversionFactor" column="conversion_factor" />
|
|
<result property="unitTypeName" column="unit_type_name" />
|
|
</resultMap>
|
|
|
|
<sql id="selectUnitConversionVo">
|
|
select id, unit_type, unit_name, base_unit, conversion_factor, unit_type_name from unit_conversion
|
|
</sql>
|
|
|
|
<select id="selectUnitConversionList" parameterType="UnitConversion" resultMap="UnitConversionResult">
|
|
<include refid="selectUnitConversionVo"/>
|
|
<where>
|
|
<if test="unitType != null and unitType != ''"> and unit_type = #{unitType}</if>
|
|
<if test="unitName != null and unitName != ''"> and unit_name like concat('%', #{unitName}, '%')</if>
|
|
<if test="baseUnit != null "> and base_unit = #{baseUnit}</if>
|
|
<if test="conversionFactor != null and conversionFactor != ''"> and conversion_factor = #{conversionFactor}</if>
|
|
<if test="unitTypeName != null and unitTypeName != ''"> and unit_type_name like concat('%', #{unitTypeName}, '%')</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectUnitConversionById" parameterType="Long" resultMap="UnitConversionResult">
|
|
<include refid="selectUnitConversionVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertUnitConversion" parameterType="UnitConversion" useGeneratedKeys="true" keyProperty="id">
|
|
insert into unit_conversion
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="unitType != null and unitType != ''">unit_type,</if>
|
|
<if test="unitName != null and unitName != ''">unit_name,</if>
|
|
<if test="baseUnit != null">base_unit,</if>
|
|
<if test="conversionFactor != null">conversion_factor,</if>
|
|
<if test="unitTypeName != null and unitTypeName != ''">unit_type_name,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="unitType != null and unitType != ''">#{unitType},</if>
|
|
<if test="unitName != null and unitName != ''">#{unitName},</if>
|
|
<if test="baseUnit != null">#{baseUnit},</if>
|
|
<if test="conversionFactor != null">#{conversionFactor},</if>
|
|
<if test="unitTypeName != null and unitTypeName != ''">#{unitTypeName},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateUnitConversion" parameterType="UnitConversion">
|
|
update unit_conversion
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="unitType != null and unitType != ''">unit_type = #{unitType},</if>
|
|
<if test="unitName != null and unitName != ''">unit_name = #{unitName},</if>
|
|
<if test="baseUnit != null">base_unit = #{baseUnit},</if>
|
|
<if test="conversionFactor != null">conversion_factor = #{conversionFactor},</if>
|
|
<if test="unitTypeName != null and unitTypeName != ''">unit_type_name = #{unitTypeName},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteUnitConversionById" parameterType="Long">
|
|
delete from unit_conversion where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteUnitConversionByIds" parameterType="String">
|
|
delete from unit_conversion where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |