no message
This commit is contained in:
121
src/main/resources/mapper/BatteryCategoryMapper.xml
Normal file
121
src/main/resources/mapper/BatteryCategoryMapper.xml
Normal file
@ -0,0 +1,121 @@
|
||||
<?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.sczx.sync.mapper.BatteryCategoryMapper">
|
||||
|
||||
<!-- 结果映射 -->
|
||||
<resultMap id="BatteryCategoryMap" type="com.sczx.sync.dto.BatteryCategory">
|
||||
<id property="id" column="id"/>
|
||||
<result property="category_name" column="category_name"/>
|
||||
<result property="product" column="product"/>
|
||||
<result property="icon" column="icon"/>
|
||||
<result property="is_delete" column="is_delete"/>
|
||||
<result property="voltage" column="voltage"/>
|
||||
<result property="ah" column="ah"/>
|
||||
<result property="max_voltage" column="max_voltage"/>
|
||||
<result property="max_charge" column="max_charge"/>
|
||||
<result property="batch" column="batch"/>
|
||||
<result property="cell_id" column="cell_id"/>
|
||||
<result property="charge_id" column="charge_id"/>
|
||||
<result property="operator_id" column="operator_id"/>
|
||||
<result property="protect_id" column="protect_id"/>
|
||||
<result property="supplier_id" column="supplier_id"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 表名 -->
|
||||
<sql id="table_name">zc_battery_category</sql>
|
||||
|
||||
<!-- 所有字段 -->
|
||||
<sql id="all_columns">
|
||||
id, category_name, product, icon, is_delete, voltage, ah, max_voltage,
|
||||
max_charge, batch, cell_id, charge_id, operator_id, protect_id, supplier_id
|
||||
</sql>
|
||||
|
||||
<!-- 更新电池类别 -->
|
||||
<update id="update" parameterType="com.sczx.sync.dto.BatteryCategory">
|
||||
UPDATE
|
||||
<include refid="table_name"/>
|
||||
<set>
|
||||
<if test="category_name != null and category_name != ''">
|
||||
category_name = #{category_name},
|
||||
</if>
|
||||
<if test="product != null and product != ''">
|
||||
product = #{product},
|
||||
</if>
|
||||
<if test="icon != null and icon != ''">
|
||||
icon = #{icon},
|
||||
</if>
|
||||
<if test="is_delete != null">
|
||||
is_delete = #{is_delete},
|
||||
</if>
|
||||
<if test="voltage != null and voltage != ''">
|
||||
voltage = #{voltage},
|
||||
</if>
|
||||
<if test="ah != null and ah != ''">
|
||||
ah = #{ah},
|
||||
</if>
|
||||
<if test="max_voltage != null and max_voltage != ''">
|
||||
max_voltage = #{max_voltage},
|
||||
</if>
|
||||
<if test="max_charge != null and max_charge != ''">
|
||||
max_charge = #{max_charge},
|
||||
</if>
|
||||
<if test="batch != null">
|
||||
batch = #{batch},
|
||||
</if>
|
||||
<if test="cell_id != null">
|
||||
cell_id = #{cell_id},
|
||||
</if>
|
||||
<if test="charge_id != null">
|
||||
charge_id = #{charge_id},
|
||||
</if>
|
||||
<if test="operator_id != null">
|
||||
operator_id = #{operator_id},
|
||||
</if>
|
||||
<if test="protect_id != null">
|
||||
protect_id = #{protect_id},
|
||||
</if>
|
||||
<if test="supplier_id != null">
|
||||
supplier_id = #{supplier_id},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 根据ID查询电池类别 -->
|
||||
<select id="selectById" resultMap="BatteryCategoryMap">
|
||||
SELECT
|
||||
<include refid="all_columns"/>
|
||||
FROM
|
||||
<include refid="table_name"/>
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 插入电池类别 -->
|
||||
<insert id="insert" parameterType="com.sczx.sync.dto.BatteryCategory">
|
||||
INSERT INTO
|
||||
<include refid="table_name"/>
|
||||
(
|
||||
<include refid="all_columns"/>
|
||||
)
|
||||
VALUES (
|
||||
#{id},
|
||||
#{category_name},
|
||||
#{product},
|
||||
#{icon},
|
||||
#{is_delete},
|
||||
#{voltage},
|
||||
#{ah},
|
||||
#{max_voltage},
|
||||
#{max_charge},
|
||||
#{batch},
|
||||
#{cell_id},
|
||||
#{charge_id},
|
||||
#{operator_id},
|
||||
#{protect_id},
|
||||
#{supplier_id}
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user