更新 测试微信二维码登录
This commit is contained in:
zhouwentao 2024-05-07 15:18:44 +08:00
parent 53d363bf39
commit ee0f575485
18 changed files with 451 additions and 27 deletions

View File

@ -80,6 +80,12 @@ public class ShiroConfig {
}
filterChainDefinitionMap.put("/web/user/login/**","anon");//前台页面登录
filterChainDefinitionMap.put("/web/user/getQRStatus/**","anon");//前台查询redis中当前小程序码的状态
filterChainDefinitionMap.put("/wx/getQRCode/**","anon");//前台获取微信登录码
filterChainDefinitionMap.put("/wx/user/cancelQrCode/**","anon");//取消微信二维码登录
filterChainDefinitionMap.put("/wx/user/updateQrCodeStatus/**","anon");//
filterChainDefinitionMap.put("/wx/user/getQrCodeStatus/**","anon");//
filterChainDefinitionMap.put("/mini/user/phoneLogin","anon");//小程序手机号登录
filterChainDefinitionMap.put("/mini/user/login","anon");//小程序登录
@ -94,7 +100,7 @@ public class ShiroConfig {
//filterChainDefinitionMap.put("/art/recommendMajor/testCultural","anon");//文化分测算
//学校
filterChainDefinitionMap.put("/art/school/hotList","anon");//前台-热门学校
filterChainDefinitionMap.put("/web/school/hotList","anon");//前台-热门学校
filterChainDefinitionMap.put("/art/school/search","anon");//前台-找大学
filterChainDefinitionMap.put("/art/school/schoolInfo","anon");//前台-学校详情
filterChainDefinitionMap.put("/yx/yxMajor/list","anon");//前台-查专业

View File

@ -9,7 +9,8 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>jeecg-system-biz</artifactId>
<properties>
</properties>
<dependencies>
<dependency>
<groupId>org.jeecgframework.boot</groupId>

View File

@ -249,6 +249,11 @@ public class MiniUserController {
obj.put("sessionKey", "sessionKey");
obj.put("userInfo", loginUser);
obj.put("loginState", "not");
//判断是不是 二维码登录
if (StringUtils.isNotBlank(wxModel.getUuid())) {
//更改二维码登录状态
redisUtil.set("WX_QRCODE_SCENE_"+ wxModel.getUuid(),"");
}
return Result.OK(obj);
}

View File

@ -0,0 +1,23 @@
package org.jeecg.modules.mini.wx.constant;
/**
* @author ZhouWenTao
* @create 2024-05-06-21:14
*/
public class WeiXinConstant {
/**
* 微信二维码CODE的key
*/
public static final String QR_CODE_KEY = "WX_QRCODE_SCENE_";
/**
* 微信二维码未被扫描
*/
public static final String WX_QRCODE_NOT_SCAN_STATUS = "WX_QRCODE_NOT_SCAN";
/**
* 微信二维码被扫描
*/
public static final String WX_QRCODE_SCAN_STATUS = "WX_QRCODE_SCAN";
}

View File

@ -14,7 +14,7 @@ import org.springframework.stereotype.Component;
@ConfigurationProperties(prefix = "wx")
@Data
@ToString
public class WxPayV3Bean {
public class WeXinConfig {
private String appId;

View File

@ -15,4 +15,6 @@ public class WxModel implements Serializable {
public String iv;
public String openId;
private String uuid;
}

View File

@ -0,0 +1,111 @@
package org.jeecg.modules.mini.wx.util;
import com.alibaba.fastjson.JSONObject;
import com.xkcoding.http.HttpUtil;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.jeecg.common.util.RestUtil;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
/**
* @author zwt13703
* <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140183">官方文档</a>
* 参考网站
* 二维码生成:https://blog.csdn.net/Architect_CSDN/article/details/98874379
* 二维码登录:https://blog.csdn.net/weixin_45089791/article/details/126341589
* @create 2024-05-06-17:24
*/
public class WeXinUtil {
//获取微信小程序 accessToken地址
private final static String GET_ACCESS_TOKEN_URL="https://api.weixin.qq.com/cgi-bin/token";
//带参数有限个数小程序码接口地址
// private final static String GET_WXACODE_URL="https://api.weixin.qq.com/wxa/getwxacode";
private final static String GET_WXACODE_URL="https://api.weixin.qq.com/wxa/getwxacodeunlimit";
/**
* 获取access-token
* @param grantType client_credential
* @param appid 小程序appid微信公众平台注册小程序时自动生成的
* @param secret 小程序secret微信公众平台注册小程序时自动生成的
*/
public static String getAccessToken(String appid,String secret,String grantType){
if (StringUtils.isBlank(grantType)) {
grantType = "client_credential";
}
String access_token = null;
String tokenUrl = GET_ACCESS_TOKEN_URL+"?grant_type="+ grantType+"&appid="+ appid + "&secret="+ secret;
//使用http get请求发送. 请自定义你们的代码嗷
JSONObject jsons = RestUtil.get(tokenUrl);
String expires_in = jsons.getString("expires_in");
if(StringUtils.isNotEmpty(expires_in)&&Integer.parseInt(expires_in)==7200){
//ok
access_token = jsons.getString("access_token");
}else{
System.out.println("出错获取token失败");
}
return access_token;
}
/**
* 带参数有限个数小程序码接口
* @param accessToken accessToken
* @param path 跳转小程序后的路径
* @param width 二维码的宽度
*/
public static String getWxACode(String accessToken, String path, String width){
byte[] release=null;
if (StringUtils.isBlank(path)) {
return null;
}
if (StringUtils.isBlank(width)) {
width = "430";
}
//拼接路径
String url = GET_WXACODE_URL + "?access_token=" + accessToken;
JSONObject jsonParam = new JSONObject();
jsonParam.put("scene", "id=1");
jsonParam.put("page", path);
jsonParam.put("width", Integer.parseInt(width));
jsonParam.put("auto_color", false);
Map<String,Object> line_color = new HashMap<>();
line_color.put("r", 0);
line_color.put("g", 0);
line_color.put("b", 0);
jsonParam.put("line_color", line_color);
//发送http post 请求获取图片流
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
HttpPost httpPost = new HttpPost(url);
try {
StringEntity entity = new StringEntity(JSONObject.toJSONString(jsonParam));
entity.setContentType("image/png");
httpPost.setEntity(entity);
HttpResponse response = httpClient.execute(httpPost);
try (InputStream inputStream = response.getEntity().getContent();
ByteArrayOutputStream out = new ByteArrayOutputStream()) {
byte[] buffer = new byte[1024];
int len = -1;
while ((len = inputStream.read(buffer)) != -1) {
out.write(buffer, 0, len);
}
release = out.toByteArray();
return Base64.encodeBase64String(release);
}
} catch (Exception e) {
System.out.println("获取微信小程序二维码出错:"+e.getMessage());
}
return null;
}
public static void main(String[] args) {
getWxACode("80_WOwnMgHpt70AdOLDjhrpOengYBT_nozQ_rIcgc4FmbtI64swoBxj19_7iOO7wm-vM9-lDEThsv934LodtsvVuaB2CxbWaX9oFdeAElSvBV6rbCWljXh29zG6EAwZCMiAAACFP",
"pages/zyb/login","430");
}
}

View File

@ -81,7 +81,7 @@ public class ArtRecommendMajorController {
yxSchoolMajorLambdaQueryWrapper.eq(StringUtils.isNotBlank(queryCalculateInvestmentVO.getCategory()), YxSchoolMajor::getCategory, queryCalculateInvestmentVO.getCategory());
yxSchoolMajorLambdaQueryWrapper.eq(StringUtils.isNotBlank(queryCalculateInvestmentVO.getProfessionalCategory()), YxSchoolMajor::getMajorType, queryCalculateInvestmentVO.getProfessionalCategory());
yxSchoolMajorLambdaQueryWrapper.orderByDesc(YxSchoolMajor::getRulesEnrollProbabilitySx);
List<ArtCalculateInvestmentDTO> calculateInvestmentDTOList = new ArrayList<>();
Map<String,String> rulesEnrollProbabilityMap=new HashMap<>();
rulesEnrollProbabilityMap.put("专过文排","专过文排");

View File

@ -78,4 +78,10 @@ public class WebMajorController {
return Result.OK(zylList);
}
}
@ApiOperation(value = "获取院校的专业信息")
@GetMapping(value = "/schoolMajorList")
public Result<?> schoolMajorList(QueryRecommendMajorVO queryRecommendMajorVO) {
return Result.OK(webMajorService.schoolMajorList(queryRecommendMajorVO));
}
}

View File

@ -0,0 +1,126 @@
package org.jeecg.modules.web.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.AssertUtils;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.mini.service.MiniSchoolService;
import org.jeecg.modules.web.vo.QueryRecommendMajorVO;
import org.jeecg.modules.yx.entity.YxSchoolDoubleFirstPlan;
import org.jeecg.modules.yx.entity.YxSubjectEvaluation;
import org.jeecg.modules.yx.service.IYxSchoolDoubleFirstPlanService;
import org.jeecg.modules.yx.service.IYxSchoolService;
import org.jeecg.modules.yx.service.IYxSubjectEvaluationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Description 小程序端 院校接口
* @Author ZhouWenTao
* @Date 2023/11/14 10:03
*/
@Api(tags="前台-院校接口")
@RestController
@RequestMapping("/web/school")
@Slf4j
public class WebSchoolController {
@Autowired
private IYxSchoolService yxSchoolService;
@Autowired
private MiniSchoolService miniSchoolService;
@Autowired
private IYxSchoolDoubleFirstPlanService yxSchoolDoubleFirstPlanService;
@Autowired
private IYxSubjectEvaluationService yxSubjectEvaluationService;
@Resource
private RedisUtil redisUtil;
@ApiOperation(value = "学校详情")
@GetMapping("/schoolInfo")
public Result<?> schoolInfo(QueryRecommendMajorVO queryRecommendMajorVO){
String schoolCode = queryRecommendMajorVO.getSchoolCode();
return Result.OK(miniSchoolService.getMiniSchoolInfoBySchoolCode(schoolCode));
}
@ApiOperation(value = "搜索学校")
@GetMapping("/search")
public Result<?> search(QueryRecommendMajorVO queryRecommendMajorVO){
return Result.OK(yxSchoolService.miniSchoolSearch(queryRecommendMajorVO));
}
@ApiOperation(value = "热门院校")
@GetMapping(value = "/hotList")
public Result<?> hotList(){
return Result.OK(yxSchoolService.hotList());
}
@ApiOperation(value = "学校双万计划信息")
@GetMapping(value = "/doubleFirstPlan")
public Result<?> doubleFirstPlan(QueryRecommendMajorVO queryRecommendMajorVO){
String schoolId = queryRecommendMajorVO.getSchoolId();
AssertUtils.notNull(schoolId,"请选择院校");
String key = "school:doubleFirstPlan:schoolId_"+schoolId;
String json = null;
JSONObject jsonObject = null;
if (redisUtil.hasKey(key)) {
jsonObject = JSONObject.parseObject((String) redisUtil.get(key));
}else{
LambdaQueryWrapper<YxSchoolDoubleFirstPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(YxSchoolDoubleFirstPlan::getSchoolId,schoolId);
lambdaQueryWrapper.select(YxSchoolDoubleFirstPlan::getSchoolName,
YxSchoolDoubleFirstPlan::getMajorCode,
YxSchoolDoubleFirstPlan::getLevel,
YxSchoolDoubleFirstPlan::getTrack,
YxSchoolDoubleFirstPlan::getMajorName);
List<YxSchoolDoubleFirstPlan> yxSchoolDoubleFirstPlanList = yxSchoolDoubleFirstPlanService.list(lambdaQueryWrapper);
List<YxSchoolDoubleFirstPlan> gjjList = yxSchoolDoubleFirstPlanList.stream().filter(l -> "国家级".equals(l.getLevel())).collect(Collectors.toList());
List<YxSchoolDoubleFirstPlan> sjList = yxSchoolDoubleFirstPlanList.stream().filter(l -> "省级".equals(l.getLevel())).collect(Collectors.toList());
jsonObject = new JSONObject();
jsonObject.put("gjjList",gjjList);
jsonObject.put("sjList",sjList);
json = jsonObject.toJSONString();
redisUtil.set(key,json,300);
}
return Result.OK(jsonObject);
}
@ApiOperation(value = "学校第四轮学科评估")
@GetMapping(value = "/subjectEvaluation")
public Result<?> subjectEvaluation(QueryRecommendMajorVO queryRecommendMajorVO){
String schoolId = queryRecommendMajorVO.getSchoolId();
AssertUtils.notNull(schoolId,"请选择院校");
String key = "school:subjectEvaluation:schoolId_"+schoolId;
String json = null;
List<YxSubjectEvaluation> list = null;
try {
if (redisUtil.hasKey(key)) {
list = JSONArray.parseArray((String) redisUtil.get(key),YxSubjectEvaluation.class);
}else{
LambdaQueryWrapper<YxSubjectEvaluation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(YxSubjectEvaluation::getSchoolId,schoolId);
lambdaQueryWrapper.select(YxSubjectEvaluation::getSchoolName,
YxSubjectEvaluation::getSubjectCode,
YxSubjectEvaluation::getSubjectName,
YxSubjectEvaluation::getEvaluationResult,
YxSubjectEvaluation::getEvaluationType);
list = yxSubjectEvaluationService.list(lambdaQueryWrapper);
json = JSONArray.toJSONString(list);
redisUtil.set(key,json,300);
}
}catch (Exception e){
log.error(e.getMessage());
return Result.error("异常,请联系管理员");
}
return Result.OK(list);
}
}

View File

@ -4,6 +4,8 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.mini.wx.model.WeXinConfig;
import org.jeecg.modules.system.model.SysLoginModel;
import org.jeecg.modules.web.service.WebUserService;
import org.springframework.web.bind.annotation.*;
@ -21,9 +23,17 @@ import javax.annotation.Resource;
public class WebUserController {
@Resource
private WebUserService webUserService;
@Resource
private WeXinConfig weXinConfig;
@Resource
private RedisUtil redisUtil;
@RequestMapping(value = "/login/passwd", method = RequestMethod.POST)
@ApiOperation(value = "手机号密码登录")
public Result<?> loginPasswd(@RequestBody SysLoginModel sysLoginModel){
return webUserService.loginPasswd(sysLoginModel);
}
}

View File

@ -0,0 +1,107 @@
package org.jeecg.modules.web.controller;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.mini.wx.constant.WeiXinConstant;
import org.jeecg.modules.mini.wx.model.WeXinConfig;
import org.jeecg.modules.mini.wx.util.WeXinUtil;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.UUID;
/**
* @author ZhouWenTao
* @create 2024-04-17-15:22
*/
@RequestMapping("/wx")
@RestController
@Api(tags = "微信相关接口")
@Slf4j
public class WeiXinController {
@Resource
private WeXinConfig weXinConfig;
@Resource
private RedisUtil redisUtil;
/**
* <pre>
* 获取小程序码
* </pre>
*/
@GetMapping("/getQRCode")
public Result<?> getQRCode() {
try {
//先获取accessToken
String accessToken = WeXinUtil.getAccessToken(weXinConfig.getAppId(), weXinConfig.getAppSecret(), null);
//生成一个uuid,用于标识是否扫描成功 存入redis
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
String key = WeiXinConstant.QR_CODE_KEY + uuid;
redisUtil.set(key,WeiXinConstant.WX_QRCODE_NOT_SCAN_STATUS, 180);//3分钟
String qrCodeImg = WeXinUtil.getWxACode(accessToken, "pages/zyb/qrcodeLogin", "64");
HashMap<String, Object> map = new HashMap<>();
map.put("scene", uuid);
map.put("img", "data:image/jpeg;base64," + qrCodeImg);
return Result.OK(map);
}catch (Exception e){
return Result.error("出现错误,请联系管理员,"+e.getMessage());
}
}
/**
* 获取微信二维状态
*/
@GetMapping("/user/getQrCodeStatus/{uuid}")
public Result<?> getQrCodeStatus(@PathVariable String uuid) {
String key = WeiXinConstant.QR_CODE_KEY + uuid;
String value = (String) redisUtil.get(key);
HashMap<String, String> map = new HashMap<>();
if (StringUtils.isNotEmpty(value) && value.startsWith("WX_QRCODE_SUCCESS")) {
//二维码已经扫描通过获取登录信息
String openId = value.split("-")[1];
//String token = tokenService.createToken(openId);
//map.put("qr_state", WxConstant.QR_STATUS_SUCCESS);
map.put("qr_state", "SUCCESS");
map.put("token", "1");
} else if (StringUtils.isNotEmpty(value) && value.startsWith("WX_QRCODE_SCAN")) {
//二维码被扫描但未验证
map.put("qr_state", "SCAN");
//success.put(AjaxResult.DATA_TAG, map);
}else if(StringUtils.isNotBlank(value) && value.startsWith("WX_QRCODE_NOT_SCAN")){
//二维码未被扫描
map.put("qr_state", "NOT_SCAN");
} else {
//二维码失效了
map.put("qr_state", "NULL");
//map.put(WxConstant.QR_STATUS, WxConstant.WX_QRCODE_EXPIRED);
//success.put(AjaxResult.DATA_TAG, map);
}
return Result.OK(map);
}
/**
* 更改二维码状态
*/
@GetMapping("/user/updateQrCodeStatus/{uuid}")
public Result<?> updateQrCodeStatus(@PathVariable String uuid) {
//已经扫描
String key = WeiXinConstant.QR_CODE_KEY + uuid;
redisUtil.set(key,"WX_QRCODE_SCAN",1800);
return Result.OK();
}
/**
* 取消二维码登录
*/
@GetMapping("/user/cancelQrCode/{uuid}")
public Result<?> cancelQrCode(@PathVariable String uuid) {
String key = WeiXinConstant.QR_CODE_KEY + uuid;
redisUtil.del(key);
return Result.OK();
}
}

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.web.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -19,6 +20,7 @@ import java.util.Set;
*/
@Data
@ApiModel(value = "学院专业列表对象")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RecommendMajorDTO implements Serializable {
private String id;
@ApiModelProperty(value = "录取概率")
@ -44,7 +46,6 @@ public class RecommendMajorDTO implements Serializable {
private String majorName;
@ApiModelProperty(value = "专业编码")
private String majorCode;
@JsonIgnore
@ApiModelProperty(value = "专业类型")
private String majorType;
@JsonIgnore
@ -79,6 +80,7 @@ public class RecommendMajorDTO implements Serializable {
private String probabilityOperator;
@ApiModelProperty(value = "学年制")
private Integer studyYear=0;
private Integer semester;
@ApiModelProperty(value = "历年录取数据")
private List<RecommendHistoryMajorDTO> historyList;
@ApiModelProperty(value = "历年录取数据")
@ -143,4 +145,9 @@ public class RecommendMajorDTO implements Serializable {
*/
@ApiModelProperty(value = "考试类型(统考/校考)")
private String kslx;
@ApiModelProperty(value = "学科分类")
private String xkfl;
@ApiModelProperty(value = "专业类")
private String zyl;
}

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import net.sf.json.JSON;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.jeecg.modules.web.dto.RecommendMajorDTO;
import org.jeecg.modules.web.dto.WebMajorDTO;
import org.jeecg.modules.web.vo.QueryRecommendMajorVO;
import org.jeecg.modules.yx.mapper.YxMajorMapper;
@ -42,4 +43,13 @@ public class WebMajorService {
}
return jsonObjectList;
}
/**
* 网页端-院校开设专业
* @param queryRecommendMajorVO
* @return
*/
public List<RecommendMajorDTO> schoolMajorList(QueryRecommendMajorVO queryRecommendMajorVO){
return yxMajorMapper.webSchoolMajorList(queryRecommendMajorVO);
}
}

View File

@ -33,9 +33,10 @@ public class YxSchoolMajorDTO implements Serializable {
@ApiModelProperty(value = "学校代码")
private java.lang.String schoolCode;
/**专业代码*/
@Excel(name = "专业代码", width = 15)
@ApiModelProperty(value = "专业代码")
private java.lang.String majorCode;
@ApiModelProperty(value = "专业类别")
private String majorType;
/**专业名称*/
@Excel(name = "专业名称", width = 15)
@ApiModelProperty(value = "专业名称")
@ -98,11 +99,5 @@ public class YxSchoolMajorDTO implements Serializable {
private String semester;
@ApiModelProperty(value = "学制(中文)")
private String semesterName;
@ApiModelProperty(value = "所属一级学科")
private String firstLevelDiscipline;
@ApiModelProperty(value = "学科门类")
private String subjectCategory;
@ApiModelProperty(value = "专业类别")
private String professionalCategory;
}

View File

@ -3,6 +3,7 @@ package org.jeecg.modules.yx.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.web.dto.RecommendMajorDTO;
import org.jeecg.modules.web.dto.WebMajorDTO;
import org.jeecg.modules.web.vo.QueryRecommendMajorVO;
import org.jeecg.modules.yx.entity.YxMajor;
@ -17,4 +18,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface YxMajorMapper extends BaseMapper<YxMajor> {
List<WebMajorDTO> webMajorList(@Param("q") QueryRecommendMajorVO queryRecommendMajorVO);
List<RecommendMajorDTO> webSchoolMajorList(@Param("q") QueryRecommendMajorVO queryRecommendMajorVO);
}

View File

@ -25,4 +25,25 @@
</if>
</where>
</select>
<select id="webSchoolMajorList" resultType="org.jeecg.modules.web.dto.RecommendMajorDTO">
SELECT
sm.major_name,sm.major_code,sm.major_type,sm.enrollment_code,sm.batch,m.semester,
m.xkfl,m.zyl
FROM yx_school_major sm
LEFT JOIN yx_major m ON m.major_code = sm.major_code
<where>
<if test="q.majorName!=null and q.majorName!=''">
sm.major_name like concat('%',#{q.majorName},'%')
</if>
<if test="q.schoolCode!=null and q.schoolCode!=''">
sm.school_code = #{q.schoolCode}
</if>
<if test="q.majorType!=null and q.majorType!=''">
AND sm.major_type = #{q.majorType}
</if>
<if test="q.cognitioPolyclinic!=null and q.cognitioPolyclinic!=''">
AND sm.category = #{q.cognitioPolyclinic}
</if>
</where>
</select>
</mapper>

View File

@ -12,9 +12,7 @@
s.institution_type as institutionType,
s.school_icon as schoolIcon,
m.major_desc as majorRemarks,
m.semester as studyYear,
m.first_level_discipline as firstLevelDiscipline,
sm.semester as studyYear,
sm.limitation,
sm.major_name,
sm.major_type,
@ -41,13 +39,11 @@
sm.kslx,
sm.plan_num as planNum
FROM yx_school_major sm
LEFT JOIN ( SELECT major_code,major_desc,semester,first_level_discipline FROM yx_major GROUP BY major_code ORDER
LEFT JOIN ( SELECT major_code,major_desc FROM yx_major GROUP BY major_code ORDER
BY major_desc ) m ON m.major_code = sm.major_code
LEFT JOIN (SELECT school_id,school_code FROM yx_school_child group by school_code) sc ON sc.school_code = sm.school_code
LEFT JOIN yx_school s ON s.id = sc.school_id
LEFT JOIn yx_first_level_disciplines fld ON fld.id = m.first_level_discipline
WHERE 1=1
/*sm.rules_enroll_probability is not null*/
<if test="queryvo.schoolName!=null and queryvo.schoolName!=''">
AND (s.school_name like concat('%',#{queryvo.schoolName},'%') or sc.schooL_code like concat('%',#{queryvo.schoolName},'%') or sm.major_name like
concat('%',#{queryvo.schoolName},'%'))
@ -172,10 +168,9 @@
s.province as province,
s.school_nature as propertyName,
s.institution_type as institutionType,
sm.major_name,
m.major_desc as majorRemarks,
m.semester as studyYear,
sm.semester as studyYear,
sm.major_code,
sm.tuition as studyCost
FROM yx_school_major sm
@ -195,15 +190,11 @@
</if>
</select>
<select id="dtoPage" resultType="org.jeecg.modules.yx.dto.YxSchoolMajorDTO">
SELECT sm.*,
m.semester as semester,
m.educational_level as educationalLevel,
fld.disciplines_name as professionalCategory,
di.item_text as subjectCategory
SELECT
sm.*,
m.educational_level AS educationalLevel
FROM yx_school_major sm
LEFT JOIN yx_major m ON m.major_code = sm.major_code
LEFT JOIN yx_first_level_disciplines fld ON fld.id = m.first_level_discipline
LEFT JOIN sys_dict_item di ON di.dict_id = '1693215348670623746' AND di.item_value = fld.categories_type
WHERE 1=1
<if test="queryvo.schoolCode!=null and queryvo.schoolCode!=''">
AND sm.school_code like concat('%',#{queryvo.schoolCode},'%')