12 changed files with 700 additions and 0 deletions
@ -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.project.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.project.PropertyProjectDTO; |
||||
|
import com.elink.esua.epdc.modules.project.excel.PropertyProjectExcel; |
||||
|
import com.elink.esua.epdc.modules.project.service.PropertyProjectService; |
||||
|
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 zhangyuan qu@elink-cn.com |
||||
|
* @since v1.0.0 2020-05-09 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("propertyproject") |
||||
|
public class PropertyProjectController { |
||||
|
|
||||
|
@Autowired |
||||
|
private PropertyProjectService propertyProjectService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<PropertyProjectDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<PropertyProjectDTO> page = propertyProjectService.page(params); |
||||
|
return new Result<PageData<PropertyProjectDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<PropertyProjectDTO> get(@PathVariable("id") String id){ |
||||
|
PropertyProjectDTO data = propertyProjectService.get(id); |
||||
|
return new Result<PropertyProjectDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody PropertyProjectDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
propertyProjectService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody PropertyProjectDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
propertyProjectService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
propertyProjectService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<PropertyProjectDTO> list = propertyProjectService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, PropertyProjectExcel.class); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,46 @@ |
|||||
|
/** |
||||
|
* 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.project.dao; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
||||
|
import com.elink.esua.epdc.dto.group.GroupManagementDTO; |
||||
|
import com.elink.esua.epdc.modules.project.entity.PropertyProjectEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 物业项目表 |
||||
|
* |
||||
|
* @author zhangyuan qu@elink-cn.com |
||||
|
* @since v1.0.0 2020-05-09 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface PropertyProjectDao extends BaseDao<PropertyProjectEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 项目列表 |
||||
|
* |
||||
|
* @return java.util.List<com.elink.esua.epdc.dto.group.GroupDTO> |
||||
|
* @params [params] |
||||
|
* @author zhangyuan |
||||
|
* @since 2019/10/11 14:54 |
||||
|
*/ |
||||
|
List<PropertyProjectEntity> selectListOfGroups(Map<String, Object> params); |
||||
|
} |
||||
@ -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.project.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 物业项目表 |
||||
|
* |
||||
|
* @author zhangyuan qu@elink-cn.com |
||||
|
* @since v1.0.0 2020-05-09 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("epdc_property_project") |
||||
|
public class PropertyProjectEntity extends BaseEpdcEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 网格ID |
||||
|
*/ |
||||
|
private String gridId; |
||||
|
|
||||
|
/** |
||||
|
* 网格名称 |
||||
|
*/ |
||||
|
private String grid; |
||||
|
|
||||
|
/** |
||||
|
* 物业项目名称 |
||||
|
*/ |
||||
|
private String projectName; |
||||
|
|
||||
|
/** |
||||
|
* 物业名称 |
||||
|
*/ |
||||
|
private String propertyName; |
||||
|
|
||||
|
/** |
||||
|
* 物业电话 |
||||
|
*/ |
||||
|
private String propertyTel; |
||||
|
|
||||
|
/** |
||||
|
* 物业负责人 |
||||
|
*/ |
||||
|
private String propertyManager; |
||||
|
|
||||
|
/** |
||||
|
* 物业地址 |
||||
|
*/ |
||||
|
private String propertyAddress; |
||||
|
|
||||
|
/** |
||||
|
* 父所有部门 |
||||
|
*/ |
||||
|
private String parentDeptIds; |
||||
|
|
||||
|
/** |
||||
|
* 父所有部门 |
||||
|
*/ |
||||
|
private String parentDeptNames; |
||||
|
|
||||
|
/** |
||||
|
* 所有部门ID |
||||
|
*/ |
||||
|
private String allDeptIds; |
||||
|
|
||||
|
/** |
||||
|
* 所有部门名称 |
||||
|
*/ |
||||
|
private String allDeptNames; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,89 @@ |
|||||
|
/** |
||||
|
* 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.project.excel; |
||||
|
|
||||
|
import cn.afterturn.easypoi.excel.annotation.Excel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 物业项目表 |
||||
|
* |
||||
|
* @author zhangyuan qu@elink-cn.com |
||||
|
* @since v1.0.0 2020-05-09 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PropertyProjectExcel { |
||||
|
|
||||
|
@Excel(name = "主键") |
||||
|
private String id; |
||||
|
|
||||
|
@Excel(name = "网格ID") |
||||
|
private String gridId; |
||||
|
|
||||
|
@Excel(name = "网格名称") |
||||
|
private String grid; |
||||
|
|
||||
|
@Excel(name = "物业项目名称") |
||||
|
private String projectName; |
||||
|
|
||||
|
@Excel(name = "物业名称") |
||||
|
private String propertyName; |
||||
|
|
||||
|
@Excel(name = "物业电话") |
||||
|
private String propertyTel; |
||||
|
|
||||
|
@Excel(name = "物业负责人") |
||||
|
private String propertyManager; |
||||
|
|
||||
|
@Excel(name = "物业地址") |
||||
|
private String propertyAddress; |
||||
|
|
||||
|
@Excel(name = "乐观锁") |
||||
|
private Integer revision; |
||||
|
|
||||
|
@Excel(name = "删除标记(0-否,1-是)") |
||||
|
private String delFlag; |
||||
|
|
||||
|
@Excel(name = "创建人") |
||||
|
private String createdBy; |
||||
|
|
||||
|
@Excel(name = "创建时间") |
||||
|
private Date createdTime; |
||||
|
|
||||
|
@Excel(name = "更新人") |
||||
|
private String updatedBy; |
||||
|
|
||||
|
@Excel(name = "更新时间") |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
@Excel(name = "父所有部门") |
||||
|
private String parentDeptIds; |
||||
|
|
||||
|
@Excel(name = "父所有部门") |
||||
|
private String parentDeptNames; |
||||
|
|
||||
|
@Excel(name = "所有部门ID") |
||||
|
private String allDeptIds; |
||||
|
|
||||
|
@Excel(name = "所有部门名称") |
||||
|
private String allDeptNames; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -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.project.redis; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* 物业项目表 |
||||
|
* |
||||
|
* @author zhangyuan qu@elink-cn.com |
||||
|
* @since v1.0.0 2020-05-09 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class PropertyProjectRedis { |
||||
|
@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.project.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.project.PropertyProjectDTO; |
||||
|
import com.elink.esua.epdc.modules.project.entity.PropertyProjectEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 物业项目表 |
||||
|
* |
||||
|
* @author zhangyuan qu@elink-cn.com |
||||
|
* @since v1.0.0 2020-05-09 |
||||
|
*/ |
||||
|
public interface PropertyProjectService extends BaseService<PropertyProjectEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<PropertyProjectDTO> |
||||
|
* @author generator |
||||
|
* @date 2020-05-09 |
||||
|
*/ |
||||
|
PageData<PropertyProjectDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<PropertyProjectDTO> |
||||
|
* @author generator |
||||
|
* @date 2020-05-09 |
||||
|
*/ |
||||
|
List<PropertyProjectDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return PropertyProjectDTO |
||||
|
* @author generator |
||||
|
* @date 2020-05-09 |
||||
|
*/ |
||||
|
PropertyProjectDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-05-09 |
||||
|
*/ |
||||
|
void save(PropertyProjectDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-05-09 |
||||
|
*/ |
||||
|
void update(PropertyProjectDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-05-09 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
} |
||||
@ -0,0 +1,154 @@ |
|||||
|
/** |
||||
|
* 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.project.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.modules.group.dao.GroupDao; |
||||
|
import com.elink.esua.epdc.modules.group.entity.GroupEntity; |
||||
|
import com.elink.esua.epdc.modules.project.dao.PropertyProjectDao; |
||||
|
import com.elink.esua.epdc.dto.project.PropertyProjectDTO; |
||||
|
import com.elink.esua.epdc.modules.project.entity.PropertyProjectEntity; |
||||
|
import com.elink.esua.epdc.modules.project.redis.PropertyProjectRedis; |
||||
|
import com.elink.esua.epdc.modules.project.service.PropertyProjectService; |
||||
|
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 javax.annotation.Resource; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 物业项目表 |
||||
|
* |
||||
|
* @author zhangyuan qu@elink-cn.com |
||||
|
* @since v1.0.0 2020-05-09 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class PropertyProjectServiceImpl extends BaseServiceImpl<PropertyProjectDao, PropertyProjectEntity> implements PropertyProjectService { |
||||
|
|
||||
|
@Autowired |
||||
|
private PropertyProjectRedis propertyProjectRedis; |
||||
|
|
||||
|
@Resource |
||||
|
private GroupDao groupDao; |
||||
|
|
||||
|
private final String avatarUrl = "https://epdc-yushan.elinkservice.cn/files-pro/20200512/e58074e631c5413692623b63fd51f580.png"; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<PropertyProjectDTO> page(Map<String, Object> params) { |
||||
|
IPage<PropertyProjectEntity> page = getPage(params); |
||||
|
List<PropertyProjectEntity> entityList = baseDao.selectListOfGroups(params); |
||||
|
List<PropertyProjectDTO> list = ConvertUtils.sourceToTarget(entityList, PropertyProjectDTO.class); |
||||
|
return new PageData<>(list, page.getTotal()); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<PropertyProjectDTO> list(Map<String, Object> params) { |
||||
|
List<PropertyProjectEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, PropertyProjectDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<PropertyProjectEntity> getWrapper(Map<String, Object> params) { |
||||
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<PropertyProjectEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public PropertyProjectDTO get(String id) { |
||||
|
PropertyProjectEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, PropertyProjectDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(PropertyProjectDTO dto) { |
||||
|
PropertyProjectEntity entity = ConvertUtils.sourceToTarget(dto, PropertyProjectEntity.class); |
||||
|
entity = gridInfo(entity); |
||||
|
entity.setDelFlag("0"); |
||||
|
baseDao.insert(entity); |
||||
|
|
||||
|
// 创建物业项目的同时创建群
|
||||
|
GroupEntity groupEntity = new GroupEntity(); |
||||
|
groupEntity.setPropertyProjectId(entity.getId()); |
||||
|
groupEntity.setGroupAvatar(avatarUrl); |
||||
|
groupEntity.setGroupName(entity.getProjectName() + "群"); |
||||
|
groupEntity.setGroupCategory("2"); |
||||
|
groupEntity.setGrid(entity.getGrid()); |
||||
|
groupEntity.setGridId(Long.parseLong(entity.getGridId())); |
||||
|
groupEntity.setDelFlag("0"); |
||||
|
groupEntity.setCreatedBy(entity.getCreatedBy()); |
||||
|
groupEntity.setCreatedTime(entity.getCreatedTime()); |
||||
|
groupEntity.setAllDeptIds(entity.getAllDeptIds()); |
||||
|
groupEntity.setAllDeptNames(entity.getAllDeptNames()); |
||||
|
groupEntity.setParentDeptIds(entity.getParentDeptIds()); |
||||
|
groupEntity.setParentDeptNames(entity.getParentDeptNames()); |
||||
|
groupDao.insert(groupEntity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(PropertyProjectDTO dto) { |
||||
|
PropertyProjectEntity entity = ConvertUtils.sourceToTarget(dto, PropertyProjectEntity.class); |
||||
|
entity = gridInfo(entity); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
groupDao.deleteGroupByProjectIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 处理级联选择器的网格信息 |
||||
|
* |
||||
|
* @param entity |
||||
|
* @return |
||||
|
*/ |
||||
|
private PropertyProjectEntity gridInfo(PropertyProjectEntity entity) { |
||||
|
String[] deptIds = entity.getAllDeptIds().trim().replaceAll("]", "").replaceAll("\\[", "").replaceAll("\"", "").replaceAll("'", "").split(","); |
||||
|
String[] deptNames = entity.getAllDeptNames().trim().split("/"); |
||||
|
String[] parentDeptIds = Arrays.copyOf(deptIds, deptIds.length - 1); |
||||
|
String[] parentDeptNames = Arrays.copyOf(deptNames, deptNames.length - 1); |
||||
|
|
||||
|
if (deptIds.length > 0 && deptNames.length > 0) { |
||||
|
entity.setGridId(deptIds[0]); |
||||
|
entity.setGrid(deptNames[0]); |
||||
|
entity.setAllDeptIds(StringUtils.join(deptIds, ",")); |
||||
|
entity.setAllDeptNames(StringUtils.join(deptNames, "-")); |
||||
|
entity.setParentDeptIds(StringUtils.join(parentDeptIds, ",")); |
||||
|
entity.setParentDeptNames(StringUtils.join(parentDeptNames, "-")); |
||||
|
} |
||||
|
return entity; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,53 @@ |
|||||
|
<?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.project.dao.PropertyProjectDao"> |
||||
|
|
||||
|
<resultMap type="com.elink.esua.epdc.modules.project.entity.PropertyProjectEntity" id="propertyProjectMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="gridId" column="GRID_ID"/> |
||||
|
<result property="grid" column="GRID"/> |
||||
|
<result property="projectName" column="PROJECT_NAME"/> |
||||
|
<result property="propertyName" column="PROPERTY_NAME"/> |
||||
|
<result property="propertyTel" column="PROPERTY_TEL"/> |
||||
|
<result property="propertyManager" column="PROPERTY_MANAGER"/> |
||||
|
<result property="propertyAddress" column="PROPERTY_ADDRESS"/> |
||||
|
<result property="revision" column="REVISION"/> |
||||
|
<result property="delFlag" column="DEL_FLAG"/> |
||||
|
<result property="createdBy" column="CREATED_BY"/> |
||||
|
<result property="createdTime" column="CREATED_TIME"/> |
||||
|
<result property="updatedBy" column="UPDATED_BY"/> |
||||
|
<result property="updatedTime" column="UPDATED_TIME"/> |
||||
|
<result property="parentDeptIds" column="PARENT_DEPT_IDS"/> |
||||
|
<result property="parentDeptNames" column="PARENT_DEPT_NAMES"/> |
||||
|
<result property="allDeptIds" column="ALL_DEPT_IDS"/> |
||||
|
<result property="allDeptNames" column="ALL_DEPT_NAMES"/> |
||||
|
</resultMap> |
||||
|
<sql id="Base_Column_List"> |
||||
|
<!-- |
||||
|
WARNING - @mbg.generated |
||||
|
This element is automatically generated by MyBatis Generator, do not modify. |
||||
|
This element was generated on Tue Dec 10 11:23:20 CST 2019. |
||||
|
--> |
||||
|
ID, GRID_ID, GRID, PROJECT_NAME, PROPERTY_NAME, PROPERTY_TEL, PROPERTY_MANAGER, PROPERTY_ADDRESS, |
||||
|
SORT, REVISION, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, PARENT_DEPT_IDS, |
||||
|
PARENT_DEPT_NAMES, ALL_DEPT_IDS, ALL_DEPT_NAMES |
||||
|
</sql> |
||||
|
<select id="selectListOfGroups" resultType="com.elink.esua.epdc.modules.project.entity.PropertyProjectEntity"> |
||||
|
SELECT |
||||
|
<include refid="Base_Column_List" /> |
||||
|
FROM |
||||
|
epdc_property_project |
||||
|
WHERE |
||||
|
DEL_FLAG = '0' |
||||
|
<if test="projectName != null and projectName != ''"> |
||||
|
AND PROJECT_NAME like CONCAT( '%', #{projectName}, '%' ) |
||||
|
</if> |
||||
|
<if test="gridId != null and gridId != ''"> |
||||
|
AND (GRID_ID = #{gridId} |
||||
|
OR find_in_set(#{gridId},ALL_DEPT_IDS)) |
||||
|
</if> |
||||
|
ORDER BY |
||||
|
CREATED_TIME DESC |
||||
|
</select> |
||||
|
</mapper> |
||||
Loading…
Reference in new issue