23 changed files with 1433 additions and 9 deletions
@ -0,0 +1,74 @@ |
|||||
|
/** |
||||
|
* 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; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 网格风采 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2023-07-17 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class GridStyleDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 网格风采主键 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 标题 |
||||
|
*/ |
||||
|
private String title; |
||||
|
|
||||
|
/** |
||||
|
* 内容 |
||||
|
*/ |
||||
|
private String content; |
||||
|
|
||||
|
/** |
||||
|
* 图片 |
||||
|
*/ |
||||
|
private String headerPhoto; |
||||
|
|
||||
|
/** |
||||
|
* 地址 |
||||
|
*/ |
||||
|
private String address; |
||||
|
|
||||
|
/** |
||||
|
* 时间 |
||||
|
*/ |
||||
|
private Date date; |
||||
|
|
||||
|
private String[] allDeptIds; |
||||
|
|
||||
|
private Long deptId; |
||||
|
|
||||
|
private String parentDeptNames; |
||||
|
|
||||
|
private String allDeptNames; |
||||
|
} |
@ -0,0 +1,74 @@ |
|||||
|
/** |
||||
|
* 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; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 志愿风采 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2023-07-17 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class VoluntaryStyleDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 志愿风采主键 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 标题 |
||||
|
*/ |
||||
|
private String title; |
||||
|
|
||||
|
/** |
||||
|
* 内容 |
||||
|
*/ |
||||
|
private String content; |
||||
|
|
||||
|
/** |
||||
|
* 图片 |
||||
|
*/ |
||||
|
private String headerPhoto; |
||||
|
|
||||
|
/** |
||||
|
* 地址 |
||||
|
*/ |
||||
|
private String address; |
||||
|
|
||||
|
/** |
||||
|
* 时间 |
||||
|
*/ |
||||
|
private Date date; |
||||
|
|
||||
|
private String[] allDeptIds; |
||||
|
|
||||
|
private Long deptId; |
||||
|
|
||||
|
private String parentDeptNames; |
||||
|
|
||||
|
private String allDeptNames; |
||||
|
} |
@ -0,0 +1,100 @@ |
|||||
|
/** |
||||
|
* 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.DefaultGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.elink.esua.epdc.dto.GridStyleDTO; |
||||
|
import com.elink.esua.epdc.excel.GridStyleExcel; |
||||
|
import com.elink.esua.epdc.service.GridStyleService; |
||||
|
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 elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2023-07-17 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("gridstyle") |
||||
|
public class GridStyleController { |
||||
|
|
||||
|
@Autowired |
||||
|
private GridStyleService gridStyleService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<GridStyleDTO>> page(@RequestParam Map<String, Object> params) { |
||||
|
PageData<GridStyleDTO> page = gridStyleService.page(params); |
||||
|
return new Result<PageData<GridStyleDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<GridStyleDTO> get(@PathVariable("id") String id) { |
||||
|
GridStyleDTO data = gridStyleService.get(id); |
||||
|
return new Result<GridStyleDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody GridStyleDTO dto) { |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
gridStyleService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody GridStyleDTO dto) { |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
gridStyleService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids) { |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
gridStyleService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<GridStyleDTO> list = gridStyleService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, GridStyleExcel.class); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@PostMapping("getListByDeptId") |
||||
|
public Result<List<GridStyleDTO>> getListByDeptId(@RequestBody GridStyleDTO dto) { |
||||
|
return new Result<List<GridStyleDTO>>().ok(gridStyleService.getListByDeptId(dto.getDeptId())); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,99 @@ |
|||||
|
/** |
||||
|
* 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.DefaultGroup; |
||||
|
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.elink.esua.epdc.dto.VoluntaryStyleDTO; |
||||
|
import com.elink.esua.epdc.excel.VoluntaryStyleExcel; |
||||
|
import com.elink.esua.epdc.service.VoluntaryStyleService; |
||||
|
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 elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2023-07-17 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("voluntarystyle") |
||||
|
public class VoluntaryStyleController { |
||||
|
|
||||
|
@Autowired |
||||
|
private VoluntaryStyleService voluntaryStyleService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<VoluntaryStyleDTO>> page(@RequestParam Map<String, Object> params) { |
||||
|
PageData<VoluntaryStyleDTO> page = voluntaryStyleService.page(params); |
||||
|
return new Result<PageData<VoluntaryStyleDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<VoluntaryStyleDTO> get(@PathVariable("id") String id) { |
||||
|
VoluntaryStyleDTO data = voluntaryStyleService.get(id); |
||||
|
return new Result<VoluntaryStyleDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody VoluntaryStyleDTO dto) { |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
voluntaryStyleService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody VoluntaryStyleDTO dto) { |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
voluntaryStyleService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids) { |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
voluntaryStyleService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<VoluntaryStyleDTO> list = voluntaryStyleService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, VoluntaryStyleExcel.class); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("getListByDeptId") |
||||
|
public Result<List<VoluntaryStyleDTO>> getListByDeptId(@RequestBody VoluntaryStyleDTO dto) { |
||||
|
return new Result<List<VoluntaryStyleDTO>>().ok(voluntaryStyleService.getListByDeptId(dto.getDeptId())); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
/** |
||||
|
* 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.entity.GridStyleEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 网格风采 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2023-07-17 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface GridStyleDao extends BaseDao<GridStyleEntity> { |
||||
|
|
||||
|
List<GridStyleEntity> getListByDeptId(@Param("deptId") Long deptId); |
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
/** |
||||
|
* 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.entity.VoluntaryStyleEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 志愿风采 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2023-07-17 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface VoluntaryStyleDao extends BaseDao<VoluntaryStyleEntity> { |
||||
|
|
||||
|
List<VoluntaryStyleEntity> getListByDeptId(@Param("deptId") Long deptId); |
||||
|
} |
@ -0,0 +1,67 @@ |
|||||
|
/** |
||||
|
* 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.DeptScope; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 网格风采 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2023-07-17 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@TableName("grid_style") |
||||
|
public class GridStyleEntity extends DeptScope { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 标题 |
||||
|
*/ |
||||
|
private String title; |
||||
|
|
||||
|
/** |
||||
|
* 内容 |
||||
|
*/ |
||||
|
private String content; |
||||
|
|
||||
|
/** |
||||
|
* 图片 |
||||
|
*/ |
||||
|
private String headerPhoto; |
||||
|
|
||||
|
/** |
||||
|
* 地址 |
||||
|
*/ |
||||
|
private String address; |
||||
|
|
||||
|
/** |
||||
|
* 时间 |
||||
|
*/ |
||||
|
private Date date; |
||||
|
|
||||
|
private String deptId; |
||||
|
|
||||
|
} |
@ -0,0 +1,68 @@ |
|||||
|
/** |
||||
|
* 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.DeptScope; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 志愿风采 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2023-07-17 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@TableName("voluntary_style") |
||||
|
public class VoluntaryStyleEntity extends DeptScope { |
||||
|
|
||||
|
|
||||
|
private static final long serialVersionUID = 2742920848306891141L; |
||||
|
|
||||
|
/** |
||||
|
* 标题 |
||||
|
*/ |
||||
|
private String title; |
||||
|
|
||||
|
/** |
||||
|
* 内容 |
||||
|
*/ |
||||
|
private String content; |
||||
|
|
||||
|
/** |
||||
|
* 图片 |
||||
|
*/ |
||||
|
private String headerPhoto; |
||||
|
|
||||
|
/** |
||||
|
* 地址 |
||||
|
*/ |
||||
|
private String address; |
||||
|
|
||||
|
/** |
||||
|
* 时间 |
||||
|
*/ |
||||
|
private Date date; |
||||
|
|
||||
|
private String deptId; |
||||
|
|
||||
|
} |
@ -0,0 +1,53 @@ |
|||||
|
/** |
||||
|
* 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 elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2023-07-17 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class GridStyleExcel { |
||||
|
|
||||
|
@Excel(name = "网格风采主键") |
||||
|
private String id; |
||||
|
|
||||
|
@Excel(name = "标题") |
||||
|
private String title; |
||||
|
|
||||
|
@Excel(name = "内容") |
||||
|
private String content; |
||||
|
|
||||
|
@Excel(name = "图片") |
||||
|
private String headerPhoto; |
||||
|
|
||||
|
@Excel(name = "地址") |
||||
|
private String address; |
||||
|
|
||||
|
@Excel(name = "时间") |
||||
|
private Date date; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,53 @@ |
|||||
|
/** |
||||
|
* 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 elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2023-07-17 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class VoluntaryStyleExcel { |
||||
|
|
||||
|
@Excel(name = "志愿风采主键") |
||||
|
private String id; |
||||
|
|
||||
|
@Excel(name = "标题") |
||||
|
private String title; |
||||
|
|
||||
|
@Excel(name = "内容") |
||||
|
private String content; |
||||
|
|
||||
|
@Excel(name = "图片") |
||||
|
private String headerPhoto; |
||||
|
|
||||
|
@Excel(name = "地址") |
||||
|
private String address; |
||||
|
|
||||
|
@Excel(name = "时间") |
||||
|
private Date date; |
||||
|
|
||||
|
|
||||
|
} |
@ -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 elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2023-07-17 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class GridStyleRedis { |
||||
|
@Autowired |
||||
|
private RedisUtils redisUtils; |
||||
|
|
||||
|
public void delete(Object[] ids) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void set(){ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public String get(String id){ |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
@ -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 elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2023-07-17 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class VoluntaryStyleRedis { |
||||
|
@Autowired |
||||
|
private RedisUtils redisUtils; |
||||
|
|
||||
|
public void delete(Object[] ids) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void set(){ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public String get(String id){ |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,97 @@ |
|||||
|
/** |
||||
|
* 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.GridStyleDTO; |
||||
|
import com.elink.esua.epdc.entity.GridStyleEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 网格风采 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2023-07-17 |
||||
|
*/ |
||||
|
public interface GridStyleService extends BaseService<GridStyleEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<GridStyleDTO> |
||||
|
* @author generator |
||||
|
* @date 2023-07-17 |
||||
|
*/ |
||||
|
PageData<GridStyleDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<GridStyleDTO> |
||||
|
* @author generator |
||||
|
* @date 2023-07-17 |
||||
|
*/ |
||||
|
List<GridStyleDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return GridStyleDTO |
||||
|
* @author generator |
||||
|
* @date 2023-07-17 |
||||
|
*/ |
||||
|
GridStyleDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-07-17 |
||||
|
*/ |
||||
|
void save(GridStyleDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-07-17 |
||||
|
*/ |
||||
|
void update(GridStyleDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-07-17 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
|
||||
|
List<GridStyleDTO> getListByDeptId(Long deptId); |
||||
|
} |
@ -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.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.VoluntaryStyleDTO; |
||||
|
import com.elink.esua.epdc.entity.VoluntaryStyleEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 志愿风采 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2023-07-17 |
||||
|
*/ |
||||
|
public interface VoluntaryStyleService extends BaseService<VoluntaryStyleEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<VoluntaryStyleDTO> |
||||
|
* @author generator |
||||
|
* @date 2023-07-17 |
||||
|
*/ |
||||
|
PageData<VoluntaryStyleDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<VoluntaryStyleDTO> |
||||
|
* @author generator |
||||
|
* @date 2023-07-17 |
||||
|
*/ |
||||
|
List<VoluntaryStyleDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return VoluntaryStyleDTO |
||||
|
* @author generator |
||||
|
* @date 2023-07-17 |
||||
|
*/ |
||||
|
VoluntaryStyleDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-07-17 |
||||
|
*/ |
||||
|
void save(VoluntaryStyleDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-07-17 |
||||
|
*/ |
||||
|
void update(VoluntaryStyleDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2023-07-17 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
|
||||
|
/** |
||||
|
* 根据组织ID获取志愿风采 |
||||
|
* @param deptId |
||||
|
* @return |
||||
|
*/ |
||||
|
List<VoluntaryStyleDTO> getListByDeptId(Long deptId); |
||||
|
} |
@ -0,0 +1,156 @@ |
|||||
|
/** |
||||
|
* 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.security.user.SecurityUser; |
||||
|
import com.elink.esua.epdc.commons.tools.security.user.UserDetail; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
||||
|
import com.elink.esua.epdc.dao.GridStyleDao; |
||||
|
import com.elink.esua.epdc.dto.GridStyleDTO; |
||||
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
||||
|
import com.elink.esua.epdc.entity.GridStyleEntity; |
||||
|
import com.elink.esua.epdc.service.GridStyleService; |
||||
|
import com.elink.esua.epdc.service.SysDeptService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 网格风采 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2023-07-17 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class GridStyleServiceImpl extends BaseServiceImpl<GridStyleDao, GridStyleEntity> implements GridStyleService { |
||||
|
|
||||
|
@Resource |
||||
|
private SysDeptService deptService; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<GridStyleDTO> page(Map<String, Object> params) { |
||||
|
IPage<GridStyleEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, GridStyleDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<GridStyleDTO> list(Map<String, Object> params) { |
||||
|
List<GridStyleEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, GridStyleDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<GridStyleEntity> getWrapper(Map<String, Object> params) { |
||||
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
||||
|
String title = (String) params.get("title"); |
||||
|
QueryWrapper<GridStyleEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
wrapper.like(StringUtils.isNotBlank(title), "TITLE", title); |
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public GridStyleDTO get(String id) { |
||||
|
GridStyleEntity entity = baseDao.selectById(id); |
||||
|
GridStyleDTO dto = ConvertUtils.sourceToTarget(entity, GridStyleDTO.class); |
||||
|
if (null != entity.getAllDeptIds()) { |
||||
|
dto.setAllDeptIds(entity.getAllDeptIds().split(",")); |
||||
|
dto.setDeptId(Long.valueOf(entity.getDeptId())); |
||||
|
} |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(GridStyleDTO dto) { |
||||
|
if (dto.getAllDeptIds().length == 0) { |
||||
|
setDeptId(dto); |
||||
|
} |
||||
|
GridStyleEntity entity = ConvertUtils.sourceToTarget(dto, GridStyleEntity.class); |
||||
|
biuldDept(dto, entity); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(GridStyleDTO dto) { |
||||
|
GridStyleEntity entity = ConvertUtils.sourceToTarget(dto, GridStyleEntity.class); |
||||
|
biuldDept(dto, entity); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<GridStyleDTO> getListByDeptId(Long deptId) { |
||||
|
if (null != deptId) { |
||||
|
List<GridStyleEntity> entities = baseDao.getListByDeptId(deptId); |
||||
|
return ConvertUtils.sourceToTarget(entities, GridStyleDTO.class); |
||||
|
} else |
||||
|
return new ArrayList<>(); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
private void setDeptId(GridStyleDTO dto) { |
||||
|
UserDetail user = SecurityUser.getUser(); |
||||
|
String deptId = String.valueOf(user.getDeptId()); |
||||
|
dto.setDeptId(user.getDeptId()); |
||||
|
dto.setAllDeptIds(new String[]{deptId}); |
||||
|
} |
||||
|
|
||||
|
private void biuldDept(GridStyleDTO dto, GridStyleEntity entity) { |
||||
|
ParentAndAllDeptDTO parentResult; |
||||
|
String deptId = ""; |
||||
|
if (dto.getAllDeptIds() != null && dto.getAllDeptIds().length > 1) { |
||||
|
deptId = dto.getAllDeptIds()[dto.getAllDeptIds().length - 1]; |
||||
|
entity.setDeptId(deptId); |
||||
|
parentResult = deptService.getParentAndAllDept(deptId); |
||||
|
} else { |
||||
|
parentResult = deptService.getParentAndAllDept(deptId); |
||||
|
} |
||||
|
if (null == parentResult) { |
||||
|
throw new RenException("获取部门信息失败"); |
||||
|
} else { |
||||
|
entity.setAllDeptIds(parentResult.getAllDeptIds()); |
||||
|
entity.setAllDeptNames(parentResult.getAllDeptNames()); |
||||
|
entity.setParentDeptIds(parentResult.getParentDeptIds()); |
||||
|
entity.setParentDeptNames(parentResult.getParentDeptNames()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,156 @@ |
|||||
|
/** |
||||
|
* 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.security.user.SecurityUser; |
||||
|
import com.elink.esua.epdc.commons.tools.security.user.UserDetail; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
||||
|
import com.elink.esua.epdc.dao.VoluntaryStyleDao; |
||||
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
||||
|
import com.elink.esua.epdc.dto.VoluntaryStyleDTO; |
||||
|
import com.elink.esua.epdc.entity.VoluntaryStyleEntity; |
||||
|
import com.elink.esua.epdc.service.SysDeptService; |
||||
|
import com.elink.esua.epdc.service.VoluntaryStyleService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 志愿风采 |
||||
|
* |
||||
|
* @author elink elink@elink-cn.com |
||||
|
* @since v1.0.0 2023-07-17 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class VoluntaryStyleServiceImpl extends BaseServiceImpl<VoluntaryStyleDao, VoluntaryStyleEntity> implements VoluntaryStyleService { |
||||
|
|
||||
|
@Resource |
||||
|
private SysDeptService deptService; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<VoluntaryStyleDTO> page(Map<String, Object> params) { |
||||
|
IPage<VoluntaryStyleEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, VoluntaryStyleDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<VoluntaryStyleDTO> list(Map<String, Object> params) { |
||||
|
List<VoluntaryStyleEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, VoluntaryStyleDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<VoluntaryStyleEntity> getWrapper(Map<String, Object> params) { |
||||
|
String id = (String) params.get(FieldConstant.ID_HUMP); |
||||
|
String title = (String) params.get("title"); |
||||
|
QueryWrapper<VoluntaryStyleEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
wrapper.like(StringUtils.isNotBlank(title), "TITLE", title); |
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public VoluntaryStyleDTO get(String id) { |
||||
|
VoluntaryStyleEntity entity = baseDao.selectById(id); |
||||
|
VoluntaryStyleDTO dto = ConvertUtils.sourceToTarget(entity, VoluntaryStyleDTO.class); |
||||
|
if (null != entity.getAllDeptIds()) { |
||||
|
dto.setAllDeptIds(entity.getAllDeptIds().split(",")); |
||||
|
dto.setDeptId(Long.valueOf(entity.getDeptId())); |
||||
|
} |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(VoluntaryStyleDTO dto) { |
||||
|
if (dto.getAllDeptIds().length == 0) { |
||||
|
setDeptId(dto); |
||||
|
} |
||||
|
VoluntaryStyleEntity entity = ConvertUtils.sourceToTarget(dto, VoluntaryStyleEntity.class); |
||||
|
biuldDept(dto, entity); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(VoluntaryStyleDTO dto) { |
||||
|
VoluntaryStyleEntity entity = ConvertUtils.sourceToTarget(dto, VoluntaryStyleEntity.class); |
||||
|
biuldDept(dto, entity); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<VoluntaryStyleDTO> getListByDeptId(Long deptId) { |
||||
|
if (null != deptId) { |
||||
|
List<VoluntaryStyleEntity> entities = baseDao.getListByDeptId(deptId); |
||||
|
return ConvertUtils.sourceToTarget(entities, VoluntaryStyleDTO.class); |
||||
|
} else |
||||
|
return new ArrayList<>(); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
private void setDeptId(VoluntaryStyleDTO dto) { |
||||
|
UserDetail user = SecurityUser.getUser(); |
||||
|
String deptId = String.valueOf(user.getDeptId()); |
||||
|
dto.setDeptId(user.getDeptId()); |
||||
|
dto.setAllDeptIds(new String[]{deptId}); |
||||
|
} |
||||
|
|
||||
|
private void biuldDept(VoluntaryStyleDTO dto, VoluntaryStyleEntity entity) { |
||||
|
ParentAndAllDeptDTO parentResult; |
||||
|
String deptId = ""; |
||||
|
if (dto.getAllDeptIds() != null && dto.getAllDeptIds().length > 1) { |
||||
|
deptId = dto.getAllDeptIds()[dto.getAllDeptIds().length - 1]; |
||||
|
entity.setDeptId(deptId); |
||||
|
parentResult = deptService.getParentAndAllDept(deptId); |
||||
|
} else { |
||||
|
parentResult = deptService.getParentAndAllDept(deptId); |
||||
|
} |
||||
|
if (null == parentResult) { |
||||
|
throw new RenException("获取部门信息失败"); |
||||
|
} else { |
||||
|
entity.setAllDeptIds(parentResult.getAllDeptIds()); |
||||
|
entity.setAllDeptNames(parentResult.getAllDeptNames()); |
||||
|
entity.setParentDeptIds(parentResult.getParentDeptIds()); |
||||
|
entity.setParentDeptNames(parentResult.getParentDeptNames()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
<?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.GridStyleDao"> |
||||
|
|
||||
|
<resultMap type="com.elink.esua.epdc.entity.GridStyleEntity" id="gridStyleMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="title" column="TITLE"/> |
||||
|
<result property="content" column="CONTENT"/> |
||||
|
<result property="headerPhoto" column="HEADER_PHOTO"/> |
||||
|
<result property="address" column="ADDRESS"/> |
||||
|
<result property="date" column="DATE"/> |
||||
|
<result property="deptId" column="DEPT_ID"/> |
||||
|
<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"/> |
||||
|
<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> |
||||
|
|
||||
|
<select id="getListByDeptId" resultType="com.elink.esua.epdc.entity.GridStyleEntity"> |
||||
|
select |
||||
|
gs.ID, |
||||
|
gs.TITLE, |
||||
|
gs.CONTENT, |
||||
|
gs.HEADER_PHOTO, |
||||
|
gs.ADDRESS, |
||||
|
gs.DATE, |
||||
|
gs.DEPT_ID, |
||||
|
gs.ALL_DEPT_IDS, |
||||
|
gs.ALL_DEPT_NAMES, |
||||
|
gs.PARENT_DEPT_IDS, |
||||
|
gs.PARENT_DEPT_NAMES |
||||
|
from grid_style gs |
||||
|
where gs.DEL_FLAG = 0 and gs.DEPT_ID = #{deptId} |
||||
|
</select> |
||||
|
|
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,42 @@ |
|||||
|
<?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.VoluntaryStyleDao"> |
||||
|
|
||||
|
<resultMap type="com.elink.esua.epdc.entity.VoluntaryStyleEntity" id="voluntaryStyleMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="title" column="TITLE"/> |
||||
|
<result property="content" column="CONTENT"/> |
||||
|
<result property="headerPhoto" column="HEADER_PHOTO"/> |
||||
|
<result property="address" column="ADDRESS"/> |
||||
|
<result property="date" column="DATE"/> |
||||
|
<result property="deptId" column="DEPT_ID"/> |
||||
|
<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"/> |
||||
|
<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> |
||||
|
<select id="getListByDeptId" resultType="com.elink.esua.epdc.entity.VoluntaryStyleEntity"> |
||||
|
select |
||||
|
vs.ID, |
||||
|
vs.TITLE, |
||||
|
vs.CONTENT, |
||||
|
vs.HEADER_PHOTO, |
||||
|
vs.ADDRESS, |
||||
|
vs.DATE, |
||||
|
vs.DEPT_ID, |
||||
|
vs.ALL_DEPT_IDS, |
||||
|
vs.ALL_DEPT_NAMES, |
||||
|
vs.PARENT_DEPT_IDS, |
||||
|
vs.PARENT_DEPT_NAMES |
||||
|
from voluntary_style vs |
||||
|
where vs.DEL_FLAG = 0 and vs.DEPT_ID = #{deptId} |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue