新增 批量添加目录下书签数量 数量可以自定义
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.model.LoginUser;
|
||||
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||
import org.junit.Test;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
|
||||
|
||||
import com.ruoyi.bookmark.mapper.SqMenuMapper;
|
||||
import com.ruoyi.bookmark.service.impl.SqMenuServiceImpl;
|
||||
import com.ruoyi.web.controller.yunbookmark.SqBookmarkController;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.Before;
|
||||
@ -24,6 +26,8 @@ public class SqBookmarkTest extends BaseSpringBootTest{
|
||||
|
||||
@Autowired
|
||||
private SqBookmarkController sqBookmarkController;
|
||||
@Autowired
|
||||
private SqMenuMapper sqMenuMapper;
|
||||
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@ -32,14 +36,23 @@ public class SqBookmarkTest extends BaseSpringBootTest{
|
||||
mockMvc = MockMvcBuilders.standaloneSetup(sqBookmarkController).build();
|
||||
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
|
||||
public void demo() throws Exception {
|
||||
MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get("/bookmark/bookmark/2"))
|
||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||
.andDo(MockMvcResultHandlers.print())
|
||||
.andReturn();
|
||||
Long[] menuIds={1L,4L,6L};
|
||||
sqMenuMapper.updateCountAdd(menuIds,5);
|
||||
|
||||
logger.info("执行完毕");
|
||||
|
||||
logger.info(mvcResult.getResponse().getContentAsString());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,16 +6,16 @@ spring:
|
||||
druid:
|
||||
# 主库数据源
|
||||
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
|
||||
password: root
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
@ -35,7 +35,7 @@ spring:
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
@ -43,8 +43,8 @@ spring:
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username:
|
||||
login-password:
|
||||
login-username:
|
||||
login-password:
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
@ -54,4 +54,4 @@ spring:
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
multi-statement-allow: true
|
||||
|
@ -77,7 +77,7 @@ public interface SqMenuMapper extends MyMapper<SqMenu>
|
||||
* @param menuIds
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCountReduce(Long[] menuIds);
|
||||
public int updateCountReduce(@Param("menuIds")Long[] menuIds,@Param("icount")int icount);
|
||||
|
||||
/**
|
||||
* 批量添加目录下书签数量 +1
|
||||
@ -85,7 +85,7 @@ public interface SqMenuMapper extends MyMapper<SqMenu>
|
||||
* @param menuIds +1
|
||||
* @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
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCountReduce(Long[] menuIds);
|
||||
public int updateCountReduce(Long[] menuIds,int icount);
|
||||
|
||||
/**
|
||||
* 批量添加目录下书签数量 +1
|
||||
* 批量添加目录下书签数量
|
||||
*
|
||||
* @param menuIds +1
|
||||
* @param menuIds
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCountAdd(Long[] menuIds);
|
||||
public int updateCountAdd(Long[] menuIds,int icount);
|
||||
/**
|
||||
* @auther: Wang
|
||||
* @date: 2020/08/16 20:04
|
||||
|
@ -108,24 +108,24 @@ public class SqMenuServiceImpl implements ISqMenuService
|
||||
|
||||
|
||||
/**
|
||||
* 批量减少目录下书签数量 -1
|
||||
* 批量减少目录下书签数量
|
||||
*
|
||||
* @param menuIds
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCountReduce(Long[] menuIds){
|
||||
return sqMenuMapper.updateCountReduce(menuIds);
|
||||
public int updateCountReduce(Long[] menuIds,int icount){
|
||||
return sqMenuMapper.updateCountReduce(menuIds,icount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量添加目录下书签数量 +1
|
||||
* 批量添加目录下书签数量
|
||||
*
|
||||
* @param menuIds +1
|
||||
* @param menuIds
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCountAdd(Long[] menuIds){
|
||||
return sqMenuMapper.updateCountAdd(menuIds);
|
||||
public int updateCountAdd(Long[] menuIds,int icount){
|
||||
return sqMenuMapper.updateCountAdd(menuIds,icount);
|
||||
}
|
||||
}
|
||||
|
@ -92,18 +92,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
|
||||
<delete id="updateCountReduce" parameterType="String">
|
||||
<foreach item="menuId" collection="array" separator=";" >
|
||||
update sq_menu set bookmark_count=bookmark_count-1 where menu_id = #{menuId}
|
||||
<update id="updateCountReduce" >
|
||||
<foreach item="menuId" collection="menuIds" separator=";" >
|
||||
update sq_menu set bookmark_count=bookmark_count - #{icount} where menu_id = #{menuId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="updateCountAdd" parameterType="String">
|
||||
<foreach item="menuId" collection="array" separator=";" >
|
||||
update sq_menu set bookmark_count=bookmark_count+1 where menu_id = #{menuId}
|
||||
<update id="updateCountAdd" >
|
||||
<foreach item="menuId" collection="menuIds" separator=";" >
|
||||
update sq_menu set bookmark_count = bookmark_count + #{icount} where menu_id = #{menuId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
Loading…
x
Reference in New Issue
Block a user