Merge pull request '1、数据获取调整' (#11) from dev-20240105 into master

Reviewed-on: #11
pull/12/head
chenyuan 1 year ago
commit 1680d35bd9

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

@ -117,7 +117,8 @@ public class MemberService {
// example.or(orCriteria);
// }
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);
}
@ -201,7 +202,7 @@ public class MemberService {
return memberMapper.selectAllTrainingList(schoolId);
}
public Member getPracticeMemberIdByStudentNumberAndPracticeTrainingId(String studentNumber,String practiceTrainingId) {
public Member getPracticeMemberIdByStudentNumberAndPracticeTrainingId(String studentNumber, String practiceTrainingId) {
MemberExample example = new MemberExample();
MemberExample.Criteria criteria = example.createCriteria();
criteria.andStudentNumberEqualTo(studentNumber).andTrainingIdEqualTo(practiceTrainingId);
@ -292,12 +293,12 @@ public class MemberService {
return totalProfitAndLoss;
}
public void updateStuRank(){
public void updateStuRank() {
memberMapper.updateStuRank();
}
public void buildPracticeMembers(List<Member> members) {
List<Member> memberList=new ArrayList<>();
List<Member> memberList = new ArrayList<>();
for (int i = 0; i < members.size(); i++) {
Member member = members.get(i);
if (checkUser(Constant.PRACTICE_TRAINING_ID, member.getStudentNumber())) { //解决相同账号会出现生成多个练习账号的问题
@ -309,14 +310,14 @@ public class MemberService {
member.setSchoolId(Constant.PRACTICE_SCHOOL_ID);
memberList.add(member);
}
if (memberList.size()>0){
if (memberList.size() > 0) {
insertAll(memberList);
}
}
public void buildPracticeMember(Member member) {
if (checkUser(Constant.PRACTICE_TRAINING_ID, member.getStudentNumber())) {
}else {
} else {
member.setMemberId(IdUtil.simpleUUID());
member.setTrainingId(Constant.PRACTICE_TRAINING_ID);
member.setTrainingName(Constant.TRAININGNAME);

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

Loading…
Cancel
Save