Files
zhxg_java/srs-comprehensive/src/main/resources/mapper/comprehensive/CphTermMapper.xml

69 lines
2.7 KiB
XML
Raw Normal View History

2025-07-28 15:14:11 +08:00
<?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.srs.comprehensive.mapper.CphTermMapper">
<resultMap type="CphTerm" id="CphTermResult">
<result property="id" column="id" />
<result property="termName" column="term_name" />
<result property="termCode" column="term_code" />
<result property="stuYearId" column="stu_year_id" />
</resultMap>
<sql id="selectCphTermVo">
select id, term_name, term_code, stu_year_id from cph_term
</sql>
<select id="selectCphTermList" parameterType="CphTerm" resultMap="CphTermResult">
<include refid="selectCphTermVo"/>
<where>
<if test="termName != null and termName != ''"> and term_name like concat('%', #{termName}, '%')</if>
<if test="termCode != null and termCode != ''"> and term_code = #{termCode}</if>
<if test="stuYearId != null "> and stu_year_id = #{stuYearId}</if>
</where>
</select>
<select id="selectCphTermById" parameterType="Long" resultMap="CphTermResult">
<include refid="selectCphTermVo"/>
where id = #{id}
</select>
<insert id="insertCphTerm" parameterType="CphTerm" useGeneratedKeys="true" keyProperty="id">
insert into cph_term
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="termName != null">term_name,</if>
<if test="termCode != null">term_code,</if>
<if test="stuYearId != null">stu_year_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="termName != null">#{termName},</if>
<if test="termCode != null">#{termCode},</if>
<if test="stuYearId != null">#{stuYearId},</if>
</trim>
</insert>
<select id="xlkterm_name" resultMap="CphTermResult">
SELECT id,term_name FROM cph_term
</select>
<update id="updateCphTerm" parameterType="CphTerm">
update cph_term
<trim prefix="SET" suffixOverrides=",">
<if test="termName != null">term_name = #{termName},</if>
<if test="termCode != null">term_code = #{termCode},</if>
<if test="stuYearId != null">stu_year_id = #{stuYearId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCphTermById" parameterType="Long">
delete from cph_term where id = #{id}
</delete>
<delete id="deleteCphTermByIds" parameterType="String">
delete from cph_term where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>