1、数据获取调整

pull/11/head
陈沅 1 year ago
parent 937bb33720
commit 984ca14c4a

@ -66,43 +66,44 @@ public interface MemberMapper {
List<MemberVO> selectByCondition(MemberExample example); List<MemberVO> selectByCondition(MemberExample example);
@Select("<script>" + // @Select("<script>" +
"SELECT m.*, t.status AS trainingStatus " + // "SELECT m.*, t.status AS trainingStatus " +
"FROM sys_member m " + // "FROM sys_member m " +
"LEFT JOIN sys_training t ON m.training_id = t.training_id " + // "LEFT JOIN sys_training t ON m.training_id = t.training_id " +
"WHERE m.school_id = #{schoolId} " + // "WHERE m.school_id = #{schoolId} " +
"AND (t.status = 'FINISHED') " + // "AND (t.status = 'FINISHED') " +
"<if test='className != null and className.trim() != \"\"'> " + // "<if test='className != null and className.trim() != \"\"'> " +
"AND m.class_grade = #{className} " + // "AND m.class_grade = #{className} " +
"</if> " + // "</if> " +
"<if test='trainingName != null and trainingName.trim() != \"\"'> " + // "<if test='trainingName != null and trainingName.trim() != \"\"'> " +
"AND t.training_name = #{trainingName} " + // "AND t.training_name = #{trainingName} " +
"</if> " + // "</if> " +
"<if test='markStatus != null'> " + // "<if test='markStatus != null'> " +
"<if test='markStatus == 0'> " + // "<if test='markStatus == 0'> " +
"AND m.report_score IS NULL " + // "AND m.report_score IS NULL " +
"</if> " + // "</if> " +
"<if test='markStatus == 1'> " + // "<if test='markStatus == 1'> " +
"AND m.report_score IS NOT NULL " + // "AND m.report_score IS NOT NULL " +
"</if> " + // "</if> " +
"</if> " + // "</if> " +
"<if test='keyword != null and keyword.trim() != \"\"'> " + // "<if test='keyword != null and keyword.trim() != \"\"'> " +
"AND (m.name LIKE CONCAT('%', #{keyword}, '%') OR m.student_number LIKE CONCAT('%', #{keyword}, '%')) " + // "AND (m.name LIKE CONCAT('%', #{keyword}, '%') OR m.student_number LIKE CONCAT('%', #{keyword}, '%')) " +
"</if>" + // "</if>" +
" order by stu_rank " + // " order by stu_rank " +
"</script>") // "</script>")
@Results(id = "memberVO", value = { // @Results(id = "memberVO", value = {
@Result(column = "member_id", property = "memberId", jdbcType = JdbcType.VARCHAR, id = true), // @Result(column = "member_id", property = "memberId", jdbcType = JdbcType.VARCHAR, id = true),
@Result(column = "training_id", property = "trainingId", jdbcType = JdbcType.VARCHAR), // @Result(column = "training_id", property = "trainingId", jdbcType = JdbcType.VARCHAR),
@Result(column = "name", property = "name", jdbcType = JdbcType.VARCHAR), // @Result(column = "name", property = "name", jdbcType = JdbcType.VARCHAR),
@Result(column = "student_number",property = "studentNumber", jdbcType = JdbcType.VARCHAR), // @Result(column = "student_number",property = "studentNumber", jdbcType = JdbcType.VARCHAR),
@Result(column = "class_grade",property = "classGrade", jdbcType = JdbcType.VARCHAR), // @Result(column = "class_grade",property = "classGrade", jdbcType = JdbcType.VARCHAR),
@Result(column = "stu_rank",property = "stuRank", jdbcType = JdbcType.INTEGER), // @Result(column = "stu_rank",property = "stuRank", jdbcType = JdbcType.INTEGER),
@Result(column = "cumulative_profit_loss",property = "cumulativeProfitLoss", jdbcType = JdbcType.DECIMAL), // @Result(column = "cumulative_profit_loss",property = "cumulativeProfitLoss", jdbcType = JdbcType.DECIMAL),
@Result(column = "report_score",property = "reportScore", jdbcType = JdbcType.DECIMAL), // @Result(column = "report_score",property = "reportScore", jdbcType = JdbcType.DECIMAL),
@Result(column = "yield",property = "yield", jdbcType = JdbcType.DECIMAL), // @Result(column = "yield",property = "yield", jdbcType = JdbcType.DECIMAL),
@Result(column = "training_name",property = "trainingName", jdbcType = JdbcType.VARCHAR), // @Result(column = "training_name",property = "trainingName", jdbcType = JdbcType.VARCHAR),
}) // @Result(column = "training_status",property = "trainingStatus", jdbcType = JdbcType.VARCHAR),
// })
List<MemberVO> pagedListMembers(@Param("className") String className, List<MemberVO> pagedListMembers(@Param("className") String className,
@Param("trainingName") String trainingName, @Param("trainingName") String trainingName,
@Param("markStatus") Integer markStatus, @Param("markStatus") Integer markStatus,

@ -117,7 +117,8 @@ public class MemberService {
// example.or(orCriteria); // example.or(orCriteria);
// } // }
PageHelper.startPage(page, size); PageHelper.startPage(page, size);
return new PageInfo<>(memberMapper.pagedListMembers(className, trainingName, markStatus, keyword, user.getSchoolId())); List<MemberVO> members = memberMapper.pagedListMembers(className, trainingName, markStatus, keyword, user.getSchoolId());
return new PageInfo<>(members);
} }

@ -381,28 +381,44 @@
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<!-- <select id="pagedListMembers" parameterType="com.sztzjy.forex.trading_trading.entity.MemberExample"--> <resultMap id="memberResultMap" type="com.sztzjy.forex.trading_trading.dto.MemberVO">
<!-- resultMap="BaseResultMapForMemberVO">--> <id property="memberId" column="member_id" jdbcType="VARCHAR"/>
<!-- &lt;!&ndash;--> <result property="trainingId" column="training_id" jdbcType="VARCHAR"/>
<!-- WARNING - @mbg.generated--> <result property="name" column="name" jdbcType="VARCHAR"/>
<!-- This element is automatically generated by MyBatis Generator, do not modify.--> <result property="studentNumber" column="student_number" jdbcType="VARCHAR"/>
<!-- This element was generated on Fri Jun 30 14:15:42 CST 2023.--> <result property="classGrade" column="class_grade" jdbcType="VARCHAR"/>
<!-- &ndash;&gt;--> <result property="stuRank" column="stu_rank" jdbcType="INTEGER"/>
<!-- select--> <result property="cumulativeProfitLoss" column="cumulative_profit_loss" jdbcType="DECIMAL"/>
<!-- <if test="distinct">--> <result property="reportScore" column="report_score" jdbcType="DECIMAL"/>
<!-- distinct--> <result property="yield" column="yield" jdbcType="DECIMAL"/>
<!-- </if>--> <result property="trainingName" column="training_name" jdbcType="VARCHAR"/>
<!-- <include refid="Base_Column_List"/>--> </resultMap>
<!-- from sys_member m-->
<!-- LEFT JOIN sys_training t ON m.training_id = t.training_id--> <select id="pagedListMembers" resultMap="memberResultMap">
<!-- <if test="_parameter != null">--> SELECT m.*, t.status AS trainingStatus
<!-- <include refid="Example_Where_Clause"/>--> FROM sys_member m
<!-- </if>--> LEFT JOIN sys_training t ON m.training_id = t.training_id
<!-- and t.status = 'finished'--> WHERE m.school_id = #{schoolId}
<!-- <if test="orderByClause != null">--> AND (t.status = 'FINISHED')
<!-- order by ${orderByClause}--> <if test="className != null and className != ''">
<!-- </if>--> AND m.class_grade = #{className}
<!-- </select>--> </if>
<if test="trainingName != null and trainingName != ''">
AND t.training_name = #{trainingName}
</if>
<if test="markStatus != null">
<if test="markStatus == 0">
AND m.report_score IS NULL
</if>
<if test="markStatus == 1">
AND m.report_score IS NOT NULL
</if>
</if>
<if test="keyword != null and keyword != ''">
AND (m.name LIKE CONCAT('%', #{keyword}, '%') OR m.student_number LIKE CONCAT('%', #{keyword}, '%'))
</if>
ORDER BY stu_rank
</select>
<insert id="insertAll" parameterType="java.util.List"> <insert id="insertAll" parameterType="java.util.List">
insert into sys_member (member_id, training_id, name, insert into sys_member (member_id, training_id, name,

Loading…
Cancel
Save