Commit b5fd79ac authored by 刘帅's avatar 刘帅

1.bug修复

parent bb77f5d4
......@@ -385,6 +385,7 @@ public class ApiMemberUserController extends BaseController {
if (params.containsKey("memberUserId") && StringUtils.isNotBlank(params.get("memberUserId").toString())) {
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("isExam", params.get("isExam").toString());
hashMap.put("memberUserId", params.get("memberUserId").toString());
hashMap.put("examStatus", 1);
......
package com.ruoyi.hezhi.api.kaoshi;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.hezhi.domain.TbRegion;
import com.ruoyi.hezhi.service.ITbRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
/**
* 行政区域Controller
*
* @author ruoyi
* @date 2024-10-21
*/
@RestController
@RequestMapping("/api/pc/region")
public class ApiRegionController extends BaseController
{
@Autowired
private ITbRegionService tbRegionService;
/**
* 查询行政区域列表
*/
@GetMapping("/treeList")
public AjaxResult treeList(TbRegion tbRegion)
{
List<TbRegion> list = tbRegionService.selectTbRegionTreeList(tbRegion);
return success(list);
}
}
......@@ -39,6 +39,16 @@ public class TbRegionController extends BaseController
return success(list);
}
/**
* 查询行政区域列表
*/
@GetMapping("/treeList")
public AjaxResult treeList(TbRegion tbRegion)
{
List<TbRegion> list = tbRegionService.selectTbRegionTreeList(tbRegion);
return success(list);
}
/**
* 导出行政区域列表
*/
......
......@@ -38,6 +38,20 @@ public interface TbRegionMapper
*/
public List<TbRegion> selectTbRegionList(TbRegion tbRegion);
/**
* 查询所有省份及其下级(使用JOIN)
*
* @param tbRegion 行政区域
* @return 行政区域集合
*/
public List<TbRegion> findAllRegions(TbRegion tbRegion);
// 根据类型查询区域
List<TbRegion> findByType(@Param("type") Integer type);
// 根据父ID查询子区域
List<TbRegion> findByPid(@Param("pid") Long pid);
/**
* 新增行政区域
*
......
......@@ -29,6 +29,14 @@ public interface ITbRegionService
*/
public List<TbRegion> selectTbRegionList(TbRegion tbRegion);
/**
* 查询行政区域列表
*
* @param tbRegion 行政区域
* @return 行政区域集合
*/
public List<TbRegion> selectTbRegionTreeList(TbRegion tbRegion);
/**
* 新增行政区域
*
......
......@@ -454,9 +454,21 @@ public class TbExamRegistrationServiceImpl implements ITbExamRegistrationService
registration.setGraduationSchool(examRegistrationDTO.getGraduationSchool());
registration.setEntranceYear(examRegistrationDTO.getEntranceYear());
registration.setContactInformation(examRegistrationDTO.getContactInformation());
registration.setProvinceId(examRegistrationDTO.getProvinceId());
registration.setCityId(examRegistrationDTO.getCityId());
registration.setAreaId(examRegistrationDTO.getAreaId());
if (null != examRegistrationDTO.getProvinceId()) {
registration.setProvinceId(examRegistrationDTO.getProvinceId());
TbRegion region = tbRegionMapper.selectTbRegionById(registration.getProvinceId());
registration.setProvinceName(null != region ? region.getName(): null);
}
if (null != examRegistrationDTO.getCityId()) {
registration.setCityId(examRegistrationDTO.getCityId());
TbRegion region = tbRegionMapper.selectTbRegionById(registration.getCityId());
registration.setCityName(null != region ? region.getName(): null);
}
if (null != examRegistrationDTO.getAreaId()) {
registration.setAreaId(examRegistrationDTO.getAreaId());
TbRegion region = tbRegionMapper.selectTbRegionById(registration.getAreaId());
registration.setAreaName(null != region ? region.getName(): null);
}
registration.setAddress(examRegistrationDTO.getAddress());
registration.setZipCode(examRegistrationDTO.getZipCode());
registration.setContactPhone(examRegistrationDTO.getContactPhone());
......
......@@ -192,6 +192,7 @@ public class TbExamServiceImpl implements ITbExamService
* @param tbExam 考试
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int updateTbExam(TbExam tbExam)
{
......
......@@ -47,6 +47,32 @@ public class TbRegionServiceImpl implements ITbRegionService
return tbRegionMapper.selectTbRegionList(tbRegion);
}
/**
* 查询行政区域列表
*
* @param tbRegion 行政区域
* @return 行政区域集合
*/
@Override
public List<TbRegion> selectTbRegionTreeList(TbRegion tbRegion) {
// 1. 查询所有省份
List<TbRegion> provinces = tbRegionMapper.findByType(1);
// 2. 为每个省份查询城市
for (TbRegion province : provinces) {
List<TbRegion> cities = tbRegionMapper.findByPid(province.getId());
// 3. 为每个城市查询区县
for (TbRegion city : cities) {
List<TbRegion> districts = tbRegionMapper.findByPid(city.getId());
city.setChildren(districts);
}
province.setChildren(cities);
}
return provinces;
}
/**
* 新增行政区域
*
......
......@@ -889,7 +889,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ter.pay_type AS payType,
CONVERT(IFNULL(te.name, ''), CHAR) AS examName,
tmo.pay_price AS payPrice,
CONVERT(IFNULL(ter.registration_batch, ''), CHAR) AS registrationBatch,
CONVERT(IFNULL(teb.exam_batch, ''), CHAR) AS registrationBatch,
CONVERT(IFNULL(DATE_FORMAT(teb.exam_start_time,'%Y-%m-%d %H:%i:%s'), ''), CHAR) AS examStartTime,
CONVERT(IFNULL(DATE_FORMAT(teb.exam_end_time,'%Y-%m-%d %H:%i:%s'), ''), CHAR) AS examEndTime,
......@@ -919,18 +919,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE tsc.member_user_id = ter.member_user_id
AND tsc.course_id = ter.course_id) AS total
from tb_exam_registration ter
INNER JOIN (
SELECT exam_id, MAX(create_time) as create_time
FROM tb_exam_registration
WHERE STATUS = 0 AND del_flag = 0
<if test="memberUserId != null and memberUserId != ''">
and member_user_id = #{memberUserId}
</if>
<if test="isPay != null and isPay != ''">
and is_pay = #{isPay}
</if>
GROUP BY exam_id
) AS ter2 ON ter.create_time = ter2.create_time and ter.exam_id = ter2.exam_id
<if test="isExam != 1">
INNER JOIN (
SELECT exam_id, MAX(create_time) as create_time
FROM tb_exam_registration
WHERE STATUS = 0 AND del_flag = 0
<if test="memberUserId != null and memberUserId != ''">
and member_user_id = #{memberUserId}
</if>
<if test="isPay != null and isPay != ''">
and is_pay = #{isPay}
</if>
GROUP BY exam_id
) AS ter2 ON ter.create_time = ter2.create_time and ter.exam_id = ter2.exam_id
</if>
left join tb_course tc on tc.course_id = ter.course_id
left join tb_member_order tmo on tmo.data_id = ter.exam_registration_id
left join tb_exam te on ter.exam_id = te.exam_id
......@@ -973,8 +975,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and ter.is_pay = #{isPay}
</if>
</where>
GROUP BY
ter.exam_id
<choose>
<when test="isExam != 1">
GROUP BY ter.exam_id
</when>
<otherwise>
GROUP BY ter.exam_registration_id
</otherwise>
</choose>
order by ter.create_time desc
</select>
......
......@@ -173,4 +173,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectIdByName3" resultType="java.lang.Long">
select id from tb_region where name = #{name} and type = 3 and pid = #{pid}
</select>
<select id="findAllRegions" resultType="com.ruoyi.hezhi.domain.TbRegion">
SELECT
p.id as province_id, p.name as province_name,
c.id as city_id, c.name as city_name,
d.id as district_id, d.name as district_name
FROM tb_region p
LEFT JOIN tb_region c ON p.id = c.pid AND c.type = 1 AND c.del_flag = 0
LEFT JOIN tb_region d ON c.id = d.pid AND d.type = 2 AND d.del_flag = 0
WHERE p.type = 0 AND p.del_flag = 0
ORDER BY p.code, c.code, d.code
</select>
<select id="findByType" resultType="com.ruoyi.hezhi.domain.TbRegion">
SELECT
id, pid, shortname, name, merger_name as mergerName,
type, pinyin, phone_code as phoneCode, code, first,
lng, lat, create_time as createTime, create_by as createBy,
update_time as updateTime, update_by as updateBy,
delete_time as deleteTime, delete_by as deleteBy, del_flag as delFlag
FROM tb_region
WHERE type = #{type} AND del_flag = 0
ORDER BY code
</select>
<select id="findByPid" resultType="com.ruoyi.hezhi.domain.TbRegion">
SELECT
id, pid, shortname, name, merger_name as mergerName,
type, pinyin, phone_code as phoneCode, code, first,
lng, lat, create_time as createTime, create_by as createBy,
update_time as updateTime, update_by as updateBy,
delete_time as deleteTime, delete_by as deleteBy, del_flag as delFlag
FROM tb_region
WHERE pid = #{pid} AND del_flag = 0
ORDER BY code
</select>
</mapper>
......@@ -60,7 +60,7 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-form-item label="考试批次" prop="examBatch">
<el-input v-model="form.examBatch" placeholder="请输入考试批次" />
<el-input v-model="form.examBatch" placeholder="请输入考试批次" style="width: 100%" />
</el-form-item>
<!-- <el-form-item label="报名开始时间" prop="signStartTime">-->
<!-- <el-date-picker-->
......@@ -83,7 +83,9 @@
v-model="form.examStartTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="选择考试开始时间">
placeholder="选择考试开始时间"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
<el-form-item label="考试结束时间" prop="examEndTime">
......@@ -91,7 +93,8 @@
v-model="form.examEndTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetime"
placeholder="选择考试结束时间">
placeholder="选择考试结束时间"
style="width: 100%">
</el-date-picker>
</el-form-item>
</el-form>
......
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