forked from rongchao/epmet-cloud-rizhao
9 changed files with 663 additions and 0 deletions
@ -0,0 +1,75 @@ |
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 日照:社区医疗服务 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-06-19 |
|||
*/ |
|||
@Data |
|||
public class CommunityCareDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 服务标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 服务类型 |
|||
*/ |
|||
private String serviceType; |
|||
|
|||
/** |
|||
* 发布时间 |
|||
*/ |
|||
private Date releaseTime; |
|||
|
|||
/** |
|||
* 商户名称 |
|||
*/ |
|||
private String unitName; |
|||
|
|||
/** |
|||
* 商户地址 |
|||
*/ |
|||
private String unitAddr; |
|||
|
|||
/** |
|||
* 联系人 |
|||
*/ |
|||
private String attn; |
|||
|
|||
/** |
|||
* 联系人电话 |
|||
*/ |
|||
private String attnPhone; |
|||
|
|||
/** |
|||
* 服务内容 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 上门服务 |
|||
*/ |
|||
private String onsiteServices; |
|||
|
|||
/** |
|||
* 封面图片 |
|||
*/ |
|||
private String imgUrl; |
|||
|
|||
} |
@ -0,0 +1,79 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import com.epmet.commons.tools.dto.form.PageFormDTO; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author yan Lu |
|||
* @description 描述 |
|||
* @create 2023/6/19 20:03 |
|||
*/ |
|||
@Data |
|||
public class CommunityCareFormDTO extends PageFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -1982531591277565163L; |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 服务标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 服务类型 |
|||
*/ |
|||
private String serviceType; |
|||
|
|||
/** |
|||
* 发布时间 |
|||
*/ |
|||
private String releaseTime; |
|||
|
|||
/** |
|||
* 商户名称 |
|||
*/ |
|||
private String unitName; |
|||
|
|||
/** |
|||
* 商户地址 |
|||
*/ |
|||
private String unitAddr; |
|||
|
|||
/** |
|||
* 联系人 |
|||
*/ |
|||
private String attn; |
|||
|
|||
/** |
|||
* 联系人电话 |
|||
*/ |
|||
private String attnPhone; |
|||
|
|||
/** |
|||
* 服务内容 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 上门服务 |
|||
*/ |
|||
private String onsiteServices; |
|||
|
|||
/** |
|||
* 封面图片 |
|||
*/ |
|||
private String imgUrl; |
|||
|
|||
/** |
|||
* 发布时间 |
|||
*/ |
|||
private String startTime; |
|||
|
|||
private String endTime; |
|||
} |
@ -0,0 +1,76 @@ |
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.aop.NoRepeatSubmit; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.AssertUtils; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import com.epmet.dto.CommunityCareDTO; |
|||
import com.epmet.dto.form.CommunityCareFormDTO; |
|||
import com.epmet.service.CommunityCareService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 日照:社区医疗服务 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-06-19 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("communityCare") |
|||
public class CommunityCareController { |
|||
|
|||
@Autowired |
|||
private CommunityCareService communityCareService; |
|||
|
|||
@RequestMapping("page") |
|||
public Result<PageData<CommunityCareDTO>> page(@RequestParam Map<String, Object> params) { |
|||
PageData<CommunityCareDTO> page = communityCareService.page(params); |
|||
return new Result<PageData<CommunityCareDTO>>().ok(page); |
|||
} |
|||
|
|||
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) |
|||
public Result<CommunityCareDTO> get(@PathVariable("id") String id) { |
|||
CommunityCareDTO data = communityCareService.get(id); |
|||
return new Result<CommunityCareDTO>().ok(data); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("save") |
|||
public Result save(@RequestBody CommunityCareFormDTO dto) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
communityCareService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("update") |
|||
public Result update(@RequestBody CommunityCareFormDTO dto) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
communityCareService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("delete") |
|||
public Result delete(@RequestBody String[] ids) { |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
communityCareService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("search") |
|||
public Result<PageData<CommunityCareDTO>> search(@RequestBody CommunityCareFormDTO dto) { |
|||
return new Result().ok(communityCareService.search(dto)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.CommunityCareDTO; |
|||
import com.epmet.entity.CommunityCareEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 日照:社区医疗服务 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-06-19 |
|||
*/ |
|||
@Mapper |
|||
public interface CommunityCareDao extends BaseDao<CommunityCareEntity> { |
|||
|
|||
List<CommunityCareDTO> search(@Param("title") String title, @Param("unitName") String unitName, |
|||
@Param("attn") String attn, @Param("onsite") String onsite, |
|||
@Param("startTime") String startTime, @Param("endTime") String endTime); |
|||
} |
@ -0,0 +1,73 @@ |
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 日照:社区医疗服务 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-06-19 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("community_care") |
|||
public class CommunityCareEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 服务标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 服务类型 |
|||
*/ |
|||
private String serviceType; |
|||
|
|||
/** |
|||
* 发布时间 |
|||
*/ |
|||
private Date releaseTime; |
|||
|
|||
/** |
|||
* 商户名称 |
|||
*/ |
|||
private String unitName; |
|||
|
|||
/** |
|||
* 商户地址 |
|||
*/ |
|||
private String unitAddr; |
|||
|
|||
/** |
|||
* 联系人 |
|||
*/ |
|||
private String attn; |
|||
|
|||
/** |
|||
* 联系人电话 |
|||
*/ |
|||
private String attnPhone; |
|||
|
|||
/** |
|||
* 服务内容 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 上门服务 |
|||
*/ |
|||
private String onsiteServices; |
|||
|
|||
/** |
|||
* 封面图片 |
|||
*/ |
|||
private String imgUrl; |
|||
|
|||
} |
@ -0,0 +1,69 @@ |
|||
package com.epmet.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 日照:社区医疗服务 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-06-19 |
|||
*/ |
|||
@Data |
|||
public class CommunityCareExcel { |
|||
|
|||
@Excel(name = "主键ID") |
|||
private String id; |
|||
|
|||
@Excel(name = "服务标题") |
|||
private String title; |
|||
|
|||
@Excel(name = "服务类型") |
|||
private String serviceType; |
|||
|
|||
@Excel(name = "发布时间") |
|||
private Date releaseTime; |
|||
|
|||
@Excel(name = "商户名称") |
|||
private String unitName; |
|||
|
|||
@Excel(name = "商户地址") |
|||
private String unitAddr; |
|||
|
|||
@Excel(name = "联系人") |
|||
private String attn; |
|||
|
|||
@Excel(name = "联系人电话") |
|||
private String attnPhone; |
|||
|
|||
@Excel(name = "服务内容") |
|||
private String content; |
|||
|
|||
@Excel(name = "上门服务") |
|||
private String onsiteServices; |
|||
|
|||
@Excel(name = "封面图片") |
|||
private String imgUrl; |
|||
|
|||
@Excel(name = "删除标识 0.未删除 1.已删除") |
|||
private Integer delFlag; |
|||
|
|||
@Excel(name = "乐观锁") |
|||
private Integer revision; |
|||
|
|||
@Excel(name = "创建人") |
|||
private String createdBy; |
|||
|
|||
@Excel(name = "创建时间") |
|||
private Date createdTime; |
|||
|
|||
@Excel(name = "更新人") |
|||
private String updatedBy; |
|||
|
|||
@Excel(name = "更新时间") |
|||
private Date updatedTime; |
|||
|
|||
|
|||
} |
@ -0,0 +1,81 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.CommunityCareDTO; |
|||
import com.epmet.dto.form.CommunityCareFormDTO; |
|||
import com.epmet.entity.CommunityCareEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 日照:社区医疗服务 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-06-19 |
|||
*/ |
|||
public interface CommunityCareService extends BaseService<CommunityCareEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<CommunityCareDTO> |
|||
* @author generator |
|||
* @date 2023-06-19 |
|||
*/ |
|||
PageData<CommunityCareDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<CommunityCareDTO> |
|||
* @author generator |
|||
* @date 2023-06-19 |
|||
*/ |
|||
List<CommunityCareDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return CommunityCareDTO |
|||
* @author generator |
|||
* @date 2023-06-19 |
|||
*/ |
|||
CommunityCareDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2023-06-19 |
|||
*/ |
|||
void save(CommunityCareFormDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2023-06-19 |
|||
*/ |
|||
void update(CommunityCareFormDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2023-06-19 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
PageData<CommunityCareDTO> search(CommunityCareFormDTO dto); |
|||
} |
@ -0,0 +1,117 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.dao.CommunityCareDao; |
|||
import com.epmet.dto.CommunityCareDTO; |
|||
import com.epmet.dto.form.CommunityCareFormDTO; |
|||
import com.epmet.entity.CommunityCareEntity; |
|||
import com.epmet.service.CommunityCareService; |
|||
import com.github.pagehelper.PageHelper; |
|||
import com.github.pagehelper.PageInfo; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 日照:社区医疗服务 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-06-19 |
|||
*/ |
|||
@Service |
|||
public class CommunityCareServiceImpl extends BaseServiceImpl<CommunityCareDao, CommunityCareEntity> implements CommunityCareService { |
|||
|
|||
@Override |
|||
public PageData<CommunityCareDTO> page(Map<String, Object> params) { |
|||
IPage<CommunityCareEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, CommunityCareDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<CommunityCareDTO> list(Map<String, Object> params) { |
|||
List<CommunityCareEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, CommunityCareDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<CommunityCareEntity> getWrapper(Map<String, Object> params) { |
|||
String id = (String) params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<CommunityCareEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public CommunityCareDTO get(String id) { |
|||
CommunityCareEntity entity = baseDao.selectById(id); |
|||
CommunityCareDTO dto = ConvertUtils.sourceToTarget(entity, CommunityCareDTO.class); |
|||
if (null != dto.getReleaseTime()) { |
|||
dto.setReleaseTime(DateUtil.parseDate(DateUtil.formatDate(dto.getReleaseTime()))); |
|||
} |
|||
return ConvertUtils.sourceToTarget(entity, CommunityCareDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(CommunityCareFormDTO dto) { |
|||
CommunityCareEntity entity = ConvertUtils.sourceToTarget(dto, CommunityCareEntity.class); |
|||
if (null != dto.getReleaseTime()) { |
|||
entity.setReleaseTime(DateUtil.parseDate(dto.getReleaseTime())); |
|||
} |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(CommunityCareFormDTO dto) { |
|||
CommunityCareEntity entity = ConvertUtils.sourceToTarget(dto, CommunityCareEntity.class); |
|||
if (null != dto.getReleaseTime()) { |
|||
entity.setReleaseTime(DateUtil.parseDate(dto.getReleaseTime())); |
|||
} |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
public PageData<CommunityCareDTO> search(CommunityCareFormDTO dto) { |
|||
PageInfo<CommunityCareDTO> pageInfo = PageHelper.startPage(dto.getPageNo(), dto.getPageSize(), dto.getIsPage()) |
|||
.doSelectPageInfo(() -> baseDao.search(dto.getTitle(), dto.getUnitName(), dto.getAttn(), dto.getOnsiteServices(), dto.getStartTime(), dto.getEndTime())); |
|||
if (null != pageInfo.getList() && pageInfo.getList().size() > 0) { |
|||
buildDate(pageInfo.getList()); |
|||
} |
|||
return new PageData<>(pageInfo.getList() == null ? new ArrayList<>() : pageInfo.getList(), pageInfo.getTotal()); |
|||
} |
|||
|
|||
private void buildDate(List<CommunityCareDTO> dateList) { |
|||
if (null != dateList && dateList.size() > 0) { |
|||
for (CommunityCareDTO dto : dateList) { |
|||
if (null != dto.getReleaseTime()) { |
|||
dto.setReleaseTime(DateUtil.parseDate(DateUtil.formatDate(dto.getReleaseTime()))); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,70 @@ |
|||
<?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.epmet.dao.CommunityCareDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.CommunityCareEntity" id="communityCareMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="title" column="TITLE"/> |
|||
<result property="serviceType" column="SERVICE_TYPE"/> |
|||
<result property="releaseTime" column="RELEASE_TIME"/> |
|||
<result property="unitName" column="UNIT_NAME"/> |
|||
<result property="unitAddr" column="UNIT_ADDR"/> |
|||
<result property="attn" column="ATTN"/> |
|||
<result property="attnPhone" column="ATTN_PHONE"/> |
|||
<result property="content" column="CONTENT"/> |
|||
<result property="onsiteServices" column="ONSITE_SERVICES"/> |
|||
<result property="imgUrl" column="IMG_URL"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
|
|||
|
|||
<select id="search" resultType="com.epmet.dto.CommunityCareDTO"> |
|||
SELECT |
|||
cc.ID, |
|||
cc.TITLE, |
|||
cc.SERVICE_TYPE, |
|||
cc.RELEASE_TIME, |
|||
cc.UNIT_NAME, |
|||
cc.UNIT_ADDR, |
|||
cc.ATTN, |
|||
cc.ATTN_PHONE, |
|||
cc.CONTENT, |
|||
cc.ONSITE_SERVICES, |
|||
cc.IMG_URL |
|||
FROM community_care cc |
|||
<where> |
|||
cc.DEL_FLAG = 0 |
|||
<if test="null != title and title != ''"> |
|||
AND cc.TITLE LIKE concat('%',#{title},'%') |
|||
</if> |
|||
<if test="null != unitName and unitName != ''"> |
|||
AND cc.UNIT_NAME LIKE concat('%',#{unitName},'%') |
|||
</if> |
|||
<if test="null != attn and attn != ''"> |
|||
AND cc.ATTN LIKE concat('%',#{attn},'%') |
|||
</if> |
|||
<if test="null != onsite and onsite != ''"> |
|||
AND cc.ONSITE_SERVICES = #{onsite} |
|||
</if> |
|||
<if test="null != startTime and startTime != '' and null != endTime and endTime !=''"> |
|||
AND DATE_FORMAT(cc.RELEASE_TIME,"%Y-%m-%d") BETWEEN DATE_FORMAT(#{startTime},"%Y-%m-%d") AND |
|||
DATE_FORMAT(#{endTime},"%Y-%m-%d") |
|||
</if> |
|||
<if test="null != startTime and startTime != ''"> |
|||
AND DATE_FORMAT(cc.RELEASE_TIME,"%Y-%m-%d") >= DATE_FORMAT(#{startTime},"%Y-%m-%d") |
|||
</if> |
|||
<if test="null != endTime and endTime != ''"> |
|||
AND DATE_FORMAT(cc.RELEASE_TIME,"%Y-%m-%d") <= DATE_FORMAT(#{endTime},"%Y-%m-%d") |
|||
</if> |
|||
</where> |
|||
|
|||
</select> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue