新增 批量添加目录下书签数量 数量可以自定义
This commit is contained in:
parent
fd61ceda4c
commit
102b94e4d1
@ -6,6 +6,7 @@ import com.ruoyi.bookmark.service.ISqBookmarkService;
|
|||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
import com.sun.org.apache.bcel.internal.generic.NEW;
|
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||||
|
import org.junit.Test;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
@ -155,6 +156,19 @@ public class SqMenuController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 批量更新书签的数量
|
||||||
|
// */
|
||||||
|
//
|
||||||
|
// @RequestMapping("/bookmarkcount")
|
||||||
|
// public void bookmarkcount()
|
||||||
|
// {
|
||||||
|
//
|
||||||
|
// Long[] menuIds={1L,2L,3L};
|
||||||
|
//
|
||||||
|
// sqMenuService.updateCountAdd(menuIds,5);
|
||||||
|
// logger.info("执行完毕");
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.ruoyi.web.test.controller;
|
package com.ruoyi.web.test.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.bookmark.mapper.SqMenuMapper;
|
||||||
|
import com.ruoyi.bookmark.service.impl.SqMenuServiceImpl;
|
||||||
import com.ruoyi.web.controller.yunbookmark.SqBookmarkController;
|
import com.ruoyi.web.controller.yunbookmark.SqBookmarkController;
|
||||||
import org.assertj.core.api.Assertions;
|
import org.assertj.core.api.Assertions;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@ -24,6 +26,8 @@ public class SqBookmarkTest extends BaseSpringBootTest{
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SqBookmarkController sqBookmarkController;
|
private SqBookmarkController sqBookmarkController;
|
||||||
|
@Autowired
|
||||||
|
private SqMenuMapper sqMenuMapper;
|
||||||
|
|
||||||
private MockMvc mockMvc;
|
private MockMvc mockMvc;
|
||||||
|
|
||||||
@ -32,14 +36,23 @@ public class SqBookmarkTest extends BaseSpringBootTest{
|
|||||||
mockMvc = MockMvcBuilders.standaloneSetup(sqBookmarkController).build();
|
mockMvc = MockMvcBuilders.standaloneSetup(sqBookmarkController).build();
|
||||||
logger.info("setup().........");
|
logger.info("setup().........");
|
||||||
}
|
}
|
||||||
|
// @Test
|
||||||
|
// public void demo() throws Exception {
|
||||||
|
// MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get("/bookmark/bookmark/2"))
|
||||||
|
// .andExpect(MockMvcResultMatchers.status().isOk())
|
||||||
|
// .andDo(MockMvcResultHandlers.print())
|
||||||
|
// .andReturn();
|
||||||
|
//
|
||||||
|
// logger.info(mvcResult.getResponse().getContentAsString());
|
||||||
|
//
|
||||||
|
// }
|
||||||
@Test
|
@Test
|
||||||
public void demo() throws Exception {
|
public void demo() throws Exception {
|
||||||
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get("/bookmark/bookmark/2"))
|
Long[] menuIds={1L,4L,6L};
|
||||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
sqMenuMapper.updateCountAdd(menuIds,5);
|
||||||
.andDo(MockMvcResultHandlers.print())
|
|
||||||
.andReturn();
|
logger.info("执行完毕");
|
||||||
|
|
||||||
logger.info(mvcResult.getResponse().getContentAsString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://localhost:3306/dqsj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://localhost:3306/dqsj?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: root
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
|
@ -77,7 +77,7 @@ public interface SqMenuMapper extends MyMapper<SqMenu>
|
|||||||
* @param menuIds
|
* @param menuIds
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateCountReduce(Long[] menuIds);
|
public int updateCountReduce(@Param("menuIds")Long[] menuIds,@Param("icount")int icount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量添加目录下书签数量 +1
|
* 批量添加目录下书签数量 +1
|
||||||
@ -85,7 +85,7 @@ public interface SqMenuMapper extends MyMapper<SqMenu>
|
|||||||
* @param menuIds +1
|
* @param menuIds +1
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateCountAdd(Long[] menuIds);
|
public int updateCountAdd(@Param("menuIds")Long[] menuIds,@Param("icount")int icount);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,20 +13,20 @@ public interface ISqMenuService
|
|||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量减少目录下书签数量 -1
|
* 批量减少目录下书签数量
|
||||||
*
|
*
|
||||||
* @param menuIds
|
* @param menuIds
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateCountReduce(Long[] menuIds);
|
public int updateCountReduce(Long[] menuIds,int icount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量添加目录下书签数量 +1
|
* 批量添加目录下书签数量
|
||||||
*
|
*
|
||||||
* @param menuIds +1
|
* @param menuIds
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateCountAdd(Long[] menuIds);
|
public int updateCountAdd(Long[] menuIds,int icount);
|
||||||
/**
|
/**
|
||||||
* @auther: Wang
|
* @auther: Wang
|
||||||
* @date: 2020/08/16 20:04
|
* @date: 2020/08/16 20:04
|
||||||
|
@ -108,24 +108,24 @@ public class SqMenuServiceImpl implements ISqMenuService
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量减少目录下书签数量 -1
|
* 批量减少目录下书签数量
|
||||||
*
|
*
|
||||||
* @param menuIds
|
* @param menuIds
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateCountReduce(Long[] menuIds){
|
public int updateCountReduce(Long[] menuIds,int icount){
|
||||||
return sqMenuMapper.updateCountReduce(menuIds);
|
return sqMenuMapper.updateCountReduce(menuIds,icount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量添加目录下书签数量 +1
|
* 批量添加目录下书签数量
|
||||||
*
|
*
|
||||||
* @param menuIds +1
|
* @param menuIds
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateCountAdd(Long[] menuIds){
|
public int updateCountAdd(Long[] menuIds,int icount){
|
||||||
return sqMenuMapper.updateCountAdd(menuIds);
|
return sqMenuMapper.updateCountAdd(menuIds,icount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,18 +92,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
|
||||||
<delete id="updateCountReduce" parameterType="String">
|
<update id="updateCountReduce" >
|
||||||
<foreach item="menuId" collection="array" separator=";" >
|
<foreach item="menuId" collection="menuIds" separator=";" >
|
||||||
update sq_menu set bookmark_count=bookmark_count-1 where menu_id = #{menuId}
|
update sq_menu set bookmark_count=bookmark_count - #{icount} where menu_id = #{menuId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
<delete id="updateCountAdd" parameterType="String">
|
<update id="updateCountAdd" >
|
||||||
<foreach item="menuId" collection="array" separator=";" >
|
<foreach item="menuId" collection="menuIds" separator=";" >
|
||||||
update sq_menu set bookmark_count=bookmark_count+1 where menu_id = #{menuId}
|
update sq_menu set bookmark_count = bookmark_count + #{icount} where menu_id = #{menuId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user