增加品牌管理,品牌动态选择

This commit is contained in:
19173159168
2025-08-12 21:25:07 +08:00
parent 676e156702
commit 6fadd0aed9
29 changed files with 1419 additions and 34 deletions

View File

@ -119,7 +119,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectCompanyStoreVo"/>
where id = #{id}
</select>
<select id="checkStoreNoUnique" parameterType="String" resultMap="CompanyStoreResult">
<include refid="selectCompanyStoreVo"/>
where store_number = #{storeNumber} and del_flag = '0' limit 1
</select>
<insert id="insertCompanyStore" parameterType="CompanyStore" useGeneratedKeys="true" keyProperty="id">
insert into zc_company_store
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -0,0 +1,151 @@
<?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.ZcCarBrandMapper">
<resultMap type="ZcCarBrand" id="ZcCarBrandResult">
<result property="id" column="id" />
<result property="brandName" column="brand_name" />
<result property="brandIntro" column="brand_intro" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="extend1" column="extend1" />
<result property="extend2" column="extend2" />
<result property="extend3" column="extend3" />
</resultMap>
<resultMap id="ZcCarBrandZcCarModelResult" type="ZcCarBrand" extends="ZcCarBrandResult">
<collection property="zcCarModelList" notNullColumn="sub_id" javaType="java.util.List" resultMap="ZcCarModelResult" />
</resultMap>
<resultMap type="ZcCarModel" id="ZcCarModelResult">
<result property="id" column="sub_id" />
<result property="modelName" column="sub_model_name" />
<result property="brandId" column="sub_brand_id" />
<result property="brandName" column="sub_brand_name" />
<result property="batteryType" column="sub_battery_type" />
<result property="maxSpeed" column="sub_max_speed" />
<result property="weight" column="sub_weight" />
<result property="status" column="sub_status" />
<result property="delFlag" column="sub_del_flag" />
<result property="createBy" column="sub_create_by" />
<result property="createTime" column="sub_create_time" />
<result property="updateBy" column="sub_update_by" />
<result property="updateTime" column="sub_update_time" />
<result property="remark" column="sub_remark" />
<result property="extend1" column="sub_extend1" />
<result property="extend2" column="sub_extend2" />
<result property="extend3" column="sub_extend3" />
</resultMap>
<sql id="selectZcCarBrandVo">
select id, brand_name, brand_intro, status, del_flag, create_by, create_time, update_by, update_time, remark, extend1, extend2, extend3 from zc_car_brand
</sql>
<select id="selectZcCarBrandList" parameterType="ZcCarBrand" resultMap="ZcCarBrandResult">
<include refid="selectZcCarBrandVo"/>
<where>
del_flag = '0'
<if test="brandName != null and brandName != ''"> and brand_name like concat('%', #{brandName}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="extend1 != null and extend1 != ''"> and extend1 = #{extend1}</if>
<if test="extend2 != null and extend2 != ''"> and extend2 = #{extend2}</if>
<if test="extend3 != null and extend3 != ''"> and extend3 = #{extend3}</if>
</where>
</select>
<select id="selectZcCarBrandById" parameterType="Long" resultMap="ZcCarBrandZcCarModelResult">
select a.id, a.brand_name, a.brand_intro, a.status, a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time, a.remark, a.extend1, a.extend2, a.extend3,
b.id as sub_id, b.model_name as sub_model_name, b.brand_id as sub_brand_id, b.brand_name as sub_brand_name, b.battery_type as sub_battery_type, b.max_speed as sub_max_speed, b.weight as sub_weight, b.status as sub_status, b.del_flag as sub_del_flag, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time, b.remark as sub_remark, b.extend1 as sub_extend1, b.extend2 as sub_extend2, b.extend3 as sub_extend3
from zc_car_brand a
left join zc_car_model b on b.brand_id = a.id
where a.id = #{id}
</select>
<insert id="insertZcCarBrand" parameterType="ZcCarBrand" useGeneratedKeys="true" keyProperty="id">
insert into zc_car_brand
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="brandName != null and brandName != ''">brand_name,</if>
<if test="brandIntro != null">brand_intro,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="extend1 != null">extend1,</if>
<if test="extend2 != null">extend2,</if>
<if test="extend3 != null">extend3,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="brandName != null and brandName != ''">#{brandName},</if>
<if test="brandIntro != null">#{brandIntro},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="extend1 != null">#{extend1},</if>
<if test="extend2 != null">#{extend2},</if>
<if test="extend3 != null">#{extend3},</if>
</trim>
</insert>
<update id="updateZcCarBrand" parameterType="ZcCarBrand">
update zc_car_brand
<trim prefix="SET" suffixOverrides=",">
<if test="brandName != null and brandName != ''">brand_name = #{brandName},</if>
<if test="brandIntro != null">brand_intro = #{brandIntro},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="extend1 != null">extend1 = #{extend1},</if>
<if test="extend2 != null">extend2 = #{extend2},</if>
<if test="extend3 != null">extend3 = #{extend3},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZcCarBrandById" parameterType="Long">
delete from zc_car_brand where id = #{id}
</delete>
<delete id="deleteZcCarBrandByIds" parameterType="String">
delete from zc_car_brand where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteZcCarModelByBrandIds" parameterType="String">
delete from zc_car_model where brand_id in
<foreach item="brandId" collection="array" open="(" separator="," close=")">
#{brandId}
</foreach>
</delete>
<delete id="deleteZcCarModelByBrandId" parameterType="Long">
delete from zc_car_model where brand_id = #{brandId}
</delete>
<insert id="batchZcCarModel">
insert into zc_car_model( id, model_name, brand_id, brand_name, battery_type, max_speed, weight, status, del_flag, create_by, create_time, update_by, update_time, remark, extend1, extend2, extend3) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.modelName}, #{item.brandId}, #{item.brandName}, #{item.batteryType}, #{item.maxSpeed}, #{item.weight}, #{item.status}, #{item.delFlag}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark}, #{item.extend1}, #{item.extend2}, #{item.extend3})
</foreach>
</insert>
</mapper>

View File

@ -49,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectZcCarModelVo"/>
<where>
<if test="modelName != null and modelName != ''"> and model_name like concat('%', #{modelName}, '%')</if>
<if test="brandId != null"> and brand_id = #{brandId}</if>
<if test="brandName != null and brandName != ''"> and brand_name like concat('%', #{brandName}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
@ -124,7 +125,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
where id = #{id}
</update>
<update id="updateZcCarModelBrand" parameterType="ZcCarModel">
update zc_car_model set brand_name = #{brandName} where brand_id = #{brandId}
</update>
<delete id="deleteZcCarModelById" parameterType="Long">
delete from zc_car_model where id = #{id}
</delete>
@ -141,6 +144,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectModelsByBrand" resultMap="ZcCarModelResult">
SELECT id,model_name FROM zc_car_model WHERE del_flag = 0 and brand_name = #{brandName} ORDER BY model_name ASC
SELECT id,model_name FROM zc_car_model WHERE del_flag = 0 and brand_id = #{brandId} ORDER BY model_name ASC
</select>
<select id="checkModelNameUnique" resultType="com.ruoyi.operation.domain.ZcCarModel">
SELECT * FROM zc_car_model WHERE del_flag = 0 and brand_id = #{brandId} and model_name = #{modelName}
</select>
</mapper>