Commit 6a6b0517 authored by licc's avatar licc

方案查询接口逻辑实现

parent 91f334be
...@@ -6,7 +6,9 @@ import java.math.BigDecimal; ...@@ -6,7 +6,9 @@ import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 字符串工具类 * 字符串工具类
...@@ -541,4 +543,23 @@ public class StringUtil { ...@@ -541,4 +543,23 @@ public class StringUtil {
return sb2.toString(); return sb2.toString();
} }
} }
/**
* 把 "1,2,3,4,5,6,7" 转化为list
*
* @param s 入参
* @return 结果
*/
public static List<Integer> strToArray(String s) {
if (StringUtils.isEmpty(s)) {
return new ArrayList<>();
}
List<Integer> result = new ArrayList<>();
String[] str = s.split(",");
for (String string : str) {
result.add(Integer.valueOf(string));
}
return result;
}
} }
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.AdmissionRule;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* @author 86187
*/
public interface AdmissionRuleMapper extends BaseMapper<AdmissionRule> {
AdmissionRule add(AdmissionRule admissionRule);
int edit(AdmissionRule admissionRule);
int delById(@Param("id") Integer id);
AdmissionRule getByType(@Param("type") Integer type);
}
...@@ -12,4 +12,12 @@ public interface ProfessionMapper extends BaseMapper<Profession> { ...@@ -12,4 +12,12 @@ public interface ProfessionMapper extends BaseMapper<Profession> {
List<Profession> getList(); List<Profession> getList();
Profession getById(@Param("id") Integer id); Profession getById(@Param("id") Integer id);
/**
* 根据专业ids,获取专业名称
*
* @param ids ids
* @return 专业名称
*/
List<String> getNameByIds(@Param("list") List<Integer> ids);
} }
...@@ -16,4 +16,6 @@ public interface VolunteerMapper extends BaseMapper<Volunteer> { ...@@ -16,4 +16,6 @@ public interface VolunteerMapper extends BaseMapper<Volunteer> {
List<Volunteer> getListByIds(@Param("list") List<Integer> ids); List<Volunteer> getListByIds(@Param("list") List<Integer> ids);
int updateBySchemeId(@Param("schemeId") Integer schemeId); int updateBySchemeId(@Param("schemeId") Integer schemeId);
List<Volunteer> getVolunteerList(Map<String,Object> map);
} }
<?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="cn.wisenergy.mapper.AdmissionRuleMapper">
<resultMap id="userMap" type="cn.wisenergy.model.app.AdmissionRule">
<id column="id" property="id"/>
<result column="type" property="type"/>
<result column="culture_max" property="cultureMax"/>
<result column="culture_min" property="cultureMin"/>
<result column="profession_max" property="professionMax"/>
<result column="profession_min" property="professionMin"/>
<result column="up_mark" property="upMark"/>
<result column="down_mark" property="downMark"/>
<result column="number" property="number"/>
<result column="is_delete" property="isDelete"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<sql id="table">
user
</sql>
<sql id="cols_all">
id,
<include refid="cols_exclude_id"/>
</sql>
<sql id="cols_exclude_id">
type,culture_max, culture_min,profession_max,profession_min,up_mark, down_mark,number,is_delete,create_time,update_time
</sql>
<sql id="vals">
#{type},#{cultureMax},#{cultureMin},#{professionMax},#{professionMin},#{upMark},#{downMark}, #{number},
#{isDelete},now(),now()
</sql>
<sql id="updateCondition">
<if test="type != null">type = #{type},</if>
<if test="cultureMax != null">culture_max =#{cultureMax},</if>
<if test="cultureMin != null">culture_min =#{cultureMin},</if>
<if test="professionMax != null">profession_max =#{professionMax},</if>
<if test="professionMin != null">profession_min =#{professionMin},</if>
<if test="upMark != null">up_mark = #{upMark},</if>
<if test="downMark != null">down_mark =#{downMark},</if>
<if test="number != null">number = #{number},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
update_time =now()
</sql>
<sql id="criteria">
<if test="id != null">id = #{id}</if>
<if test="type != null">and type = #{type}</if>
<if test="cultureMax != null">and culture_max =#{cultureMax}</if>
<if test="cultureMin != null">and culture_min =#{cultureMin}</if>
<if test="professionMax != null">and profession_max =#{professionMax}</if>
<if test="professionMin != null">and profession_min =#{professionMin}</if>
<if test="upMark != null">and up_mark = #{upMark}</if>
<if test="downMark != null">and down_mark =#{downMark}</if>
<if test="number != null">and number = #{number}</if>
<if test="isDelete != null">and is_delete = #{isDelete}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
</sql>
<insert id="add" parameterType="cn.wisenergy.model.app.AdmissionRule" keyProperty="id" useGeneratedKeys="true">
insert into
<include refid="table"/>
(<include refid="cols_exclude_id"/>)
value(
<include refid="vals"/>
)
</insert>
<update id="edit" parameterType="cn.wisenergy.model.app.AdmissionRule">
UPDATE
<include refid="table"/>
<set>
<include refid="updateCondition"/>
</set>
<where>
id = #{id}
</where>
</update>
<delete id="delById" parameterType="java.lang.Integer">
delete from
<include refid="table"/>
where id = #{id}
</delete>
<select id="getByType" resultType="cn.wisenergy.model.app.AdmissionRule">
SELECT COUNT(id)
FROM
<include refid="table"/>
where is_delete=0 and type=#{type}
</select>
</mapper>
...@@ -71,4 +71,16 @@ ...@@ -71,4 +71,16 @@
where id=#{id} where id=#{id}
</select> </select>
<select id="getNameByIds" resultType="java.lang.String">
select name
from
<include refid="table"/>
<where>
id IN
<foreach collection="list" index="index" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</where>
</select>
</mapper> </mapper>
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
</sql> </sql>
<sql id="cols_exclude_id"> <sql id="cols_exclude_id">
type,scheme_id,major_name,academy, course_demand,nature,year_limit,plan_num, castArchives_num,launch_num,lowest_mark, type,scheme_id,major_name,academy, course_demand,nature,year_limit,plan_num,
castArchives_num,launch_num,lowest_mark,
lowest_rank,is_delete,create_time,update_time lowest_rank,is_delete,create_time,update_time
</sql> </sql>
...@@ -116,4 +117,33 @@ ...@@ -116,4 +117,33 @@
</where> </where>
</select> </select>
<select id="getVolunteerList" resultType="cn.wisenergy.model.app.Volunteer">
select
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
is_delete =0
<if test="upGrade != null">
and #{upGrade} > lowest_mark
</if>
<if test="downGrade != null">
and lowest_mark >#{downGrade}
</if>
<if test="classNames != null and classNames.size() >0">
and
<foreach collection="list" index="index" item="id" separator="or" open="(" close=")">
course_demand LIKE CONCAT('%',#{item},'%')
</foreach>
</if>
<if test="professionNames != null and classNames.size() >0">
and
<foreach collection="list" index="index" item="id" separator="or" open="(" close=")">
major_name LIKE CONCAT('%',#{item},'%')
</foreach>
</if>
limit #{number}
</where>
</select>
</mapper> </mapper>
package cn.wisenergy.model.app;
import cn.wisenergy.model.common.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
*@ Description: 录取规则实体类
*@ Author : 86187
*@ Date : 2021/1/19 10:43
* @author 86187
*/
@Data
@ApiModel(value = "AdmissionRule")
public class AdmissionRule extends BaseEntity implements Serializable {
private static final long serialVersionUID = -9211670648343824241L;
/**
* 录取规则id
*/
@ApiModelProperty(value = "录取规则id",name = "id")
private Integer id;
/**
* 方案类型:1:本科文化一批 2:本科美术一批 3:艺术本科批文学编导 4:本科体育 5:专科专业分类6:专科美术一批 7:专科文学编导一批 8:专科体育一批
*/
@ApiModelProperty(value = "方案类型:1:本科文化一批 2:本科美术一批 3:艺术本科批文学编导 4:本科体育 " +
"5:专科专业分类6:专科美术一批 7:专科文学编导一批 8:专科体育一批",name = "type")
private Integer type;
/**
* 文化成绩最高分
*/
@ApiModelProperty(value = "文化成绩最高分",name = "cultureMax")
private Double cultureMax;
/**
* 文化成绩最低分
*/
@ApiModelProperty(value = "文化成绩最低分",name = "cultureMin")
private Double cultureMin;
/**
* 专业成绩最高分
*/
@ApiModelProperty(value = "专业成绩最高分",name = "professionMax")
private Double professionMax;
/**
* 专业成绩最低分
*/
@ApiModelProperty(value = "专业成绩最低分",name = "professionMin")
private Double professionMin;
/**
* 向上浮动分数
*/
@ApiModelProperty(value = "向上浮动分数",name = "upMark")
private Double upMark;
/**
* 向下浮动分数
*/
@ApiModelProperty(value = "向下浮动分数",name = "downMark")
private Double downMark;
/**
* 展示志愿总数
*/
@ApiModelProperty(value = "展示志愿总数",name = "number")
private Double number;
}
...@@ -11,7 +11,8 @@ import java.util.Date; ...@@ -11,7 +11,8 @@ import java.util.Date;
*@ Description: 用户成绩实体类 *@ Description: 用户成绩实体类
*@ Author : 86187 *@ Author : 86187
*@ Date : 2021/1/7 14:56 *@ Date : 2021/1/7 14:56
*/ * @author 86187
*/
@Data @Data
@ApiModel(value = "ScoreInfo") @ApiModel(value = "ScoreInfo")
public class ScoreInfo implements Serializable { public class ScoreInfo implements Serializable {
...@@ -33,67 +34,67 @@ public class ScoreInfo implements Serializable { ...@@ -33,67 +34,67 @@ public class ScoreInfo implements Serializable {
* 文化成绩 * 文化成绩
*/ */
@ApiModelProperty(value = "文化成绩",name = "cultureGrade") @ApiModelProperty(value = "文化成绩",name = "cultureGrade")
private String cultureGrade; private Double cultureGrade;
/** /**
* 专业成绩 * 专业成绩
*/ */
@ApiModelProperty(value = "专业成绩",name = "majorGrade") @ApiModelProperty(value = "专业成绩",name = "majorGrade")
private String majorGrade; private Double majorGrade;
/** /**
* 语文成绩 * 语文成绩
*/ */
@ApiModelProperty(value = "语文成绩",name = "languageGrade") @ApiModelProperty(value = "语文成绩",name = "languageGrade")
private String languageGrade; private Double languageGrade;
/** /**
* 数学成绩 * 数学成绩
*/ */
@ApiModelProperty(value = "数学成绩",name = "mathGrade") @ApiModelProperty(value = "数学成绩",name = "mathGrade")
private String mathGrade; private Double mathGrade;
/** /**
* 英语成绩 * 英语成绩
*/ */
@ApiModelProperty(value = "英语成绩",name = "englishGrade") @ApiModelProperty(value = "英语成绩",name = "englishGrade")
private String englishGrade; private Double englishGrade;
/** /**
* 物理成绩 * 物理成绩
*/ */
@ApiModelProperty(value = "物理成绩",name = "physicsGrade") @ApiModelProperty(value = "物理成绩",name = "physicsGrade")
private String physicsGrade; private Double physicsGrade;
/** /**
* 化学成绩 * 化学成绩
*/ */
@ApiModelProperty(value = "化学成绩",name = "chemistryGrade") @ApiModelProperty(value = "化学成绩",name = "chemistryGrade")
private String chemistryGrade; private Double chemistryGrade;
/** /**
* 生物成绩 * 生物成绩
*/ */
@ApiModelProperty(value = "生物成绩",name = "biologyGrade") @ApiModelProperty(value = "生物成绩",name = "biologyGrade")
private String biologyGrade; private Double biologyGrade;
/** /**
* 历史成绩 * 历史成绩
*/ */
@ApiModelProperty(value = "历史成绩",name = "historyGrade") @ApiModelProperty(value = "历史成绩",name = "historyGrade")
private String historyGrade; private Double historyGrade;
/** /**
* 地成绩 * 地成绩
*/ */
@ApiModelProperty(value = "地成绩",name = "geographyGrade") @ApiModelProperty(value = "地成绩",name = "geographyGrade")
private String geographyGrade; private Double geographyGrade;
/** /**
* 政治成绩 * 政治成绩
*/ */
@ApiModelProperty(value = "政治成绩",name = "politicsGrade") @ApiModelProperty(value = "政治成绩",name = "politicsGrade")
private String politicsGrade; private Double politicsGrade;
/** /**
* 创建时间 * 创建时间
......
...@@ -16,15 +16,15 @@ public enum SchemeTypeEnums { ...@@ -16,15 +16,15 @@ public enum SchemeTypeEnums {
UNDERGRADUATE_LITERATURE(3,"文学编导本科一批"), UNDERGRADUATE_LITERATURE(3,"文学编导本科一批"),
UNDERGRADUATE_SPORTS(4,"本科体育"), UNDERGRADUATE_SPORTS(4,"本科体育一批"),
JUNIOR_COLLEGE_MAJOR(5,"专科专业"), JUNIOR_COLLEGE_MAJOR(5,"专科文化一批"),
JUNIOR_COLLEGE_ARTS(6,"专科美术一批"), JUNIOR_COLLEGE_ARTS(6,"专科美术一批"),
JUNIOR_COLLEGE_LITERATURE(7,"文学编导专科一批"), JUNIOR_COLLEGE_LITERATURE(7,"文学编导专科一批"),
JUNIOR_COLLEGE_SPORTS(8,"专科体育"); JUNIOR_COLLEGE_SPORTS(8,"专科体育一批");
private Integer code; private Integer code;
......
package cn.wisenergy.model.enums;
/**
* @author 86187
* @ Description: 考生学科枚举
* @ Author : 86187
* @ Date : 2021/1/19 15:02
*/
public enum StudentClassEnum {
//物理
PHYSICS_GRADE(1, "物理"),
//化学
CHEMISTRY_GRADE(2, "化学"),
//生物
BIOLOGY_GRADE(3, "生物"),
//历史
HISTORY_GRADE(4, "历史"),
GEOGRAPHY_GRADE(5, "地理"),
POLITICS_GRADE(6, "政治"),
UNLIMITED(7, "不限");
private Integer code;
private String desc;
StudentClassEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public Integer getCode() {
return code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public void setCode(Integer code) {
this.code = code;
}
}
...@@ -7,10 +7,10 @@ import lombok.Data; ...@@ -7,10 +7,10 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
/** /**
*@ Description: 方案查询Vo * @ Description: 方案查询Vo
*@ Author : 86187 * @ Author : 86187
*@ Date : 2021/1/13 14:53 * @ Date : 2021/1/13 14:53
*/ */
@Data @Data
@ApiModel(value = "SchemeQueryVo") @ApiModel(value = "SchemeQueryVo")
public class SchemeQueryVo implements Serializable { public class SchemeQueryVo implements Serializable {
...@@ -20,14 +20,26 @@ public class SchemeQueryVo implements Serializable { ...@@ -20,14 +20,26 @@ public class SchemeQueryVo implements Serializable {
/** /**
* 用户id * 用户id
*/ */
@ApiModelProperty(value = "用户id",name = "userId") @ApiModelProperty(value = "用户id", name = "userId")
private Integer userId; private Integer userId;
/** /**
* 专业ids * 专业ids
*/ */
@ApiModelProperty(value = "专业ids,如'1,2,3,4,5,6...'",name = "professionIds") @ApiModelProperty(value = "专业ids,如'1,2,3,4,5,6...'", name = "professionIds")
private String professionIds; private String professionIds;
/**
* 文化课成绩
*/
@ApiModelProperty(value = "文化课成绩", name = "cultureGrade")
private String cultureGrade;
/**
* 专业课成绩
*/
@ApiModelProperty(value = "专业课成绩", name = "majorGrade")
private String majorGrade;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment