forked from rongchao/epmet-cloud-rizhao
10 changed files with 671 additions and 0 deletions
@ -0,0 +1,70 @@ |
|||
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-20 |
|||
*/ |
|||
@Data |
|||
public class RecreationSportDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 类型 |
|||
*/ |
|||
private String type; |
|||
|
|||
/** |
|||
* 内容 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 地址 |
|||
*/ |
|||
private String address; |
|||
|
|||
/** |
|||
* 开始时间 |
|||
*/ |
|||
private Date startTime; |
|||
|
|||
/** |
|||
* 结束时间 |
|||
*/ |
|||
private Date endTime; |
|||
|
|||
/** |
|||
* 是否报名 |
|||
*/ |
|||
private String apply; |
|||
|
|||
/** |
|||
* 报名开始时间 |
|||
*/ |
|||
private Date applyStart; |
|||
|
|||
/** |
|||
* 报名结束时间 |
|||
*/ |
|||
private Date applyEnd; |
|||
|
|||
} |
@ -0,0 +1,71 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import com.epmet.commons.tools.dto.form.PageFormDTO; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 日照:文体信息管理 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-06-20 |
|||
*/ |
|||
@Data |
|||
public class RecreationSportFormDTO extends PageFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 类型 |
|||
*/ |
|||
private String type; |
|||
|
|||
/** |
|||
* 内容 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 地址 |
|||
*/ |
|||
private String address; |
|||
|
|||
/** |
|||
* 开始时间 |
|||
*/ |
|||
private Date startTime; |
|||
|
|||
/** |
|||
* 结束时间 |
|||
*/ |
|||
private Date endTime; |
|||
|
|||
/** |
|||
* 是否报名 |
|||
*/ |
|||
private String apply; |
|||
|
|||
/** |
|||
* 报名开始时间 |
|||
*/ |
|||
private Date applyStart; |
|||
|
|||
/** |
|||
* 报名结束时间 |
|||
*/ |
|||
private Date applyEnd; |
|||
|
|||
} |
@ -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.RecreationSportDTO; |
|||
import com.epmet.dto.form.RecreationSportFormDTO; |
|||
import com.epmet.service.RecreationSportService; |
|||
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-20 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("recreationSport") |
|||
public class RecreationSportController { |
|||
|
|||
@Autowired |
|||
private RecreationSportService recreationSportService; |
|||
|
|||
@RequestMapping("page") |
|||
public Result<PageData<RecreationSportDTO>> page(@RequestParam Map<String, Object> params) { |
|||
PageData<RecreationSportDTO> page = recreationSportService.page(params); |
|||
return new Result<PageData<RecreationSportDTO>>().ok(page); |
|||
} |
|||
|
|||
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) |
|||
public Result<RecreationSportDTO> get(@PathVariable("id") String id) { |
|||
RecreationSportDTO data = recreationSportService.get(id); |
|||
return new Result<RecreationSportDTO>().ok(data); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("save") |
|||
public Result save(@RequestBody RecreationSportFormDTO dto) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
recreationSportService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("update") |
|||
public Result update(@RequestBody RecreationSportFormDTO dto) { |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
recreationSportService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("delete") |
|||
public Result delete(@RequestBody String[] ids) { |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
recreationSportService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("search") |
|||
public Result<PageData<RecreationSportDTO>> search(@RequestBody RecreationSportFormDTO dto) { |
|||
return new Result().ok(recreationSportService.search(dto)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.RecreationSportDTO; |
|||
import com.epmet.entity.RecreationSportEntity; |
|||
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-20 |
|||
*/ |
|||
@Mapper |
|||
public interface RecreationSportDao extends BaseDao<RecreationSportEntity> { |
|||
|
|||
List<RecreationSportDTO> search(@Param("title") String title, @Param("type") String type, |
|||
@Param("apply") String apply, @Param("startTime") String startTime, |
|||
@Param("endTime") String endTime); |
|||
} |
@ -0,0 +1,68 @@ |
|||
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-20 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("recreation_sport") |
|||
public class RecreationSportEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 标题 |
|||
*/ |
|||
private String title; |
|||
|
|||
/** |
|||
* 类型 |
|||
*/ |
|||
private String type; |
|||
|
|||
/** |
|||
* 内容 |
|||
*/ |
|||
private String content; |
|||
|
|||
/** |
|||
* 地址 |
|||
*/ |
|||
private String address; |
|||
|
|||
/** |
|||
* 开始时间 |
|||
*/ |
|||
private Date startTime; |
|||
|
|||
/** |
|||
* 结束时间 |
|||
*/ |
|||
private Date endTime; |
|||
|
|||
/** |
|||
* 是否报名 |
|||
*/ |
|||
private String apply; |
|||
|
|||
/** |
|||
* 报名开始时间 |
|||
*/ |
|||
private Date applyStart; |
|||
|
|||
/** |
|||
* 报名结束时间 |
|||
*/ |
|||
private Date applyEnd; |
|||
|
|||
} |
@ -0,0 +1,66 @@ |
|||
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-20 |
|||
*/ |
|||
@Data |
|||
public class RecreationSportExcel { |
|||
|
|||
@Excel(name = "主键ID") |
|||
private String id; |
|||
|
|||
@Excel(name = "标题") |
|||
private String title; |
|||
|
|||
@Excel(name = "类型") |
|||
private String type; |
|||
|
|||
@Excel(name = "内容") |
|||
private String content; |
|||
|
|||
@Excel(name = "地址") |
|||
private String address; |
|||
|
|||
@Excel(name = "开始时间") |
|||
private Date startTime; |
|||
|
|||
@Excel(name = "结束时间") |
|||
private Date endTime; |
|||
|
|||
@Excel(name = "是否报名") |
|||
private String apply; |
|||
|
|||
@Excel(name = "报名开始时间") |
|||
private Date applyStart; |
|||
|
|||
@Excel(name = "报名结束时间") |
|||
private Date applyEnd; |
|||
|
|||
@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.RecreationSportDTO; |
|||
import com.epmet.dto.form.RecreationSportFormDTO; |
|||
import com.epmet.entity.RecreationSportEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 日照:文体信息管理 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2023-06-20 |
|||
*/ |
|||
public interface RecreationSportService extends BaseService<RecreationSportEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<RecreationSportDTO> |
|||
* @author generator |
|||
* @date 2023-06-20 |
|||
*/ |
|||
PageData<RecreationSportDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<RecreationSportDTO> |
|||
* @author generator |
|||
* @date 2023-06-20 |
|||
*/ |
|||
List<RecreationSportDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return RecreationSportDTO |
|||
* @author generator |
|||
* @date 2023-06-20 |
|||
*/ |
|||
RecreationSportDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2023-06-20 |
|||
*/ |
|||
void save(RecreationSportFormDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2023-06-20 |
|||
*/ |
|||
void update(RecreationSportFormDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2023-06-20 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
PageData<RecreationSportDTO> search(RecreationSportFormDTO dto); |
|||
} |
@ -0,0 +1,95 @@ |
|||
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.RecreationSportDao; |
|||
import com.epmet.dto.RecreationSportDTO; |
|||
import com.epmet.dto.form.RecreationSportFormDTO; |
|||
import com.epmet.entity.RecreationSportEntity; |
|||
import com.epmet.service.RecreationSportService; |
|||
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-20 |
|||
*/ |
|||
@Service |
|||
public class RecreationSportServiceImpl extends BaseServiceImpl<RecreationSportDao, RecreationSportEntity> implements RecreationSportService { |
|||
|
|||
@Override |
|||
public PageData<RecreationSportDTO> page(Map<String, Object> params) { |
|||
IPage<RecreationSportEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, RecreationSportDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<RecreationSportDTO> list(Map<String, Object> params) { |
|||
List<RecreationSportEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, RecreationSportDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<RecreationSportEntity> getWrapper(Map<String, Object> params) { |
|||
String id = (String) params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<RecreationSportEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public RecreationSportDTO get(String id) { |
|||
RecreationSportEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, RecreationSportDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(RecreationSportFormDTO dto) { |
|||
RecreationSportEntity entity = ConvertUtils.sourceToTarget(dto, RecreationSportEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(RecreationSportFormDTO dto) { |
|||
RecreationSportEntity entity = ConvertUtils.sourceToTarget(dto, RecreationSportEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
public PageData<RecreationSportDTO> search(RecreationSportFormDTO dto) { |
|||
PageInfo<RecreationSportDTO> pageInfo = PageHelper.startPage(dto.getPageNo(), dto.getPageSize(), dto.getIsPage()) |
|||
.doSelectPageInfo(() -> baseDao.search(dto.getTitle(), dto.getType(), dto.getApply(), |
|||
DateUtil.formatDateTime(dto.getStartTime()), DateUtil.formatDateTime(dto.getEndTime()))); |
|||
return new PageData<>(pageInfo.getList() == null ? new ArrayList<>() : pageInfo.getList(), pageInfo.getTotal()); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,57 @@ |
|||
<?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.PhysicianManageDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.PhysicianManageEntity" id="physicianManageMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="name" column="NAME"/> |
|||
<result property="idCard" column="ID_CARD"/> |
|||
<result property="mobile" column="MOBILE"/> |
|||
<result property="level" column="LEVEL"/> |
|||
<result property="subOrg" column="SUB_ORG"/> |
|||
<result property="orgLevel" column="ORG_LEVEL"/> |
|||
<result property="imsi" column="IMSI"/> |
|||
<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> |
|||
<sql id="returnMap"> |
|||
pm.ID, |
|||
pm.NAME, |
|||
pm.ID_CARD, |
|||
pm.MOBILE, |
|||
pm.LEVEL, |
|||
pm.SUB_ORG, |
|||
pm.ORG_LEVEL, |
|||
pm.IMSI |
|||
</sql> |
|||
<select id="search" resultType="com.epmet.dto.PhysicianManageDTO"> |
|||
SELECT |
|||
<include refid="returnMap"/> |
|||
FROM physician_manage pm |
|||
<where> |
|||
pm.DEL_FLAG = 0 |
|||
<if test="null != name and name != ''"> |
|||
AND pm.NAME LIKE concat('%',#{name},'%') |
|||
</if> |
|||
<if test="null != idCard and idCard != ''"> |
|||
AND pm.ID_CARD LIKE concat('%',#{idCard},'%') |
|||
</if> |
|||
<if test="null != subOrg and subOrg != ''"> |
|||
AND pm.SUB_ORG LIKE concat('%',#{subOrg},'%') |
|||
</if> |
|||
<if test="null != level and level != ''"> |
|||
AND pm.LEVEL = #{level} |
|||
</if> |
|||
<if test="null != orgLevel and orgLevel != ''"> |
|||
AND pm.ORG_LEVEL = #{orgLevel} |
|||
</if> |
|||
</where> |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,64 @@ |
|||
<?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.RecreationSportDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.RecreationSportEntity" id="recreationSportMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="title" column="TITLE"/> |
|||
<result property="type" column="TYPE"/> |
|||
<result property="content" column="CONTENT"/> |
|||
<result property="address" column="ADDRESS"/> |
|||
<result property="startTime" column="START_TIME"/> |
|||
<result property="endTime" column="END_TIME"/> |
|||
<result property="apply" column="APPLY"/> |
|||
<result property="applyStart" column="APPLY_START"/> |
|||
<result property="applyEnd" column="APPLY_END"/> |
|||
<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> |
|||
|
|||
<sql id="returnMap"> |
|||
rs.ID, |
|||
rs.TITLE, |
|||
rs.TYPE, |
|||
rs.CONTENT, |
|||
rs.ADDRESS, |
|||
rs.START_TIME, |
|||
rs.END_TIME, |
|||
rs.APPLY, |
|||
rs.APPLY_START, |
|||
rs.APPLY_END |
|||
</sql> |
|||
|
|||
<select id="search" resultType="com.epmet.dto.RecreationSportDTO"> |
|||
SELECT |
|||
<include refid="returnMap"/> |
|||
FROM recreation_sport rs |
|||
<where> |
|||
rs.DEL_FLAG = 0 |
|||
<if test="null != title and title != ''"> |
|||
AND rs.TITLE LIKE concat('%',#{title},'%') |
|||
</if> |
|||
<if test="null != type and type != ''"> |
|||
AND rs.TYPE LIKE concat('%', #{type},'%') |
|||
</if> |
|||
<if test="null != apply and apply != ''"> |
|||
AND rs.APPLY = #{apply} |
|||
</if> |
|||
<if test="null != startTime and startTime != ''"> |
|||
AND DATE_FORMAT(rs.START_TIME,"%Y-%m-%d") >= DATE_FORMAT(#{startTime},"%Y-%m-%d") |
|||
</if> |
|||
<if test="null != endTime and endTime != ''"> |
|||
AND DATE_FORMAT(rs.END_TIME,"%Y-%m-%d") <= DATE_FORMAT(#{endTime},"%Y-%m-%d") |
|||
</if> |
|||
</where> |
|||
|
|||
</select> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue