blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/activation/controller/ActivationController.java
New file @@ -0,0 +1,136 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.jfpt.activation.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springblade.jfpt.activation.entity.Activation; import org.springblade.jfpt.activation.service.IActivationService; import org.springblade.jfpt.activation.vo.ActivationVO; import org.springblade.jfpt.activation.wrapper.ActivationWrapper; import org.springblade.jfpt.wj.entity.Wj; import org.springblade.jfpt.wj.service.IWjService; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.UUID; /** * 控制器 * * @author BladeX * @since 2020-08-11 */ @RestController @AllArgsConstructor @RequestMapping("activation/activation") @Api(value = "", tags = "接口") public class ActivationController extends BladeController { private final IActivationService activationService; /** * 详情 */ @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "详情", notes = "传入survey") public R<ActivationVO> detail(Activation activation) { Activation detail = activationService.getOne(Condition.getQueryWrapper(activation)); return R.data(ActivationWrapper.build().entityVO(detail)); } /** * 分页 */ @GetMapping("/list") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入survey") public R<IPage<ActivationVO>> list(Activation activation, Query query) { IPage<Activation> pages = activationService.page(Condition.getPage(query), Condition.getQueryWrapper(activation)); return R.data(ActivationWrapper.build().pageVO(pages)); } /** * 自定义分页 */ @GetMapping("/page") @ApiOperationSupport(order = 3) @ApiOperation(value = "分页", notes = "传入survey") public R<IPage<ActivationVO>> page(ActivationVO activation, Query query) { IPage<ActivationVO> pages = activationService.selectSurveyPage(Condition.getPage(query), activation); return R.data(pages); } /** * 新增 */ @PostMapping("/save") @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入survey") public R save(@Valid @RequestBody Activation activation) { return R.status(activationService.save(activation)); } /** * 修改 */ @PostMapping("/update") @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入survey") public R update(@Valid @RequestBody Activation activation) { return R.status(activationService.updateById(activation)); } /** * 新增或修改 */ @PostMapping("/submit") @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入survey") public R submit(@Valid Activation activation) { return R.status(activationService.saveOrUpdate(activation)); } /** * 删除 */ @PostMapping("/remove") @ApiOperationSupport(order = 8) @ApiOperation(value = "删除", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(activationService.removeByIds(Func.toLongList(ids))); } } blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/activation/dto/ActivationDTO.java
New file @@ -0,0 +1,34 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.jfpt.activation.dto; import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.jfpt.activation.entity.Activation; /** * 数据传输对象实体类 * * @author BladeX * @since 2020-08-11 */ @Data @EqualsAndHashCode(callSuper = true) public class ActivationDTO extends Activation { private static final long serialVersionUID = 1L; } blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/activation/entity/Activation.java
New file @@ -0,0 +1,74 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.jfpt.activation.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; /** * 实体类 * * @author BladeX * @since 2020-08-11 */ @Data @TableName("sys_activation") @ApiModel(value = "Survey对象", description = "Survey对象") public class Activation implements Serializable { private static final long serialVersionUID = 1L; @TableId(value = "id", type = IdType.AUTO) private Integer id; /** * 人员名称 */ @ApiModelProperty(value = "人员名称") private String name; /** * 身份证 */ @ApiModelProperty(value = "身份证") @TableField("identityCard") private String identityCard; /** * 票码 */ @ApiModelProperty(value = "票码") @TableField("ticketCode") private String ticketCode; /** * 是否激活 */ @ApiModelProperty(value = "是否激活") @TableField("activation") private String activation; } blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/activation/mapper/ActivationMapper.java
New file @@ -0,0 +1,42 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.jfpt.activation.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.jfpt.activation.entity.Activation; import org.springblade.jfpt.activation.vo.ActivationVO; import java.util.List; /** * Mapper 接口 * * @author BladeX * @since 2020-08-11 */ public interface ActivationMapper extends BaseMapper<Activation> { /** * 自定义分页 * * @param page * @param survey * @return */ List<ActivationVO> selectSurveyPage(IPage page, ActivationVO survey); } blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/activation/mapper/ActivationMapper.xml
New file @@ -0,0 +1,20 @@ <?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="org.springblade.jfpt.activation.mapper.ActivationMapper"> <!-- 通用查询映射结果 --> <resultMap id="activationResultMap" type="org.springblade.jfpt.activation.entity.Activation"> <id column="id" property="id"/> <result column="name" property="name"/> <result column="identityCard" property="identityCard"/> <result column="ticketCode" property="ticketCode"/> <result column="activation" property="activation"/> </resultMap> <select id="selectSurveyPage" resultMap="activationResultMap"> select * from sys_activation where is_deleted = 0 </select> </mapper> blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/activation/service/IActivationService.java
New file @@ -0,0 +1,40 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.jfpt.activation.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import org.springblade.jfpt.activation.entity.Activation; import org.springblade.jfpt.activation.vo.ActivationVO; /** * 服务类 * * @author BladeX * @since 2020-08-11 */ public interface IActivationService extends IService<Activation> { /** * 自定义分页 * * @param page * @param survey * @return */ IPage<ActivationVO> selectSurveyPage(IPage<ActivationVO> page, ActivationVO survey); } blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/activation/service/impl/ActivationServiceImpl.java
New file @@ -0,0 +1,43 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.jfpt.activation.service.impl; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springblade.jfpt.activation.entity.Activation; import org.springblade.jfpt.activation.mapper.ActivationMapper; import org.springblade.jfpt.activation.service.IActivationService; import org.springblade.jfpt.activation.vo.ActivationVO; import org.springframework.stereotype.Service; /** * 服务实现类 * * @author BladeX * @since 2020-08-11 */ @Service public class ActivationServiceImpl extends ServiceImpl<ActivationMapper, Activation> implements IActivationService { @Override public IPage<ActivationVO> selectSurveyPage(IPage<ActivationVO> page, ActivationVO survey) { return page.setRecords(baseMapper.selectSurveyPage(page, survey)); } } blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/activation/vo/ActivationVO.java
New file @@ -0,0 +1,36 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.jfpt.activation.vo; import io.swagger.annotations.ApiModel; import lombok.Data; import lombok.EqualsAndHashCode; import org.springblade.jfpt.activation.entity.Activation; /** * 视图实体类 * * @author BladeX * @since 2020-08-11 */ @Data @EqualsAndHashCode(callSuper = true) @ApiModel(value = "SurveyVO对象", description = "SurveyVO对象") public class ActivationVO extends Activation { private static final long serialVersionUID = 1L; } blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/activation/wrapper/ActivationWrapper.java
New file @@ -0,0 +1,50 @@ /* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package org.springblade.jfpt.activation.wrapper; import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; import org.springblade.jfpt.activation.entity.Activation; import org.springblade.jfpt.activation.vo.ActivationVO; import java.util.Objects; /** * 包装类,返回视图层所需的字段 * * @author BladeX * @since 2020-08-11 */ public class ActivationWrapper extends BaseEntityWrapper<Activation, ActivationVO> { public static ActivationWrapper build() { return new ActivationWrapper(); } @Override public ActivationVO entityVO(Activation survey) { ActivationVO surveyVO = Objects.requireNonNull(BeanUtil.copy(survey, ActivationVO.class)); //User createUser = UserCache.getUser(survey.getCreateUser()); //User updateUser = UserCache.getUser(survey.getUpdateUser()); //surveyVO.setCreateUserName(createUser.getName()); //surveyVO.setUpdateUserName(updateUser.getName()); return surveyVO; } }