去除分页插件

This commit is contained in:
季圣华
2020-04-19 15:26:14 +08:00
parent 60234752f2
commit a4895d955a
15 changed files with 84 additions and 215 deletions

View File

@@ -563,7 +563,7 @@
var remark = $.trim($("#searchRemark").val()); var remark = $.trim($("#searchRemark").val());
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/depot/getDepotList", url: "/depot/list",
dataType: "json", dataType: "json",
data: ({ data: ({
search: JSON.stringify({ search: JSON.stringify({

View File

@@ -488,7 +488,7 @@
var loginName = $.trim($("#searchLoginName").val()); var loginName = $.trim($("#searchLoginName").val());
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/user/getUserList", url: "/user/list",
dataType: "json", dataType: "json",
data: ({ data: ({
search: JSON.stringify({ search: JSON.stringify({

View File

@@ -108,11 +108,6 @@
<version>1.7.25</version> <version>1.7.25</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.10</version>
</dependency>
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId> <artifactId>mybatis-plus-boot-starter</artifactId>

View File

@@ -1,11 +1,7 @@
package com.jsh.erp.controller; package com.jsh.erp.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.Depot; import com.jsh.erp.datasource.entities.Depot;
@@ -149,54 +145,8 @@ public class DepotController {
} }
return arr; return arr;
} }
/** /**
* create by: cjl
* description:
* 查询仓库列表信息
* create time: 2019/2/25 14:32
* @Param: pageSize
 * @Param: currentPage
 * @Param: search
* @return java.lang.String
*/
@RequestMapping(value = "/getDepotList")
public String getDepotList(
@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
@RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage,
@RequestParam(value = Constants.SEARCH, required = false) String search) throws Exception{
Map<String, Object> parameterMap = new HashMap<String, Object>();
//查询参数
JSONObject obj=JSON.parseObject(search);
Set<String> key= obj.keySet();
for(String keyEach: key){
parameterMap.put(keyEach,obj.getString(keyEach));
}
PageQueryInfo queryInfo = new PageQueryInfo();
Map<String, Object> objectMap = new HashMap<String, Object>();
if (pageSize == null || pageSize <= 0) {
pageSize = BusinessConstants.DEFAULT_PAGINATION_PAGE_SIZE;
}
if (currentPage == null || currentPage <= 0) {
currentPage = BusinessConstants.DEFAULT_PAGINATION_PAGE_NUMBER;
}
PageHelper.startPage(currentPage,pageSize,true);
List<DepotEx> list = depotService.getDepotList(parameterMap);
//获取分页查询后的数据
PageInfo<DepotEx> pageInfo = new PageInfo<>(list);
objectMap.put("page", queryInfo);
if (list == null) {
queryInfo.setRows(new ArrayList<Object>());
queryInfo.setTotal(BusinessConstants.DEFAULT_LIST_NULL_NUMBER);
return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code);
}
queryInfo.setRows(list);
queryInfo.setTotal(pageInfo.getTotal());
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn
* description:
* 批量删除仓库信息 * 批量删除仓库信息
* create time: 2019/3/29 11:15 * create time: 2019/3/29 11:15
* @Param: ids * @Param: ids

View File

@@ -3,8 +3,6 @@ package com.jsh.erp.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.DepotEx; import com.jsh.erp.datasource.entities.DepotEx;
@@ -403,16 +401,8 @@ public class MaterialController {
} }
PageQueryInfo queryInfo = new PageQueryInfo(); PageQueryInfo queryInfo = new PageQueryInfo();
Map<String, Object> objectMap = new HashMap<String, Object>(); Map<String, Object> objectMap = new HashMap<String, Object>();
if (pageSize == null || pageSize <= 0) {
pageSize = BusinessConstants.DEFAULT_PAGINATION_PAGE_SIZE;
}
if (currentPage == null || currentPage <= 0) {
currentPage = BusinessConstants.DEFAULT_PAGINATION_PAGE_NUMBER;
}
PageHelper.startPage(currentPage,pageSize,true);
List<Material> list = materialService.getMaterialEnableSerialNumberList(parameterMap); List<Material> list = materialService.getMaterialEnableSerialNumberList(parameterMap);
//获取分页查询后的数据 Long count = materialService.getMaterialEnableSerialNumberCount(parameterMap);
PageInfo<Material> pageInfo = new PageInfo<>(list);
objectMap.put("page", queryInfo); objectMap.put("page", queryInfo);
if (list == null) { if (list == null) {
queryInfo.setRows(new ArrayList<Object>()); queryInfo.setRows(new ArrayList<Object>());
@@ -420,7 +410,7 @@ public class MaterialController {
return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code); return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code);
} }
queryInfo.setRows(list); queryInfo.setRows(list);
queryInfo.setTotal(pageInfo.getTotal()); queryInfo.setTotal(count);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code); return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} }
/** /**

View File

@@ -3,8 +3,6 @@ package com.jsh.erp.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.Tenant; import com.jsh.erp.datasource.entities.Tenant;
@@ -258,50 +256,6 @@ public class UserController {
} }
return res; return res;
} }
/**
* create by: cjl
* description:
* 查询分页用户列表
* create time: 2019/3/8 15:08
* @Param: pageSize
 * @Param: currentPage
 * @Param: search
* @return java.lang.String
*/
@GetMapping(value = "/getUserList")
public String getUserList(@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
@RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage,
@RequestParam(value = Constants.SEARCH, required = false) String search)throws Exception {
Map<String, Object> parameterMap = new HashMap<String, Object>();
//查询参数
JSONObject obj= JSON.parseObject(search);
Set<String> key= obj.keySet();
for(String keyEach: key){
parameterMap.put(keyEach,obj.getString(keyEach));
}
PageQueryInfo queryInfo = new PageQueryInfo();
Map<String, Object> objectMap = new HashMap<String, Object>();
if (pageSize == null || pageSize <= 0) {
pageSize = BusinessConstants.DEFAULT_PAGINATION_PAGE_SIZE;
}
if (currentPage == null || currentPage <= 0) {
currentPage = BusinessConstants.DEFAULT_PAGINATION_PAGE_NUMBER;
}
PageHelper.startPage(currentPage,pageSize,true);
List<UserEx> list = userService.getUserList(parameterMap);
//获取分页查询后的数据
PageInfo<UserEx> pageInfo = new PageInfo<>(list);
objectMap.put("page", queryInfo);
if (list == null) {
queryInfo.setRows(new ArrayList<Object>());
queryInfo.setTotal(BusinessConstants.DEFAULT_LIST_NULL_NUMBER);
return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code);
}
queryInfo.setRows(list);
queryInfo.setTotal(pageInfo.getTotal());
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/** /**
* create by: cjl * create by: cjl

View File

@@ -11,7 +11,7 @@ import java.util.Map;
public interface DepotMapperEx { public interface DepotMapperEx {
List<Depot> selectByConditionDepot( List<DepotEx> selectByConditionDepot(
@Param("name") String name, @Param("name") String name,
@Param("type") Integer type, @Param("type") Integer type,
@Param("remark") String remark, @Param("remark") String remark,
@@ -23,7 +23,5 @@ public interface DepotMapperEx {
@Param("type") Integer type, @Param("type") Integer type,
@Param("remark") String remark); @Param("remark") String remark);
List<DepotEx> getDepotList(Map<String, Object> params);
int batchDeleteDepotByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]); int batchDeleteDepotByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
} }

View File

@@ -64,6 +64,8 @@ public interface MaterialMapperEx {
* */ * */
List<Material> getMaterialEnableSerialNumberList(Map<String, Object> parameterMap); List<Material> getMaterialEnableSerialNumberList(Map<String, Object> parameterMap);
Long getMaterialEnableSerialNumberCount(Map<String, Object> parameterMap);
int batchDeleteMaterialByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]); int batchDeleteMaterialByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
List<Material> getMaterialListByCategoryIds(@Param("categoryIds") String[] categoryIds); List<Material> getMaterialListByCategoryIds(@Param("categoryIds") String[] categoryIds);

View File

@@ -13,7 +13,7 @@ import java.util.Map;
public interface UserMapperEx { public interface UserMapperEx {
List<User> selectByConditionUser( List<UserEx> selectByConditionUser(
@Param("userName") String userName, @Param("userName") String userName,
@Param("loginName") String loginName, @Param("loginName") String loginName,
@Param("offset") Integer offset, @Param("offset") Integer offset,
@@ -23,8 +23,6 @@ public interface UserMapperEx {
@Param("userName") String userName, @Param("userName") String userName,
@Param("loginName") String loginName); @Param("loginName") String loginName);
List<UserEx> getUserList(Map<String, Object> parameterMap);
List<User> getUserListByUserNameOrLoginName(@Param("userName") String userName, List<User> getUserListByUserNameOrLoginName(@Param("userName") String userName,
@Param("loginName") String loginName); @Param("loginName") String loginName);

View File

@@ -77,8 +77,8 @@ public class DepotService {
return list; return list;
} }
public List<Depot> select(String name, Integer type, String remark, int offset, int rows)throws Exception { public List<DepotEx> select(String name, Integer type, String remark, int offset, int rows)throws Exception {
List<Depot> list=null; List<DepotEx> list=null;
try{ try{
list=depotMapperEx.selectByConditionDepot(name, type, remark, offset, rows); list=depotMapperEx.selectByConditionDepot(name, type, remark, offset, rows);
}catch(Exception e){ }catch(Exception e){
@@ -191,15 +191,6 @@ public class DepotService {
return list; return list;
} }
public List<DepotEx> getDepotList(Map<String, Object> parameterMap)throws Exception {
List<DepotEx> list=null;
try{
list= depotMapperEx.getDepotList(parameterMap);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepotByIds(String ids)throws Exception { public int batchDeleteDepotByIds(String ids)throws Exception {
logService.insertLog("仓库", logService.insertLog("仓库",

View File

@@ -596,6 +596,17 @@ public class MaterialService {
} }
return list; return list;
} }
public Long getMaterialEnableSerialNumberCount(Map<String, Object> parameterMap)throws Exception {
Long count =null;
try{
count= materialMapperEx.getMaterialEnableSerialNumberCount(parameterMap);
}catch(Exception e){
JshException.readFail(logger, e);
}
return count;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteMaterialByIds(String ids) throws Exception{ public int batchDeleteMaterialByIds(String ids) throws Exception{
logService.insertLog("商品", logService.insertLog("商品",

View File

@@ -77,8 +77,8 @@ public class UserService {
return list; return list;
} }
public List<User> select(String userName, String loginName, int offset, int rows)throws Exception { public List<UserEx> select(String userName, String loginName, int offset, int rows)throws Exception {
List<User> list=null; List<UserEx> list=null;
try{ try{
list=userMapperEx.selectByConditionUser(userName, loginName, offset, rows); list=userMapperEx.selectByConditionUser(userName, loginName, offset, rows);
}catch(Exception e){ }catch(Exception e){
@@ -299,16 +299,6 @@ public class UserService {
return (User)request.getSession().getAttribute("user"); return (User)request.getSession().getAttribute("user");
} }
public List<UserEx> getUserList(Map<String, Object> parameterMap) throws Exception{
List<UserEx> list=null;
try{
list= userMapperEx.getUserList(parameterMap);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
/** /**
* 根据用户名查询id * 根据用户名查询id
* @param loginName * @param loginName

View File

@@ -5,60 +5,44 @@
<result column="principalName" jdbcType="VARCHAR" property="principalName" /> <result column="principalName" jdbcType="VARCHAR" property="principalName" />
</resultMap> </resultMap>
<select id="selectByConditionDepot" parameterType="com.jsh.erp.datasource.entities.DepotExample" resultMap="com.jsh.erp.datasource.mappers.DepotMapper.BaseResultMap"> <select id="selectByConditionDepot" parameterType="com.jsh.erp.datasource.entities.DepotExample" resultMap="ResultMapEx">
select * select dep.*,usr.username as principalName
FROM jsh_depot FROM jsh_depot dep
left join jsh_user usr on usr.id=dep.principal and ifnull(usr.status,'0') not in('1','2')
where 1=1 where 1=1
<if test="name != null"> <if test="name != null">
and name like '%${name}%' and dep.name like '%${name}%'
</if> </if>
<if test="type != null"> <if test="type != null">
and type=${type} and dep.type=${type}
</if> </if>
<if test="remark != null"> <if test="remark != null">
and remark like '%${remark}%' and dep.remark like '%${remark}%'
</if> </if>
and ifnull(delete_Flag,'0') !='1' and ifnull(dep.delete_Flag,'0') !='1'
order by sort asc order by dep.sort asc
<if test="offset != null and rows != null"> <if test="offset != null and rows != null">
limit #{offset},#{rows} limit #{offset},#{rows}
</if> </if>
</select> </select>
<select id="countsByDepot" resultType="java.lang.Long"> <select id="countsByDepot" resultType="java.lang.Long">
SELECT SELECT
COUNT(id) COUNT(dep.id)
FROM jsh_depot
WHERE 1=1
<if test="name != null">
and name like '%${name}%'
</if>
<if test="type != null">
and type=${type}
</if>
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getDepotList" parameterType="java.util.Map" resultMap="ResultMapEx">
select dep.*,usr.username as principalName
FROM jsh_depot dep FROM jsh_depot dep
left join jsh_user usr on usr.id=dep.principal and ifnull(usr.status,'0') not in('1','2') left join jsh_user usr on usr.id=dep.principal and ifnull(usr.status,'0') not in('1','2')
where 1=1 WHERE 1=1
<if test="name != null and name != ''"> <if test="name != null">
<bind name="name" value="'%' + _parameter.name + '%'" /> and dep.name like '%${name}%'
and dep.name like #{name}
</if> </if>
<if test="type != null and type != ''"> <if test="type != null">
and dep.type=#{type} and dep.type=${type}
</if> </if>
<if test="remark != null and remark != ''"> <if test="remark != null">
<bind name="remark" value="'%' + _parameter.remark + '%'" /> and dep.remark like '%${remark}%'
and dep.remark like #{remark}
</if> </if>
and ifnull(dep.delete_Flag,'0') !='1' and ifnull(dep.delete_Flag,'0') !='1'
order by dep.sort asc
</select> </select>
<update id="batchDeleteDepotByIds"> <update id="batchDeleteDepotByIds">
update jsh_depot update jsh_depot
set delete_Flag='1' set delete_Flag='1'

View File

@@ -161,6 +161,7 @@
and ifnull(m.delete_Flag,'0') !='1' and ifnull(m.delete_Flag,'0') !='1'
</select> </select>
<select id="getMaterialEnableSerialNumberList" parameterType="java.util.Map" resultMap="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap"> <select id="getMaterialEnableSerialNumberList" parameterType="java.util.Map" resultMap="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap">
select select
Id, CategoryId, name, Mfrs, Packing, SafetyStock, Model, Standard, Color, Unit, Remark, Id, CategoryId, name, Mfrs, Packing, SafetyStock, Model, Standard, Color, Unit, Remark,
@@ -181,6 +182,24 @@
and ifnull(delete_Flag,'0') !='1' and ifnull(delete_Flag,'0') !='1'
order by id desc order by id desc
</select> </select>
<select id="getMaterialEnableSerialNumberCount" resultType="java.lang.Long">
select count(1)
FROM jsh_material
where 1=1
and enabled ='1'
and enableSerialNumber ='1'
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'" />
and name like #{name}
</if>
<if test="model != null and model != ''">
<bind name="model" value="'%' + _parameter.model + '%'" />
and model like #{model}
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<update id="batchDeleteMaterialByIds"> <update id="batchDeleteMaterialByIds">
update jsh_material update jsh_material
set delete_Flag='1' set delete_Flag='1'

View File

@@ -7,52 +7,39 @@
<result column="user_blng_orga_dspl_seq" jdbcType="VARCHAR" property="userBlngOrgaDsplSeq" /> <result column="user_blng_orga_dspl_seq" jdbcType="VARCHAR" property="userBlngOrgaDsplSeq" />
<result column="orgaUserRelId" jdbcType="BIGINT" property="orgaUserRelId" /> <result column="orgaUserRelId" jdbcType="BIGINT" property="orgaUserRelId" />
</resultMap> </resultMap>
<select id="selectByConditionUser" parameterType="com.jsh.erp.datasource.entities.UserExample" resultMap="com.jsh.erp.datasource.mappers.UserMapper.BaseResultMap"> <select id="selectByConditionUser" parameterType="com.jsh.erp.datasource.entities.UserExample" resultMap="ResultMapEx">
select *
FROM jsh_user
where 1=1
and ifnull(status,'0') not in('1','2')
<if test="userName != null">
and username like '%${userName}%'
</if>
<if test="loginName != null">
and login_name like '%${loginName}%'
</if>
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
</select>
<select id="countsByUser" resultType="java.lang.Long">
SELECT
COUNT(id)
FROM jsh_user
WHERE 1=1
and ifnull(status,'0') not in('1','2')
<if test="userName != null">
and username like '%${userName}%'
</if>
<if test="loginName != null">
and login_name like '%${loginName}%'
</if>
</select>
<select id="getUserList" parameterType="java.util.Map" resultMap="ResultMapEx">
select user.id, user.username, user.login_name, user.position, user.email, user.phonenum, select user.id, user.username, user.login_name, user.position, user.email, user.phonenum,
user.description, user.remark,user.isystem,org.id as orgaId,user.tenant_id,org.org_abr,rel.user_blng_orga_dspl_seq, user.description, user.remark,user.isystem,org.id as orgaId,user.tenant_id,org.org_abr,rel.user_blng_orga_dspl_seq,
rel.id as orgaUserRelId rel.id as orgaUserRelId
FROM jsh_user user FROM jsh_user user
left join jsh_orga_user_rel rel on user.id=rel.user_id and ifnull(rel.delete_flag,'0') !='1' left join jsh_orga_user_rel rel on user.id=rel.user_id and ifnull(rel.delete_flag,'0') !='1'
left join jsh_organization org on rel.orga_id=org.id and ifnull(org.org_stcd,'0') !='5' left join jsh_organization org on rel.orga_id=org.id and ifnull(org.org_stcd,'0') !='5'
where 1=1 where 1=1
and ifnull(user.status,'0') not in('1','2') and ifnull(user.status,'0') not in('1','2')
<if test="userName != null and userName != ''"> <if test="userName != null">
<bind name="userName" value="'%' + _parameter.userName + '%'" /> and user.username like '%${userName}%'
and user.username like #{userName}
</if> </if>
<if test="loginName != null and loginName != ''"> <if test="loginName != null">
<bind name="loginName" value="'%' + _parameter.loginName + '%'" /> and user.login_name like '%${loginName}%'
and user.login_name like #{loginName}
</if> </if>
order by user.id desc order by user.id desc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
</select>
<select id="countsByUser" resultType="java.lang.Long">
select count(user.id)
FROM jsh_user user
left join jsh_orga_user_rel rel on user.id=rel.user_id and ifnull(rel.delete_flag,'0') !='1'
left join jsh_organization org on rel.orga_id=org.id and ifnull(org.org_stcd,'0') !='5'
where 1=1
and ifnull(user.status,'0') not in('1','2')
<if test="userName != null">
and user.username like '%${userName}%'
</if>
<if test="loginName != null">
and user.login_name like '%${loginName}%'
</if>
</select> </select>
<select id="getUserListByUserNameOrLoginName" resultMap="com.jsh.erp.datasource.mappers.UserMapper.BaseResultMap"> <select id="getUserListByUserNameOrLoginName" resultMap="com.jsh.erp.datasource.mappers.UserMapper.BaseResultMap">
select user.id, user.username, user.login_name, user.position, user.email, user.phonenum, select user.id, user.username, user.login_name, user.position, user.email, user.phonenum,