commit
143dbf3c65
7 changed files with 237 additions and 0 deletions
@ -0,0 +1,34 @@ |
||||
package com.ccic.safeliab.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
import java.sql.Timestamp; |
||||
|
||||
@Data |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@Accessors(chain = true) |
||||
@TableName("ex_exam_info") |
||||
public class ExamSchedule extends BaseEntity{ |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* 主键ID |
||||
*/ |
||||
@TableId(value = "exam_id", type = IdType.ID_WORKER) |
||||
@JsonFormat(shape = JsonFormat.Shape.STRING) |
||||
private Long examId; |
||||
private String examName; |
||||
private Integer paperId; |
||||
private String regulatedIndustry; |
||||
private String examRegion; |
||||
private String validFrom; |
||||
private String validTo; |
||||
private Integer publishStatus; |
||||
private String remark; |
||||
} |
@ -0,0 +1,16 @@ |
||||
package com.ccic.safeliab.dao; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.ccic.safeliab.entity.ExamSchedule; |
||||
import com.ccic.safeliab.entity.Industry; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Mapper |
||||
public interface ExamScheduleMapper extends BaseMapper<ExamSchedule> { |
||||
List<ExamSchedule> selectExamSchedule(Map<String, Object> param); |
||||
List<Map<String,Object>> getIndustry(); |
||||
List<Map<String,Object>> getPaper(); |
||||
} |
@ -0,0 +1,15 @@ |
||||
package com.ccic.safeliab.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.ccic.safeliab.entity.ExamSchedule; |
||||
import com.ccic.safeliab.entity.Industry; |
||||
import com.ccic.safeliab.support.BaseService; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public interface ExamScheduleService extends BaseService<ExamSchedule> { |
||||
public List<ExamSchedule> selectExamSchedule(Map<String, Object> param); |
||||
public List<Map<String,Object>> getIndustry(); |
||||
public List<Map<String,Object>> getPaper(); |
||||
} |
@ -0,0 +1,30 @@ |
||||
package com.ccic.safeliab.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.ccic.safeliab.dao.ExamScheduleMapper; |
||||
import com.ccic.safeliab.entity.ExamSchedule; |
||||
import com.ccic.safeliab.entity.Industry; |
||||
import com.ccic.safeliab.support.BaseServiceImpl; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service |
||||
public class ExamScheduleServiceImpl extends BaseServiceImpl<ExamScheduleMapper, ExamSchedule> implements ExamScheduleService { |
||||
|
||||
public List<ExamSchedule> selectExamSchedule(Map<String, Object> param){ |
||||
return baseMapper.selectExamSchedule(param); |
||||
} |
||||
|
||||
public List<Map<String,Object>> getIndustry(){ |
||||
return baseMapper.getIndustry(); |
||||
} |
||||
|
||||
public List<Map<String,Object>> getPaper(){ |
||||
return baseMapper.getPaper(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,7 @@ |
||||
package com.ccic.safeliab.vo; |
||||
|
||||
import com.ccic.safeliab.entity.ExamSchedule; |
||||
import com.ccic.safeliab.entity.InsDemo; |
||||
|
||||
public class ExamScheduleVO extends ExamSchedule { |
||||
} |
@ -0,0 +1,85 @@ |
||||
package com.ccic.safeliab.web; |
||||
|
||||
import com.ccic.safeliab.entity.ExamSchedule; |
||||
import com.ccic.safeliab.service.ExamScheduleService; |
||||
import com.ccic.safeliab.support.Condition; |
||||
import com.ccic.safeliab.util.R; |
||||
import com.ccic.safeliab.vo.ExamScheduleVO; |
||||
import com.ccic.safeliab.vo.InsDemoVO; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@RestController |
||||
@RequestMapping("/ex/exam-schedule") |
||||
public class ExamScheduleController { |
||||
@Autowired |
||||
private ExamScheduleService service; |
||||
@GetMapping("/select") |
||||
public R select( @RequestParam(required = false) String examName, |
||||
@RequestParam(required = false) String paperName, |
||||
@RequestParam(required = false) String regulatedIndustry, |
||||
@RequestParam(required = false) String validDate, |
||||
@RequestParam(defaultValue = "1") int page, |
||||
@RequestParam(defaultValue = "10") int pageSize) { |
||||
// 模拟数据库查询
|
||||
List<ExamSchedule> examList = new ArrayList<>(); |
||||
ExamScheduleVO insDemoVO = new ExamScheduleVO(); |
||||
// 这里可以添加实际的数据库查询逻辑
|
||||
|
||||
Map<String, Object> param = new HashMap<>(); |
||||
param.put("examName", examName); |
||||
param.put("paperName", paperName); |
||||
param.put("regulatedIndustry", regulatedIndustry); |
||||
param.put("date", validDate); |
||||
examList = service.selectExamSchedule(param); |
||||
Map<Object,Object> result = new HashMap<>(); |
||||
result.put("data", examList); |
||||
result.put("total", examList.size()); |
||||
return R.ok().data(result); |
||||
} |
||||
@GetMapping("/cancel") |
||||
public R cancel() { |
||||
ExamScheduleVO insDemoVO = new ExamScheduleVO(); |
||||
return R.ok().data(service.list(Condition.getQueryWrapper(insDemoVO))); |
||||
} |
||||
@GetMapping("/publish") |
||||
public R publish() { |
||||
ExamScheduleVO insDemoVO = new ExamScheduleVO(); |
||||
return R.ok().data(service.list(Condition.getQueryWrapper(insDemoVO))); |
||||
} |
||||
@PostMapping("/update") |
||||
public R update(@RequestBody ExamScheduleVO examSchedule) { |
||||
examSchedule.setPublishStatus(0); |
||||
boolean result = service.saveOrUpdate(examSchedule); |
||||
return R.ok().data("success."); |
||||
} |
||||
|
||||
@PostMapping("/insert") |
||||
public R insert(@RequestBody ExamScheduleVO examSchedule) { |
||||
examSchedule.setPublishStatus(0); |
||||
boolean result = service.save(examSchedule); |
||||
return R.ok().data("success."); |
||||
} |
||||
@GetMapping("/getIndustry") |
||||
public R getIndustry(){ |
||||
return R.ok().data(service.getIndustry()); |
||||
} |
||||
|
||||
@GetMapping("/getPaper") |
||||
public R getPaper(){ |
||||
List<Map<String,Object>> results = new ArrayList<>(); |
||||
results.addAll(service.getPaper()); |
||||
return R.ok().data(results); |
||||
} |
||||
|
||||
|
||||
@GetMapping("/show") |
||||
public R show() { |
||||
return R.ok().data("success."); |
||||
} |
||||
} |
@ -0,0 +1,50 @@ |
||||
<?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="com.ccic.safeliab.dao.ExamScheduleMapper"> |
||||
<select id="selectExamSchedule" parameterType="java.util.Map" resultType="com.ccic.safeliab.entity.ExamSchedule"> |
||||
SELECT |
||||
info.exam_id, |
||||
info.exam_name, |
||||
paper.paper_name, |
||||
info.regulated_industry, |
||||
info.exam_region, |
||||
info.valid_from, |
||||
info.valid_to, |
||||
info.publish_status |
||||
FROM |
||||
ex_exam_info info |
||||
LEFT JOIN ex_exam_papers paper |
||||
ON info.paper_id = paper.paper_id |
||||
WHERE |
||||
info.is_deleted = 0 |
||||
<if test="examName != null and examName != ''"> |
||||
AND info.exam_name LIKE CONCAT('%', #{examName}, '%') |
||||
</if> |
||||
<if test="paperName != null and paperName != ''"> |
||||
AND paper.paper_name LIKE CONCAT('%', #{paperName}, '%') |
||||
</if> |
||||
<if test="regulatedIndustry != null and regulatedIndustry != ''"> |
||||
AND info.regulated_industry = #{regulatedIndustry} |
||||
</if> |
||||
<if test="date != null and date != ''"> |
||||
AND #{date} BETWEEN info.valid_from AND info.valid_to |
||||
</if> |
||||
</select> |
||||
<select id="getIndustry" resultType="java.util.Map"> |
||||
select |
||||
industry_id, |
||||
industry_name |
||||
from tbl_industry |
||||
where status = 1 |
||||
</select> |
||||
<select id="getPaper" resultType="java.util.Map"> |
||||
select |
||||
paper_id, |
||||
paper_name, |
||||
total_score, |
||||
exam_duration, |
||||
entity_id as regulatory_industry |
||||
from ex_exam_papers |
||||
where is_deleted = 0 |
||||
</select> |
||||
</mapper> |
Loading…
Reference in new issue