车型支持电池改为查询数据库

This commit is contained in:
majian314
2025-09-26 17:24:08 +08:00
parent 399a365224
commit 0d6c2eb1d7
13 changed files with 1282 additions and 17 deletions

View File

@ -0,0 +1,128 @@
<?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.operation.mapper.ZcBatteryCategoryMapper">
<resultMap type="ZcBatteryCategory" id="ZcBatteryCategoryResult">
<result property="id" column="id" />
<result property="categoryName" column="category_name" />
<result property="product" column="product" />
<result property="icon" column="icon" />
<result property="isDelete" column="is_delete" />
<result property="voltage" column="voltage" />
<result property="ah" column="ah" />
<result property="maxVoltage" column="max_voltage" />
<result property="maxCharge" column="max_charge" />
<result property="batch" column="batch" />
<result property="cellId" column="cell_id" />
<result property="chargeId" column="charge_id" />
<result property="operatorId" column="operator_id" />
<result property="protectId" column="protect_id" />
<result property="supplierId" column="supplier_id" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
<result property="remarks" column="remarks" />
</resultMap>
<sql id="selectZcBatteryCategoryVo">
select id, category_name, product, icon, is_delete, voltage, ah, max_voltage, max_charge, batch, cell_id, charge_id, operator_id, protect_id, supplier_id ,
CONCAT(category_name,'/',product) as remarks
from zc_battery_category
</sql>
<select id="selectZcBatteryCategoryList" parameterType="ZcBatteryCategory" resultMap="ZcBatteryCategoryResult">
<include refid="selectZcBatteryCategoryVo"/>
<where>
<if test="categoryName != null and categoryName != ''"> and category_name like concat('%', #{categoryName}, '%')</if>
<if test="product != null and product != ''"> and product = #{product}</if>
<if test="icon != null and icon != ''"> and icon = #{icon}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
<if test="voltage != null and voltage != ''"> and voltage = #{voltage}</if>
<if test="ah != null and ah != ''"> and ah = #{ah}</if>
<if test="maxVoltage != null and maxVoltage != ''"> and max_voltage = #{maxVoltage}</if>
<if test="maxCharge != null and maxCharge != ''"> and max_charge = #{maxCharge}</if>
<if test="batch != null "> and batch = #{batch}</if>
</where>
</select>
<select id="selectZcBatteryCategoryById" parameterType="Long" resultMap="ZcBatteryCategoryResult">
<include refid="selectZcBatteryCategoryVo"/>
where id = #{id}
</select>
<insert id="insertZcBatteryCategory" parameterType="ZcBatteryCategory" useGeneratedKeys="true" keyProperty="id">
insert into zc_battery_category
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="categoryName != null and categoryName != ''">category_name,</if>
<if test="product != null and product != ''">product,</if>
<if test="icon != null">icon,</if>
<if test="isDelete != null">is_delete,</if>
<if test="voltage != null and voltage != ''">voltage,</if>
<if test="ah != null and ah != ''">ah,</if>
<if test="maxVoltage != null and maxVoltage != ''">max_voltage,</if>
<if test="maxCharge != null and maxCharge != ''">max_charge,</if>
<if test="batch != null">batch,</if>
<if test="cellId != null">cell_id,</if>
<if test="chargeId != null">charge_id,</if>
<if test="operatorId != null">operator_id,</if>
<if test="protectId != null">protect_id,</if>
<if test="supplierId != null">supplier_id,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="categoryName != null and categoryName != ''">#{categoryName},</if>
<if test="product != null and product != ''">#{product},</if>
<if test="icon != null">#{icon},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="voltage != null and voltage != ''">#{voltage},</if>
<if test="ah != null and ah != ''">#{ah},</if>
<if test="maxVoltage != null and maxVoltage != ''">#{maxVoltage},</if>
<if test="maxCharge != null and maxCharge != ''">#{maxCharge},</if>
<if test="batch != null">#{batch},</if>
<if test="cellId != null">#{cellId},</if>
<if test="chargeId != null">#{chargeId},</if>
<if test="operatorId != null">#{operatorId},</if>
<if test="protectId != null">#{protectId},</if>
<if test="supplierId != null">#{supplierId},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if>
</trim>
</insert>
<update id="updateZcBatteryCategory" parameterType="ZcBatteryCategory">
update zc_battery_category
<trim prefix="SET" suffixOverrides=",">
<if test="categoryName != null and categoryName != ''">category_name = #{categoryName},</if>
<if test="product != null and product != ''">product = #{product},</if>
<if test="icon != null">icon = #{icon},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="voltage != null and voltage != ''">voltage = #{voltage},</if>
<if test="ah != null and ah != ''">ah = #{ah},</if>
<if test="maxVoltage != null and maxVoltage != ''">max_voltage = #{maxVoltage},</if>
<if test="maxCharge != null and maxCharge != ''">max_charge = #{maxCharge},</if>
<if test="batch != null">batch = #{batch},</if>
<if test="cellId != null">cell_id = #{cellId},</if>
<if test="chargeId != null">charge_id = #{chargeId},</if>
<if test="operatorId != null">operator_id = #{operatorId},</if>
<if test="protectId != null">protect_id = #{protectId},</if>
<if test="supplierId != null">supplier_id = #{supplierId},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZcBatteryCategoryById" parameterType="Long">
delete from zc_battery_category where id = #{id}
</delete>
<delete id="deleteZcBatteryCategoryByIds" parameterType="String">
delete from zc_battery_category where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>