diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/UserWxFormIdDTO.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/UserWxFormIdDTO.java new file mode 100644 index 000000000..3196f77d0 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/UserWxFormIdDTO.java @@ -0,0 +1,81 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 用户标签表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-09-26 + */ +@Data +public class UserWxFormIdDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 微信openId + */ + private String wxOpenId; + + /** + * 微信formId + */ + private String wxFormId; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 删除标记 + */ + private String delFlag; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcUserWxFormIdFormDTO.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcUserWxFormIdFormDTO.java new file mode 100644 index 000000000..5f42ecc77 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcUserWxFormIdFormDTO.java @@ -0,0 +1,20 @@ +package com.elink.esua.epdc.dto.epdc.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author: qushutong + * @Date: 2019/9/26 14:14 + * @Description: 发送完消息之后删除 + */ +@Data +public class EpdcUserWxFormIdFormDTO implements Serializable { + + private static final long serialVersionUID = 1708791774502867360L; + + @NotBlank(message = "id不能为空") + private String id; +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcUserWxFormIdSaveFormDTO.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcUserWxFormIdSaveFormDTO.java new file mode 100644 index 000000000..55314caab --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcUserWxFormIdSaveFormDTO.java @@ -0,0 +1,23 @@ +package com.elink.esua.epdc.dto.epdc.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author: qushutong + * @Date: 2019/9/26 14:14 + * @Description: 保存formid + */ +@Data +public class EpdcUserWxFormIdSaveFormDTO implements Serializable { + + private static final long serialVersionUID = 5579624182759030906L; + + @NotBlank(message = "wxOpenId不能为空") + private String wxOpenId; + + @NotBlank(message = "wxFormId不能为空") + private String wxFormId; +} diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAooUserWxFormIdController.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAooUserWxFormIdController.java new file mode 100644 index 000000000..aac7074a9 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/EpdcAooUserWxFormIdController.java @@ -0,0 +1,101 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.controller; + +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.DefaultGroup; +import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; +import com.elink.esua.epdc.dto.UserWxFormIdDTO; +import com.elink.esua.epdc.dto.epdc.form.EpdcUserWxFormIdFormDTO; +import com.elink.esua.epdc.dto.epdc.form.EpdcUserWxFormIdSaveFormDTO; +import com.elink.esua.epdc.excel.UserWxFormIdExcel; +import com.elink.esua.epdc.service.UserWxFormIdService; +import org.springframework.beans.BeanUtils; +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 2019-09-26 + */ +@RestController +@RequestMapping("wxformid") +public class EpdcAooUserWxFormIdController { + + @Autowired + private UserWxFormIdService userWxFormIdService; + + + /*** + * 完成推送之后删除用过的formid + * @param dto + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author qushutong + * @date 2019/9/26 14:15 + */ + @PostMapping("deleteById") + public Result deleteById(@RequestBody EpdcUserWxFormIdFormDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + userWxFormIdService.deleteById(dto.getId()); + return new Result(); + } + + /*** + * 新增一跳 + * @param dto + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author qushutong + * @date 2019/9/26 14:25 + */ + @PostMapping("save") + public Result delete(@RequestBody EpdcUserWxFormIdSaveFormDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + UserWxFormIdDTO userWxFormIdDTO = new UserWxFormIdDTO(); + BeanUtils.copyProperties(dto, userWxFormIdDTO); + userWxFormIdService.save(userWxFormIdDTO); + return new Result(); + } + + + /*** + * 查出最新一条记录 + * @param openId + * @return com.elink.esua.epdc.commons.tools.utils.Result + * @author qushutong + * @date 2019/9/26 14:11 + */ + @GetMapping("getByOpenId/{openId}") + public Result get(@PathVariable("openId") String openId) { + UserWxFormIdDTO data = userWxFormIdService.getByOpenId(openId); + return new Result().ok(data); + } +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/UserWxFormIdController.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/UserWxFormIdController.java new file mode 100644 index 000000000..c32147de7 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/controller/UserWxFormIdController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.controller; + +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.dto.UserWxFormIdDTO; +import com.elink.esua.epdc.excel.UserWxFormIdExcel; +import com.elink.esua.epdc.service.UserWxFormIdService; +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 2019-09-26 + */ +@RestController +@RequestMapping("userwxformid") +public class UserWxFormIdController { + + @Autowired + private UserWxFormIdService userWxFormIdService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = userWxFormIdService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + UserWxFormIdDTO data = userWxFormIdService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody UserWxFormIdDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + userWxFormIdService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody UserWxFormIdDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + userWxFormIdService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + userWxFormIdService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = userWxFormIdService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, UserWxFormIdExcel.class); + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/UserWxFormIdDao.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/UserWxFormIdDao.java new file mode 100644 index 000000000..f932f2697 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/dao/UserWxFormIdDao.java @@ -0,0 +1,41 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.dao; + +import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; +import com.elink.esua.epdc.dto.UserWxFormIdDTO; +import com.elink.esua.epdc.entity.UserWxFormIdEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 用户标签表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-09-26 + */ +@Mapper +public interface UserWxFormIdDao extends BaseDao { + /*** + * 获取最新一条formid + * @param openId + * @return com.elink.esua.epdc.dto.UserWxFormIdDTO + * @author qushutong + * @date 2019/9/26 14:05 + */ + UserWxFormIdDTO getByOpenId(String openId); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/UserWxFormIdEntity.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/UserWxFormIdEntity.java new file mode 100644 index 000000000..c2b6ee468 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/entity/UserWxFormIdEntity.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.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 2019-09-26 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("epdc_user_wx_form_id") +public class UserWxFormIdEntity extends BaseEpdcEntity { + + private static final long serialVersionUID = 1L; + + /** + * 微信openId + */ + private String wxOpenId; + + /** + * 微信formId + */ + private String wxFormId; + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/UserWxFormIdExcel.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/UserWxFormIdExcel.java new file mode 100644 index 000000000..76c98bbe6 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/excel/UserWxFormIdExcel.java @@ -0,0 +1,62 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 用户标签表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-09-26 + */ +@Data +public class UserWxFormIdExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "微信openId") + private String wxOpenId; + + @Excel(name = "微信formId") + private String wxFormId; + + @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; + + @Excel(name = "删除标记") + private String delFlag; + + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/redis/UserWxFormIdRedis.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/redis/UserWxFormIdRedis.java new file mode 100644 index 000000000..5b9ef672d --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/redis/UserWxFormIdRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.redis; + +import com.elink.esua.epdc.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 用户标签表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-09-26 + */ +@Component +public class UserWxFormIdRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/UserWxFormIdService.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/UserWxFormIdService.java new file mode 100644 index 000000000..e3c1f72fb --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/UserWxFormIdService.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.service; + +import com.elink.esua.epdc.commons.mybatis.service.BaseService; +import com.elink.esua.epdc.commons.tools.page.PageData; +import com.elink.esua.epdc.dto.UserWxFormIdDTO; +import com.elink.esua.epdc.entity.UserWxFormIdEntity; + +import java.util.List; +import java.util.Map; + +/** + * 用户标签表 + * + * @author qu qu@elink-cn.com + * @since v1.0.0 2019-09-26 + */ +public interface UserWxFormIdService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2019-09-26 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2019-09-26 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return UserWxFormIdDTO + * @author generator + * @date 2019-09-26 + */ + UserWxFormIdDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2019-09-26 + */ + void save(UserWxFormIdDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2019-09-26 + */ + void update(UserWxFormIdDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2019-09-26 + */ + void delete(String[] ids); + + /*** + * 获取最新一条formid + * @param openId + * @return com.elink.esua.epdc.dto.UserWxFormIdDTO + * @author qushutong + * @date 2019/9/26 14:03 + */ + UserWxFormIdDTO getByOpenId(String openId); +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserWxFormIdServiceImpl.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserWxFormIdServiceImpl.java new file mode 100644 index 000000000..4b57ebada --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/UserWxFormIdServiceImpl.java @@ -0,0 +1,107 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.elink.esua.epdc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +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.dao.UserWxFormIdDao; +import com.elink.esua.epdc.dto.UserWxFormIdDTO; +import com.elink.esua.epdc.entity.UserWxFormIdEntity; +import com.elink.esua.epdc.redis.UserWxFormIdRedis; +import com.elink.esua.epdc.service.UserWxFormIdService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +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 2019-09-26 + */ +@Service +public class UserWxFormIdServiceImpl extends BaseServiceImpl implements UserWxFormIdService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, UserWxFormIdDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, UserWxFormIdDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public UserWxFormIdDTO get(String id) { + UserWxFormIdEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, UserWxFormIdDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(UserWxFormIdDTO dto) { + UserWxFormIdEntity entity = ConvertUtils.sourceToTarget(dto, UserWxFormIdEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(UserWxFormIdDTO dto) { + UserWxFormIdEntity entity = ConvertUtils.sourceToTarget(dto, UserWxFormIdEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public UserWxFormIdDTO getByOpenId(String openId) { + return baseDao.getByOpenId(openId); + } + +} \ No newline at end of file diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/UserWxFormIdDao.xml b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/UserWxFormIdDao.xml new file mode 100644 index 000000000..100d2f365 --- /dev/null +++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/resources/mapper/UserWxFormIdDao.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file