lanan-system/dl-module-jx/src/main/resources/mapper/jx/DriveSchoolCoachMapper.xml
2024-08-28 00:54:30 +08:00

204 lines
12 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="cn.iocoder.yudao.module.jx.mapper.DriveSchoolCoachMapper">
<resultMap type="cn.iocoder.yudao.module.jx.domain.DriveSchoolCoach" id="DriveSchoolCoachResult">
<result property="id" column="id" />
<result property="deptId" column="dept_id" />
<result property="image" column="image" />
<result property="instructorName" column="instructor_name" />
<result property="phone" column="phone" />
<result property="student" column="student" />
<result property="driveLicense" column="drive_license" />
<result property="age" column="age" />
<result property="sex" column="sex" />
<result property="averageStar" column="average_star" />
<result property="experienceYear" column="experience_year" />
<result property="instructorDesc" column="instructor_desc" />
<result property="drivingYear" column="driving_year" />
<result property="driveCardType" column="drive_card_type" />
<result property="subjectType" column="subject_type" />
<result property="createTime" column="create_time" />
<result property="creator" column="creator" />
<result property="updateTime" column="update_time" />
<result property="updater" column="updater" />
<result property="indenty" column="indenty" />
<result property="carId" column="carId" />
<result property="address" column="address" />
</resultMap>
<sql id="selectDriveSchoolCoachVo">
select id,address, carId,indenty,dept_id, image, drive_license,instructor_name, phone, student,age, sex, average_star, experience_year, instructor_desc, driving_year, drive_card_type,subject_type, create_time, creator, update_time, updater from drive_school_coach
</sql>
<select id="selectAllJlId" resultMap="DriveSchoolCoachResult">
select * from drive_school_coach
</select>
<select id="selectDriveSchoolCoachList" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolCoach" resultMap="DriveSchoolCoachResult">
<include refid="selectDriveSchoolCoachVo"/>
<where>
deleted = 0
<if test="entity.id != null "> and id = #{entity.id}</if>
<if test="entity.deptId != null "> and dept_id = #{entity.deptId}</if>
<if test="entity.image != null and entity.image != ''"> and image = #{entity.image}</if>
<if test="entity.instructorName != null and entity.instructorName != ''"> and instructor_name like concat('%', #{entity.instructorName}, '%')</if>
<if test="entity.age != null "> and age = #{entity.age}</if>
<if test="entity.sex != null and entity.sex != ''"> and sex = #{entity.sex}</if>
<if test="entity.averageStar != null "> and average_star = #{entity.averageStar}</if>
<if test="entity.experienceYear != null "> and experience_year = #{entity.experienceYear}</if>
<if test="entity.instructorDesc != null and entity.instructorDesc != ''"> and instructor_desc = #{entity.instructorDesc}</if>
<if test="entity.subjectType != null and entity.subjectType != ''"> and subject_type like concat('%',#{entity.subjectType},'%')</if>
<if test="entity.drivingYear != null "> and driving_year = #{drivingYear}</if>
<if test="entity.driveCardType != null and entity.driveCardType != ''"> and drive_card_type = #{entity.driveCardType}</if>
</where>
order by create_time desc
</select>
<select id="selectDriveSchoolCoachListAll" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolCoach" resultMap="DriveSchoolCoachResult">
<include refid="selectDriveSchoolCoachVo"/>
<where>
deleted = 0
<if test="entity.id != null "> and id = #{entity.id}</if>
<if test="entity.deptId != null "> and dept_id = #{entity.deptId}</if>
<if test="entity.image != null and entity.image != ''"> and image = #{entity.image}</if>
<if test="entity.instructorName != null and entity.instructorName != ''"> and instructor_name like concat('%', #{entity.instructorName}, '%')</if>
<if test="entity.age != null "> and age = #{entity.age}</if>
<if test="entity.sex != null and entity.sex != ''"> and sex = #{entity.sex}</if>
<if test="entity.averageStar != null "> and average_star = #{entity.averageStar}</if>
<if test="entity.experienceYear != null "> and experience_year = #{entity.experienceYear}</if>
<if test="entity.instructorDesc != null and entity.instructorDesc != ''"> and instructor_desc = #{entity.instructorDesc}</if>
<if test="entity.subjectType != null and entity.subjectType != ''"> and subject_type like concat('%',#{entity.subjectType},'%')</if>
<if test="entity.drivingYear != null "> and driving_year = #{drivingYear}</if>
<if test="entity.driveCardType != null and entity.driveCardType != ''"> and drive_card_type = #{entity.driveCardType}</if>
</where>
order by create_time desc
</select>
<select id="selectDriveSchoolCoachById" parameterType="Long" resultMap="DriveSchoolCoachResult">
<include refid="selectDriveSchoolCoachVo"/>
where id = #{id}
</select>
<select id="findSelfJl" resultType="cn.iocoder.yudao.module.jx.domain.DriveSchoolCoach">
select
dsc.*
from drive_school_pay dsp join drive_school_coach dsc on dsp.jlId = dsc.id
where dsp.deleted = 0 and dsp.userId = #{userId} and jlId is not null
order by dsp.createTime desc
limit 1
</select>
<select id="findCoachByCoachName" resultType="cn.iocoder.yudao.module.jx.domain.DriveSchoolCoach">
select * from drive_school_coach where deleted = 0 and instructor_name = #{coachName}
</select>
<select id="findInfoByJxId" resultType="cn.iocoder.yudao.module.jx.domain.DriveSchoolCoach">
select * from drive_school_info where id = #{jxId}
</select>
<select id="findJlByDeptId" resultType="cn.iocoder.yudao.module.jx.domain.DriveSchoolCoach">
select * from drive_school_coach where deleted = 0 and dept_id = #{deptId}
</select>
<insert id="insertDriveSchoolCoach" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolCoach">
insert into drive_school_coach
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="deptId != null">dept_id,</if>
<if test="image != null">image,</if>
<if test="instructorName != null and instructorName != ''">instructor_name,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="student != null and student != ''">student,</if>
<if test="driveLicense != null and driveLicense != ''">drive_license,</if>
<if test="age != null">age,</if>
<if test="sex != null and sex != ''">sex,</if>
<if test="averageStar != null">average_star,</if>
<if test="experienceYear != null">experience_year,</if>
<if test="instructorDesc != null and instructorDesc != ''">instructor_desc,</if>
<if test="drivingYear != null">driving_year,</if>
<if test="driveCardType != null">drive_card_type,</if>
<if test="subjectType != null">subject_type,</if>
<if test="createTime != null">create_time,</if>
<if test="creator != null">creator,</if>
<if test="updateTime != null">update_time,</if>
<if test="updater != null">updater,</if>
<if test="indenty != null">indenty,</if>
<if test="carId != null">carId,</if>
<if test="address != null">address,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="deptId != null">#{deptId},</if>
<if test="image != null">#{image},</if>
<if test="instructorName != null and instructorName != ''">#{instructorName},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="student != null and student != ''">#{student},</if>
<if test="driveLicense != null and driveLicense != ''">#{driveLicense},</if>
<if test="age != null">#{age},</if>
<if test="sex != null and sex != ''">#{sex},</if>
<if test="averageStar != null">#{averageStar},</if>
<if test="experienceYear != null">#{experienceYear},</if>
<if test="instructorDesc != null and instructorDesc != ''">#{instructorDesc},</if>
<if test="drivingYear != null">#{drivingYear},</if>
<if test="driveCardType != null">#{driveCardType},</if>
<if test="subjectType != null">#{subjectType},</if>
<if test="createTime != null">#{createTime},</if>
<if test="creator != null">#{creator},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updater != null">#{updater},</if>
<if test="indenty != null">#{indenty},</if>
<if test="carId != null">#{carId},</if>
<if test="address != null">#{address},</if>
</trim>
</insert>
<update id="updateDriveSchoolCoach" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolCoach">
update drive_school_coach
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="image != null">image = #{image},</if>
<if test="instructorName != null and instructorName != ''">instructor_name = #{instructorName},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="student != null and student != ''">student = #{student},</if>
<if test="driveLicense != null and driveLicense != ''">drive_license = #{driveLicense},</if>
<if test="age != null">age = #{age},</if>
<if test="sex != null and sex != ''">sex = #{sex},</if>
<if test="averageStar != null">average_star = #{averageStar},</if>
<if test="experienceYear != null">experience_year = #{experienceYear},</if>
<if test="instructorDesc != null and instructorDesc != ''">instructor_desc = #{instructorDesc},</if>
<if test="drivingYear != null">driving_year = #{drivingYear},</if>
<if test="driveCardType != null">drive_card_type = #{driveCardType},</if>
<if test="subjectType != null">subject_type = #{subjectType},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="creator != null">creator = #{creator},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updater != null">updater = #{updater},</if>
<if test="indenty != null">indenty = #{indenty},</if>
<if test="carId != null">carId = #{carId},</if>
<if test="address != null">address = #{address},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDriveSchoolCoachById" parameterType="Long">
delete from drive_school_coach where id = #{id}
</delete>
<delete id="deleteDriveSchoolCoachByIds" parameterType="String">
delete from drive_school_coach where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getCoachNumber" resultType="Integer">
select count(1) number from drive_school_coach where dept_id = #{deptId}
</select>
<select id="selectByPhonenumber" parameterType="String" resultMap="DriveSchoolCoachResult">
<include refid="selectDriveSchoolCoachVo"/>
where deleted = 0 and phone = #{phonenumber}
</select>
</mapper>