修改提出的问题和新需求

This commit is contained in:
2025-07-30 10:09:14 +08:00
parent e08e1689a7
commit ecd499a497
11 changed files with 140 additions and 12 deletions

View File

@ -26,20 +26,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="yx" column="yx" />
<result property="qt" column="qt" />
<result property="sfqr" column="sfqr" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectCjStudentVo">
select id, xm,xh, xb, zy,xy,sydsh, sydshi, bynf, zgyl, gzdw, dwxz, dwdz, zwjb, shjz, dbry, rysfzs,sj, yx, qt, sfqr from cj_student
select id, xm,xh,bj, xb, zy,xy,sydsh, sydshi, bynf, zgyl, gzdw, dwxz, dwdz, zwjb, shjz, dbry, rysfzs,sj, yx, qt, sfqr,update_time from cj_student
</sql>
<select id="selectCjStudentList" parameterType="CjStudent" resultMap="CjStudentResult">
<include refid="selectCjStudentVo"/>
<where>
<if test="xm != null and xm != ''"> and xm = #{xm}</if>
<if test="xm != null and xm != ''"> and xm like concat('%', #{xm}, '%')</if>
<if test="xh != null and xh != ''"> and xh = #{xh}</if>
<if test="bj != null and bj != ''"> and bj = #{bj}</if>
<if test="xb != null and xb != ''"> and xb = #{xb}</if>
<if test="zy != null and zy != ''"> and zy = #{zy}</if>
<if test="xy != null and xy != ''"> and xy = #{xy}</if>
<if test="zy != null and zy != ''"> and zy like concat('%', #{zy}, '%')</if>
<if test="xy != null and xy != ''"> and xy like concat('%', #{xy}, '%')</if>
<if test="sydsh != null and sydsh != ''"> and sydsh = #{sydsh}</if>
<if test="sydshi != null and sydshi != ''"> and sydshi = #{sydshi}</if>
<if test="bynf != null "> and bynf = #{bynf}</if>
@ -75,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHEN rysfzs = 0 THEN '***'
WHEN rysfzs = 1 THEN xm
ELSE xm -- 可选:处理 rysfzs 不是 0 或 1 的情况
END AS xm,xh, xb, zy,xy,sydsh, sydshi, bynf, zgyl, gzdw, dwxz, dwdz, zwjb, shjz, dbry, rysfzs,sj, yx, qt, sfqr from cj_student
END AS xm,xh, xb,bj, zy,xy,sydsh, sydshi, bynf, zgyl, gzdw, dwxz, dwdz, zwjb, shjz, dbry, rysfzs,sj, yx, qt, sfqr from cj_student
<where>
dbry is not null and dbry != '' and dbry != '无'
</where>
@ -90,6 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into cj_student
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="xm != null">xm,</if>
<if test="bj != null">bj,</if>
<if test="xh != null">xh,</if>
<if test="xb != null">xb,</if>
<if test="zy != null">zy,</if>
@ -109,9 +112,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="yx != null">yx,</if>
<if test="qt != null">qt,</if>
<if test="sfqr != null">sfqr,</if>
</trim>
update_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="xm != null">#{xm},</if>
<if test="bj != null">#{bj},</if>
<if test="xh != null">#{xh},</if>
<if test="xb != null">#{xb},</if>
<if test="zy != null">#{zy},</if>
@ -131,16 +136,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="yx != null">#{yx},</if>
<if test="qt != null">#{qt},</if>
<if test="sfqr != null">#{sfqr},</if>
sysdate()
</trim>
</insert>
<insert id="insertCjStudentBatch" parameterType="list">
insert into cj_student
(xm,xh, xb, zy,xy,sydsh, sydshi, bynf, zgyl, gzdw, dwxz, dwdz, zwjb, shjz, dbry, rysfzs,sj, yx, qt, sfqr)
(xm,bj,xh, xb, zy,xy,sydsh, sydshi, bynf, zgyl, gzdw, dwxz, dwdz, zwjb, shjz, dbry, rysfzs,sj, yx, qt, sfqr,update_time)
VALUES
<foreach item="item" collection="list" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
#{item.xm},
#{item.bj},
#{item.xh},
#{item.xb},
#{item.zy},
@ -159,7 +166,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.sj},
#{item.yx},
#{item.qt},
#{item.sfqr}
#{item.sfqr},
sysdate()
</trim>
</foreach>
</insert>
@ -168,6 +176,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update cj_student
<trim prefix="SET" suffixOverrides=",">
<if test="xm != null">xm = #{xm},</if>
<if test="bj != null">bj = #{bj},</if>
<if test="xb != null">xb = #{xb},</if>
<if test="zy != null">zy = #{zy},</if>
<if test="sydsh != null">sydsh = #{sydsh},</if>
@ -185,6 +194,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="yx != null">yx = #{yx},</if>
<if test="qt != null">qt = #{qt},</if>
<if test="sfqr != null">sfqr = #{sfqr},</if>
update_time = sysdate()
</trim>
where id = #{id}
</update>

View File

@ -118,7 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
END AS city,
COUNT(*) AS student_count
FROM cj_student
where sfqr = 1
where sfqr = 1 and sydsh is not null
and cast(bynf as unsigned)
between YEAR(CURRENT_DATE) - #{year} + 1 and YEAR(CURRENT_DATE)
GROUP BY