<?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.thhy.engineering.modules.biz.car.mapper.SysCarMapper">
|
<resultMap id="BaseResultMap" type="com.thhy.engineering.modules.biz.car.entity.SysCar">
|
<!--
|
WARNING - @mbg.generated
|
This element is automatically generated by MyBatis Generator, do not modify.
|
This element was generated on Mon May 15 10:53:49 CST 2023.
|
-->
|
<id column="car_id" jdbcType="VARCHAR" property="carId" />
|
<result column="car_brand" jdbcType="VARCHAR" property="carBrand" />
|
<result column="car_type" jdbcType="VARCHAR" property="carType" />
|
<result column="car_driver" jdbcType="VARCHAR" property="carDriver" />
|
<result column="car_phone" jdbcType="VARCHAR" property="carPhone" />
|
<result column="car_notes" jdbcType="VARCHAR" property="carNotes" />
|
<result column="is_use" jdbcType="INTEGER" property="isUse" />
|
<result column="company_id" jdbcType="VARCHAR" property="companyId" />
|
</resultMap>
|
|
|
<select id="carBrandByOne" parameterType="java.lang.String" resultType="java.lang.String">
|
select car_id as carId from sys_car
|
where is_use=1
|
and car_brand=#{carBrand}
|
</select>
|
<insert id="carInsert">
|
insert into sys_car
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="carId != null">
|
car_id,
|
</if>
|
<if test="carBrand != null">
|
car_brand,
|
</if>
|
<if test="carType != null">
|
car_type,
|
</if>
|
<if test="carDriver != null">
|
car_driver,
|
</if>
|
<if test="carPhone != null">
|
car_phone,
|
</if>
|
<if test="carNotes != null">
|
car_notes,
|
</if>
|
<if test="isUse != null">
|
is_use,
|
</if>
|
<if test="companyId != null">
|
company_id,
|
</if>
|
<if test="createUser != null">
|
create_user,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="carId != null">
|
#{carId,jdbcType=VARCHAR},
|
</if>
|
<if test="carBrand != null">
|
#{carBrand,jdbcType=VARCHAR},
|
</if>
|
<if test="carType != null">
|
#{carType,jdbcType=VARCHAR},
|
</if>
|
<if test="carDriver != null">
|
#{carDriver,jdbcType=VARCHAR},
|
</if>
|
<if test="carPhone != null">
|
#{carPhone,jdbcType=VARCHAR},
|
</if>
|
<if test="carNotes != null">
|
#{carNotes,jdbcType=VARCHAR},
|
</if>
|
<if test="isUse != null">
|
#{isUse,jdbcType=INTEGER},
|
</if>
|
<if test="companyId != null">
|
#{companyId,jdbcType=VARCHAR},
|
</if>
|
<if test="createUser != null">
|
#{createUser,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
|
<select id="carList" resultType="com.thhy.engineering.modules.biz.car.entity.SysCar">
|
SELECT
|
sc.car_id AS carId,
|
sc.car_brand AS carBrand,
|
sc.car_driver AS carDriver,
|
sc.car_notes AS carNotes,
|
sc.car_phone AS carPhone,
|
sd.dict_name AS dictName
|
FROM
|
sys_car sc
|
LEFT JOIN sys_dict sd ON sc.car_type = sd.dict_id
|
where sc.is_use=1
|
<if test="companyId!=null and companyId!='' ">
|
and sc.company_id=#{companyId}
|
</if>
|
<if test="carBrand!=null and carBrand!='' ">
|
and sc.car_brand like concat('%',#{carBrand},'%')
|
</if>
|
order by sc.create_time desc
|
</select>
|
|
<select id="carInfo" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.car.entity.SysCar">
|
SELECT
|
sc.car_id AS carId,
|
sc.car_brand AS carBrand,
|
sc.car_driver AS carDriver,
|
sc.car_notes AS carNotes,
|
sc.car_phone AS carPhone,
|
sd.dict_name AS dictName,
|
sc.car_type as carType
|
FROM
|
sys_car sc
|
LEFT JOIN sys_dict sd ON sc.car_type = sd.dict_id
|
where sc.is_use=1
|
and sc.car_id=#{carId}
|
</select>
|
<update id="carDel" parameterType="java.lang.String">
|
update sys_car set
|
is_use=2
|
where car_id=#{carId}
|
</update>
|
<update id="carUpdate" >
|
update sys_car
|
<set>
|
<if test="carBrand != null">
|
car_brand = #{carBrand,jdbcType=VARCHAR},
|
</if>
|
<if test="carType != null">
|
car_type = #{carType,jdbcType=VARCHAR},
|
</if>
|
<if test="carDriver != null">
|
car_driver = #{carDriver,jdbcType=VARCHAR},
|
</if>
|
<if test="carPhone != null">
|
car_phone = #{carPhone,jdbcType=VARCHAR},
|
</if>
|
<if test="carNotes != null">
|
car_notes = #{carNotes,jdbcType=VARCHAR},
|
</if>
|
<if test="isUse != null">
|
is_use = #{isUse,jdbcType=INTEGER},
|
</if>
|
<if test="companyId != null">
|
company_id = #{companyId,jdbcType=VARCHAR},
|
</if>
|
</set>
|
where car_id = #{carId,jdbcType=VARCHAR}
|
</update>
|
<select id="carPull" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.car.entity.SysCar">
|
SELECT
|
sc.car_id AS carId,
|
sc.car_brand AS carBrand,
|
sc.car_driver AS carDriver,
|
sc.car_notes AS carNotes,
|
sc.car_phone AS carPhone,
|
sd.dict_name AS dictName
|
FROM
|
sys_car sc
|
LEFT JOIN sys_dict sd ON sc.car_type = sd.dict_id
|
where sc.is_use=1
|
<if test="companyId!=null and companyId!='' ">
|
and sc.company_id=#{companyId}
|
</if>
|
</select>
|
</mapper>
|