8 changed files with 652 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.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.ScreenDeptInfoDTO; |
||||
|
import com.elink.esua.epdc.excel.ScreenDeptInfoExcel; |
||||
|
import com.elink.esua.epdc.service.ScreenDeptInfoService; |
||||
|
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-08-03 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("screendeptinfo") |
||||
|
public class ScreenDeptInfoController { |
||||
|
|
||||
|
@Autowired |
||||
|
private ScreenDeptInfoService screenDeptInfoService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<ScreenDeptInfoDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<ScreenDeptInfoDTO> page = screenDeptInfoService.page(params); |
||||
|
return new Result<PageData<ScreenDeptInfoDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<ScreenDeptInfoDTO> get(@PathVariable("id") String id){ |
||||
|
ScreenDeptInfoDTO data = screenDeptInfoService.get(id); |
||||
|
return new Result<ScreenDeptInfoDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody ScreenDeptInfoDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
screenDeptInfoService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody ScreenDeptInfoDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
screenDeptInfoService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
screenDeptInfoService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<ScreenDeptInfoDTO> list = screenDeptInfoService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, ScreenDeptInfoExcel.class); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,55 @@ |
|||||
|
/** |
||||
|
* 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.dao; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
||||
|
import com.elink.esua.epdc.dto.ScreenDeptInfoDTO; |
||||
|
import com.elink.esua.epdc.entity.ScreenDeptInfoEntity; |
||||
|
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-08-03 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface ScreenDeptInfoDao extends BaseDao<ScreenDeptInfoEntity> { |
||||
|
/** |
||||
|
* 功能描述: 列表信息查询 |
||||
|
* |
||||
|
* @param: Map<String, Object> |
||||
|
* @return: List<ScreenDeptInfoEntity> |
||||
|
* @author: zhy |
||||
|
* @date: 2020/8/4 10:01 |
||||
|
*/ |
||||
|
List<ScreenDeptInfoEntity> selectListOfScreenDeptInfo(Map<String, Object> params); |
||||
|
/** |
||||
|
* 功能描述: 基本信息查询 |
||||
|
* |
||||
|
* @param: ScreenDeptInfoDTO |
||||
|
* @return: ScreenDeptInfoEntity |
||||
|
* @author: zhy |
||||
|
* @date: 2020/8/4 10:01 |
||||
|
*/ |
||||
|
ScreenDeptInfoEntity selectByDept(ScreenDeptInfoDTO dto); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,102 @@ |
|||||
|
/** |
||||
|
* 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.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 网格小程序码 |
||||
|
* |
||||
|
* @author zhangyuan qu@elink-cn.com |
||||
|
* @since v1.0.0 2020-08-03 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("epdc_screen_dept_info") |
||||
|
public class ScreenDeptInfoEntity extends BaseEpdcEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 网格ID |
||||
|
*/ |
||||
|
private Long deptId; |
||||
|
|
||||
|
/** |
||||
|
* 小程序码URL |
||||
|
*/ |
||||
|
private String deptName; |
||||
|
|
||||
|
/** |
||||
|
* 排序,正序 |
||||
|
*/ |
||||
|
private Integer sort; |
||||
|
|
||||
|
/** |
||||
|
* 小区数 |
||||
|
*/ |
||||
|
private Integer villageNum; |
||||
|
|
||||
|
/** |
||||
|
* 楼栋数 |
||||
|
*/ |
||||
|
private Integer buildingNum; |
||||
|
|
||||
|
/** |
||||
|
* 楼长数 |
||||
|
*/ |
||||
|
private Integer houseMasterNum; |
||||
|
|
||||
|
/** |
||||
|
* 重点关注人员数 |
||||
|
*/ |
||||
|
private Integer focusGroupsNum; |
||||
|
|
||||
|
/** |
||||
|
* 人口数 |
||||
|
*/ |
||||
|
private Integer personNum; |
||||
|
|
||||
|
/** |
||||
|
* 实有党员数 |
||||
|
*/ |
||||
|
private Integer partyNum; |
||||
|
|
||||
|
/** |
||||
|
* 网格长 |
||||
|
*/ |
||||
|
private String gridMaster; |
||||
|
|
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String remark; |
||||
|
|
||||
|
/** |
||||
|
* 拓展信息 |
||||
|
*/ |
||||
|
private String extend; |
||||
|
|
||||
|
} |
||||
@ -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.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-08-03 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ScreenDeptInfoExcel { |
||||
|
|
||||
|
@Excel(name = "主键") |
||||
|
private String id; |
||||
|
|
||||
|
@Excel(name = "网格ID") |
||||
|
private Long deptId; |
||||
|
|
||||
|
@Excel(name = "小程序码URL") |
||||
|
private String deptName; |
||||
|
|
||||
|
@Excel(name = "排序,正序") |
||||
|
private Integer sort; |
||||
|
|
||||
|
@Excel(name = "小区数") |
||||
|
private Integer villageNum; |
||||
|
|
||||
|
@Excel(name = "楼栋数") |
||||
|
private Integer buildingNum; |
||||
|
|
||||
|
@Excel(name = "楼长数") |
||||
|
private Integer houseMasterNum; |
||||
|
|
||||
|
@Excel(name = "重点关注人员数") |
||||
|
private Integer focusGroupsNum; |
||||
|
|
||||
|
@Excel(name = "人口数") |
||||
|
private Integer personNum; |
||||
|
|
||||
|
@Excel(name = "实有党员数") |
||||
|
private Integer partyNum; |
||||
|
|
||||
|
@Excel(name = "网格长") |
||||
|
private String gridMaster; |
||||
|
|
||||
|
@Excel(name = "创建时间") |
||||
|
private Date createdTime; |
||||
|
|
||||
|
@Excel(name = "更新人") |
||||
|
private String updatedBy; |
||||
|
|
||||
|
@Excel(name = "更新时间") |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
@Excel(name = "删除标记") |
||||
|
private String delFlag; |
||||
|
|
||||
|
@Excel(name = "备注") |
||||
|
private String remark; |
||||
|
|
||||
|
@Excel(name = "拓展信息") |
||||
|
private String extend; |
||||
|
|
||||
|
@Excel(name = "创建人") |
||||
|
private String createdBy; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -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.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-08-03 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class ScreenDeptInfoRedis { |
||||
|
@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.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.ScreenDeptInfoDTO; |
||||
|
import com.elink.esua.epdc.entity.ScreenDeptInfoEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 网格小程序码 |
||||
|
* |
||||
|
* @author zhangyuan qu@elink-cn.com |
||||
|
* @since v1.0.0 2020-08-03 |
||||
|
*/ |
||||
|
public interface ScreenDeptInfoService extends BaseService<ScreenDeptInfoEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<ScreenDeptInfoDTO> |
||||
|
* @author generator |
||||
|
* @date 2020-08-03 |
||||
|
*/ |
||||
|
PageData<ScreenDeptInfoDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<ScreenDeptInfoDTO> |
||||
|
* @author generator |
||||
|
* @date 2020-08-03 |
||||
|
*/ |
||||
|
List<ScreenDeptInfoDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return ScreenDeptInfoDTO |
||||
|
* @author generator |
||||
|
* @date 2020-08-03 |
||||
|
*/ |
||||
|
ScreenDeptInfoDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-08-03 |
||||
|
*/ |
||||
|
void save(ScreenDeptInfoDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-08-03 |
||||
|
*/ |
||||
|
void update(ScreenDeptInfoDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-08-03 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
} |
||||
@ -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.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.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.dao.ScreenDeptInfoDao; |
||||
|
import com.elink.esua.epdc.dto.ScreenDeptInfoDTO; |
||||
|
import com.elink.esua.epdc.entity.ScreenDeptInfoEntity; |
||||
|
import com.elink.esua.epdc.redis.ScreenDeptInfoRedis; |
||||
|
import com.elink.esua.epdc.service.ScreenDeptInfoService; |
||||
|
import com.elink.esua.epdc.service.SysDeptService; |
||||
|
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 zhangyuan qu@elink-cn.com |
||||
|
* @since v1.0.0 2020-08-03 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class ScreenDeptInfoServiceImpl extends BaseServiceImpl<ScreenDeptInfoDao, ScreenDeptInfoEntity> implements ScreenDeptInfoService { |
||||
|
|
||||
|
@Autowired |
||||
|
private ScreenDeptInfoRedis screenDeptInfoRedis; |
||||
|
|
||||
|
@Autowired |
||||
|
private SysDeptService sysDeptService; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<ScreenDeptInfoDTO> page(Map<String, Object> params) { |
||||
|
IPage<ScreenDeptInfoEntity> page = getPage(params); |
||||
|
if (params.containsKey("deptId") && StringUtils.isNotBlank(params.get("deptId").toString())) { |
||||
|
params.put("deptList", sysDeptService.getSubDeptIdList(Long.parseLong(params.get("deptId").toString()))); |
||||
|
} |
||||
|
List<ScreenDeptInfoEntity> entityList = baseDao.selectListOfScreenDeptInfo(params); |
||||
|
List<ScreenDeptInfoDTO> list = ConvertUtils.sourceToTarget(entityList, ScreenDeptInfoDTO.class); |
||||
|
return new PageData<>(list, page.getTotal()); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<ScreenDeptInfoDTO> list(Map<String, Object> params) { |
||||
|
List<ScreenDeptInfoEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, ScreenDeptInfoDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<ScreenDeptInfoEntity> getWrapper(Map<String, Object> params) { |
||||
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<ScreenDeptInfoEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ScreenDeptInfoDTO get(String id) { |
||||
|
ScreenDeptInfoEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, ScreenDeptInfoDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(ScreenDeptInfoDTO dto) { |
||||
|
ScreenDeptInfoEntity screenDeptInfo = baseDao.selectByDept(dto); |
||||
|
if (screenDeptInfo != null) { |
||||
|
throw new RenException("该机构数据已经存在"); |
||||
|
} |
||||
|
ScreenDeptInfoEntity entity = ConvertUtils.sourceToTarget(dto, ScreenDeptInfoEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(ScreenDeptInfoDTO dto) { |
||||
|
ScreenDeptInfoEntity entity = ConvertUtils.sourceToTarget(dto, ScreenDeptInfoEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,55 @@ |
|||||
|
<?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.dao.ScreenDeptInfoDao"> |
||||
|
|
||||
|
<resultMap type="com.elink.esua.epdc.entity.ScreenDeptInfoEntity" id="screenDeptInfoMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="deptId" column="DEPT_ID"/> |
||||
|
<result property="deptName" column="DEPT_NAME"/> |
||||
|
<result property="sort" column="sort"/> |
||||
|
<result property="villageNum" column="village_num"/> |
||||
|
<result property="buildingNum" column="building_num"/> |
||||
|
<result property="houseMasterNum" column="house_master_num"/> |
||||
|
<result property="focusGroupsNum" column="focus_groups_num"/> |
||||
|
<result property="personNum" column="person_num"/> |
||||
|
<result property="partyNum" column="party_num"/> |
||||
|
<result property="gridMaster" column="grid_master"/> |
||||
|
<result property="createdTime" column="CREATED_TIME"/> |
||||
|
<result property="updatedBy" column="UPDATED_BY"/> |
||||
|
<result property="updatedTime" column="UPDATED_TIME"/> |
||||
|
<result property="delFlag" column="DEL_FLAG"/> |
||||
|
<result property="remark" column="remark"/> |
||||
|
<result property="extend" column="extend"/> |
||||
|
<result property="createdBy" column="CREATED_BY"/> |
||||
|
</resultMap> |
||||
|
<sql id="Base_Column_List"> |
||||
|
ID,DEPT_ID,DEPT_NAME,sort,village_num,building_num,house_master_num, |
||||
|
focus_groups_num,person_num,party_num,grid_master, |
||||
|
CREATED_BY,CREATED_TIME,UPDATED_BY,UPDATED_TIME,DEL_FLAG,remark,extend |
||||
|
</sql> |
||||
|
<select id="selectListOfScreenDeptInfo" resultType="com.elink.esua.epdc.entity.ScreenDeptInfoEntity"> |
||||
|
SELECT |
||||
|
<include refid="Base_Column_List"/> |
||||
|
FROM |
||||
|
epdc_screen_dept_info sdi |
||||
|
WHERE |
||||
|
DEL_FLAG = '0' |
||||
|
<if test="deptId != null and deptId != ''"> |
||||
|
AND DEPT_ID IN |
||||
|
<foreach collection="deptList" item="gridId" open="(" separator="," close=")">#{gridId}</foreach> |
||||
|
</if> |
||||
|
ORDER BY sort, CREATED_TIME DESC |
||||
|
</select> |
||||
|
<select id="selectByDept" resultType="com.elink.esua.epdc.entity.ScreenDeptInfoEntity"> |
||||
|
SELECT |
||||
|
<include refid="Base_Column_List"/> |
||||
|
FROM |
||||
|
epdc_screen_dept_info sdi |
||||
|
WHERE |
||||
|
DEL_FLAG = '0' |
||||
|
<if test="deptId != null and deptId != ''"> |
||||
|
AND DEPT_ID = #{deptId} |
||||
|
</if> |
||||
|
</select> |
||||
|
</mapper> |
||||
Loading…
Reference in new issue