parent
b20171e25d
commit
e5fe333a03
7 changed files with 193 additions and 0 deletions
@ -0,0 +1,42 @@ |
||||
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{ |
||||
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; |
||||
private Long createUser; |
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
private Timestamp createTime; |
||||
private Long updateUser; |
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
private Timestamp updateTime; |
||||
private Integer status; |
||||
private Integer isDeleted; |
||||
} |
@ -0,0 +1,13 @@ |
||||
package com.ccic.safeliab.dao; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.ccic.safeliab.entity.ExamSchedule; |
||||
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); |
||||
} |
@ -0,0 +1,11 @@ |
||||
package com.ccic.safeliab.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.ccic.safeliab.entity.ExamSchedule; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public interface ExamScheduleService extends IService<ExamSchedule> { |
||||
public List<ExamSchedule> selectExamSchedule(Map<String, Object> param); |
||||
} |
@ -0,0 +1,16 @@ |
||||
package com.ccic.safeliab.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.ccic.safeliab.dao.ExamScheduleMapper; |
||||
import com.ccic.safeliab.entity.ExamSchedule; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service |
||||
public class ExamScheduleServiceImpl extends ServiceImpl<ExamScheduleMapper, ExamSchedule> implements ExamScheduleService { |
||||
public List<ExamSchedule> selectExamSchedule(Map<String, Object> param){ |
||||
return baseMapper.selectExamSchedule(param); |
||||
} |
||||
} |
@ -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,71 @@ |
||||
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("/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) { |
||||
boolean result = service.saveOrUpdate(examSchedule); |
||||
return R.ok().data("success."); |
||||
} |
||||
|
||||
@PostMapping("/insert") |
||||
public R insert(@RequestBody ExamScheduleVO examSchedule) { |
||||
boolean result = service.save(examSchedule); |
||||
return R.ok().data("success."); |
||||
} |
||||
|
||||
@GetMapping("/show") |
||||
public R show() { |
||||
return R.ok().data("success."); |
||||
} |
||||
} |
@ -0,0 +1,33 @@ |
||||
<?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> |
||||
</mapper> |
Loading…
Reference in new issue