35 changed files with 1424 additions and 82 deletions
@ -0,0 +1,86 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.activity; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 活动详细时间段表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-09-02 |
|||
*/ |
|||
@Data |
|||
public class ActPeriodDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 活动ID |
|||
*/ |
|||
private String actId; |
|||
|
|||
/** |
|||
* 活动开始时间 |
|||
*/ |
|||
private Date actPeriodStartTime; |
|||
|
|||
/** |
|||
* 活动结束时间 |
|||
*/ |
|||
private Date actPeriodEndTime; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 删除标识 0:未删除 1:删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,81 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.activity; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 活动详细时间段用户关系表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-09-02 |
|||
*/ |
|||
@Data |
|||
public class ActPeriodUserDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 活动详细时间段表ID |
|||
*/ |
|||
private String actPeriodId; |
|||
|
|||
/** |
|||
* 活动用户关系表ID |
|||
*/ |
|||
private String actUserRelationId; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 删除标识 0:未删除 1:删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.elink.esua.epdc.activity.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 活动报名 |
|||
*/ |
|||
@Data |
|||
public class EpdcActSignupFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 活动ID |
|||
*/ |
|||
@NotBlank(message = "活动ID不能为空") |
|||
private String actId; |
|||
|
|||
/** |
|||
* 参与活动时间段 |
|||
*/ |
|||
@NotNull(message = "参与活动时间段不能为空") |
|||
private List<String> actPeriodId; |
|||
} |
@ -0,0 +1,84 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.activity.controller; |
|||
|
|||
import com.elink.esua.epdc.activity.ActPeriodDTO; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
|||
import com.elink.esua.epdc.modules.activity.service.ActPeriodService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 活动详细时间段表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-09-02 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("actperiod") |
|||
public class ActPeriodController { |
|||
|
|||
@Autowired |
|||
private ActPeriodService actPeriodService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<ActPeriodDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<ActPeriodDTO> page = actPeriodService.page(params); |
|||
return new Result<PageData<ActPeriodDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<ActPeriodDTO> get(@PathVariable("id") String id){ |
|||
ActPeriodDTO data = actPeriodService.get(id); |
|||
return new Result<ActPeriodDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody ActPeriodDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
actPeriodService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody ActPeriodDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
actPeriodService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
actPeriodService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,87 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.activity.controller; |
|||
|
|||
import com.elink.esua.epdc.activity.ActPeriodUserDTO; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
|||
import com.elink.esua.epdc.modules.activity.service.ActPeriodUserService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 活动详细时间段用户关系表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-09-02 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("actperioduser") |
|||
public class ActPeriodUserController { |
|||
|
|||
@Autowired |
|||
private ActPeriodUserService actPeriodUserService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<ActPeriodUserDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<ActPeriodUserDTO> page = actPeriodUserService.page(params); |
|||
return new Result<PageData<ActPeriodUserDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<ActPeriodUserDTO> get(@PathVariable("id") String id){ |
|||
ActPeriodUserDTO data = actPeriodUserService.get(id); |
|||
return new Result<ActPeriodUserDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody ActPeriodUserDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
actPeriodUserService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody ActPeriodUserDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
actPeriodUserService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
actPeriodUserService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,66 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.activity.dao; |
|||
|
|||
import com.elink.esua.epdc.activity.ActPeriodDTO; |
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.modules.activity.entity.ActPeriodEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 活动详细时间段表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-09-02 |
|||
*/ |
|||
@Mapper |
|||
public interface ActPeriodDao extends BaseDao<ActPeriodEntity> { |
|||
|
|||
/** |
|||
* 查询活动已报名的时间段 |
|||
* |
|||
* @param actId |
|||
* @return java.util.List<com.elink.esua.epdc.activity.ActPeriodDTO> |
|||
* @author lc |
|||
* @since 2021/9/2 16:02 |
|||
*/ |
|||
List<ActPeriodDTO> selectPeriodsAlreadySignIn(String actId); |
|||
|
|||
/** |
|||
* 删除活动时间段 |
|||
* |
|||
* @param actId |
|||
* @return void |
|||
* @author lc |
|||
* @since 2021/9/2 15:30 |
|||
*/ |
|||
void modifyDelFlagByActId(String actId); |
|||
|
|||
/** |
|||
* 获取活动时间段 |
|||
* |
|||
* @param actId |
|||
* @return java.util.List<com.elink.esua.epdc.activity.ActPeriodDTO> |
|||
* @author lc |
|||
* @since 2021/9/2 16:29 |
|||
*/ |
|||
List<ActPeriodDTO> selectListOfActPeriodsByActId(String actId); |
|||
|
|||
} |
@ -0,0 +1,56 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.activity.dao; |
|||
|
|||
import com.elink.esua.epdc.activity.ActPeriodDTO; |
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.modules.activity.entity.ActPeriodUserEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 活动详细时间段用户关系表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-09-02 |
|||
*/ |
|||
@Mapper |
|||
public interface ActPeriodUserDao extends BaseDao<ActPeriodUserEntity> { |
|||
|
|||
/** |
|||
* 获取用户报名时间段 |
|||
* |
|||
* @param actUserRelationId |
|||
* @return java.util.List<com.elink.esua.epdc.activity.ActPeriodDTO> |
|||
* @author lc |
|||
* @since 2021/9/2 20:06 |
|||
*/ |
|||
List<ActPeriodDTO> selectListOfSignInActPeriodsByActUserRelationId(String actUserRelationId); |
|||
|
|||
/** |
|||
* 删除参与活动时间段记录 |
|||
* |
|||
* @param actUserRelationId |
|||
* @return void |
|||
* @author lc |
|||
* @since 2021/9/3 15:47 |
|||
*/ |
|||
void modifyActPeriodUserDelFlagByActUserRelationId(String actUserRelationId); |
|||
|
|||
} |
@ -0,0 +1,56 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.activity.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 活动详细时间段表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-09-02 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_act_period") |
|||
public class ActPeriodEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 活动ID |
|||
*/ |
|||
private String actId; |
|||
|
|||
/** |
|||
* 活动开始时间 |
|||
*/ |
|||
private Date actPeriodStartTime; |
|||
|
|||
/** |
|||
* 活动结束时间 |
|||
*/ |
|||
private Date actPeriodEndTime; |
|||
|
|||
} |
@ -0,0 +1,51 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.activity.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 活动详细时间段用户关系表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-09-02 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_act_period_user") |
|||
public class ActPeriodUserEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 活动详细时间段表ID |
|||
*/ |
|||
private String actPeriodId; |
|||
|
|||
/** |
|||
* 活动用户关系表ID |
|||
*/ |
|||
private String actUserRelationId; |
|||
|
|||
} |
@ -0,0 +1,115 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.activity.service; |
|||
|
|||
import com.elink.esua.epdc.activity.ActPeriodDTO; |
|||
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.modules.activity.entity.ActPeriodEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 活动详细时间段表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-09-02 |
|||
*/ |
|||
public interface ActPeriodService extends BaseService<ActPeriodEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<ActPeriodDTO> |
|||
* @author generator |
|||
* @date 2021-09-02 |
|||
*/ |
|||
PageData<ActPeriodDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<ActPeriodDTO> |
|||
* @author generator |
|||
* @date 2021-09-02 |
|||
*/ |
|||
List<ActPeriodDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return ActPeriodDTO |
|||
* @author generator |
|||
* @date 2021-09-02 |
|||
*/ |
|||
ActPeriodDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-09-02 |
|||
*/ |
|||
void save(ActPeriodDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-09-02 |
|||
*/ |
|||
void update(ActPeriodDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-09-02 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 删除活动时间段 |
|||
* |
|||
* @param actId |
|||
* @return void |
|||
* @author lc |
|||
* @since 2021/9/2 15:28 |
|||
*/ |
|||
void removeActPeriodsByActId(String actId); |
|||
|
|||
/** |
|||
* 获取活动时间段 |
|||
* |
|||
* @param actId |
|||
* @return java.util.List<com.elink.esua.epdc.activity.ActPeriodDTO> |
|||
* @author lc |
|||
* @since 2021/9/2 16:13 |
|||
*/ |
|||
List<ActPeriodDTO> listOfActPeriodsByActId(String actId); |
|||
} |
@ -0,0 +1,116 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.activity.service; |
|||
|
|||
import com.elink.esua.epdc.activity.ActPeriodDTO; |
|||
import com.elink.esua.epdc.activity.ActPeriodUserDTO; |
|||
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.modules.activity.entity.ActPeriodUserEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 活动详细时间段用户关系表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-09-02 |
|||
*/ |
|||
public interface ActPeriodUserService extends BaseService<ActPeriodUserEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<ActPeriodUserDTO> |
|||
* @author generator |
|||
* @date 2021-09-02 |
|||
*/ |
|||
PageData<ActPeriodUserDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<ActPeriodUserDTO> |
|||
* @author generator |
|||
* @date 2021-09-02 |
|||
*/ |
|||
List<ActPeriodUserDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return ActPeriodUserDTO |
|||
* @author generator |
|||
* @date 2021-09-02 |
|||
*/ |
|||
ActPeriodUserDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-09-02 |
|||
*/ |
|||
void save(ActPeriodUserDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-09-02 |
|||
*/ |
|||
void update(ActPeriodUserDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2021-09-02 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
/** |
|||
* 获取用户报名时间段 |
|||
* |
|||
* @param actUserRelationId |
|||
* @return java.util.List<com.elink.esua.epdc.activity.ActPeriodDTO> |
|||
* @author lc |
|||
* @since 2021/9/2 20:05 |
|||
*/ |
|||
List<ActPeriodDTO> listOfSignInActPeriodsByActUserRelationId(String actUserRelationId); |
|||
|
|||
/** |
|||
* 删除参与活动时间段记录 |
|||
* |
|||
* @param actUserRelationId |
|||
* @return void |
|||
* @author lc |
|||
* @since 2021/9/3 15:45 |
|||
*/ |
|||
void removeActPeriodUserByActUserRelationId(String actUserRelationId); |
|||
} |
@ -0,0 +1,117 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.activity.service.impl; |
|||
|
|||
import cn.hutool.core.collection.CollectionUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.elink.esua.epdc.activity.ActPeriodDTO; |
|||
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|||
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|||
import com.elink.esua.epdc.modules.activity.dao.ActPeriodDao; |
|||
import com.elink.esua.epdc.modules.activity.entity.ActPeriodEntity; |
|||
import com.elink.esua.epdc.modules.activity.service.ActPeriodService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 活动详细时间段表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-09-02 |
|||
*/ |
|||
@Service |
|||
public class ActPeriodServiceImpl extends BaseServiceImpl<ActPeriodDao, ActPeriodEntity> implements ActPeriodService { |
|||
|
|||
@Override |
|||
public PageData<ActPeriodDTO> page(Map<String, Object> params) { |
|||
IPage<ActPeriodEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, ActPeriodDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<ActPeriodDTO> list(Map<String, Object> params) { |
|||
List<ActPeriodEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, ActPeriodDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<ActPeriodEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<ActPeriodEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public ActPeriodDTO get(String id) { |
|||
ActPeriodEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, ActPeriodDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(ActPeriodDTO dto) { |
|||
ActPeriodEntity entity = ConvertUtils.sourceToTarget(dto, ActPeriodEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(ActPeriodDTO dto) { |
|||
ActPeriodEntity entity = ConvertUtils.sourceToTarget(dto, ActPeriodEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void removeActPeriodsByActId(String actId) { |
|||
// 校验活动是否已有人报名,有人报名后不能修改活动时间段
|
|||
List<ActPeriodDTO> periods = baseDao.selectPeriodsAlreadySignIn(actId); |
|||
if (CollectionUtil.isNotEmpty(periods)) { |
|||
throw new RenException("活动时间段已有人报名,不能修改"); |
|||
} |
|||
baseDao.modifyDelFlagByActId(actId); |
|||
} |
|||
|
|||
@Override |
|||
public List<ActPeriodDTO> listOfActPeriodsByActId(String actId) { |
|||
return baseDao.selectListOfActPeriodsByActId(actId); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,111 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.modules.activity.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.elink.esua.epdc.activity.ActPeriodDTO; |
|||
import com.elink.esua.epdc.activity.ActPeriodUserDTO; |
|||
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|||
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|||
import com.elink.esua.epdc.modules.activity.dao.ActPeriodUserDao; |
|||
import com.elink.esua.epdc.modules.activity.entity.ActPeriodUserEntity; |
|||
import com.elink.esua.epdc.modules.activity.service.ActPeriodUserService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 活动详细时间段用户关系表 |
|||
* |
|||
* @author qu qu@elink-cn.com |
|||
* @since v1.0.0 2021-09-02 |
|||
*/ |
|||
@Service |
|||
public class ActPeriodUserServiceImpl extends BaseServiceImpl<ActPeriodUserDao, ActPeriodUserEntity> implements ActPeriodUserService { |
|||
|
|||
@Override |
|||
public PageData<ActPeriodUserDTO> page(Map<String, Object> params) { |
|||
IPage<ActPeriodUserEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, ActPeriodUserDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<ActPeriodUserDTO> list(Map<String, Object> params) { |
|||
List<ActPeriodUserEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, ActPeriodUserDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<ActPeriodUserEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<ActPeriodUserEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public ActPeriodUserDTO get(String id) { |
|||
ActPeriodUserEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, ActPeriodUserDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(ActPeriodUserDTO dto) { |
|||
ActPeriodUserEntity entity = ConvertUtils.sourceToTarget(dto, ActPeriodUserEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(ActPeriodUserDTO dto) { |
|||
ActPeriodUserEntity entity = ConvertUtils.sourceToTarget(dto, ActPeriodUserEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
public List<ActPeriodDTO> listOfSignInActPeriodsByActUserRelationId(String actUserRelationId) { |
|||
return baseDao.selectListOfSignInActPeriodsByActUserRelationId(actUserRelationId); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void removeActPeriodUserByActUserRelationId(String actUserRelationId) { |
|||
baseDao.modifyActPeriodUserDelFlagByActUserRelationId(actUserRelationId); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,37 @@ |
|||
<?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.elink.esua.epdc.modules.activity.dao.ActPeriodDao"> |
|||
|
|||
<select id="selectPeriodsAlreadySignIn" resultType="com.elink.esua.epdc.activity.ActPeriodDTO"> |
|||
SELECT |
|||
p.ID |
|||
FROM |
|||
epdc_act_period p |
|||
LEFT JOIN epdc_act_period_user pu ON pu.ACT_PERIOD_ID = p.ID |
|||
WHERE |
|||
p.DEL_FLAG = '0' |
|||
AND pu.DEL_FLAG = '0' |
|||
AND ACT_ID = #{actId} |
|||
</select> |
|||
|
|||
<update id="modifyDelFlagByActId"> |
|||
update epdc_act_period set del_flag = '1' where act_id = #{actId} |
|||
</update> |
|||
|
|||
<select id="selectListOfActPeriodsByActId" resultType="com.elink.esua.epdc.activity.ActPeriodDTO"> |
|||
SELECT |
|||
ID, |
|||
ACT_ID, |
|||
ACT_PERIOD_START_TIME, |
|||
ACT_PERIOD_END_TIME |
|||
FROM |
|||
epdc_act_period |
|||
WHERE |
|||
DEL_FLAG = '0' |
|||
AND ACT_ID = #{actId} |
|||
ORDER BY |
|||
ACT_PERIOD_START_TIME |
|||
</select> |
|||
|
|||
</mapper> |
@ -0,0 +1,40 @@ |
|||
<?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.elink.esua.epdc.modules.activity.dao.ActPeriodUserDao"> |
|||
|
|||
<select id="selectListOfSignInActPeriodsByActUserRelationId" resultType="com.elink.esua.epdc.activity.ActPeriodDTO"> |
|||
SELECT |
|||
CASE |
|||
WHEN |
|||
p.ACT_PERIOD_START_TIME IS NULL THEN |
|||
t.ACT_START_TIME ELSE p.ACT_PERIOD_START_TIME |
|||
END AS actPeriodStartTime, |
|||
CASE |
|||
WHEN p.ACT_PERIOD_END_TIME IS NULL THEN |
|||
t.ACT_END_TIME ELSE p.ACT_PERIOD_END_TIME |
|||
END AS actPeriodEndTime |
|||
FROM |
|||
( |
|||
SELECT |
|||
ur.ID, |
|||
ai.ACT_START_TIME, |
|||
ai.ACT_END_TIME |
|||
FROM |
|||
epdc_act_user_relation ur |
|||
LEFT JOIN epdc_act_info ai ON ai.ID = ur.ACT_ID |
|||
WHERE |
|||
ur.ID = #{actUserRelationId} |
|||
) t |
|||
LEFT JOIN epdc_act_period_user pu ON pu.ACT_USER_RELATION_ID = t.ID |
|||
AND pu.DEL_FLAG = '0' |
|||
LEFT JOIN epdc_act_period p ON p.ID = pu.ACT_PERIOD_ID |
|||
AND p.DEL_FLAG = '0' |
|||
ORDER BY actPeriodStartTime |
|||
</select> |
|||
|
|||
<update id="modifyActPeriodUserDelFlagByActUserRelationId"> |
|||
update epdc_act_period_user set del_flag = '1' where ACT_USER_RELATION_ID = #{actUserRelationId} |
|||
</update> |
|||
|
|||
</mapper> |
Loading…
Reference in new issue