forked from liweijie/education
排课功能优化
This commit is contained in:
@@ -12,6 +12,18 @@ public interface SSKCMapper extends BaseMapper<SSKC> {
|
||||
|
||||
List<SSKC> selectBySemester(@Param("nd") Integer nd, @Param("xqdc") Integer xqdc);
|
||||
|
||||
/**
|
||||
* 按年度查询全部实施_课程(不做停用过滤)。
|
||||
* <p>禁用 {@code selectList(wrapper)} 读本表:中文列名 + VARBINARY 主键下,
|
||||
* MyBatis-Plus 自动 SQL 的列标签与 resultMap 列名不匹配,会整行返回 null 元素。</p>
|
||||
*/
|
||||
List<SSKC> selectByNd(@Param("nd") Integer nd);
|
||||
|
||||
/**
|
||||
* 按科目编号查询实施_课程(同样绕开 selectList,原因见上)。
|
||||
*/
|
||||
List<SSKC> selectByKmbh(@Param("kmbh") String kmbh);
|
||||
|
||||
List<SSKC> selectByClassBh(@Param("classBh") String classBh, @Param("nd") Integer nd);
|
||||
|
||||
SSKC selectByCourseBhAndClassBh(@Param("courseBh") String courseBh, @Param("classBh") String classBh, @Param("nd") Integer nd);
|
||||
@@ -20,4 +32,20 @@ public interface SSKCMapper extends BaseMapper<SSKC> {
|
||||
* 按编号批量查询(编号为 VARBINARY GUID,不能用 selectBatchIds——主键 typeHandler 对 IN 参数不生效)
|
||||
*/
|
||||
List<SSKC> selectByBhs(@Param("list") List<String> bhs);
|
||||
|
||||
/**
|
||||
* 按编号批量删除(同上:编号为 VARBINARY GUID,deleteById 直绑字符串会报
|
||||
* dm.jdbc.driver.DMException: Invalid hexadecimal digits)。
|
||||
*
|
||||
* @return 删除行数
|
||||
*/
|
||||
int deleteByBhs(@Param("list") List<String> bhs);
|
||||
|
||||
/**
|
||||
* 按编号更新运行编制可调项(学时 / 周课时 / 责任教员 / 默认场地)。
|
||||
* 同样绕开 GUID 主键直接绑定:updateById 会对主键绑字符串而失败。
|
||||
* 传 null 的字段不更新。
|
||||
*/
|
||||
int updateBasicByBh(@Param("bh") String bh, @Param("xs") Integer xs, @Param("zks") Integer zks,
|
||||
@Param("jybh") String jybh, @Param("jsbh") String jsbh);
|
||||
}
|
||||
@@ -2,9 +2,46 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.roomroot.jwgl.mapper.SSKCMapper">
|
||||
|
||||
<!--
|
||||
注意:达梦业务表列名为中文,MyBatis 的 autoMapping 按列标签匹配 Java 属性名,
|
||||
"科目编号" 无法自动映射到 kmbh、"学时" 无法映射到 xs,会全部读出 null。
|
||||
因此这里必须逐列显式声明;autoMapping 仅作兜底。
|
||||
-->
|
||||
<resultMap id="SSKCMap" type="com.roomroot.jwgl.entity.SSKC" autoMapping="true">
|
||||
<id column="编号" property="bh" jdbcType="VARBINARY"
|
||||
typeHandler="com.roomroot.jwgl.handler.DmGuidTypeHandler"/>
|
||||
<result column="年度" property="nd"/>
|
||||
<result column="教员编号" property="jybh"/>
|
||||
<result column="教员课次序号" property="jykcxh"/>
|
||||
<result column="科目编号" property="kmbh"/>
|
||||
<result column="教室编号" property="jsbh"/>
|
||||
<result column="学时" property="xs"/>
|
||||
<result column="课类型" property="klx"/>
|
||||
<result column="课程标准编号" property="ktbzbh"/>
|
||||
<result column="课程课时系数" property="kcksxs"/>
|
||||
<result column="课程学员测评状态" property="kcxycpzt"/>
|
||||
<result column="学分" property="xf"/>
|
||||
<result column="创建时间" property="cjsj"/>
|
||||
<result column="变动时间" property="bdsj"/>
|
||||
<result column="课表变动时间" property="kbbdsj"/>
|
||||
<result column="测评结果样式编号" property="cpjgygbh"/>
|
||||
<result column="理论学时" property="llxs"/>
|
||||
<result column="实践学时" property="sjxs"/>
|
||||
<result column="考核学时" property="khxs"/>
|
||||
<result column="运行学时" property="yxxs"/>
|
||||
<result column="运行理论学时" property="yxllxs"/>
|
||||
<result column="运行实践学时" property="yxsjxs"/>
|
||||
<result column="运行考核学时" property="yxkhxs"/>
|
||||
<result column="成绩分制" property="cjfz"/>
|
||||
<result column="不计入学员平均分" property="bjrxypjf"/>
|
||||
<result column="周课时" property="zks"/>
|
||||
<result column="预计测评结束时间" property="yjcpjssj"/>
|
||||
<result column="分值权重标准编号" property="fzqzbzbh"/>
|
||||
<result column="JSONZD" property="jsonzd"/>
|
||||
<result column="评学综合得分" property="pxxhdf"/>
|
||||
<result column="确认评学综合" property="qrpxzh"/>
|
||||
<result column="责任教员编号" property="zrjybh"/>
|
||||
<result column="教员评学_结束状态" property="jypxjszt"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectBySemester" resultMap="SSKCMap">
|
||||
@@ -12,6 +49,24 @@
|
||||
WHERE 年度 = #{nd} AND 学期第次 = #{xqdc} AND 停用 = 0
|
||||
</select>
|
||||
|
||||
<!--
|
||||
按年度查询全部实施_课程。
|
||||
注意:本表列名为中文、主键为 VARBINARY(16),MyBatis-Plus 自动 SQL(BaseMapper.selectList 等)
|
||||
的列标签与 resultMap 的列名对不上,会让每一行都判为"未匹配任何列"而返回 null 元素
|
||||
(MyBatis returnInstanceForEmptyRow 默认 false 时会丢弃整行)。
|
||||
因此凡是要按条件读本表,一律走显式 XML,不要用 selectList。
|
||||
-->
|
||||
<select id="selectByNd" resultMap="SSKCMap">
|
||||
SELECT * FROM 实施_课程
|
||||
WHERE 年度 = #{nd}
|
||||
</select>
|
||||
|
||||
<!-- 同上:按科目编号查询,禁用 selectList -->
|
||||
<select id="selectByKmbh" resultMap="SSKCMap">
|
||||
SELECT * FROM 实施_课程
|
||||
WHERE 科目编号 = #{kmbh}
|
||||
</select>
|
||||
|
||||
<!--
|
||||
达梦:实施_课程.编号 为 VARBINARY(16),实施_课程学员队.实施_课程编号 为 CHAR(36)。
|
||||
禁止 编号 = 实施_课程编号:达梦会把 CHAR 当十六进制转 VARBINARY,UUID 中的 '-' 报 -6147。
|
||||
@@ -40,4 +95,26 @@
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<!-- 批量删除:同一原因,deleteById 直绑字符串会报 Invalid hexadecimal digits -->
|
||||
<delete id="deleteByBhs">
|
||||
DELETE FROM 实施_课程
|
||||
WHERE LOWER(RAWTOHEX("编号")) IN
|
||||
<foreach collection="list" item="bh" open="(" separator="," close=")">
|
||||
LOWER(REPLACE(TRIM(#{bh}), '-', ''))
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 更新运行编制可调项:同样绕开 GUID 主键直接绑定 -->
|
||||
<update id="updateBasicByBh">
|
||||
UPDATE 实施_课程
|
||||
<set>
|
||||
<if test="xs != null">"学时" = #{xs},</if>
|
||||
<if test="zks != null">"周课时" = #{zks},</if>
|
||||
<if test="jybh != null and jybh != ''">"教员编号" = #{jybh},</if>
|
||||
<if test="jsbh != null and jsbh != ''">"教室编号" = #{jsbh},</if>
|
||||
"变动时间" = CURRENT_TIMESTAMP
|
||||
</set>
|
||||
WHERE LOWER(RAWTOHEX("编号")) = LOWER(REPLACE(TRIM(#{bh}), '-', ''))
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user