9 changed files with 855 additions and 0 deletions
@ -0,0 +1,177 @@ |
|||
/** |
|||
* 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.dto.item; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* 项目表 项目表 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-04 |
|||
*/ |
|||
@Data |
|||
public class ItemDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* ID |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 事件ID |
|||
*/ |
|||
private String eventId; |
|||
|
|||
/** |
|||
* 议题ID |
|||
*/ |
|||
private String issueId; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 用户昵称 |
|||
*/ |
|||
private String nickName; |
|||
|
|||
/** |
|||
* 用户头像 |
|||
*/ |
|||
private String userFace; |
|||
|
|||
/** |
|||
* 议题内容 |
|||
*/ |
|||
private String issueContent; |
|||
|
|||
/** |
|||
* 区 |
|||
*/ |
|||
private String area; |
|||
|
|||
/** |
|||
* 区ID |
|||
*/ |
|||
private String areaId; |
|||
|
|||
/** |
|||
* 街道 |
|||
*/ |
|||
private String street; |
|||
|
|||
/** |
|||
* 街道ID |
|||
*/ |
|||
private String streetId; |
|||
|
|||
/** |
|||
* 社区 |
|||
*/ |
|||
private String community; |
|||
|
|||
/** |
|||
* 社区ID |
|||
*/ |
|||
private String communityId; |
|||
|
|||
/** |
|||
* 网格 |
|||
*/ |
|||
private String grid; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 议题位置地址 |
|||
*/ |
|||
private String issueAddress; |
|||
|
|||
/** |
|||
* 议题分类ID |
|||
*/ |
|||
private String issueCategoryId; |
|||
|
|||
/** |
|||
* 议题位置纬度 |
|||
*/ |
|||
private BigDecimal issusLatitude; |
|||
|
|||
/** |
|||
* 议题位置经度 |
|||
*/ |
|||
private BigDecimal issueLongitude; |
|||
|
|||
/** |
|||
* 友邻社区ID |
|||
*/ |
|||
private String friendlyCommunityId; |
|||
|
|||
/** |
|||
* 评价打分 |
|||
*/ |
|||
private Integer issueScore; |
|||
|
|||
/** |
|||
* 项目状态 0-待网格长处理,5-待社区处理,10-待街道党建办处理,15-待街道处理,20-待区直部门党建办处理,25-待区直部门处理,30-处理,35-关闭,40-结束议题 |
|||
*/ |
|||
private Integer itemState; |
|||
|
|||
/** |
|||
* 删除标识 0:未删除,1:已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,94 @@ |
|||
/** |
|||
* 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.item.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.item.ItemDTO; |
|||
import com.elink.esua.epdc.modules.item.excel.ItemExcel; |
|||
import com.elink.esua.epdc.modules.item.service.ItemService; |
|||
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 yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-04 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("item") |
|||
public class ItemController { |
|||
|
|||
@Autowired |
|||
private ItemService itemService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<ItemDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<ItemDTO> page = itemService.page(params); |
|||
return new Result<PageData<ItemDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<ItemDTO> get(@PathVariable("id") String id){ |
|||
ItemDTO data = itemService.get(id); |
|||
return new Result<ItemDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody ItemDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
itemService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody ItemDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
itemService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
itemService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<ItemDTO> list = itemService.list(params); |
|||
ExcelUtils.exportExcelToTarget(response, null, list, ItemExcel.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
/** |
|||
* 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.item.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.modules.item.entity.ItemEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 项目表 项目表 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-04 |
|||
*/ |
|||
@Mapper |
|||
public interface ItemDao extends BaseDao<ItemEntity> { |
|||
|
|||
} |
@ -0,0 +1,147 @@ |
|||
/** |
|||
* 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.item.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 项目表 项目表 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-04 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_item") |
|||
public class ItemEntity extends BaseEpdcEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 事件ID |
|||
*/ |
|||
private String eventId; |
|||
|
|||
/** |
|||
* 议题ID |
|||
*/ |
|||
private String issueId; |
|||
|
|||
/** |
|||
* 用户ID |
|||
*/ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 用户昵称 |
|||
*/ |
|||
private String nickName; |
|||
|
|||
/** |
|||
* 用户头像 |
|||
*/ |
|||
private String userFace; |
|||
|
|||
/** |
|||
* 议题内容 |
|||
*/ |
|||
private String issueContent; |
|||
|
|||
/** |
|||
* 区 |
|||
*/ |
|||
private String area; |
|||
|
|||
/** |
|||
* 区ID |
|||
*/ |
|||
private String areaId; |
|||
|
|||
/** |
|||
* 街道 |
|||
*/ |
|||
private String street; |
|||
|
|||
/** |
|||
* 街道ID |
|||
*/ |
|||
private String streetId; |
|||
|
|||
/** |
|||
* 社区 |
|||
*/ |
|||
private String community; |
|||
|
|||
/** |
|||
* 社区ID |
|||
*/ |
|||
private String communityId; |
|||
|
|||
/** |
|||
* 网格 |
|||
*/ |
|||
private String grid; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 议题位置地址 |
|||
*/ |
|||
private String issueAddress; |
|||
|
|||
/** |
|||
* 议题分类ID |
|||
*/ |
|||
private String issueCategoryId; |
|||
|
|||
/** |
|||
* 议题位置纬度 |
|||
*/ |
|||
private BigDecimal issusLatitude; |
|||
|
|||
/** |
|||
* 议题位置经度 |
|||
*/ |
|||
private BigDecimal issueLongitude; |
|||
|
|||
/** |
|||
* 友邻社区ID |
|||
*/ |
|||
private String friendlyCommunityId; |
|||
|
|||
/** |
|||
* 评价打分 |
|||
*/ |
|||
private Integer issueScore; |
|||
|
|||
/** |
|||
* 项目状态 0-待网格长处理,5-待社区处理,10-待街道党建办处理,15-待街道处理,20-待区直部门党建办处理,25-待区直部门处理,30-处理,35-关闭,40-结束议题 |
|||
*/ |
|||
private Integer itemState; |
|||
|
|||
} |
@ -0,0 +1,120 @@ |
|||
/** |
|||
* 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.item.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 项目表 项目表 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-04 |
|||
*/ |
|||
@Data |
|||
public class ItemExcel { |
|||
|
|||
@Excel(name = "ID") |
|||
private String id; |
|||
|
|||
@Excel(name = "事件ID") |
|||
private String eventId; |
|||
|
|||
@Excel(name = "议题ID") |
|||
private String issueId; |
|||
|
|||
@Excel(name = "用户ID") |
|||
private String userId; |
|||
|
|||
@Excel(name = "用户昵称") |
|||
private String nickName; |
|||
|
|||
@Excel(name = "用户头像") |
|||
private String userFace; |
|||
|
|||
@Excel(name = "议题内容") |
|||
private String issueContent; |
|||
|
|||
@Excel(name = "区") |
|||
private String area; |
|||
|
|||
@Excel(name = "区ID") |
|||
private String areaId; |
|||
|
|||
@Excel(name = "街道") |
|||
private String street; |
|||
|
|||
@Excel(name = "街道ID") |
|||
private String streetId; |
|||
|
|||
@Excel(name = "社区") |
|||
private String community; |
|||
|
|||
@Excel(name = "社区ID") |
|||
private String communityId; |
|||
|
|||
@Excel(name = "网格") |
|||
private String grid; |
|||
|
|||
@Excel(name = "网格ID") |
|||
private String gridId; |
|||
|
|||
@Excel(name = "议题位置地址") |
|||
private String issueAddress; |
|||
|
|||
@Excel(name = "议题分类ID") |
|||
private String issueCategoryId; |
|||
|
|||
@Excel(name = "议题位置纬度") |
|||
private BigDecimal issusLatitude; |
|||
|
|||
@Excel(name = "议题位置经度") |
|||
private BigDecimal issueLongitude; |
|||
|
|||
@Excel(name = "友邻社区ID") |
|||
private String friendlyCommunityId; |
|||
|
|||
@Excel(name = "评价打分") |
|||
private Integer issueScore; |
|||
|
|||
@Excel(name = "项目状态 0-待网格长处理,5-待社区处理,10-待街道党建办处理,15-待街道处理,20-待区直部门党建办处理,25-待区直部门处理,30-处理,35-关闭,40-结束议题") |
|||
private Integer itemState; |
|||
|
|||
@Excel(name = "删除标识 0:未删除,1:已删除") |
|||
private String 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,47 @@ |
|||
/** |
|||
* 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.item.redis; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 项目表 项目表 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-04 |
|||
*/ |
|||
@Component |
|||
public class ItemRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,95 @@ |
|||
/** |
|||
* 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.item.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.item.ItemDTO; |
|||
import com.elink.esua.epdc.modules.item.entity.ItemEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 项目表 项目表 |
|||
* |
|||
* @author yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-04 |
|||
*/ |
|||
public interface ItemService extends BaseService<ItemEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<ItemDTO> |
|||
* @author |
|||
* @date |
|||
*/ |
|||
PageData<ItemDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<ItemDTO> |
|||
* @author |
|||
* @date |
|||
*/ |
|||
List<ItemDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return ItemDTO |
|||
* @author |
|||
* @date |
|||
*/ |
|||
ItemDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author |
|||
* @date |
|||
*/ |
|||
void save(ItemDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author |
|||
* @date |
|||
*/ |
|||
void update(ItemDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author |
|||
* @date |
|||
*/ |
|||
void delete(String[] ids); |
|||
} |
@ -0,0 +1,104 @@ |
|||
/** |
|||
* 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.item.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.constant.FieldConstant; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|||
import com.elink.esua.epdc.dto.item.ItemDTO; |
|||
import com.elink.esua.epdc.modules.item.dao.ItemDao; |
|||
import com.elink.esua.epdc.modules.item.entity.ItemEntity; |
|||
import com.elink.esua.epdc.modules.item.redis.ItemRedis; |
|||
import com.elink.esua.epdc.modules.item.service.ItemService; |
|||
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 yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-04 |
|||
*/ |
|||
@Service |
|||
public class ItemServiceImpl extends BaseServiceImpl<ItemDao, ItemEntity> implements ItemService { |
|||
|
|||
@Autowired |
|||
private ItemRedis itemRedis; |
|||
|
|||
@Override |
|||
public PageData<ItemDTO> page(Map<String, Object> params) { |
|||
IPage<ItemEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, ItemDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<ItemDTO> list(Map<String, Object> params) { |
|||
List<ItemEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, ItemDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<ItemEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<ItemEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public ItemDTO get(String id) { |
|||
ItemEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, ItemDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(ItemDTO dto) { |
|||
ItemEntity entity = ConvertUtils.sourceToTarget(dto, ItemEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(ItemDTO dto) { |
|||
ItemEntity entity = ConvertUtils.sourceToTarget(dto, ItemEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,38 @@ |
|||
<?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.item.dao.ItemDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.modules.item.entity.ItemEntity" id="itemMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="eventId" column="EVENT_ID"/> |
|||
<result property="issueId" column="ISSUE_ID"/> |
|||
<result property="userId" column="USER_ID"/> |
|||
<result property="nickName" column="NICK_NAME"/> |
|||
<result property="userFace" column="USER_FACE"/> |
|||
<result property="issueContent" column="ISSUE_CONTENT"/> |
|||
<result property="area" column="AREA"/> |
|||
<result property="areaId" column="AREA_ID"/> |
|||
<result property="street" column="STREET"/> |
|||
<result property="streetId" column="STREET_ID"/> |
|||
<result property="community" column="COMMUNITY"/> |
|||
<result property="communityId" column="COMMUNITY_ID"/> |
|||
<result property="grid" column="GRID"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="issueAddress" column="ISSUE_ADDRESS"/> |
|||
<result property="issueCategoryId" column="ISSUE_CATEGORY_ID"/> |
|||
<result property="issusLatitude" column="ISSUS_LATITUDE"/> |
|||
<result property="issueLongitude" column="ISSUE_LONGITUDE"/> |
|||
<result property="friendlyCommunityId" column="FRIENDLY_COMMUNITY_ID"/> |
|||
<result property="issueScore" column="ISSUE_SCORE"/> |
|||
<result property="itemState" column="ITEM_STATE"/> |
|||
<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> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue