新增样本批量删除

This commit is contained in:
沈健
2021-04-12 14:21:25 +08:00
parent 9f61c8e2ec
commit 560bde3f78
10 changed files with 122 additions and 17 deletions
@@ -12,6 +12,7 @@ import com.fangjia.service.mongo.fangjia.SeawaterService;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang.StringUtils;
import org.sothis.core.util.Pager;
import org.sothis.web.mvc.annotation.Param;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
@@ -116,6 +117,14 @@ public class SeawaterController {
return ret;
}
public Object batchDeleteAction(@Param(name="ids") String ids) throws UnsupportedEncodingException {
JsonModel ret = new JsonModel();
if (StringUtils.isNotBlank(ids)){
seawaterService.deleteByIds(ids);
}
return ret;
}
public void setSeawaterService(SeawaterService seawaterService) {
this.seawaterService = seawaterService;
}
@@ -118,9 +118,13 @@
</td>
</tr>
</table>
<span style="font-size:12px;">查询到<b style="color:red;">${pager.totalRows!}</b>条记录</span>
<div>
<span style="font-size:12px;">查询到<b style="color:red;">${pager.totalRows!}</b>条记录</span>
<input class ="btn btn-primary" id="batchDelete" type="submit" value="批量删除" style="float: right" />
</div>
<table id="dataSheet" class="table table-hover table-condensed" name="reginTable">
<tr>
<th style="width:30px;"><input type="checkbox" id="checkAll"/>全选</th>
<th style="width:60px;">类型</th>
<th style="width:50px;">区域</th>
<th style="width:130px;">小区名</th>
@@ -142,6 +146,7 @@
<#if seawaterList??>
<#list seawaterList as it>
<tr>
<td><input type="checkbox" name="houseCheck" value="${it.id}"/></td>
<td>
<#if it.category! == 'sell'>
二手房
@@ -249,7 +254,7 @@
}
});
}
changeCity('${cityDisplay!}');
$(".hrefClick").click(function(){
@@ -336,8 +341,48 @@
$("#roomSpan").hide();
}
}
// 全选
$("#checkAll").click(function(){
$('input[name="houseCheck"]').each(function() {
var _this = this
if (_this.checked == true) {
_this.checked = false
} else {
_this.checked = true
}
})
})
$("#batchDelete").click(function(){
if(confirm('确认要删除所选的数据吗?')) {
var ids = "";
$('input:checkbox[name=houseCheck]:checked').each(function() {
var _this = $(this);
ids += _this.val() + ","
});
if (ids == "") {
alert("请选择数据")
return false;
}
jQuery.ajax({
type: 'POST',
url: '../seawater/batchDelete',
data:{ids:ids},
dataType: 'json',
timeout: 100000,
success: function(model) {
alert("批量删除操作成功");
location.reload();
},
error : function() {
//alert("操作失败");
}
});
}
});
</script>
</html>
</#compress>