| | |
| | | @ApiImplicitParam(name = "ids", value = "ID数组", dataType = "Integer", paramType = "query", allowMultiple = true, example = "1") |
| | | }) |
| | | @GetMapping(value = "/deletes") |
| | | public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) { |
| | | public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids, HttpServletRequest req) { |
| | | try { |
| | | if (ids == null || ids.isEmpty()) { |
| | | return fail("id数组不能为空", -1); |
| | | } |
| | | |
| | | int count = publishService.deletes(StringHelper.join(ids, ",")); |
| | | int count = publishService.deletes(ids, req); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | public PublishEntity selectById(int id); |
| | | |
| | | /** |
| | | * 根据ID字符串查询 |
| | | * |
| | | * @param ids ID字符串 |
| | | * @return 记录集合 |
| | | */ |
| | | public List<PublishEntity> selectByIds(String ids); |
| | | |
| | | /** |
| | | * 插入一条 |
| | | * |
| | | * @param entity |
| | |
| | | import com.lf.server.helper.RestHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.mapper.data.PublishMapper; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Autowired |
| | | PublishMapper publishMapper; |
| | | |
| | | @Autowired |
| | | FmeService fmeService; |
| | | |
| | | private final static Log log = LogFactory.getLog(PublishService.class); |
| | | |
| | | @Override |
| | | public Integer selectCount(String name) { |
| | |
| | | @Override |
| | | public PublishEntity selectById(int id) { |
| | | return publishMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<PublishEntity> selectByIds(String ids) { |
| | | return publishMapper.selectByIds(ids); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | return map; |
| | | } |
| | | |
| | | /** |
| | | * 删除多条 |
| | | */ |
| | | public Integer deletes(List<Integer> idList, HttpServletRequest req) { |
| | | String ids = StringHelper.join(idList, ","); |
| | | |
| | | deleteRes(ids, req); |
| | | |
| | | return deletes(ids); |
| | | } |
| | | |
| | | /** |
| | | * 删除资源 |
| | | */ |
| | | private void deleteRes(String ids, HttpServletRequest req) { |
| | | List<PublishEntity> list = selectByIds(ids); |
| | | if (null == list || list.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | for (PublishEntity entity : list) { |
| | | try { |
| | | fmeService.deleteRes(entity.getRegid(), req); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <select id="selectByIds" resultType="com.lf.server.entity.data.PublishEntity"> |
| | | select * from lf.sys_publish where id in (${ids}); |
| | | </select> |
| | | |
| | | <insert id="insert" parameterType="com.lf.server.entity.data.PublishEntity"> |
| | | insert into lf.sys_publish |
| | | (regid,name,url,path,type,status,dirid,depid,min,max,json,create_user,create_time,geom,bak) |