From 2ec2494a01b058255c423bddc180dae4c2fa9464 Mon Sep 17 00:00:00 2001 From: limqhz Date: Mon, 8 Mar 2021 00:08:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=81=A5=E5=BA=B7=E6=8A=A5=E5=91=8A=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/sv/entity/HealthDoc.java | 18 +- .../controller/MemberHealthDocController.java | 54 +++ .../java/com/sv/mapper/HealthDocMapper.java | 7 +- .../common/MemberHealthDocService.java | 66 +++ .../mybatis/mapper/sv/HealthDocMapper.xml | 421 +++--------------- .../main/resources/tools/generatorConfig.xml | 4 + 6 files changed, 216 insertions(+), 354 deletions(-) create mode 100644 oms/src/main/java/com/sv/oms/controller/MemberHealthDocController.java create mode 100644 service/src/main/java/com/sv/service/common/MemberHealthDocService.java diff --git a/entity/src/main/java/com/sv/entity/HealthDoc.java b/entity/src/main/java/com/sv/entity/HealthDoc.java index 175ed9b..a696f98 100644 --- a/entity/src/main/java/com/sv/entity/HealthDoc.java +++ b/entity/src/main/java/com/sv/entity/HealthDoc.java @@ -1,12 +1,18 @@ package com.sv.entity; +import java.io.Serializable; import java.util.Date; -public class HealthDoc { +public class HealthDoc implements Serializable { private Integer id; private Integer memberId; + /** + * 用户昵称 + */ + private String nickName; + private String docName; private String docType; @@ -56,6 +62,14 @@ public class HealthDoc { this.memberId = memberId; } + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + public String getDocName() { return docName; } @@ -119,4 +133,4 @@ public class HealthDoc { public void setDeleted(Byte deleted) { this.deleted = deleted; } -} \ No newline at end of file +} diff --git a/oms/src/main/java/com/sv/oms/controller/MemberHealthDocController.java b/oms/src/main/java/com/sv/oms/controller/MemberHealthDocController.java new file mode 100644 index 0000000..91b009c --- /dev/null +++ b/oms/src/main/java/com/sv/oms/controller/MemberHealthDocController.java @@ -0,0 +1,54 @@ +package com.sv.oms.controller; + +import com.sv.entity.HealthDoc; +import com.sv.service.common.MemberHealthDocService; +import com.ydd.framework.core.common.Pagination; +import com.ydd.framework.core.common.dto.ResponseDTO; +import com.ydd.oms.controller.OmsController; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/** + * Controller - 用户健康报告 + * + * @author limqhz + */ +@RestController +public class MemberHealthDocController extends OmsController { + + private final Logger logger = LoggerFactory.getLogger(MemberHealthDocController.class); + + @Resource + private MemberHealthDocService memberHealthDocService; + + /** + * 分页查询用户会员卡 + */ + @RequestMapping(value = "/member/health/docs", method = RequestMethod.GET) + public ResponseDTO findPage(Pagination pagination) { + return ResponseDTO.ok() + .setPagination(memberHealthDocService.findPage(pagination)); + } + + /** + * 保存用户会员卡 + */ + @RequestMapping(value = "/member/health/save", method = RequestMethod.POST) + public ResponseDTO save(HealthDoc healthDoc) { + memberHealthDocService.save(healthDoc); + return ResponseDTO.ok("保存成功"); + } + + /** + * 删除用户会员卡 + */ + @RequestMapping(value = "/member/health/delete", method = RequestMethod.POST) + public ResponseDTO delete(@RequestParam("id") Integer id) { + memberHealthDocService.delete(id); + return ResponseDTO.ok("删除成功"); + } + +} diff --git a/service/src/main/java/com/sv/mapper/HealthDocMapper.java b/service/src/main/java/com/sv/mapper/HealthDocMapper.java index d385be1..0940f69 100644 --- a/service/src/main/java/com/sv/mapper/HealthDocMapper.java +++ b/service/src/main/java/com/sv/mapper/HealthDocMapper.java @@ -1,6 +1,9 @@ package com.sv.mapper; import com.sv.entity.HealthDoc; +import org.apache.ibatis.annotations.Param; + +import java.util.List; public interface HealthDocMapper { int deleteByPrimaryKey(Integer id); @@ -14,4 +17,6 @@ public interface HealthDocMapper { int updateByPrimaryKeySelective(HealthDoc record); int updateByPrimaryKey(HealthDoc record); -} \ No newline at end of file + + List findMemAll(); +} diff --git a/service/src/main/java/com/sv/service/common/MemberHealthDocService.java b/service/src/main/java/com/sv/service/common/MemberHealthDocService.java new file mode 100644 index 0000000..b8ddde9 --- /dev/null +++ b/service/src/main/java/com/sv/service/common/MemberHealthDocService.java @@ -0,0 +1,66 @@ +package com.sv.service.common; + +import com.github.pagehelper.PageHelper; +import com.sv.entity.HealthDoc; +import com.sv.mapper.HealthDocMapper; +import com.ydd.framework.core.common.Pagination; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; + +/** + * Service - 用户会员卡 + * + * @author yechanglin + * @since 2018-08-02 + */ +@Service +@Transactional +public class MemberHealthDocService extends MemberCardCommonService { + + private final Logger logger = LoggerFactory.getLogger(MemberHealthDocService.class); + + @Resource + private HealthDocMapper healthDocMapper; + + /** + * 上传健康报告 + * + * @param healthDoc 健康报告 + */ + @Transactional + public void save(HealthDoc healthDoc) { + healthDocMapper.insert(healthDoc); + } + + /** + * 删除用户健康报告 + * + * @param id 编号 + * @return 删除数量 + */ + public Integer delete(Integer id) { + if (id == null || id <= 0) { + return 0; + } + return healthDocMapper.deleteByPrimaryKey(id); + } + + /** + * 查询用户健康报告 + * + * @param pagination 分页信息 + * @return 分页结果 + */ + public Pagination findPage(Pagination pagination) { + PageHelper.startPage(pagination.getPage(), pagination.getPageSize()); + PageHelper.orderBy("id desc"); + pagination.setQueryResult(healthDocMapper.findMemAll()); + return pagination; + } + +} + diff --git a/service/src/main/resources/mybatis/mapper/sv/HealthDocMapper.xml b/service/src/main/resources/mybatis/mapper/sv/HealthDocMapper.xml index 42af0f1..fadafd0 100644 --- a/service/src/main/resources/mybatis/mapper/sv/HealthDocMapper.xml +++ b/service/src/main/resources/mybatis/mapper/sv/HealthDocMapper.xml @@ -1,434 +1,153 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - id, member_id, doc_name, doc_type, file_type, doc_path, platform_id, created_time, + + id, member_id, doc_name, doc_type, file_type, doc_path, platform_id, created_time, modified_time, deleted - - - delete from sv_health_docs - where id = #{id,jdbcType=INTEGER} - - - insert into sv_health_docs (id, member_id, doc_name, - doc_type, file_type, doc_path, - platform_id, created_time, modified_time, - deleted) - values (#{id,jdbcType=INTEGER}, #{memberId,jdbcType=INTEGER}, #{docName,jdbcType=VARCHAR}, - #{docType,jdbcType=CHAR}, #{fileType,jdbcType=CHAR}, #{docPath,jdbcType=VARCHAR}, - #{platformId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, #{modifiedTime,jdbcType=TIMESTAMP}, - #{deleted,jdbcType=TINYINT}) - - - insert into sv_health_docs - - - id, - - - member_id, - - - doc_name, - - - doc_type, - - - file_type, - - - doc_path, - - - platform_id, - - - created_time, - - - modified_time, - - - deleted, - - - - - #{id,jdbcType=INTEGER}, - - - #{memberId,jdbcType=INTEGER}, - - - #{docName,jdbcType=VARCHAR}, - - - #{docType,jdbcType=CHAR}, - - - #{fileType,jdbcType=CHAR}, - - - #{docPath,jdbcType=VARCHAR}, - - - #{platformId,jdbcType=INTEGER}, - - - #{createdTime,jdbcType=TIMESTAMP}, - - - #{modifiedTime,jdbcType=TIMESTAMP}, - - - #{deleted,jdbcType=TINYINT}, - - - - - update sv_health_docs - - - member_id = #{memberId,jdbcType=INTEGER}, - - - doc_name = #{docName,jdbcType=VARCHAR}, - - - doc_type = #{docType,jdbcType=CHAR}, - - - file_type = #{fileType,jdbcType=CHAR}, - - - doc_path = #{docPath,jdbcType=VARCHAR}, - - - platform_id = #{platformId,jdbcType=INTEGER}, - - - created_time = #{createdTime,jdbcType=TIMESTAMP}, - - - modified_time = #{modifiedTime,jdbcType=TIMESTAMP}, - - - deleted = #{deleted,jdbcType=TINYINT}, - - - where id = #{id,jdbcType=INTEGER} - - - update sv_health_docs - set member_id = #{memberId,jdbcType=INTEGER}, - doc_name = #{docName,jdbcType=VARCHAR}, - doc_type = #{docType,jdbcType=CHAR}, - file_type = #{fileType,jdbcType=CHAR}, - doc_path = #{docPath,jdbcType=VARCHAR}, - platform_id = #{platformId,jdbcType=INTEGER}, - created_time = #{createdTime,jdbcType=TIMESTAMP}, - modified_time = #{modifiedTime,jdbcType=TIMESTAMP}, - deleted = #{deleted,jdbcType=TINYINT} - where id = #{id,jdbcType=INTEGER} - - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - id, member_id, doc_name, doc_type, file_type, doc_path, platform_id, created_time, - modified_time, deleted - - select - - distinct - - - from sv_health_docs - - - - - order by ${orderByClause} - - - - + + + + delete from sv_health_docs where id = #{id,jdbcType=INTEGER} - - delete from sv_health_docs - - - - - - insert into sv_health_docs (id, member_id, doc_name, - doc_type, file_type, doc_path, - platform_id, created_time, modified_time, + + insert into sv_health_docs (id, member_id, doc_name, + doc_type, file_type, doc_path, + platform_id, created_time, modified_time, deleted) - values (#{id,jdbcType=INTEGER}, #{memberId,jdbcType=INTEGER}, #{docName,jdbcType=VARCHAR}, - #{docType,jdbcType=CHAR}, #{fileType,jdbcType=CHAR}, #{docPath,jdbcType=VARCHAR}, - #{platformId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, #{modifiedTime,jdbcType=TIMESTAMP}, + values (#{id,jdbcType=INTEGER}, #{memberId,jdbcType=INTEGER}, #{docName,jdbcType=VARCHAR}, + #{docType,jdbcType=CHAR}, #{fileType,jdbcType=CHAR}, #{docPath,jdbcType=VARCHAR}, + #{platformId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, #{modifiedTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=TINYINT}) - + insert into sv_health_docs - - + + id, - + member_id, - + doc_name, - + doc_type, - + file_type, - + doc_path, - + platform_id, - + created_time, - + modified_time, - + deleted, - - + + #{id,jdbcType=INTEGER}, - + #{memberId,jdbcType=INTEGER}, - + #{docName,jdbcType=VARCHAR}, - + #{docType,jdbcType=CHAR}, - + #{fileType,jdbcType=CHAR}, - + #{docPath,jdbcType=VARCHAR}, - + #{platformId,jdbcType=INTEGER}, - + #{createdTime,jdbcType=TIMESTAMP}, - + #{modifiedTime,jdbcType=TIMESTAMP}, - + #{deleted,jdbcType=TINYINT}, - - + update sv_health_docs - - - id = #{record.id,jdbcType=INTEGER}, - - - member_id = #{record.memberId,jdbcType=INTEGER}, - - - doc_name = #{record.docName,jdbcType=VARCHAR}, - - - doc_type = #{record.docType,jdbcType=CHAR}, - - - file_type = #{record.fileType,jdbcType=CHAR}, - - - doc_path = #{record.docPath,jdbcType=VARCHAR}, - - - platform_id = #{record.platformId,jdbcType=INTEGER}, - - - created_time = #{record.createdTime,jdbcType=TIMESTAMP}, - - - modified_time = #{record.modifiedTime,jdbcType=TIMESTAMP}, - - - deleted = #{record.deleted,jdbcType=TINYINT}, - - - - - - - - update sv_health_docs - set id = #{record.id,jdbcType=INTEGER}, - member_id = #{record.memberId,jdbcType=INTEGER}, - doc_name = #{record.docName,jdbcType=VARCHAR}, - doc_type = #{record.docType,jdbcType=CHAR}, - file_type = #{record.fileType,jdbcType=CHAR}, - doc_path = #{record.docPath,jdbcType=VARCHAR}, - platform_id = #{record.platformId,jdbcType=INTEGER}, - created_time = #{record.createdTime,jdbcType=TIMESTAMP}, - modified_time = #{record.modifiedTime,jdbcType=TIMESTAMP}, - deleted = #{record.deleted,jdbcType=TINYINT} - - - - - - update sv_health_docs - - + + member_id = #{memberId,jdbcType=INTEGER}, - + doc_name = #{docName,jdbcType=VARCHAR}, - + doc_type = #{docType,jdbcType=CHAR}, - + file_type = #{fileType,jdbcType=CHAR}, - + doc_path = #{docPath,jdbcType=VARCHAR}, - + platform_id = #{platformId,jdbcType=INTEGER}, - + created_time = #{createdTime,jdbcType=TIMESTAMP}, - + modified_time = #{modifiedTime,jdbcType=TIMESTAMP}, - + deleted = #{deleted,jdbcType=TINYINT}, where id = #{id,jdbcType=INTEGER} - + update sv_health_docs set member_id = #{memberId,jdbcType=INTEGER}, doc_name = #{docName,jdbcType=VARCHAR}, @@ -441,4 +160,4 @@ deleted = #{deleted,jdbcType=TINYINT} where id = #{id,jdbcType=INTEGER} - \ No newline at end of file + diff --git a/service/src/main/resources/tools/generatorConfig.xml b/service/src/main/resources/tools/generatorConfig.xml index 78efa97..8de40ba 100644 --- a/service/src/main/resources/tools/generatorConfig.xml +++ b/service/src/main/resources/tools/generatorConfig.xml @@ -91,6 +91,10 @@ 注意:大小写敏感问题。 -->