切换到jsh的版本

This commit is contained in:
qiankunpingtai
2019-11-08 20:34:36 +08:00
parent 9182e734fc
commit 7cabc39ab8
125 changed files with 1692 additions and 46688 deletions

View File

@@ -1,10 +1,17 @@
package com.jsh.erp;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.DispatcherServlet;
import javax.servlet.http.Cookie;
@SpringBootApplication
@MapperScan(basePackages = {"com.jsh.erp.datasource.mappers"})

View File

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantHandler;
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser;
import com.jsh.erp.datasource.entities.User;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.LongValue;
import org.apache.ibatis.mapping.MappedStatement;
@@ -21,15 +22,7 @@ import java.util.List;
@Configuration
public class TenantConfig {
/**
* create by: qiankunpingtai
* create time: 2019/4/28 14:28
* websitehttps://qiankunpingtai.cn
* description:
* 实现多租户和无租户模式数据可以兼容在一个数据库中
* 多租户模式根据tenant_id=租户id来筛选个人数据
* 无租户模式根据tenant_id=-1来筛选数据
*/
@Bean
public PaginationInterceptor paginationInterceptor(HttpServletRequest request) {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
@@ -41,11 +34,9 @@ public class TenantConfig {
//从session中获取租户id
Object tenantId = request.getSession().getAttribute("tenantId");
if(tenantId!=null){
//多租户模式租户id从当前用户获取
return new LongValue(Long.parseLong(tenantId.toString()));
} else {
//无租户模式租户id为-1
return new LongValue(Long.valueOf(-1));
return null;
}
}
@@ -56,11 +47,30 @@ public class TenantConfig {
@Override
public boolean doTableFilter(String tableName) {
// 这里可以判断是否过滤表
if ("tbl_sequence".equals(tableName) || "dual".equals(tableName)|| "jsh_tenant".equals(tableName)) {
return true;
//获取开启状态
Object tenantId = request.getSession().getAttribute("tenantId");
if(tenantId!=null) {
//从session中获取租户id
String loginName = null;
Object userInfo = request.getSession().getAttribute("user");
if(userInfo != null) {
User user = (User) userInfo;
loginName = user.getLoginame();
}
if(("admin").equals(loginName)) {
return true;
} else {
// 这里可以判断是否过滤表
if ("jsh_materialproperty".equals(tableName) || "tbl_sequence".equals(tableName)
|| "jsh_userbusiness".equals(tableName) || "jsh_functions".equals(tableName)
|| "jsh_tenant".equals(tableName)) {
return true;
} else {
return false;
}
}
} else {
return false;
return true;
}
}
});
@@ -71,14 +81,12 @@ public class TenantConfig {
@Override
public boolean doFilter(MetaObject metaObject) {
MappedStatement ms = SqlParserHelper.getMappedStatement(metaObject);
// 过滤自定义查询此处跳过指定id的查询不追加租户id过滤条件
if ("com.jsh.erp.datasource.mappers.UserMapperEx.getUserListByLoginName".equals(ms.getId())||
"com.jsh.erp.datasource.mappers.UserMapperEx.getUserListByloginNameAndPassword".equals(ms.getId())||
"com.jsh.erp.datasource.mappers.DepotItemMapperEx.getCurrentRepByMaterialIdAndDepotId".equals(ms.getId())) {
// 过滤自定义查询此时无租户信息约束出现
if ("com.jsh.erp.datasource.mappers.UserMapperEx.getUserListByUserNameOrLoginName".equals(ms.getId())||
"com.jsh.erp.datasource.mappers.DepotItemMapperEx.getStockByParam".equals(ms.getId())) {
return true;
}
return false;
}
});
return paginationInterceptor;

View File

@@ -213,11 +213,7 @@ public class BusinessConstants {
* 默认管理员账号
*/
public static final String DEFAULT_MANAGER = "admin";
/**
* 测试用户的基础数据设定
* */
public static final String TEST_USER_NUM_LIMIT="2000";
public static final String TEST_BILLS_NUM_LIMIT="200000";

View File

@@ -278,9 +278,6 @@ public class ExceptionConstants {
//商品库存不足
public static final int MATERIAL_STOCK_NOT_ENOUGH_CODE = 8000004;
public static final String MATERIAL_STOCK_NOT_ENOUGH_MSG = "商品:%s库存不足";
//商品单位不正确
public static final int MATERIAL_UNIT_NOT_RIGHT_CODE = 8000005;
public static final String MATERIAL_UNIT_NOT_RIGHT_MSG = "商品:%s单位不正确使用单位:%s基础单位%s副单位%s";
/**
* 单据信息
* type = 85

View File

@@ -5,7 +5,6 @@ import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.AccountHead;
import com.jsh.erp.datasource.entities.AccountHeadVo4ListEx;
import com.jsh.erp.exception.BusinessParamCheckingException;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.accountHead.AccountHeadService;
import com.jsh.erp.utils.BaseResponseInfo;
@@ -35,6 +34,27 @@ public class AccountHeadController {
@Resource
private AccountHeadService accountHeadService;
/**
* 获取最大的id
* @param request
* @return
*/
@GetMapping(value = "/getMaxId")
public BaseResponseInfo getMaxId(HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
Long maxId = accountHeadService.getMaxId();
map.put("maxId", maxId);
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 查询单位的累计应收和累计应付,收预付款不计入此处
@@ -125,38 +145,5 @@ public class AccountHeadController {
}
return result;
}
/**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn
* description:
* 新增财务信息和财务明细信息
* create time: 2019/5/21 15:50
* @Param: beanJson
 * @Param: inserted
 * @Param: deleted
 * @Param: updated
 * @Param: request
* @return java.lang.Object
*/
@RequestMapping(value = "/addAccountHeadAndDetail")
public Object addAccountHeadAndDetail(@RequestParam("info") String beanJson,
@RequestParam("inserted") String inserted,
@RequestParam("deleted") String deleted,
@RequestParam("updated") String updated,
@RequestParam("listType") String listType,HttpServletRequest request) throws Exception{
JSONObject result = ExceptionConstants.standardSuccess();
accountHeadService.addAccountHeadAndDetail(beanJson,inserted,deleted,updated,listType);
return result;
}
@RequestMapping(value = "/updateAccountHeadAndDetail")
public Object updateAccountHeadAndDetail(@RequestParam("id") Long id,@RequestParam("info") String beanJson,@RequestParam("inserted") String inserted,
@RequestParam("deleted") String deleted,
@RequestParam("updated") String updated,@RequestParam("listType") String listType) throws Exception{
JSONObject result = ExceptionConstants.standardSuccess();
accountHeadService.updateAccountHeadAndDetail(id,beanJson,inserted,deleted,updated,listType);
return result;
}
}

View File

@@ -86,6 +86,27 @@ public class DepotHeadController {
return res;
}
/**
* 获取最大的id
* @param request
* @return
*/
@GetMapping(value = "/getMaxId")
public BaseResponseInfo getMaxId(HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
Long maxId = depotHeadService.getMaxId();
map.put("maxId", maxId);
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 查找单据_根据月份(报表)
@@ -383,7 +404,7 @@ public class DepotHeadController {
throw new BusinessParamCheckingException(ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_CODE,
ExceptionConstants.DEPOT_HEAD_OVER_LIMIT_FAILED_MSG);
} else {
depotHeadService.addDepotHeadAndDetail(beanJson,inserted,deleted,updated);
depotHeadService.addDepotHeadAndDetail(beanJson,inserted,deleted,updated,tenantId);
}
return result;
}

View File

@@ -4,8 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.DepotItemVo4DetailByTypeAndMId;
import com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx;
import com.jsh.erp.datasource.entities.*;
import com.jsh.erp.datasource.vo.DepotItemStockWarningCount;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.depotItem.DepotItemService;
@@ -13,10 +12,8 @@ import com.jsh.erp.service.material.MaterialService;
import com.jsh.erp.utils.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.dao.DataAccessException;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -74,8 +71,6 @@ public class DepotItemController {
item.put("Type", d.getNewtype()); //进出类型
item.put("BasicNumber", d.getBnum()); //数量
item.put("OperTime", d.getOtime()); //时间
item.put("depotName", d.getDepotName()); //仓库名称
item.put("depotInName", d.getDepotInName()); //调入仓库名称
dataArray.add(item);
}
}
@@ -92,27 +87,32 @@ public class DepotItemController {
/**
* 根据商品id和仓库id查询库存数量
* @param depotId
* @param mId
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value = "/findStockNumByMaterialId")
public String findStockNumByMaterialId(
@RequestParam("materialId") String mId,
HttpServletRequest request) throws Exception{
Map<String, Object> objectMap = new HashMap<String, Object>();
//存放数据json数组
JSONArray dataArray = new JSONArray();
JSONObject item = new JSONObject();
item.put("thisSum", depotItemService.getCurrentRepByMaterialIdAndDepotId(Long.valueOf(mId),null));
dataArray.add(item);
objectMap.put("page", dataArray);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
@GetMapping(value = "/findStockNumById")
public BaseResponseInfo findStockNumById(
@RequestParam("depotId") Long depotId,
@RequestParam("mId") Long mId,
HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
Long tenantId = Long.parseLong(request.getSession().getAttribute("tenantId").toString());
map.put("stock", depotItemService.getStockByParam(depotId,mId,null,null,tenantId));
res.code = 200;
res.data = map;
} catch (Exception e) {
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
/**
* 查询计量单位信息
*
@@ -144,7 +144,7 @@ public class DepotItemController {
try {
List<DepotItemVo4WithInfoEx> dataList = new ArrayList<DepotItemVo4WithInfoEx>();
if(headerId != 0) {
dataList = depotItemService.getDetailList(headerId);
dataList = depotItemService.getDetailList(headerId);
}
String[] mpArr = mpList.split(",");
JSONObject outer = new JSONObject();
@@ -164,13 +164,17 @@ public class DepotItemController {
ratio = ratio.substring(ratio.indexOf("("));
}
//品名/型号/扩展信息/包装
String MaterialName = diEx.getMName() + ((diEx.getMModel() == null || diEx.getMModel().equals("")) ? "" : "(" + diEx.getMModel() + ")");
String MaterialName = (diEx.getMName() == null || diEx.getMName().equals("")) ? "" : diEx.getMName()
+ ((diEx.getMModel() == null || diEx.getMModel().equals("")) ? "" : "(" + diEx.getMModel() + ")");
String materialOther = getOtherInfo(mpArr, diEx);
MaterialName = MaterialName + materialOther + ((diEx.getUName() == null || diEx.getUName().equals("")) ? "" : "(" + diEx.getUName() + ")") + ratio;
item.put("MaterialName", MaterialName);
item.put("MaterialName", MaterialName == null ? "" : MaterialName);
item.put("Stock", depotItemService.getStockByParam(diEx.getDepotid(),diEx.getMaterialid(),null,null,tenantId));
item.put("Unit", diEx.getMunit());
item.put("OperNumber", diEx.getOpernumber());
item.put("BasicNumber", diEx.getBasicnumber());
//统计该商品已分批出库的总数量-用于订单
item.put("finishNumber", depotItemService.getFinishNumber(diEx.getMaterialid(),diEx.getHeaderid()));
item.put("UnitPrice", diEx.getUnitprice());
item.put("TaxUnitPrice", diEx.getTaxunitprice());
item.put("AllPrice", diEx.getAllprice());
@@ -235,11 +239,11 @@ public class DepotItemController {
return materialOther;
}
/**
* 查找所有的明细
* @param currentPage
* @param pageSize
* @param projectId
* @param monthTime
* @param headIds
* @param materialIds
@@ -247,7 +251,7 @@ public class DepotItemController {
* @param request
* @return
*/
@RequestMapping(value = "/findByAll")
@PostMapping(value = "/findByAll")
public BaseResponseInfo findByAll(@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
@RequestParam("depotId") Long depotId,
@@ -301,12 +305,11 @@ public class DepotItemController {
}
/**
* 导出excel表格
* @param currentPage
* @param pageSize
* @param projectId
* @param monthTime
* @param headIds
* @param materialIds
@@ -357,18 +360,19 @@ public class DepotItemController {
/**
* 统计总计金额
* @param pid
* @param monthTime
* @param headIds
* @param materialIds
* @param request
* @return
*/
@RequestMapping(value = "/totalCountMoney")
@PostMapping(value = "/totalCountMoney")
public BaseResponseInfo totalCountMoney(@RequestParam("depotId") Long depotId,
@RequestParam("monthTime") String monthTime,
@RequestParam("headIds") String headIds,
@RequestParam("materialIds") String materialIds,
HttpServletRequest request) throws Exception{
@RequestParam("monthTime") String monthTime,
@RequestParam("headIds") String headIds,
@RequestParam("materialIds") String materialIds,
HttpServletRequest request) throws Exception{
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
Long tenantId = Long.parseLong(request.getSession().getAttribute("tenantId").toString());
@@ -394,8 +398,6 @@ public class DepotItemController {
return res;
}
/**
* 进货统计
* @param currentPage
@@ -407,7 +409,7 @@ public class DepotItemController {
* @param request
* @return
*/
@GetMapping(value = "/buyIn")
@PostMapping(value = "/buyIn")
public BaseResponseInfo buyIn(@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
@RequestParam("monthTime") String monthTime,
@@ -427,10 +429,10 @@ public class DepotItemController {
if (null != dataList) {
for (DepotItemVo4WithInfoEx diEx : dataList) {
JSONObject item = new JSONObject();
BigDecimal InSum = sumNumberBuyOrSale("入库", "采购", diEx.getMId(), monthTime);
BigDecimal OutSum = sumNumberBuyOrSale("出库", "采购退货", diEx.getMId(), monthTime);
BigDecimal InSumPrice = sumPriceBuyOrSale("入库", "采购", diEx.getMId(), monthTime);
BigDecimal OutSumPrice = sumPriceBuyOrSale("出库", "采购退货", diEx.getMId(), monthTime);
BigDecimal InSum = depotItemService.buyOrSale("入库", "采购", diEx.getMId(), monthTime, "number");
BigDecimal OutSum = depotItemService.buyOrSale("出库", "采购退货", diEx.getMId(), monthTime, "number");
BigDecimal InSumPrice = depotItemService.buyOrSale("入库", "采购", diEx.getMId(), monthTime, "price");
BigDecimal OutSumPrice = depotItemService.buyOrSale("出库", "采购退货", diEx.getMId(), monthTime, "price");
item.put("MaterialName", diEx.getMName());
item.put("MaterialModel", diEx.getMModel());
//扩展信息
@@ -438,6 +440,7 @@ public class DepotItemController {
item.put("MaterialOther", materialOther);
item.put("MaterialColor", diEx.getMColor());
item.put("MaterialUnit", diEx.getMaterialUnit());
item.put("UName", diEx.getUName());
item.put("InSum", InSum);
item.put("OutSum", OutSum);
item.put("InSumPrice", InSumPrice);
@@ -467,7 +470,7 @@ public class DepotItemController {
* @param request
* @return
*/
@GetMapping(value = "/saleOut")
@PostMapping(value = "/saleOut")
public BaseResponseInfo saleOut(@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
@RequestParam("monthTime") String monthTime,
@@ -487,14 +490,15 @@ public class DepotItemController {
if (null != dataList) {
for (DepotItemVo4WithInfoEx diEx : dataList) {
JSONObject item = new JSONObject();
BigDecimal OutSumRetail = sumNumberBuyOrSale("出库", "零售", diEx.getMId(), monthTime);
BigDecimal OutSum = sumNumberBuyOrSale("出库", "销售", diEx.getMId(), monthTime);
BigDecimal InSumRetail = sumNumberBuyOrSale("入库", "零售退货", diEx.getMId(), monthTime);
BigDecimal InSum = sumNumberBuyOrSale("入库", "销售退货", diEx.getMId(), monthTime);
BigDecimal OutSumRetailPrice = sumPriceBuyOrSale("出库", "零售", diEx.getMId(), monthTime);
BigDecimal OutSumPrice = sumPriceBuyOrSale("出库", "销售", diEx.getMId(), monthTime);
BigDecimal InSumRetailPrice = sumPriceBuyOrSale("入库", "零售退货", diEx.getMId(), monthTime);
BigDecimal InSumPrice = sumPriceBuyOrSale("入库", "销售退货", diEx.getMId(), monthTime);
BigDecimal OutSumRetail = depotItemService.buyOrSale("出库", "零售", diEx.getMId(), monthTime,"number");
BigDecimal OutSum = depotItemService.buyOrSale("出库", "销售", diEx.getMId(), monthTime,"number");
BigDecimal InSumRetail = depotItemService.buyOrSale("入库", "零售退货", diEx.getMId(), monthTime,"number");
BigDecimal InSum = depotItemService.buyOrSale("入库", "销售退货", diEx.getMId(), monthTime,"number");
BigDecimal OutSumRetailPrice = depotItemService.buyOrSale("出库", "零售", diEx.getMId(), monthTime,"price");
BigDecimal OutSumPrice = depotItemService.buyOrSale("出库", "销售", diEx.getMId(), monthTime,"price");
BigDecimal InSumRetailPrice = depotItemService.buyOrSale("入库", "零售退货", diEx.getMId(), monthTime,"price");
BigDecimal InSumPrice = depotItemService.buyOrSale("入库", "销售退货", diEx.getMId(), monthTime,"price");
BigDecimal OutInSumPrice = (OutSumRetailPrice.add(OutSumPrice)).subtract(InSumRetailPrice.add(InSumPrice));
item.put("MaterialName", diEx.getMName());
item.put("MaterialModel", diEx.getMModel());
//扩展信息
@@ -502,10 +506,12 @@ public class DepotItemController {
item.put("MaterialOther", materialOther);
item.put("MaterialColor", diEx.getMColor());
item.put("MaterialUnit", diEx.getMaterialUnit());
item.put("UName", diEx.getUName());
item.put("OutSum", OutSumRetail.add(OutSum));
item.put("InSum", InSumRetail.add(InSum));
item.put("OutSumPrice", OutSumRetailPrice.add(OutSumPrice));
item.put("InSumPrice", InSumRetailPrice.add(InSumPrice));
item.put("OutInSumPrice",OutInSumPrice);//实际销售金额
dataArray.add(item);
}
}
@@ -520,34 +526,22 @@ public class DepotItemController {
return res;
}
public BigDecimal sumNumberBuyOrSale(String type, String subType, Long MId, String MonthTime)throws Exception {
BigDecimal sumNumber = BigDecimal.ZERO;
String sumType = "Number";
try {
BigDecimal sum = depotItemService.buyOrSale(type, subType, MId, MonthTime, sumType);
if(sum != null) {
sumNumber = sum;
}
} catch (Exception e) {
e.printStackTrace();
/**
* 获取单位
* @param materialUnit
* @param uName
* @return
*/
public String getUName(String materialUnit, String uName) {
String unitName = null;
if(!StringUtil.isEmpty(materialUnit)) {
unitName = materialUnit;
} else if(!StringUtil.isEmpty(uName)) {
unitName = uName.substring(0,uName.indexOf(","));
}
return sumNumber;
return unitName;
}
public BigDecimal sumPriceBuyOrSale(String type, String subType, Long MId, String MonthTime)throws Exception {
BigDecimal sumPrice = BigDecimal.ZERO;
String sumType = "Price";
try {
BigDecimal sum = depotItemService.buyOrSale(type, subType, MId, MonthTime, sumType);
if(sum != null) {
sumPrice = sum;
}
} catch (Exception e) {
e.printStackTrace();
}
return sumPrice;
}
/**
* 获取单价
* @param presetPriceOne
@@ -624,6 +618,7 @@ public class DepotItemController {
* @param currentPage
* @param pageSize
* @param projectId
* @param monthTime
* @param request
* @param response
* @return
@@ -646,7 +641,6 @@ public class DepotItemController {
if (null != dataList) {
for (DepotItemStockWarningCount diEx : dataList) {
String[] objs = new String[9];
objs[0] = diEx.getMaterialName().toString();
objs[1] = diEx.getMaterialModel().toString();
objs[2] = diEx.getMaterialOther().toString();
@@ -711,20 +705,4 @@ public class DepotItemController {
}
return res;
}
/**
* 获取单位
* @param materialUnit
* @param uName
* @return
*/
public String getUName(String materialUnit, String uName) {
String unitName = null;
if(!StringUtil.isEmpty(materialUnit)) {
unitName = materialUnit;
} else if(!StringUtil.isEmpty(uName)) {
unitName = uName.substring(0,uName.indexOf(","));
}
return unitName;
}
}

View File

@@ -154,10 +154,9 @@ public class FunctionsController {
if(("admin").equals(loginName)) {
dataList.add(fun);
} else {
// if(!("系统管理").equals(fun.getName())) {
// dataList.add(fun);
// }
dataList.add(fun);
if(!("系统管理").equals(fun.getName())) {
dataList.add(fun);
}
}
}

View File

@@ -2,28 +2,19 @@ package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONArray;
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.ExceptionConstants;
import com.jsh.erp.datasource.entities.Role;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.role.RoleService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
/**
* @author ji sheng hua 华夏ERP
@@ -74,35 +65,11 @@ public class RoleController {
return arr;
}
@RequestMapping(value = "/list")
public String list(@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
@RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage,
@RequestParam("name") String name,
HttpServletRequest request)throws Exception {
Map<String, String> parameterMap = ParamUtils.requestToMap(request);
parameterMap.put("name", name);
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<Role> list = roleService.getRoleList(parameterMap);
//获取分页查询后的数据
PageInfo<Role> 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);
@PostMapping(value = "/list")
public List<Role> list(HttpServletRequest request)throws Exception {
return roleService.getRole();
}
/**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn

View File

@@ -43,7 +43,7 @@ public class UserController {
private Logger logger = LoggerFactory.getLogger(UserController.class);
@Value("${manage.roleId}")
private Long manageRoleId;
private Integer manageRoleId;
@Resource
private UserService userService;
@@ -103,11 +103,9 @@ public class UserController {
break;
default:
try {
//验证通过 可以登录放入session记录登录日志
user = userService.getUserListByloginNameAndPassword(username,password);
// logService.create(new Logdetails(user, "登录系统", model.getClientIp(),
// new Timestamp(System.currentTimeMillis()), (short) 0, "管理用户:" + username + " 登录系统", username + " 登录系统"));
msgTip = "user can login";
//验证通过 可以登录放入session记录登录日志
user = userService.getUserByUserName(username);
request.getSession().setAttribute("user",user);
if(user.getTenantId()!=null) {
Tenant tenant = tenantService.getTenantByTenantId(user.getTenantId());
@@ -345,7 +343,8 @@ public class UserController {
ue.setUsername(loginame);
ue.setLoginame(loginame);
ue.setPassword(password);
ue = userService.registerUser(ue,manageRoleId);
userService.checkUserNameAndLoginName(ue); //检查用户名和登录名
ue = userService.registerUser(ue,manageRoleId,request);
return result;
}
/**

View File

@@ -1,692 +0,0 @@
package com.jsh.erp.datasource.entities;
import java.util.ArrayList;
import java.util.List;
public class AssetCategoryExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table jsh_assetcategory
*
* @mbggenerated
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table jsh_assetcategory
*
* @mbggenerated
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table jsh_assetcategory
*
* @mbggenerated
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_assetcategory
*
* @mbggenerated
*/
public AssetCategoryExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_assetcategory
*
* @mbggenerated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_assetcategory
*
* @mbggenerated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_assetcategory
*
* @mbggenerated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_assetcategory
*
* @mbggenerated
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_assetcategory
*
* @mbggenerated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_assetcategory
*
* @mbggenerated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_assetcategory
*
* @mbggenerated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_assetcategory
*
* @mbggenerated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_assetcategory
*
* @mbggenerated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jsh_assetcategory
*
* @mbggenerated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table jsh_assetcategory
*
* @mbggenerated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andAssetnameIsNull() {
addCriterion("assetname is null");
return (Criteria) this;
}
public Criteria andAssetnameIsNotNull() {
addCriterion("assetname is not null");
return (Criteria) this;
}
public Criteria andAssetnameEqualTo(String value) {
addCriterion("assetname =", value, "assetname");
return (Criteria) this;
}
public Criteria andAssetnameNotEqualTo(String value) {
addCriterion("assetname <>", value, "assetname");
return (Criteria) this;
}
public Criteria andAssetnameGreaterThan(String value) {
addCriterion("assetname >", value, "assetname");
return (Criteria) this;
}
public Criteria andAssetnameGreaterThanOrEqualTo(String value) {
addCriterion("assetname >=", value, "assetname");
return (Criteria) this;
}
public Criteria andAssetnameLessThan(String value) {
addCriterion("assetname <", value, "assetname");
return (Criteria) this;
}
public Criteria andAssetnameLessThanOrEqualTo(String value) {
addCriterion("assetname <=", value, "assetname");
return (Criteria) this;
}
public Criteria andAssetnameLike(String value) {
addCriterion("assetname like", value, "assetname");
return (Criteria) this;
}
public Criteria andAssetnameNotLike(String value) {
addCriterion("assetname not like", value, "assetname");
return (Criteria) this;
}
public Criteria andAssetnameIn(List<String> values) {
addCriterion("assetname in", values, "assetname");
return (Criteria) this;
}
public Criteria andAssetnameNotIn(List<String> values) {
addCriterion("assetname not in", values, "assetname");
return (Criteria) this;
}
public Criteria andAssetnameBetween(String value1, String value2) {
addCriterion("assetname between", value1, value2, "assetname");
return (Criteria) this;
}
public Criteria andAssetnameNotBetween(String value1, String value2) {
addCriterion("assetname not between", value1, value2, "assetname");
return (Criteria) this;
}
public Criteria andIsystemIsNull() {
addCriterion("isystem is null");
return (Criteria) this;
}
public Criteria andIsystemIsNotNull() {
addCriterion("isystem is not null");
return (Criteria) this;
}
public Criteria andIsystemEqualTo(Byte value) {
addCriterion("isystem =", value, "isystem");
return (Criteria) this;
}
public Criteria andIsystemNotEqualTo(Byte value) {
addCriterion("isystem <>", value, "isystem");
return (Criteria) this;
}
public Criteria andIsystemGreaterThan(Byte value) {
addCriterion("isystem >", value, "isystem");
return (Criteria) this;
}
public Criteria andIsystemGreaterThanOrEqualTo(Byte value) {
addCriterion("isystem >=", value, "isystem");
return (Criteria) this;
}
public Criteria andIsystemLessThan(Byte value) {
addCriterion("isystem <", value, "isystem");
return (Criteria) this;
}
public Criteria andIsystemLessThanOrEqualTo(Byte value) {
addCriterion("isystem <=", value, "isystem");
return (Criteria) this;
}
public Criteria andIsystemIn(List<Byte> values) {
addCriterion("isystem in", values, "isystem");
return (Criteria) this;
}
public Criteria andIsystemNotIn(List<Byte> values) {
addCriterion("isystem not in", values, "isystem");
return (Criteria) this;
}
public Criteria andIsystemBetween(Byte value1, Byte value2) {
addCriterion("isystem between", value1, value2, "isystem");
return (Criteria) this;
}
public Criteria andIsystemNotBetween(Byte value1, Byte value2) {
addCriterion("isystem not between", value1, value2, "isystem");
return (Criteria) this;
}
public Criteria andDescriptionIsNull() {
addCriterion("description is null");
return (Criteria) this;
}
public Criteria andDescriptionIsNotNull() {
addCriterion("description is not null");
return (Criteria) this;
}
public Criteria andDescriptionEqualTo(String value) {
addCriterion("description =", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotEqualTo(String value) {
addCriterion("description <>", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionGreaterThan(String value) {
addCriterion("description >", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionGreaterThanOrEqualTo(String value) {
addCriterion("description >=", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLessThan(String value) {
addCriterion("description <", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLessThanOrEqualTo(String value) {
addCriterion("description <=", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLike(String value) {
addCriterion("description like", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotLike(String value) {
addCriterion("description not like", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionIn(List<String> values) {
addCriterion("description in", values, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotIn(List<String> values) {
addCriterion("description not in", values, "description");
return (Criteria) this;
}
public Criteria andDescriptionBetween(String value1, String value2) {
addCriterion("description between", value1, value2, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotBetween(String value1, String value2) {
addCriterion("description not between", value1, value2, "description");
return (Criteria) this;
}
public Criteria andTenantIdIsNull() {
addCriterion("tenant_id is null");
return (Criteria) this;
}
public Criteria andTenantIdIsNotNull() {
addCriterion("tenant_id is not null");
return (Criteria) this;
}
public Criteria andTenantIdEqualTo(Long value) {
addCriterion("tenant_id =", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotEqualTo(Long value) {
addCriterion("tenant_id <>", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdGreaterThan(Long value) {
addCriterion("tenant_id >", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
addCriterion("tenant_id >=", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdLessThan(Long value) {
addCriterion("tenant_id <", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdLessThanOrEqualTo(Long value) {
addCriterion("tenant_id <=", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdIn(List<Long> values) {
addCriterion("tenant_id in", values, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotIn(List<Long> values) {
addCriterion("tenant_id not in", values, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdBetween(Long value1, Long value2) {
addCriterion("tenant_id between", value1, value2, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotBetween(Long value1, Long value2) {
addCriterion("tenant_id not between", value1, value2, "tenantId");
return (Criteria) this;
}
public Criteria andDeleteFlagIsNull() {
addCriterion("delete_Flag is null");
return (Criteria) this;
}
public Criteria andDeleteFlagIsNotNull() {
addCriterion("delete_Flag is not null");
return (Criteria) this;
}
public Criteria andDeleteFlagEqualTo(String value) {
addCriterion("delete_Flag =", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagNotEqualTo(String value) {
addCriterion("delete_Flag <>", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagGreaterThan(String value) {
addCriterion("delete_Flag >", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagGreaterThanOrEqualTo(String value) {
addCriterion("delete_Flag >=", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagLessThan(String value) {
addCriterion("delete_Flag <", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagLessThanOrEqualTo(String value) {
addCriterion("delete_Flag <=", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagLike(String value) {
addCriterion("delete_Flag like", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagNotLike(String value) {
addCriterion("delete_Flag not like", value, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagIn(List<String> values) {
addCriterion("delete_Flag in", values, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagNotIn(List<String> values) {
addCriterion("delete_Flag not in", values, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagBetween(String value1, String value2) {
addCriterion("delete_Flag between", value1, value2, "deleteFlag");
return (Criteria) this;
}
public Criteria andDeleteFlagNotBetween(String value1, String value2) {
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table jsh_assetcategory
*
* @mbggenerated do_not_delete_during_merge
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table jsh_assetcategory
*
* @mbggenerated
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@@ -11,10 +11,6 @@ public class DepotItemVo4DetailByTypeAndMId {
private Integer bnum;
private Date otime;
//仓库名称
private String depotName;
//调入仓库名称
private String depotInName;
public String getNumber() {
return number;
@@ -47,20 +43,4 @@ public class DepotItemVo4DetailByTypeAndMId {
public void setOtime(Date otime) {
this.otime = otime;
}
public String getDepotName() {
return depotName;
}
public void setDepotName(String depotName) {
this.depotName = depotName;
}
public String getDepotInName() {
return depotInName;
}
public void setDepotInName(String depotInName) {
this.depotInName = depotInName;
}
}

View File

@@ -97,14 +97,6 @@ public class Functions {
*/
private String deleteFlag;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_functions.tenant_id
*
* @mbggenerated
*/
private Long tenantId;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_functions.Id
@@ -392,28 +384,4 @@ public class Functions {
public void setDeleteFlag(String deleteFlag) {
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_functions.tenant_id
*
* @return the value of jsh_functions.tenant_id
*
* @mbggenerated
*/
public Long getTenantId() {
return tenantId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_functions.tenant_id
*
* @param tenantId the value for jsh_functions.tenant_id
*
* @mbggenerated
*/
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
}

View File

@@ -1003,66 +1003,6 @@ public class FunctionsExample {
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
return (Criteria) this;
}
public Criteria andTenantIdIsNull() {
addCriterion("tenant_id is null");
return (Criteria) this;
}
public Criteria andTenantIdIsNotNull() {
addCriterion("tenant_id is not null");
return (Criteria) this;
}
public Criteria andTenantIdEqualTo(Long value) {
addCriterion("tenant_id =", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotEqualTo(Long value) {
addCriterion("tenant_id <>", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdGreaterThan(Long value) {
addCriterion("tenant_id >", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
addCriterion("tenant_id >=", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdLessThan(Long value) {
addCriterion("tenant_id <", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdLessThanOrEqualTo(Long value) {
addCriterion("tenant_id <=", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdIn(List<Long> values) {
addCriterion("tenant_id in", values, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotIn(List<Long> values) {
addCriterion("tenant_id not in", values, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdBetween(Long value1, Long value2) {
addCriterion("tenant_id between", value1, value2, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotBetween(Long value1, Long value2) {
addCriterion("tenant_id not between", value1, value2, "tenantId");
return (Criteria) this;
}
}
/**

View File

@@ -49,14 +49,6 @@ public class MaterialProperty {
*/
private String deleteFlag;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_materialproperty.tenant_id
*
* @mbggenerated
*/
private Long tenantId;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialproperty.id
@@ -200,28 +192,4 @@ public class MaterialProperty {
public void setDeleteFlag(String deleteFlag) {
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_materialproperty.tenant_id
*
* @return the value of jsh_materialproperty.tenant_id
*
* @mbggenerated
*/
public Long getTenantId() {
return tenantId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_materialproperty.tenant_id
*
* @param tenantId the value for jsh_materialproperty.tenant_id
*
* @mbggenerated
*/
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
}

View File

@@ -593,66 +593,6 @@ public class MaterialPropertyExample {
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
return (Criteria) this;
}
public Criteria andTenantIdIsNull() {
addCriterion("tenant_id is null");
return (Criteria) this;
}
public Criteria andTenantIdIsNotNull() {
addCriterion("tenant_id is not null");
return (Criteria) this;
}
public Criteria andTenantIdEqualTo(Long value) {
addCriterion("tenant_id =", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotEqualTo(Long value) {
addCriterion("tenant_id <>", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdGreaterThan(Long value) {
addCriterion("tenant_id >", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
addCriterion("tenant_id >=", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdLessThan(Long value) {
addCriterion("tenant_id <", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdLessThanOrEqualTo(Long value) {
addCriterion("tenant_id <=", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdIn(List<Long> values) {
addCriterion("tenant_id in", values, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotIn(List<Long> values) {
addCriterion("tenant_id not in", values, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdBetween(Long value1, Long value2) {
addCriterion("tenant_id between", value1, value2, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotBetween(Long value1, Long value2) {
addCriterion("tenant_id not between", value1, value2, "tenantId");
return (Criteria) this;
}
}
/**

View File

@@ -49,14 +49,6 @@ public class UserBusiness {
*/
private String deleteFlag;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column jsh_userbusiness.tenant_id
*
* @mbggenerated
*/
private Long tenantId;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_userbusiness.Id
@@ -200,28 +192,4 @@ public class UserBusiness {
public void setDeleteFlag(String deleteFlag) {
this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column jsh_userbusiness.tenant_id
*
* @return the value of jsh_userbusiness.tenant_id
*
* @mbggenerated
*/
public Long getTenantId() {
return tenantId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column jsh_userbusiness.tenant_id
*
* @param tenantId the value for jsh_userbusiness.tenant_id
*
* @mbggenerated
*/
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
}

View File

@@ -603,66 +603,6 @@ public class UserBusinessExample {
addCriterion("delete_Flag not between", value1, value2, "deleteFlag");
return (Criteria) this;
}
public Criteria andTenantIdIsNull() {
addCriterion("tenant_id is null");
return (Criteria) this;
}
public Criteria andTenantIdIsNotNull() {
addCriterion("tenant_id is not null");
return (Criteria) this;
}
public Criteria andTenantIdEqualTo(Long value) {
addCriterion("tenant_id =", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotEqualTo(Long value) {
addCriterion("tenant_id <>", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdGreaterThan(Long value) {
addCriterion("tenant_id >", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdGreaterThanOrEqualTo(Long value) {
addCriterion("tenant_id >=", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdLessThan(Long value) {
addCriterion("tenant_id <", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdLessThanOrEqualTo(Long value) {
addCriterion("tenant_id <=", value, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdIn(List<Long> values) {
addCriterion("tenant_id in", values, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotIn(List<Long> values) {
addCriterion("tenant_id not in", values, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdBetween(Long value1, Long value2) {
addCriterion("tenant_id between", value1, value2, "tenantId");
return (Criteria) this;
}
public Criteria andTenantIdNotBetween(Long value1, Long value2) {
addCriterion("tenant_id not between", value1, value2, "tenantId");
return (Criteria) this;
}
}
/**

View File

@@ -25,6 +25,7 @@ public interface AccountHeadMapperEx {
@Param("beginTime") String beginTime,
@Param("endTime") String endTime);
Long getMaxId();
BigDecimal findAllMoney(
@Param("supplierId") Integer supplierId,
@@ -42,7 +43,4 @@ public interface AccountHeadMapperEx {
List<AccountHead> getAccountHeadListByOrganIds(@Param("organIds") String[] organIds);
List<AccountHead> getAccountHeadListByHandsPersonIds(@Param("handsPersonIds") String[] handsPersonIds);
int addAccountHead(AccountHead accountHead);
int updateAccountHead(AccountHead accountHead);
}

View File

@@ -38,6 +38,7 @@ public interface DepotHeadMapperEx {
@Param("materialParam") String materialParam,
@Param("depotIds") String depotIds);
Long getMaxId();
String findMaterialsListByHeaderId(
@Param("id") Long id);
@@ -110,6 +111,7 @@ public interface DepotHeadMapperEx {
* */
void updatedepotHead(DepotHead depotHead);
void updateBuildOnlyNumber();
/**
* 获得一个全局唯一的数作为订单号的追加
* */

View File

@@ -36,15 +36,6 @@ public interface DepotItemMapperEx {
Long findDetailByTypeAndMaterialIdCounts(
@Param("mId") Long mId);
int findByTypeAndDepotIdAndMaterialIdIn(
@Param("depotId") Long depotId,
@Param("mId") Long mId);
int findByTypeAndDepotIdAndMaterialIdOut(
@Param("depotId") Long depotId,
@Param("mId") Long mId);
List<DepotItemVo4WithInfoEx> getDetailList(
@Param("headerId") Long headerId);
@@ -115,6 +106,4 @@ public interface DepotItemMapperEx {
int findStockWarningCountTotal( @Param("pid") Integer pid);
BigDecimal getFinishNumber(@Param("mid") Long mid, @Param("linkNumber") String linkNumber);
BigDecimal getCurrentRepByMaterialIdAndDepotId(@Param("materialId") Long materialId, @Param("depotId") Long depotId,@Param("tenantId")Long tenantId);
}

View File

@@ -6,7 +6,6 @@ import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface RoleMapperEx {
@@ -19,5 +18,4 @@ public interface RoleMapperEx {
@Param("name") String name);
int batchDeleteRoleByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
List<Role> getRoleList(Map<String, String> parameterMap);
}

View File

@@ -93,4 +93,4 @@ public interface TenantMapper {
* @mbggenerated
*/
int updateByPrimaryKey(Tenant record);
}
}

View File

@@ -14,4 +14,4 @@ public interface TenantMapperEx {
Long countsByTenant(
@Param("loginName") String loginName);
}
}

View File

@@ -1,6 +1,5 @@
package com.jsh.erp.datasource.mappers;
import com.baomidou.mybatisplus.annotation.SqlParser;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.entities.UserEx;
import com.jsh.erp.datasource.entities.UserExample;
@@ -29,18 +28,12 @@ public interface UserMapperEx {
int addUser(UserEx ue);
int updateUser(UserEx ue);
/**
* 这个查询不添加租户id保证登录名全局唯一
* */
List<User> getUserListByLoginName(@Param("loginame") String loginame);
List<User> getUserListByUserNameOrLoginName(@Param("userName") String userName,
@Param("loginame") String loginame);
int batDeleteOrUpdateUser(@Param("ids") String ids[], @Param("status") byte status);
List<TreeNodeEx> getNodeTree();
List<TreeNodeEx> getNextNodeTree(Map<String, Object> parameterMap);
List<User> getUserListByUserNameAndTenantId(@Param("userName")String userName, @Param("tenantId")Long tenantId);
String addRegisterUserNotInclueUser(@Param("userId") Long userId,@Param("tenantId") Long tenantId,@Param("roleId") Long roleId);
List<User> getUserListByloginNameAndPassword(@Param("loginame")String loginame, @Param("password")String password);
}

View File

@@ -9,7 +9,6 @@ import com.jsh.erp.datasource.mappers.AccountHeadMapper;
import com.jsh.erp.datasource.mappers.AccountHeadMapperEx;
import com.jsh.erp.datasource.mappers.AccountItemMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.accountItem.AccountItemService;
import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
@@ -24,7 +23,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -44,8 +42,6 @@ public class AccountHeadService {
private LogService logService;
@Resource
private AccountItemMapperEx accountItemMapperEx;
@Resource
private AccountItemService accountItemService;
public AccountHead getAccountHead(long id) throws Exception {
AccountHead result=null;
@@ -162,6 +158,16 @@ public class AccountHeadService {
return list==null?0:list.size();
}
public Long getMaxId()throws Exception {
Long result = null;
try{
result = accountHeadMapperEx.getMaxId();
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
public BigDecimal findAllMoney(Integer supplierId, String type, String mode, String endTime) {
String modeName = "";
if (mode.equals("实际")) {
@@ -306,49 +312,4 @@ public class AccountHeadService {
deleteTotal= batchDeleteAccountHeadByIds(ids);
return deleteTotal;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void addAccountHeadAndDetail(String beanJson, String inserted, String deleted, String updated, String listType) throws Exception {
/**处理财务信息*/
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
try{
accountHeadMapperEx.addAccountHead(accountHead);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
/**
* create by: qiankunpingtai
* create time: 2019/5/22 10:30
* websitehttps://qiankunpingtai.cn
* description:
* 处理财务明细信息
*
*/
accountItemService.saveDetials(inserted, deleted, updated, accountHead.getId(), listType);
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void updateAccountHeadAndDetail(Long id, String beanJson, String inserted, String deleted, String updated, String listType)throws Exception {
/**更新财务信息*/
AccountHead accountHead = JSONObject.parseObject(beanJson, AccountHead.class);
accountHead.setId(id);
try{
accountHeadMapperEx.updateAccountHead(accountHead);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
/**
* create by: qiankunpingtai
* create time: 2019/5/22 10:30
* websitehttps://qiankunpingtai.cn
* description:
* 更新财务明细信息
*/
accountItemService.saveDetials(inserted, deleted, updated, accountHead.getId(), listType);
}
}

View File

@@ -228,15 +228,16 @@ public class DepotHeadService {
/**
* 创建一个唯一的序列号
* */
public String buildOnlyNumber()throws Exception{
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public String buildOnlyNumber()throws Exception{
Long buildOnlyNumber=null;
synchronized (this){
try{
depotHeadMapperEx.updateBuildOnlyNumber(); //编号+1
buildOnlyNumber= depotHeadMapperEx.getBuildOnlyNumber(BusinessConstants.DEPOT_NUMBER_SEQ);
}catch(Exception e){
JshException.writeFail(logger, e);
}
}
if(buildOnlyNumber<BusinessConstants.SEQ_TO_STRING_MIN_LENGTH){
StringBuffer sb=new StringBuffer(buildOnlyNumber.toString());
@@ -250,7 +251,15 @@ public class DepotHeadService {
}
}
public Long getMaxId()throws Exception {
Long result = null;
try{
result = depotHeadMapperEx.getMaxId();
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
public String findMaterialsListByHeaderId(Long id)throws Exception {
String result = null;
@@ -460,7 +469,7 @@ public class DepotHeadService {
* @return java.lang.String
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void addDepotHeadAndDetail(String beanJson, String inserted, String deleted, String updated) throws Exception {
public void addDepotHeadAndDetail(String beanJson, String inserted, String deleted, String updated,Long tenantId) throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_HEAD,
BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
@@ -485,7 +494,7 @@ public class DepotHeadService {
}
}
/**入库和出库处理单据子表信息*/
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId());
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId);
/**如果关联单据号非空则更新订单的状态为2 */
if(depotHead.getLinknumber()!=null) {
DepotHead depotHeadOrders = new DepotHead();
@@ -537,7 +546,7 @@ public class DepotHeadService {
}
}
/**入库和出库处理单据子表信息*/
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId());
depotItemService.saveDetials(inserted,deleted,updated,depotHead.getId(),tenantId);
}
/**

View File

@@ -32,7 +32,6 @@ import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Service
public class DepotItemService {
@@ -65,10 +64,7 @@ public class DepotItemService {
try{
result=depotItemMapper.selectByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -80,10 +76,7 @@ public class DepotItemService {
try{
list=depotItemMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -93,10 +86,7 @@ public class DepotItemService {
try{
list=depotItemMapperEx.selectByConditionDepotItem(name, type, remark, offset, rows);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -106,10 +96,7 @@ public class DepotItemService {
try{
result=depotItemMapperEx.countsByDepotItem(name, type, remark);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -121,10 +108,7 @@ public class DepotItemService {
try{
result=depotItemMapper.insertSelective(depotItem);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -137,10 +121,7 @@ public class DepotItemService {
try{
result=depotItemMapper.updateByPrimaryKeySelective(depotItem);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
@@ -151,10 +132,7 @@ public class DepotItemService {
try{
result=depotItemMapper.deleteByPrimaryKey(id);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -168,10 +146,7 @@ public class DepotItemService {
try{
result=depotItemMapper.deleteByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -183,10 +158,7 @@ public class DepotItemService {
try{
list=depotItemMapper.selectByExample(example);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list==null?0:list.size();
}
@@ -201,10 +173,7 @@ public class DepotItemService {
try{
list = depotItemMapperEx.findDetailByTypeAndMaterialIdList(mId, QueryUtils.offset(map), QueryUtils.rows(map));
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return list;
}
@@ -245,13 +214,6 @@ public class DepotItemService {
}
return result;
}
public int findByTypeAndMaterialIdAndDepotId(String type, Long mId, Long depotId) {
if(type.equals(TYPE)) {
return depotItemMapperEx.findByTypeAndDepotIdAndMaterialIdIn(depotId, mId);
} else {
return depotItemMapperEx.findByTypeAndDepotIdAndMaterialIdOut(depotId, mId);
}
}
public List<DepotItemVo4WithInfoEx> getDetailList(Long headerId)throws Exception {
List<DepotItemVo4WithInfoEx> list =null;
@@ -292,13 +254,12 @@ public class DepotItemService {
result= depotItemMapperEx.buyOrSalePrice(type, subType, MId, MonthTime, sumType);
}
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
return result;
}
/**
* 统计采购或销售的总金额
* @param type
@@ -317,14 +278,13 @@ public class DepotItemService {
return result;
}
/**
* 2019-02-02修改
* 我之前对操作数量的理解有偏差
* 这里重点重申一下BasicNumber=OperNumber*ratio
* */
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public String saveDetials(String inserted, String deleted, String updated, Long headerId) throws Exception{
public String saveDetials(String inserted, String deleted, String updated, Long headerId, Long tenantId) throws Exception{
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM,
BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
@@ -333,185 +293,183 @@ public class DepotItemService {
try{
depotHead =depotHeadMapper.selectByPrimaryKey(headerId);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
JshException.readFail(logger, e);
}
//获得当前操作人
User userInfo=userService.getCurrentUser();
//转为json
JSONArray insertedJson = JSONArray.parseArray(inserted);
JSONArray deletedJson = JSONArray.parseArray(deleted);
JSONArray updatedJson = JSONArray.parseArray(updated);
/**
* 2019-01-28优先处理删除的
* 删除的可以继续卖,删除的需要将使用的序列号回收
* 插入的需要判断当前货源是否充足
* 更新的需要判断货源是否充足
* */
if (null != deletedJson) {
StringBuffer bf=new StringBuffer();
for (int i = 0; i < deletedJson.size(); i++) {
//首先回收序列号,如果是调拨,不用处理序列号
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
DepotItem depotItem = getDepotItem(tempDeletedJson.getLong("Id"));
JSONArray insertedJson = JSONArray.parseArray(inserted);
JSONArray deletedJson = JSONArray.parseArray(deleted);
JSONArray updatedJson = JSONArray.parseArray(updated);
/**
* 2019-01-28优先处理删除的
* 删除的可以继续卖,删除的需要将使用的序列号回收
* 插入的需要判断当前货源是否充足
* 更新的需要判断货源是否充足
* */
if (null != deletedJson) {
StringBuffer bf=new StringBuffer();
for (int i = 0; i < deletedJson.size(); i++) {
//首先回收序列号,如果是调拨,不用处理序列号
JSONObject tempDeletedJson = JSONObject.parseObject(deletedJson.getString(i));
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())){
DepotItem depotItem = getDepotItem(tempDeletedJson.getLong("Id"));
if(depotItem==null){
continue;
}
/**
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */
Material material= materialService.getMaterial(depotItem.getMaterialid());
if(material==null){
continue;
}
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())){
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
userInfo);
}
}
this.deleteDepotItem(tempDeletedJson.getLong("Id"));
bf.append(tempDeletedJson.getLong("Id"));
if(i<(deletedJson.size()-1)){
bf.append(",");
}
}
this.batchDeleteDepotItemByIds(bf.toString());
}
if (null != insertedJson) {
for (int i = 0; i < insertedJson.size(); i++) {
DepotItem depotItem = new DepotItem();
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
depotItem.setHeaderid(headerId);
depotItem.setMaterialid(tempInsertedJson.getLong("MaterialId"));
depotItem.setMunit(tempInsertedJson.getString("Unit"));
if (!StringUtil.isEmpty(tempInsertedJson.get("OperNumber").toString())) {
depotItem.setOpernumber(tempInsertedJson.getBigDecimal("OperNumber"));
try {
String Unit = tempInsertedJson.get("Unit").toString();
BigDecimal oNumber = tempInsertedJson.getBigDecimal("OperNumber");
Long mId = Long.parseLong(tempInsertedJson.get("MaterialId").toString());
/***
* 为什么调用的方法要先把基础单位去掉,去掉之后后续还能获取到?
* */
//以下进行单位换算
// String UnitName = findUnitName(mId); //查询计量单位名称
String unitName = materialService.findUnitName(mId);
if (!StringUtil.isEmpty(unitName)) {
String unitList = unitName.substring(0, unitName.indexOf("("));
String ratioList = unitName.substring(unitName.indexOf("("));
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
if (Unit.equals(basicUnit)) { //如果等于基础单位
depotItem.setBasicnumber(oNumber); //数量一致
} else if (Unit.equals(otherUnit)) { //如果等于副单位
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio)) ); //数量乘以比例
}
} else {
depotItem.setBasicnumber(oNumber); //其他情况
}
} catch (Exception e) {
logger.error(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e);
}
}
if (!StringUtil.isEmpty(tempInsertedJson.get("UnitPrice").toString())) {
depotItem.setUnitprice(tempInsertedJson.getBigDecimal("UnitPrice"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxUnitPrice").toString())) {
depotItem.setTaxunitprice(tempInsertedJson.getBigDecimal("TaxUnitPrice"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("AllPrice").toString())) {
depotItem.setAllprice(tempInsertedJson.getBigDecimal("AllPrice"));
}
depotItem.setRemark(tempInsertedJson.getString("Remark"));
if (tempInsertedJson.get("DepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("DepotId").toString())) {
depotItem.setDepotid(tempInsertedJson.getLong("DepotId"));
}
if (tempInsertedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("AnotherDepotId").toString())) {
depotItem.setAnotherdepotid(tempInsertedJson.getLong("AnotherDepotId"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxRate").toString())) {
depotItem.setTaxrate(tempInsertedJson.getBigDecimal("TaxRate"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxMoney").toString())) {
depotItem.setTaxmoney(tempInsertedJson.getBigDecimal("TaxMoney"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxLastMoney").toString())) {
depotItem.setTaxlastmoney(tempInsertedJson.getBigDecimal("TaxLastMoney"));
}
if (tempInsertedJson.get("OtherField1") != null) {
depotItem.setOtherfield1(tempInsertedJson.getString("OtherField1"));
}
if (tempInsertedJson.get("OtherField2") != null) {
depotItem.setOtherfield2(tempInsertedJson.getString("OtherField2"));
}
if (tempInsertedJson.get("OtherField3") != null) {
depotItem.setOtherfield3(tempInsertedJson.getString("OtherField3"));
}
if (tempInsertedJson.get("OtherField4") != null) {
depotItem.setOtherfield4(tempInsertedJson.getString("OtherField4"));
}
if (tempInsertedJson.get("OtherField5") != null) {
depotItem.setOtherfield5(tempInsertedJson.getString("OtherField5"));
}
if (tempInsertedJson.get("MType") != null) {
depotItem.setMtype(tempInsertedJson.getString("MType"));
}
/**
* 出库时判断库存是否充足
* */
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
if(depotItem==null){
continue;
}
Material material= materialService.getMaterial(depotItem.getMaterialid());
if(material==null){
continue;
}
BigDecimal stock = getStockByParam(depotItem.getDepotid(),depotItem.getMaterialid(),null,null,tenantId);
BigDecimal thisBasicNumber = depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber();
if(stock.compareTo(thisBasicNumber)<0){
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
}
/**出库时处理序列号*/
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
/**
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
//查询单据子表中开启序列号的数据列表
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
}
}
}
this.insertDepotItemWithObj(depotItem);
}
}
if (null != updatedJson) {
for (int i = 0; i < updatedJson.size(); i++) {
JSONObject tempUpdatedJson = JSONObject.parseObject(updatedJson.getString(i));
DepotItem depotItem = this.getDepotItem(tempUpdatedJson.getLong("Id"));
if(depotItem==null){
continue;
}
/**
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */
Material material= materialService.getMaterial(depotItem.getMaterialid());
if(material==null){
continue;
}
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())){
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
userInfo);
}
}
this.deleteDepotItem(tempDeletedJson.getLong("Id"));
bf.append(tempDeletedJson.getLong("Id"));
if(i<(deletedJson.size()-1)){
bf.append(",");
}
}
this.batchDeleteDepotItemByIds(bf.toString());
}
if (null != insertedJson) {
for (int i = 0; i < insertedJson.size(); i++) {
DepotItem depotItem = new DepotItem();
JSONObject tempInsertedJson = JSONObject.parseObject(insertedJson.getString(i));
depotItem.setHeaderid(headerId);
depotItem.setMaterialid(tempInsertedJson.getLong("MaterialId"));
depotItem.setMunit(tempInsertedJson.getString("Unit"));
Material material= materialService.getMaterial(depotItem.getMaterialid());
if (!StringUtil.isEmpty(tempInsertedJson.get("OperNumber").toString())) {
depotItem.setOpernumber(tempInsertedJson.getBigDecimal("OperNumber"));
String Unit = tempInsertedJson.get("Unit").toString();
BigDecimal oNumber = tempInsertedJson.getBigDecimal("OperNumber");
Long mId = Long.parseLong(tempInsertedJson.get("MaterialId").toString());
/***
* 为什么调用的方法要先把基础单位去掉,去掉之后后续还能获取到?
* */
//以下进行单位换算
// String UnitName = findUnitName(mId); //查询计量单位名称
String unitName = materialService.findUnitName(mId);
if (!StringUtil.isEmpty(unitName)) {
String unitList = unitName.substring(0, unitName.indexOf("("));
String ratioList = unitName.substring(unitName.indexOf("("));
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
if (Unit.equals(basicUnit)) { //如果等于基础单位
depotItem.setBasicnumber(oNumber); //数量一致
} else if (Unit.equals(otherUnit)) { //如果等于副单位
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio)) ); //数量乘以比例
}else{
//不等于基础单位也不等于副单位,单位存在问题
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_CODE,
String.format(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_MSG,material==null?"":material.getName(),Unit,basicUnit,otherUnit));
}
} else {
depotItem.setBasicnumber(oNumber); //其他情况
}
}
if (!StringUtil.isEmpty(tempInsertedJson.get("UnitPrice").toString())) {
depotItem.setUnitprice(tempInsertedJson.getBigDecimal("UnitPrice"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxUnitPrice").toString())) {
depotItem.setTaxunitprice(tempInsertedJson.getBigDecimal("TaxUnitPrice"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("AllPrice").toString())) {
depotItem.setAllprice(tempInsertedJson.getBigDecimal("AllPrice"));
}
depotItem.setRemark(tempInsertedJson.getString("Remark"));
if (tempInsertedJson.get("DepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("DepotId").toString())) {
depotItem.setDepotid(tempInsertedJson.getLong("DepotId"));
}
if (tempInsertedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempInsertedJson.get("AnotherDepotId").toString())) {
depotItem.setAnotherdepotid(tempInsertedJson.getLong("AnotherDepotId"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxRate").toString())) {
depotItem.setTaxrate(tempInsertedJson.getBigDecimal("TaxRate"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxMoney").toString())) {
depotItem.setTaxmoney(tempInsertedJson.getBigDecimal("TaxMoney"));
}
if (!StringUtil.isEmpty(tempInsertedJson.get("TaxLastMoney").toString())) {
depotItem.setTaxlastmoney(tempInsertedJson.getBigDecimal("TaxLastMoney"));
}
if (tempInsertedJson.get("OtherField1") != null) {
depotItem.setOtherfield1(tempInsertedJson.getString("OtherField1"));
}
if (tempInsertedJson.get("OtherField2") != null) {
depotItem.setOtherfield2(tempInsertedJson.getString("OtherField2"));
}
if (tempInsertedJson.get("OtherField3") != null) {
depotItem.setOtherfield3(tempInsertedJson.getString("OtherField3"));
}
if (tempInsertedJson.get("OtherField4") != null) {
depotItem.setOtherfield4(tempInsertedJson.getString("OtherField4"));
}
if (tempInsertedJson.get("OtherField5") != null) {
depotItem.setOtherfield5(tempInsertedJson.getString("OtherField5"));
}
if (tempInsertedJson.get("MType") != null) {
depotItem.setMtype(tempInsertedJson.getString("MType"));
}
/**
* 出库时判断库存是否充足
* */
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
if(depotItem==null){
continue;
}
if(material==null){
continue;
}
if(getCurrentRepByMaterialIdAndDepotId(material.getId(),depotItem.getDepotid()).compareTo(depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber())==-1){
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
}
/**出库时处理序列号*/
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
//首先回收序列号
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())
&&!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
/**
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
//查询单据子表中开启序列号的数据列表
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
}
}
}
this.insertDepotItemWithObj(depotItem);
}
}
if (null != updatedJson) {
for (int i = 0; i < updatedJson.size(); i++) {
JSONObject tempUpdatedJson = JSONObject.parseObject(updatedJson.getString(i));
DepotItem depotItem = this.getDepotItem(tempUpdatedJson.getLong("Id"));
if(depotItem==null){
continue;
}
Material material= materialService.getMaterial(depotItem.getMaterialid());
if(material==null){
continue;
}
//首先回收序列号
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())) {
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
/**
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */
if (BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), (depotItem.getBasicnumber() == null ? 0 : depotItem.getBasicnumber()).intValue(),
serialNumberService.cancelSerialNumber(depotItem.getMaterialid(), depotItem.getHeaderid(), (depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),
userInfo);
}
/**收回序列号的时候释放库存*/
@@ -519,104 +477,102 @@ public class DepotItemService {
depotItem.setBasicnumber(BigDecimal.ZERO);
this.updateDepotItemWithObj(depotItem);
}
}
depotItem.setId(tempUpdatedJson.getLong("Id"));
depotItem.setMaterialid(tempUpdatedJson.getLong("MaterialId"));
depotItem.setMunit(tempUpdatedJson.getString("Unit"));
if(!material.getId().equals(depotItem.getMaterialid())){
material= materialService.getMaterial(depotItem.getMaterialid());
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("OperNumber").toString())) {
depotItem.setOpernumber(tempUpdatedJson.getBigDecimal("OperNumber"));
String Unit = tempUpdatedJson.get("Unit").toString();
BigDecimal oNumber = tempUpdatedJson.getBigDecimal("OperNumber");
Long mId = Long.parseLong(tempUpdatedJson.get("MaterialId").toString());
//以下进行单位换算
// String UnitName = findUnitName(mId); //查询计量单位名称
String unitName = materialService.findUnitName(mId);
if (!StringUtil.isEmpty(unitName)) {
String unitList = unitName.substring(0, unitName.indexOf("("));
String ratioList = unitName.substring(unitName.indexOf("("));
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
if (Unit.equals(basicUnit)) { //如果等于基础单位
depotItem.setBasicnumber(oNumber); //数量一致
} else if (Unit.equals(otherUnit)) { //如果等于副单位
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio))); //数量乘以比例
}else{
//不等于基础单位也不等于副单位,单位存在问题
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_CODE,
String.format(ExceptionConstants.MATERIAL_UNIT_NOT_RIGHT_MSG,material==null?"":material.getName(),Unit,basicUnit,otherUnit));
}
} else {
depotItem.setBasicnumber(oNumber); //其他情况
}
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("UnitPrice").toString())) {
depotItem.setUnitprice(tempUpdatedJson.getBigDecimal("UnitPrice"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxUnitPrice").toString())) {
depotItem.setTaxunitprice(tempUpdatedJson.getBigDecimal("TaxUnitPrice"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("AllPrice").toString())) {
depotItem.setAllprice(tempUpdatedJson.getBigDecimal("AllPrice"));
}
depotItem.setRemark(tempUpdatedJson.getString("Remark"));
if (tempUpdatedJson.get("DepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("DepotId").toString())) {
depotItem.setDepotid(tempUpdatedJson.getLong("DepotId"));
}
if (tempUpdatedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("AnotherDepotId").toString())) {
depotItem.setAnotherdepotid(tempUpdatedJson.getLong("AnotherDepotId"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxRate").toString())) {
depotItem.setTaxrate(tempUpdatedJson.getBigDecimal("TaxRate"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxMoney").toString())) {
depotItem.setTaxmoney(tempUpdatedJson.getBigDecimal("TaxMoney"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxLastMoney").toString())) {
depotItem.setTaxlastmoney(tempUpdatedJson.getBigDecimal("TaxLastMoney"));
}
depotItem.setOtherfield1(tempUpdatedJson.getString("OtherField1"));
depotItem.setOtherfield2(tempUpdatedJson.getString("OtherField2"));
depotItem.setOtherfield3(tempUpdatedJson.getString("OtherField3"));
depotItem.setOtherfield4(tempUpdatedJson.getString("OtherField4"));
depotItem.setOtherfield5(tempUpdatedJson.getString("OtherField5"));
depotItem.setMtype(tempUpdatedJson.getString("MType"));
/**
* create by: qiankunpingtai
* create time: 2019/3/25 15:18
* websitehttps://qiankunpingtai.cn
* description:
* 修改了商品类型时,库中的商品和页面传递的不同
* 这里需要重新获取页面传递的商品信息
*/
if(!material.getId().equals(depotItem.getMaterialid())){
if(material==null){
continue;
}
}
/**出库时处理序列号*/
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
if(getCurrentRepByMaterialIdAndDepotId(material.getId(),depotItem.getDepotid())
.compareTo(depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber())==-1){
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
}
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
/**
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
//查询单据子表中开启序列号的数据列表
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
depotItem.setId(tempUpdatedJson.getLong("Id"));
depotItem.setMaterialid(tempUpdatedJson.getLong("MaterialId"));
depotItem.setMunit(tempUpdatedJson.getString("Unit"));
if (!StringUtil.isEmpty(tempUpdatedJson.get("OperNumber").toString())) {
depotItem.setOpernumber(tempUpdatedJson.getBigDecimal("OperNumber"));
try {
String Unit = tempUpdatedJson.get("Unit").toString();
BigDecimal oNumber = tempUpdatedJson.getBigDecimal("OperNumber");
Long mId = Long.parseLong(tempUpdatedJson.get("MaterialId").toString());
//以下进行单位换算
// String UnitName = findUnitName(mId); //查询计量单位名称
String unitName = materialService.findUnitName(mId);
if (!StringUtil.isEmpty(unitName)) {
String unitList = unitName.substring(0, unitName.indexOf("("));
String ratioList = unitName.substring(unitName.indexOf("("));
String basicUnit = unitList.substring(0, unitList.indexOf(",")); //基本单位
String otherUnit = unitList.substring(unitList.indexOf(",") + 1); //副单位
Integer ratio = Integer.parseInt(ratioList.substring(ratioList.indexOf(":") + 1).replace(")", "")); //比例
if (Unit.equals(basicUnit)) { //如果等于基础单位
depotItem.setBasicnumber(oNumber); //数量一致
} else if (Unit.equals(otherUnit)) { //如果等于副单位
depotItem.setBasicnumber(oNumber.multiply(new BigDecimal(ratio))); //数量乘以比例
}
} else {
depotItem.setBasicnumber(oNumber); //其他情况
}
} catch (Exception e) {
logger.error(">>>>>>>>>>>>>>>>>>>设置基础数量异常", e);
}
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("UnitPrice").toString())) {
depotItem.setUnitprice(tempUpdatedJson.getBigDecimal("UnitPrice"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxUnitPrice").toString())) {
depotItem.setTaxunitprice(tempUpdatedJson.getBigDecimal("TaxUnitPrice"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("AllPrice").toString())) {
depotItem.setAllprice(tempUpdatedJson.getBigDecimal("AllPrice"));
}
depotItem.setRemark(tempUpdatedJson.getString("Remark"));
if (tempUpdatedJson.get("DepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("DepotId").toString())) {
depotItem.setDepotid(tempUpdatedJson.getLong("DepotId"));
}
if (tempUpdatedJson.get("AnotherDepotId") != null && !StringUtil.isEmpty(tempUpdatedJson.get("AnotherDepotId").toString())) {
depotItem.setAnotherdepotid(tempUpdatedJson.getLong("AnotherDepotId"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxRate").toString())) {
depotItem.setTaxrate(tempUpdatedJson.getBigDecimal("TaxRate"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxMoney").toString())) {
depotItem.setTaxmoney(tempUpdatedJson.getBigDecimal("TaxMoney"));
}
if (!StringUtil.isEmpty(tempUpdatedJson.get("TaxLastMoney").toString())) {
depotItem.setTaxlastmoney(tempUpdatedJson.getBigDecimal("TaxLastMoney"));
}
depotItem.setOtherfield1(tempUpdatedJson.getString("OtherField1"));
depotItem.setOtherfield2(tempUpdatedJson.getString("OtherField2"));
depotItem.setOtherfield3(tempUpdatedJson.getString("OtherField3"));
depotItem.setOtherfield4(tempUpdatedJson.getString("OtherField4"));
depotItem.setOtherfield5(tempUpdatedJson.getString("OtherField5"));
depotItem.setMtype(tempUpdatedJson.getString("MType"));
/**
* create by: qiankunpingtai
* create time: 2019/3/25 15:18
* websitehttps://qiankunpingtai.cn
* description:
* 修改了商品类型时,库中的商品和页面传递的不同
* 这里需要重新获取页面传递的商品信息
*/
if(!material.getId().equals(depotItem.getMaterialid())){
material= materialService.getMaterial(depotItem.getMaterialid());
if(material==null){
continue;
}
}
/**出库时处理序列号*/
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
BigDecimal stock = getStockByParam(depotItem.getDepotid(),depotItem.getMaterialid(),null,null,tenantId);
BigDecimal thisBasicNumber = depotItem.getBasicnumber()==null?BigDecimal.ZERO:depotItem.getBasicnumber();
if(stock.compareTo(thisBasicNumber)<0){
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG,material==null?"":material.getName()));
}
if(!BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubtype())) {
/**
* 判断商品是否开启序列号,开启的收回序列号,未开启的跳过
* */
if(BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableserialnumber())) {
//查询单据子表中开启序列号的数据列表
serialNumberService.checkAndUpdateSerialNumber(depotItem, userInfo);
}
}
}
this.updateDepotItemWithObj(depotItem);
}
this.updateDepotItemWithObj(depotItem);
}
}
return null;
}
/**
@@ -639,17 +595,7 @@ public class DepotItemService {
}
return unitName;
}
/**
* 查询商品当前库存数量是否充足,
*
* */
public int getCurrentInStock(Long materialId, Long depotId){
//入库数量
int inSum = findByTypeAndMaterialIdAndDepotId(BusinessConstants.DEPOTHEAD_TYPE_STORAGE, materialId, depotId);
//出库数量
int outSum = findByTypeAndMaterialIdAndDepotId(BusinessConstants.DEPOTHEAD_TYPE_OUT, materialId ,depotId);
return (inSum-outSum);
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteDepotItemByIds(String ids)throws Exception {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_DEPOT_ITEM,
@@ -661,10 +607,7 @@ public class DepotItemService {
try{
result =depotItemMapperEx.batchDeleteDepotItemByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
JshException.writeFail(logger, e);
}
return result;
}
@@ -690,35 +633,6 @@ public class DepotItemService {
}
return result;
}
/**
* create by: qiankunpingtai
* create time: 2019/5/16 18:15
* websitehttps://qiankunpingtai.cn
* description:
* 查询指定仓库指定材料的当前库存
*/
public BigDecimal getCurrentRepByMaterialIdAndDepotId(Long materialId,Long depotId) {
BigDecimal result = BigDecimal.ZERO;
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
Long tenantId=null;
Object tenantIdO = request.getSession().getAttribute("tenantId");
if(tenantIdO!=null){
//多租户模式租户id从当前用户获取
tenantId=Long.valueOf(tenantIdO.toString());
} else {
//无租户模式租户id为-1
tenantId=Long.valueOf(-1);
}
try{
result =depotItemMapperEx.getCurrentRepByMaterialIdAndDepotId(materialId,depotId,tenantId);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
return result;
}
/**
* 统计该商品已分批出库的总数量-用于订单

View File

@@ -24,7 +24,6 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
public class RoleService {
@@ -49,10 +48,12 @@ public class RoleService {
return result;
}
public List<Role> getRoleList(Map<String, String> parameterMap)throws Exception {
public List<Role> getRole()throws Exception {
RoleExample example = new RoleExample();
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Role> list=null;
try{
list=roleMapperEx.getRoleList(parameterMap);
list=roleMapper.selectByExample(example);
}catch(Exception e){
JshException.readFail(logger, e);
}

View File

@@ -379,29 +379,19 @@ public class SerialNumberService {
* @return void
*/
public void checkAndUpdateSerialNumber(DepotItem depotItem,User userInfo) throws Exception{
if(depotItem!=null){
//查询商品下已分配的可用序列号数量
int serialNumberSum=0;
try{
serialNumberSum= serialNumberMapperEx.countSerialNumberByMaterialIdAndDepotheadId(depotItem.getMaterialid(),null,BusinessConstants.IS_SELL_HOLD);
//BasicNumber=OperNumber*ratio
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
if((depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue()>serialNumberSum){
//获取商品名称
Material material= materialMapper.selectByPrimaryKey(depotItem.getMaterialid());
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_CODE,
String.format(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_MSG,material==null?"":material.getName()));
}
//商品下序列号充足,分配序列号
sellSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),userInfo);
}
if(depotItem!=null){
//查询商品下已分配的可用序列号数量
int SerialNumberSum= serialNumberMapperEx.countSerialNumberByMaterialIdAndDepotheadId(depotItem.getMaterialid(),null,BusinessConstants.IS_SELL_HOLD);
//BasicNumber=OperNumber*ratio
if((depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue()>SerialNumberSum){
//获取商品名称
Material material= materialMapper.selectByPrimaryKey(depotItem.getMaterialid());
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_CODE,
String.format(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_NOT_ENOUGH_MSG,material==null?"":material.getName()));
}
//商品下序列号充足,分配序列号
sellSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),userInfo);
}
}
/**
*
@@ -483,30 +473,25 @@ public class SerialNumberService {
int insertNum=0;
StringBuffer prefixBuf=new StringBuffer(serialNumberPrefix).append(million);
do{
list=new ArrayList<SerialNumberEx>();
int forNum = BusinessConstants.BATCH_INSERT_MAX_NUMBER>=batAddTotal?batAddTotal:BusinessConstants.BATCH_INSERT_MAX_NUMBER;
for(int i=0;i<forNum;i++){
insertNum++;
SerialNumberEx each=new SerialNumberEx();
each.setMaterialId(materialId);
each.setCreator(userId);
each.setCreateTime(date);
each.setUpdater(userId);
each.setUpdateTime(date);
each.setRemark(remark);
each.setSerialNumber(new StringBuffer(prefixBuf.toString()).append(insertNum).toString());
list.add(each);
}
int result=0;
try{
result = serialNumberMapperEx.batAddSerialNumber(list);
}catch(Exception e){
JshException.writeFail(logger, e);
}
list=new ArrayList<SerialNumberEx>();
int forNum = BusinessConstants.BATCH_INSERT_MAX_NUMBER>=batAddTotal?batAddTotal:BusinessConstants.BATCH_INSERT_MAX_NUMBER;
for(int i=0;i<forNum;i++){
insertNum++;
SerialNumberEx each=new SerialNumberEx();
each.setMaterialId(materialId);
each.setCreator(userId);
each.setCreateTime(date);
each.setUpdater(userId);
each.setUpdateTime(date);
each.setRemark(remark);
each.setSerialNumber(new StringBuffer(prefixBuf.toString()).append(insertNum).toString());
list.add(each);
}
try{
serialNumberMapperEx.batAddSerialNumber(list);
batAddTotal -= BusinessConstants.BATCH_INSERT_MAX_NUMBER;
}while(batAddTotal>0);
}catch(Exception e){
JshException.writeFail(logger, e);
}
}
}
/**

View File

@@ -209,7 +209,7 @@ public class SupplierService {
int result=0;
try{
if(supplier!=null){
supplier.setAdvancein((supplier.getAdvancein()==null?BigDecimal.ZERO:supplier.getAdvancein()).add(advanceIn)); //增加预收款的金额,可能增加的是负值
supplier.setAdvancein(supplier.getAdvancein().add(advanceIn)); //增加预收款的金额,可能增加的是负值
result=supplierMapper.updateByPrimaryKeySelective(supplier);
}
}catch(Exception e){

View File

@@ -45,7 +45,7 @@ public class TenantComponent implements ICommonQuery {
@Override
public int insert(String beanJson, HttpServletRequest request)throws Exception {
return tenantService.insertTenant(beanJson);
return tenantService.insertTenant(beanJson, request);
}
@Override

View File

@@ -68,7 +68,7 @@ public class TenantService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertTenant(String beanJson)throws Exception {
public int insertTenant(String beanJson, HttpServletRequest request)throws Exception {
Tenant tenant = JSONObject.parseObject(beanJson, Tenant.class);
int result=0;
try{

View File

@@ -21,7 +21,6 @@ import com.jsh.erp.service.userBusiness.UserBusinessService;
import com.jsh.erp.utils.ExceptionCodeConstants;
import com.jsh.erp.utils.StringUtil;
import com.jsh.erp.utils.Tools;
import org.apache.ibatis.annotations.DeleteProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@@ -219,33 +218,35 @@ public class UserService {
return result;
}
public int validateUser(String username, String password){
/**默认是可以登录的*/
List<User> list = null;
try {
list=this.getUserListByloginName(username);
} catch (Exception e) {
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
logger.error(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e);
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
}
public int validateUser(String username, String password) throws Exception {
/**默认是可以登录的*/
List<User> list = null;
try {
UserExample example = new UserExample();
example.createCriteria().andLoginameEqualTo(username);
list = userMapper.selectByExample(example);
} catch (Exception e) {
logger.error(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e);
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
}
if (null != list && list.size() == 0) {
return ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST;
}
User user=null;
try {
user = this.getUserListByloginNameAndPassword(username,password);
} catch (Exception e) {
logger.error(">>>>>>>>>>访问验证用户密码后台信息异常", e);
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
}
if (null != list && list.size() == 0) {
return ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST;
}
if (null == user ) {
return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR;
}
return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT;
try {
UserExample example = new UserExample();
example.createCriteria().andLoginameEqualTo(username).andPasswordEqualTo(password);
list = userMapper.selectByExample(example);
} catch (Exception e) {
logger.error(">>>>>>>>>>访问验证用户密码后台信息异常", e);
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
}
if (null != list && list.size() == 0) {
return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR;
}
return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT;
}
public User getUserByUserName(String username)throws Exception {
@@ -310,8 +311,7 @@ public class UserService {
BusinessConstants.LOG_OPERATION_TYPE_ADD,
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//检查用户名和登录名
checkLoginName(ue);
checkUserName(ue);
checkUserNameAndLoginName(ue);
//新增用户信息
ue= this.addUser(ue);
if(ue==null){
@@ -351,11 +351,7 @@ public class UserService {
* 3是否管理者默认为员工
* 4默认用户状态为正常
* */
//用户没有设置密码时,使用默认密码
if(StringUtil.isEmpty(ue.getPassword())){
ue.setPassword(Tools.md5Encryp(BusinessConstants.USER_DEFAULT_PASSWORD));
}
ue.setPassword(Tools.md5Encryp(BusinessConstants.USER_DEFAULT_PASSWORD));
ue.setIsystem(BusinessConstants.USER_NOT_SYSTEM);
if(ue.getIsmanager()==null){
ue.setIsmanager(BusinessConstants.USER_NOT_MANAGER);
@@ -374,7 +370,7 @@ public class UserService {
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public UserEx registerUser(UserEx ue, Long manageRoleId) throws Exception{
public UserEx registerUser(UserEx ue, Integer manageRoleId, HttpServletRequest request) throws Exception{
/**
* create by: qiankunpingtai
* create time: 2019/4/9 18:00
@@ -386,46 +382,42 @@ public class UserService {
throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE,
ExceptionConstants.USER_NAME_LIMIT_USE_MSG);
} else {
/**
* create by: qiankunpingtai
* create time: 2019/4/24 10:57
* websitehttps://qiankunpingtai.cn
* description:
* 检查登录名是否已存在
*
*/
checkLoginName(ue);
/**
* create by: qiankunpingtai
* create time: 2019/4/24 14:47
* websitehttps://qiankunpingtai.cn
* description:
* 注册一个新用户需要做如下操作
* 1、分配应用
* 2、分配功能模块
* 3、分配产品扩展字段
* 4、分配角色默认添加超级管理员角色不可修改
* 5、写入用户信息
* 6、写入用户角色应用功能关系
*/
ue=this.addUser(ue);
ue.setPassword(Tools.md5Encryp(ue.getPassword()));
ue.setIsystem(BusinessConstants.USER_NOT_SYSTEM);
if (ue.getIsmanager() == null) {
ue.setIsmanager(BusinessConstants.USER_NOT_MANAGER);
}
ue.setStatus(BusinessConstants.USER_STATUS_NORMAL);
int result=0;
try{
result= userMapperEx.addUser(ue);
}catch(Exception e){
JshException.writeFail(logger, e);
}
//更新租户id
User user = new User();
user.setId(ue.getId());
user.setTenantId(ue.getId());
userService.updateUserTenant(user);
addRegisterUserNotInclueUser(user.getId(),user.getTenantId(),manageRoleId);
// //新增用户与角色的关系
// JSONObject ubObj = new JSONObject();
// ubObj.put("type", "UserRole");
// ubObj.put("keyid", ue.getId());
// JSONArray ubArr = new JSONArray();
// ubArr.add(manageRoleId);
// ubObj.put("value", ubArr.toString());
// userBusinessService.insertUserBusiness(ubObj.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
return ue;
//新增用户与角色的关系
JSONObject ubObj = new JSONObject();
ubObj.put("type", "UserRole");
ubObj.put("keyid", ue.getId());
JSONArray ubArr = new JSONArray();
ubArr.add(manageRoleId);
ubObj.put("value", ubArr.toString());
userBusinessService.insertUserBusiness(ubObj.toString(), ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//创建租户信息
JSONObject tenantObj = new JSONObject();
tenantObj.put("tenantId", ue.getId());
tenantObj.put("loginName",ue.getLoginame());
String param = tenantObj.toJSONString();
tenantService.insertTenant(param, request);
logger.info("===============创建租户信息完成===============");
if (result > 0) {
return ue;
}
return null;
}
}
@@ -450,8 +442,7 @@ public class UserService {
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(ue.getId()).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
//检查用户名和登录名
checkLoginName(ue);
checkUserName(ue);
checkUserNameAndLoginName(ue);
//更新用户信息
ue = this.updateUser(ue);
if (ue == null) {
@@ -503,13 +494,14 @@ public class UserService {
return null;
}
/**
* create by: qiankunpingtai
* create time: 2019/4/24 11:02
* websitehttps://qiankunpingtai.cn
* create by: cjl
* description:
* 检查登录名全局唯一
* 检查用户名称和登录名不能重复
* create time: 2019/3/12 11:36
* @Param: userEx
* @return void
*/
public void checkLoginName(UserEx userEx)throws Exception{
public void checkUserNameAndLoginName(UserEx userEx)throws Exception{
List<User> list=null;
if(userEx==null){
return;
@@ -539,25 +531,10 @@ public class UserService {
}
}
}
/**
* create by: qiankunpingtai
* create time: 2019/4/24 11:02
* websitehttps://qiankunpingtai.cn
* description:
* 检查用户名同一个租户范围内内唯一
*
*/
public void checkUserName(UserEx userEx)throws Exception{
List<User> list=null;
if(userEx==null){
return;
}
Long userId=userEx.getId();
//检查用户名
if(!StringUtils.isEmpty(userEx.getUsername())){
String userName=userEx.getUsername();
list=this.getUserListByUserNameAndTenantId(userName,userEx.getTenantId());
list=this.getUserListByUserName(userName);
if(list!=null&&list.size()>0){
if(list.size()>1){
//超过一条数据存在,该用户名已存在
@@ -578,58 +555,32 @@ public class UserService {
}
}
}
/**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn
* description:
* 通过用户名和租户id获取用户信息
* create time: 2019/4/24 11:18
* @Param: userName
 * @Param: tenantId
* @return java.util.List<com.jsh.erp.datasource.entities.User>
*/
private List<User> getUserListByUserNameAndTenantId(String userName, Long tenantId) {
* 通过用户名获取用户列表
* */
public List<User> getUserListByUserName(String userName)throws Exception{
List<User> list =null;
try{
list=userMapperEx.getUserListByUserNameAndTenantId(userName,tenantId);
list=userMapperEx.getUserListByUserNameOrLoginName(userName,null);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
/**
* 通过登录名获取用户列表
* */
public List<User> getUserListByloginName(String loginName){
List<User> list =null;
try{
list=userMapperEx.getUserListByLoginName(loginName);
list=userMapperEx.getUserListByUserNameOrLoginName(null,loginName);
}catch(Exception e){
JshException.readFail(logger, e);
}
return list;
}
/**
* 通过登录名和密码获取用户列表
* */
public User getUserListByloginNameAndPassword(String loginName,String password){
List<User> list =null;
try{
list=userMapperEx.getUserListByloginNameAndPassword(loginName,password);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
if(list!=null&&list.size()>0){
return list.get(0);
}
return null;
}
/**
* 批量删除用户
* */
@@ -662,34 +613,4 @@ public class UserService {
}
return list;
}
/**
* create by: qiankunpingtai
* websitehttps://qiankunpingtai.cn
* description:
* 1、分配应用
* 2、分配功能模块
* 3、分配产品扩展字段
* 4、分配角色默认添加超级管理员角色不可修改
* 5、写入用户角色应用功能关系
* create time: 2019/4/26 9:37
* @Param: userId 用户id
 * @Param: tenantId 租户id
 * @Param: roleId 模板角色id
* @return java.lang.String
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public String addRegisterUserNotInclueUser(Long userId,Long tenantId,Long roleId)throws Exception {
String result =null;
try{
result=userMapperEx.addRegisterUserNotInclueUser(userId,tenantId,roleId);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_WRITE_FAIL_CODE,ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
ExceptionConstants.DATA_WRITE_FAIL_MSG);
}
return result;
}
}

View File

@@ -19,30 +19,7 @@ resource=src/main/resources
web.front.baseDir=erp_web
mybatis.type-aliases-package=com.jsh.erp.datasource.entities.*
mybatis.mapper-locations=classpath:./mapper_xml/*.xml
#开启sql打印
logging.level.com.jsh.erp.datasource.mappers=DEBUG
#日志
logging.config=classpath:logback-spring.xml
logging.level.com.didispace=DEBUG
logging.level.com.jsh.erp=debug
#pagehelper配置
pagehelper.helperDialect=mysql
pagehelper.offsetAsPageNum=true
pagehelper.rowBoundsWithCount=true
pagehelper.pageSizeZero=true
pagehelper.reasonable=false
pagehelper.params=pageNum=pageHelperStart;pageSize=pageHelperRows;
pagehelper.supportMethodsArguments=false
#mybatis-plus配置
mybatis-plus.mapper-locations=classpath:./mapper_xml/*.xml
#跳过某些方法过滤配置
mybatis-plus.global-config.sql-parser-cache=true
#获取管理系统信息
manage.roleId=10
#租户对应的角色id
manage.roleId=10

View File

@@ -1,197 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL如果设置为WARN则低于WARN的信息都不会输出 -->
<!-- scan:当此属性设置为true时配置文件如果发生改变将会被重新加载默认值为true -->
<!-- scanPeriod:设置监测配置文件是否有修改的时间间隔如果没有给出时间单位默认单位是毫秒。当scan为true时此属性生效。默认的时间间隔为1分钟。 -->
<!-- debug:当此属性设置为true时将打印出logback内部日志信息实时查看logback运行状态。默认值为false。 -->
<configuration scan="true" scanPeriod="10 seconds">
<configuration>
<property name="LOG_FILE" value="${logs.home}/jshERP"/>
<property name="LOG_PATTERN" value="%d{yyyy/MM/dd-HH:mm:ss} %-5level [%thread] %logger - %msg%n"/>
<!--<include resource="org/springframework/boot/logging/logback/base.xml" />-->
<contextName>logback</contextName>
<!-- name的值是变量的名称value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后可以使“${}”来使用变量。 -->
<property name="log.path" value="../logs/jshERP" />
<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!--输出到控制台-->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!--此日志appender是为开发使用只配置最底级别控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>debug</level>
</filter>
<encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
<!-- 设置字符集 -->
<charset>UTF-8</charset>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<!--输出到文件-->
<!-- 时间滚动输出 level为 DEBUG 日志 -->
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_debug.log</file>
<!--日志文件输出格式-->
<appender name="TIME_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_FILE}.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 设置字符集 -->
<pattern>${LOG_PATTERN}</pattern>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志归档 -->
<fileNamePattern>${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxHistory>10</maxHistory>
<totalSizeCap>1GB</totalSizeCap>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录debug级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>debug</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 INFO 日志 -->
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_info.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 每天日志归档路径以及格式 -->
<fileNamePattern>${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录info级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 WARN 日志 -->
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_warn.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录warn级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>warn</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 ERROR 日志 -->
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_error.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录ERROR级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!--
<logger>用来设置某一个包或者具体的某一个类的日志打印级别、
以及指定<appender>。<logger>仅有一个name属性
一个可选的level和一个可选的addtivity属性。
name:用来指定受此logger约束的某一个包或者具体的某一个类。
level:用来设置打印级别大小写无关TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF
还有一个特俗值INHERITED或者同义词NULL代表强制执行上级的级别。
如果未设置此属性那么当前logger将会继承上级的级别。
addtivity:是否向上级logger传递打印信息。默认是true。
-->
<!--<logger name="org.springframework.web" level="info"/>-->
<!--<logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/>-->
<!--
使用mybatis的时候sql语句是debug下才会打印而这里我们只配置了info所以想要查看sql语句的话有以下两种操作
第一种把<root level="info">改成<root level="DEBUG">这样就会打印sql不过这样日志那边会出现很多其他消息
第二种就是单独给dao下目录配置debug模式代码如下这样配置sql语句会打印其他还是正常info级别
-->
<!--
root节点是必选节点用来指定最基础的日志输出级别只有一个level属性
level:用来设置打印级别大小写无关TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF
不能设置为INHERITED或者同义词NULL。默认是DEBUG
可以包含零个或多个元素标识这个appender将会添加到这个logger。
-->
<!--开发环境:打印控制台
<springProfile name="dev">
<logger name="com.nmys.view" level="debug"/>
</springProfile>
-->
<root level="info">
<appender-ref ref="CONSOLE" />
<appender-ref ref="DEBUG_FILE" />
<appender-ref ref="INFO_FILE" />
<appender-ref ref="WARN_FILE" />
<appender-ref ref="ERROR_FILE" />
<root level="ERROR">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="TIME_FILE"/>
</root>
<!--生产环境:输出到文件-->
<!--<springProfile name="pro">-->
<!--<root level="info">-->
<!--<appender-ref ref="CONSOLE" />-->
<!--<appender-ref ref="DEBUG_FILE" />-->
<!--<appender-ref ref="INFO_FILE" />-->
<!--<appender-ref ref="ERROR_FILE" />-->
<!--<appender-ref ref="WARN_FILE" />-->
<!--</root>-->
<!--</springProfile>-->
<logger name="com.jsh" additivity="false" level="DEBUG">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="TIME_FILE"/>
</logger>
</configuration>

View File

@@ -15,18 +15,17 @@
left join jsh_person p on ah.HandsPersonId=p.id and ifnull(p.delete_Flag,'0') !='1'
left join jsh_account a on ah.AccountId=a.id and ifnull(a.delete_Flag,'0') !='1'
where 1=1
<if test="billNo != null and billNo != ''">
<bind name="billNo" value="'%' + _parameter.billNo + '%'"/>
and ah.BillNo like #{billNo}
<if test="billNo != null">
and ah.BillNo like '%${billNo}%'
</if>
<if test="type != null and type != ''">
and ah.Type= #{type}
<if test="type != null">
and ah.Type='${type}'
</if>
<if test="beginTime != null and beginTime != ''">
and ah.BillTime &gt;= #{beginTime}
<if test="beginTime != null">
and ah.BillTime &gt;= '${beginTime}'
</if>
<if test="endTime != null and endTime != ''">
and ah.BillTime &lt;= #{endTime}
<if test="endTime != null">
and ah.BillTime &lt;= '${endTime}'
</if>
and ifnull(ah.delete_Flag,'0') !='1'
order by ah.Id desc
@@ -41,27 +40,29 @@
COUNT(id)
FROM jsh_accounthead
WHERE 1=1
<if test="billNo != null and billNo != ''">
<bind name="billNo" value="'%' + _parameter.billNo + '%'"/>
and BillNo like #{billNo}
<if test="billNo != null">
and BillNo like '%${billNo}%'
</if>
<if test="type != null and type != ''">
and Type=#{type}
<if test="type != null">
and Type='${type}'
</if>
<if test="beginTime != null and beginTime != ''">
and BillTime &gt;= #{beginTime}
<if test="beginTime != null">
and BillTime &gt;= '${beginTime}'
</if>
<if test="endTime != null and endTime != ''">
and BillTime &lt;= #{endTime}
<if test="endTime != null">
and BillTime &lt;= '${endTime}'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getMaxId" resultType="java.lang.Long">
select max(Id) as Id from jsh_accounthead
</select>
<select id="findAllMoney" resultType="java.math.BigDecimal">
select sum(#{modeName}) as allMoney from jsh_accounthead
where Type=#{type}
and OrganId =#{supplierId} and BillTime <![CDATA[ <=#{endTime}]]>
select sum(${modeName}) as allMoney from jsh_accounthead
where Type='${type}'
and OrganId =${supplierId} and BillTime <![CDATA[ <='${endTime}']]>
and ifnull(delete_Flag,'0') !='1'
</select>
@@ -73,7 +74,7 @@
left join jsh_account a on ah.AccountId=a.id and ifnull(a.delete_Flag,'0') !='1'
where 1=1
<if test="billNo != null">
and ah.BillNo = #{billNo}
and ah.BillNo = '${billNo}'
</if>
and ifnull(ah.delete_Flag,'0') !='1'
</select>
@@ -123,56 +124,4 @@
)
and ifnull(delete_Flag,'0') !='1'
</select>
<insert id="addAccountHead" parameterType="com.jsh.erp.datasource.entities.AccountHead"
useGeneratedKeys="true" keyProperty="id" keyColumn="id">
insert into jsh_accounthead (Id, Type, OrganId,
HandsPersonId, ChangeAmount, TotalPrice,
AccountId, BillNo, BillTime,
Remark, tenant_id, delete_Flag
)
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{organid,jdbcType=BIGINT},
#{handspersonid,jdbcType=BIGINT}, #{changeamount,jdbcType=DECIMAL}, #{totalprice,jdbcType=DECIMAL},
#{accountid,jdbcType=BIGINT}, #{billno,jdbcType=VARCHAR}, #{billtime,jdbcType=TIMESTAMP},
#{remark,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR}
)
</insert>
<update id="updateAccountHead" parameterType="com.jsh.erp.datasource.entities.AccountHead">
update jsh_accounthead
<set>
<if test="type != null">
Type = #{type,jdbcType=VARCHAR},
</if>
<if test="organid != null">
OrganId = #{organid,jdbcType=BIGINT},
</if>
<if test="handspersonid != null">
HandsPersonId = #{handspersonid,jdbcType=BIGINT},
</if>
<if test="changeamount != null">
ChangeAmount = #{changeamount,jdbcType=DECIMAL},
</if>
<if test="totalprice != null">
TotalPrice = #{totalprice,jdbcType=DECIMAL},
</if>
<if test="accountid != null">
AccountId = #{accountid,jdbcType=BIGINT},
</if>
<if test="billno != null">
BillNo = #{billno,jdbcType=VARCHAR},
</if>
<if test="billtime != null">
BillTime = #{billtime,jdbcType=TIMESTAMP},
</if>
<if test="remark != null">
Remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
<if test="deleteFlag != null">
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
</if>
</set>
where Id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -11,16 +11,14 @@
select *
FROM jsh_accountitem
where 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
<if test="type != null">
and type=#{type}
and type=${type}
</if>
<if test="remark != null and remark != ''">
<bind name="remark" value="'%' + _parameter.remark + '%'"/>
and remark like #{remark}
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
<if test="offset != null and rows != null">
@@ -32,16 +30,14 @@
COUNT(id)
FROM jsh_accountitem
WHERE 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
<if test="type != null">
and type=#{type}
and type=${type}
</if>
<if test="remark != null and remark != ''">
<bind name="remark" value="'%' + _parameter.remark + '%'"/>
and remark like #{remark}
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
@@ -50,7 +46,7 @@
select ai.*,a.Name AccountName,ioi.Name InOutItemName
from jsh_accountitem ai left join jsh_account a on ai.AccountId=a.id and ifnull(a.delete_Flag,'0') !='1'
left join jsh_inoutitem ioi on ai.InOutItemId = ioi.id and ifnull(ioi.delete_Flag,'0') !='1'
where ai.HeaderId = #{headerId}
where ai.HeaderId = ${headerId}
and ifnull(ai.delete_Flag,'0') !='1'
order by ai.id asc
</select>

View File

@@ -19,17 +19,14 @@
select *
FROM jsh_account
where 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
<if test="serialNo != null and serialNo != ''">
<bind name="serialNo" value="'%' + _parameter.serialNo + '%'"/>
and SerialNo like #{serialNo}
<if test="serialNo != null">
and SerialNo like '%${serialNo}%'
</if>
<if test="remark != null and remark != ''">
<bind name="remark" value="'%' + _parameter.remark + '%'"/>
and remark like #{remark}
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
<if test="offset != null and rows != null">
@@ -42,17 +39,14 @@
COUNT(id)
FROM jsh_account
WHERE 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
<if test="serialNo != null and serialNo != ''">
<bind name="serialNo" value="'%' + _parameter.serialNo + '%'"/>
and SerialNo like #{serialNo}
<if test="serialNo != null">
and SerialNo like '%${serialNo}%'
</if>
<if test="remark != null and remark != ''">
<bind name="remark" value="'%' + _parameter.remark + '%'"/>
and remark like #{remark}
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
@@ -63,7 +57,7 @@
from jsh_depothead dh inner join jsh_supplier s on dh.OrganId = s.id and ifnull(s.delete_Flag,'0') !='1'
where 1=1
<if test="accountId != null">
and dh.AccountId=#{accountId}
and dh.AccountId=${accountId}
</if>
and ifnull(dh.delete_Flag,'0') !='1'
@@ -73,7 +67,7 @@
from jsh_accounthead ah inner join jsh_supplier s on ah.OrganId=s.id and ifnull(s.delete_Flag,'0') !='1'
where 1=1
<if test="accountId != null">
and ah.AccountId=#{accountId}
and ah.AccountId=${accountId}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
<!--明细中涉及的账户(收款,付款,收预付款) -->
@@ -83,7 +77,7 @@
inner join jsh_accountitem ai on ai.HeaderId=ah.Id and ifnull(ai.delete_Flag,'0') !='1'
where ah.Type in ('收款','付款','收预付款')
<if test="accountId != null">
and ai.AccountId=#{accountId}
and ai.AccountId=${accountId}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
<!--主表中转出的账户 -->
@@ -92,7 +86,7 @@
from jsh_accounthead ah inner join jsh_accountitem ai on ai.HeaderId=ah.Id and ifnull(ai.delete_Flag,'0') !='1'
where ah.Type='转账'
<if test="accountId != null">
and ah.AccountId=#{accountId}
and ah.AccountId=${accountId}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
<!--明细中被转入的账户 -->
@@ -101,7 +95,7 @@
from jsh_accounthead ah inner join jsh_accountitem ai on ai.HeaderId=ah.Id and ifnull(ai.delete_Flag,'0') !='1'
where ah.Type='转账'
<if test="accountId != null">
and ai.AccountId=#{accountId}
and ai.AccountId=${accountId}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
<!--多账户的情况 -->
@@ -111,8 +105,7 @@
from jsh_depothead dh inner join jsh_supplier s on dh.OrganId = s.id and ifnull(s.delete_Flag,'0') !='1'
where 1=1
<if test="accountId != null">
<bind name="accountId" value="'%' + _parameter.accountId + '%'"/>
and dh.AccountIdList like #{accountId}
and dh.AccountIdList like '%${accountId}%'
</if>
and ifnull(dh.delete_Flag,'0') !='1'
ORDER BY oTime desc
@@ -129,7 +122,7 @@
from jsh_depothead dh inner join jsh_supplier s on dh.OrganId = s.id and ifnull(s.delete_Flag,'0') !='1'
where 1=1
<if test="accountId != null">
and dh.AccountId=#{accountId}
and dh.AccountId=${accountId}
</if>
and ifnull(dh.delete_Flag,'0') !='1'
<!--主表收入和支出涉及的账户 -->
@@ -138,7 +131,7 @@
from jsh_accounthead ah inner join jsh_supplier s on ah.OrganId=s.id and ifnull(s.delete_Flag,'0') !='1'
where 1=1
<if test="accountId != null">
and ah.AccountId=#{accountId}
and ah.AccountId=${accountId}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
<!--明细中涉及的账户(收款,付款,收预付款) -->
@@ -148,7 +141,7 @@
inner join jsh_accountitem ai on ai.HeaderId=ah.Id and ifnull(ai.delete_Flag,'0') !='1'
where ah.Type in ('收款','付款','收预付款')
<if test="accountId != null">
and ai.AccountId=#{accountId}
and ai.AccountId=${accountId}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
<!--主表中转出的账户 -->
@@ -157,7 +150,7 @@
from jsh_accounthead ah inner join jsh_accountitem ai on ai.HeaderId=ah.Id and ifnull(ai.delete_Flag,'0') !='1'
where ah.Type='转账'
<if test="accountId != null">
and ah.AccountId=#{accountId}
and ah.AccountId=${accountId}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
<!--明细中被转入的账户 -->
@@ -166,7 +159,7 @@
from jsh_accounthead ah inner join jsh_accountitem ai on ai.HeaderId=ah.Id and ifnull(ai.delete_Flag,'0') !='1'
where ah.Type='转账'
<if test="accountId != null">
and ai.AccountId=#{accountId}
and ai.AccountId=${accountId}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
<!--多账户的情况 -->
@@ -175,8 +168,7 @@
from jsh_depothead dh inner join jsh_supplier s on dh.OrganId = s.id and ifnull(s.delete_Flag,'0') !='1'
where 1=1
<if test="accountId != null">
<bind name="accountId" value="'%' + _parameter.accountId + '%'"/>
and dh.AccountIdList like #{accountId}
and dh.AccountIdList like '%${accountId}%'
</if>
and ifnull(dh.delete_Flag,'0') !='1'
) cc

View File

@@ -42,8 +42,9 @@
</resultMap>
<select id="selectByConditionDepotHead" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="ResultMapEx">
select dh.*, s.supplier OrganName, p.name HandsPersonName, a.name AccountName
select distinct dh.*, d.name ProjectName, s.supplier OrganName, p.name HandsPersonName, a.name AccountName, dd.name AllocationProjectName
from jsh_depothead dh
left join jsh_depot d on dh.ProjectId=d.id and ifnull(d.delete_Flag,'0') !='1'
left join jsh_supplier s on dh.OrganId=s.id and ifnull(s.delete_Flag,'0') !='1'
left join jsh_person p on dh.HandsPersonId=p.id and ifnull(p.delete_Flag,'0') !='1'
left join jsh_account a on dh.AccountId=a.id and ifnull(a.delete_Flag,'0') !='1'
@@ -51,41 +52,28 @@
left join jsh_depotitem di on dh.Id = di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
left join jsh_material m on di.MaterialId = m.Id and ifnull(m.delete_Flag,'0') !='1'
where 1=1
<if test="type != null and type != ''">
and dh.Type=#{type}
<if test="type != null">
and dh.Type='${type}'
</if>
<if test="subType != null and subType != ''">
and dh.SubType=#{subType}
<if test="subType != null">
and dh.SubType='${subType}'
</if>
<if test="number != null and number != ''">
<bind name="number" value="'%' + _parameter.number + '%'"/>
and dh.Number like #{number}
<if test="number != null">
and dh.Number like '%${number}%'
</if>
<if test="beginTime != null and beginTime != ''">
and dh.OperTime >= #{beginTime}
<if test="beginTime != null">
and dh.OperTime >= '${beginTime}'
</if>
<if test="endTime != null and endTime != ''">
and dh.OperTime &lt;= #{endTime}
<if test="endTime != null">
and dh.OperTime &lt;= '${endTime}'
</if>
<if test="materialParam != null">
and (m.`Name` like '%${materialParam}%' or m.Model like '%${materialParam}%')
</if>
<if test="depotIds != null">
and di.DepotId in (${depotIds})
</if>
and ifnull(dh.delete_Flag,'0') !='1'
and exists (
select 0 from jsh_depotitem di
left join jsh_material m on di.MaterialId = m.Id and ifnull(m.delete_Flag,'0') !='1' and di.tenant_id=m.tenant_id
where 1=1
and dh.Id = di.HeaderId
and dh.tenant_id=di.tenant_id
and ifnull(di.delete_Flag,'0') !='1'
<if test="materialParam != null and materialParam != ''">
<bind name="materialParam" value="'%' + _parameter.materialParam + '%'"/>
and (m.Name like #{materialParam} or m.Model like #{materialParam})
</if>
<if test="depotIds != null and depotIds != ''">
and di.DepotId in
<foreach item="did" index="index" collection="depotIds.split(',')" open="(" separator="," close=")">
#{did}
</foreach>
</if>
)
order by dh.Id desc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
@@ -93,48 +81,35 @@
</select>
<select id="countsByDepotHead" resultType="java.lang.Long">
SELECT
COUNT(dh.id)
FROM jsh_depothead dh
left join jsh_supplier s on dh.OrganId=s.id and ifnull(s.delete_Flag,'0') !='1'
left join jsh_person p on dh.HandsPersonId=p.id and ifnull(p.delete_Flag,'0') !='1'
left join jsh_account a on dh.AccountId=a.id and ifnull(a.delete_Flag,'0') !='1'
COUNT(1) from
(select distinct jsh_depothead.* FROM jsh_depothead
left join jsh_depotitem di on jsh_depothead.Id = di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
left join jsh_material m on di.MaterialId = m.Id and ifnull(m.delete_Flag,'0') !='1'
WHERE 1=1
<if test="type != null and type != ''">
and dh.Type=#{type}
<if test="type != null">
and Type='${type}'
</if>
<if test="subType != null and subType != ''">
and dh.SubType=#{subType}
<if test="subType != null">
and SubType='${subType}'
</if>
<if test="number != null and number != ''">
<bind name="number" value="'%' + _parameter.number + '%'"/>
and dh.Number like #{number}
<if test="number != null">
and Number like '%${number}%'
</if>
<if test="beginTime != null and beginTime != ''">
and dh.OperTime >= #{beginTime}
<if test="beginTime != null">
and OperTime >= '${beginTime}'
</if>
<if test="endTime != null and endTime != ''">
and dh.OperTime &lt;= #{endTime}
<if test="endTime != null">
and OperTime &lt;= '${endTime}'
</if>
and ifnull(dh.delete_Flag,'0') !='1'
and exists (
select 0 from jsh_depotitem di
left join jsh_material m on di.MaterialId = m.Id and ifnull(m.delete_Flag,'0') !='1' and di.tenant_id=m.tenant_id
where 1=1
and dh.Id = di.HeaderId
and dh.tenant_id=di.tenant_id
and ifnull(di.delete_Flag,'0') !='1'
<if test="materialParam != null and materialParam != ''">
<bind name="materialParam" value="'%' + _parameter.materialParam + '%'"/>
and (m.Name like #{materialParam} or m.Model like #{materialParam})
<if test="materialParam != null">
and (m.`Name` like '%${materialParam}%' or m.Model like '%${materialParam}%')
</if>
<if test="depotIds != null and depotIds != ''">
and di.DepotId in
<foreach item="did" index="index" collection="depotIds.split(',')" open="(" separator="," close=")">
#{did}
</foreach>
<if test="depotIds != null">
and di.DepotId in (${depotIds})
</if>
)
and ifnull(jsh_depothead.delete_Flag,'0') !='1') tb
</select>
<select id="getMaxId" resultType="java.lang.Long">
select max(Id) as Id from jsh_depothead
</select>
@@ -143,7 +118,7 @@
select group_concat(concat(jsh_material.`Name`,' ',jsh_material.Model)) as mName
from jsh_depotitem
inner join jsh_material on jsh_depotitem.MaterialId = jsh_material.Id and ifnull(jsh_material.delete_Flag,'0') !='1'
where jsh_depotitem.HeaderId = #{id}
where jsh_depotitem.HeaderId = ${id}
and ifnull(jsh_depotitem.delete_Flag,'0') !='1'
</select>
@@ -155,21 +130,18 @@
inner join jsh_material m on m.id=di.MaterialId and ifnull(m.delete_Flag,'0') !='1'
inner join jsh_supplier s on s.id=dh.OrganId and ifnull(s.delete_Flag,'0') !='1'
inner join (select id,name as dName,delete_Flag from jsh_depot ) d on d.id=di.DepotId and ifnull(d.delete_Flag,'0') !='1'
where dh.OperTime >=#{beginTime} and dh.OperTime &lt;=#{endTime}
where dh.OperTime >='${beginTime}' and dh.OperTime &lt;='${endTime}'
<if test="oId != null">
and dh.OrganId = #{oId}
and dh.OrganId = ${oId}
</if>
<if test="pid != null">
and di.DepotId = #{pid}
and di.DepotId = ${pid}
</if>
<if test="pid == null and dids != null and dids != ''">
and di.DepotId in
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
#{did}
</foreach>
<if test="pid == null">
and di.DepotId in (${dids})
</if>
<if test="type != null and type != ''">
and dh.Type=#{type}
<if test="type != null">
and dh.Type='${type}'
</if>
and ifnull(dh.delete_Flag,'0') !='1'
ORDER BY OperTime DESC,Number desc
@@ -185,21 +157,18 @@
inner join jsh_material m on m.id=di.MaterialId and ifnull(m.delete_Flag,'0') !='1'
inner join jsh_supplier s on s.id=dh.OrganId and ifnull(s.delete_Flag,'0') !='1'
inner join (select id,name as dName,delete_Flag from jsh_depot) d on d.id=di.DepotId and ifnull(d.delete_Flag,'0') !='1'
where dh.OperTime >=#{beginTime} and dh.OperTime &lt;=#{endTime}
where dh.OperTime >='${beginTime}' and dh.OperTime &lt;='${endTime}'
<if test="oId != null">
and dh.OrganId = #{oId}
and dh.OrganId = ${oId}
</if>
<if test="pid != null">
and di.DepotId = #{pid}
and di.DepotId = ${pid}
</if>
<if test="pid == null and dids != null and dids != ''">
and di.DepotId in
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
#{did}
</foreach>
<if test="pid == null">
and di.DepotId in (${dids})
</if>
<if test="type != null and type != ''">
and dh.Type=#{type}
<if test="type != null">
and dh.Type='${type}'
</if>
and ifnull(dh.delete_Flag,'0') !='1'
ORDER BY OperTime DESC,Number desc
@@ -211,18 +180,15 @@
(select sum(jdi.BasicNumber) numSum from jsh_depothead jdh
INNER JOIN jsh_depotitem jdi on jdh.id=jdi.HeaderId and ifnull(jdi.delete_Flag,'0') !='1'
where jdi.MaterialId=di.MaterialId
and jdh.type=#{type} and jdh.OperTime >=#{beginTime} and jdh.OperTime &lt;=#{endTime}
and jdh.type='${type}' and jdh.OperTime >='${beginTime}' and jdh.OperTime &lt;='${endTime}'
<if test="oId != null">
and jdh.OrganId = #{oId}
and jdh.OrganId = ${oId}
</if>
<if test="pid != null">
and jdi.DepotId= #{pid}
and jdi.DepotId= ${pid}
</if>
<if test="pid == null and dids != null and dids != ''">
and jdi.DepotId in
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
#{did}
</foreach>
<if test="pid == null">
and jdi.DepotId in (${dids})
</if>
and ifnull(jdh.delete_Flag,'0') !='1'
) numSum,
@@ -230,18 +196,15 @@
(select sum(jdi.AllPrice) priceSum from jsh_depothead jdh
INNER JOIN jsh_depotitem jdi on jdh.id=jdi.HeaderId and ifnull(jdi.delete_Flag,'0') !='1'
where jdi.MaterialId=di.MaterialId
and jdh.type=#{type} and jdh.OperTime >=#{beginTime} and jdh.OperTime &lt;=#{endTime}
and jdh.type='${type}' and jdh.OperTime >='${beginTime}' and jdh.OperTime &lt;='${endTime}'
<if test="oId != null">
and jdh.OrganId = #{oId}
and jdh.OrganId = ${oId}
</if>
<if test="pid != null">
and jdi.DepotId= #{pid}
and jdi.DepotId= ${pid}
</if>
<if test="pid == null and dids != null and dids != ''">
and jdi.DepotId in
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
#{did}
</foreach>
<if test="pid == null">
and jdi.DepotId in (${dids})
</if>
and ifnull(jdh.delete_Flag,'0') !='1'
) priceSum
@@ -252,18 +215,15 @@
LEFT JOIN jsh_materialcategory on jsh_material.CategoryId=jsh_materialcategory.Id and ifnull(jsh_materialcategory.status,'0') !='2'
where ifnull(jsh_material.delete_Flag,'0') !='1'
) m
on m.Id=di.MaterialId where dh.type=#{type} and dh.OperTime >=#{beginTime} and dh.OperTime &lt;=#{endTime}
on m.Id=di.MaterialId where dh.type='${type}' and dh.OperTime >='${beginTime}' and dh.OperTime &lt;='${endTime}'
<if test="oId != null">
and dh.OrganId = #{oId}
and dh.OrganId = ${oId}
</if>
<if test="pid != null">
and di.DepotId= #{pid}
and di.DepotId= ${pid}
</if>
<if test="pid == null and dids != null and dids != ''">
and di.DepotId in
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
#{did}
</foreach>
<if test="pid == null">
and di.DepotId in (${dids})
</if>
and ifnull(dh.delete_Flag,'0') !='1'
GROUP BY di.MaterialId,m.mName,m.Model,m.categoryName
@@ -280,18 +240,15 @@
from jsh_material
LEFT JOIN jsh_materialcategory on jsh_material.CategoryId=jsh_materialcategory.Id and ifnull(jsh_materialcategory.status,'0') !='2'
where ifnull(jsh_material.delete_Flag,'0') !='1'
) m on m.Id=di.MaterialId where dh.type=#{type} and dh.OperTime >=#{beginTime} and dh.OperTime &lt;=#{endTime}
) m on m.Id=di.MaterialId where dh.type='${type}' and dh.OperTime >='${beginTime}' and dh.OperTime &lt;='${endTime}'
<if test="oId != null">
and dh.OrganId = #{oId}
and dh.OrganId = ${oId}
</if>
<if test="pid != null">
and di.DepotId= #{pid}
and di.DepotId= ${pid}
</if>
<if test="pid == null and dids != null and dids != ''">
and di.DepotId in
<foreach item="did" index="index" collection="dids.split(',')" open="(" separator="," close=")">
#{did}
</foreach>
<if test="pid == null">
and di.DepotId in (${dids})
</if>
and ifnull(dh.delete_Flag,'0') !='1'
GROUP BY di.MaterialId,m.mName,m.Model,m.categoryName) a
@@ -301,20 +258,20 @@
select dh.Number,concat(dh.SubType,dh.Type) as type,dh.DiscountLastMoney,dh.ChangeAmount,s.supplier supplierName,
date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime from jsh_depothead dh
inner join jsh_supplier s on s.id=dh.OrganId and ifnull(s.delete_Flag,'0') !='1'
where s.type=#{supType} and (dh.SubType!='其它' and dh.SubType!='采购订单' and dh.SubType!='销售订单')
and dh.OperTime >=#{beginTime} and dh.OperTime &lt;=#{endTime}
where s.type='${supType}' and (dh.SubType!='其它' and dh.SubType!='采购订单' and dh.SubType!='销售订单')
and dh.OperTime >='${beginTime}' and dh.OperTime &lt;='${endTime}'
<if test="organId != null">
and dh.OrganId=#{organId}
and dh.OrganId=${organId}
</if>
and ifnull(dh.delete_Flag,'0') !='1'
UNION ALL
select ah.BillNo Number,ah.Type as newType,ah.TotalPrice DiscountLastMoney,ah.ChangeAmount,s.supplier supplierName,
date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime from jsh_accounthead ah
inner join jsh_supplier s on s.id=ah.OrganId and ifnull(s.delete_Flag,'0') !='1'
where s.type=#{supType}
and ah.BillTime >=#{beginTime} and ah.BillTime &lt;=#{endTime}
where s.type='${supType}'
and ah.BillTime >='${beginTime}' and ah.BillTime &lt;='${endTime}'
<if test="organId != null">
and ah.OrganId=#{organId}
and ah.OrganId=${organId}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
ORDER BY oTime
@@ -328,27 +285,27 @@
(
select count(1) a from jsh_depothead dh
inner join jsh_supplier s on s.id=dh.OrganId and ifnull(s.delete_Flag,'0') !='1'
where s.type=#{supType} and (dh.SubType!='其它' and dh.SubType!='采购订单' and dh.SubType!='销售订单')
and dh.OperTime >=#{beginTime} and dh.OperTime &lt;=#{endTime}
where s.type='${supType}' and (dh.SubType!='其它' and dh.SubType!='采购订单' and dh.SubType!='销售订单')
and dh.OperTime >='${beginTime}' and dh.OperTime &lt;='${endTime}'
<if test="organId != null">
and dh.OrganId=#{organId}
and dh.OrganId=${organId}
</if>
and ifnull(dh.delete_Flag,'0') !='1'
UNION ALL
select count(1) a from jsh_accounthead ah
inner join jsh_supplier s on s.id=ah.OrganId and ifnull(s.delete_Flag,'0') !='1'
where s.type=#{supType}
and ah.BillTime >=#{beginTime} and ah.BillTime &lt;=#{endTime}
where s.type='${supType}'
and ah.BillTime >='${beginTime}' and ah.BillTime &lt;='${endTime}'
<if test="organId != null">
and ah.OrganId=#{organId}
and ah.OrganId=${organId}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
) cc
</select>
<select id="findAllMoney" resultType="java.math.BigDecimal">
select sum(#{modeName}) as allMoney from jsh_depothead where Type=#{type} and SubType = #{subType}
and OrganId =#{supplierId} and OperTime &lt;=#{endTime}
select sum(${modeName}) as allMoney from jsh_depothead where Type='${type}' and SubType = '${subType}'
and OrganId =${supplierId} and OperTime &lt;='${endTime}'
and ifnull(delete_Flag,'0') !='1'
</select>
@@ -362,7 +319,7 @@
left join jsh_depot dd on dh.AllocationProjectId=dd.id and ifnull(dd.delete_Flag,'0') !='1'
where 1=1
<if test="number != null">
and dh.Number=#{number}
and dh.Number='${number}'
</if>
and ifnull(dh.delete_Flag,'0') !='1'
</select>
@@ -477,8 +434,13 @@
</set>
where Id = #{id,jdbcType=BIGINT}
</update>
<update id="updateBuildOnlyNumber">
update tbl_sequence set current_val = current_val + 1 where seq_name = 'depot_number_seq'
</update>
<select id="getBuildOnlyNumber" resultType="java.lang.Long">
select _nextval(#{seq_name}) from dual;
select current_val from tbl_sequence where seq_name = 'depot_number_seq'
</select>
<update id="batchDeleteDepotHeadByIds">

View File

@@ -7,8 +7,6 @@
<result column="newType" jdbcType="VARCHAR" property="newtype" />
<result column="b_num" jdbcType="BIGINT" property="bnum" />
<result column="oTime" jdbcType="TIMESTAMP" property="otime" />
<result column="depotName" jdbcType="VARCHAR" property="depotName" />
<result column="depotInName" jdbcType="VARCHAR" property="depotInName" />
</resultMap>
<resultMap extends="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap" id="ResultAndMaterialMap" type="com.jsh.erp.datasource.entities.DepotItemVo4Material">
@@ -65,16 +63,14 @@
select *
FROM jsh_depotitem
where 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
<if test="type != null">
and type=#{type}
and type=${type}
</if>
<if test="remark != null and remark != ''">
<bind name="remark" value="'%' + _parameter.remark + '%'"/>
and remark like #{remark}
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
<if test="offset != null and rows != null">
@@ -87,32 +83,20 @@
COUNT(id)
FROM jsh_depotitem
WHERE 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
<if test="type != null">
and type=#{type}
and type=${type}
</if>
<if test="remark != null and remark != ''">
<bind name="remark" value="'%' + _parameter.remark + '%'"/>
and remark like #{remark}
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="findDetailByTypeAndMaterialIdList" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="DetailByTypeAndMIdResultMap">
select dh.Number,concat(dh.SubType,dh.Type) as newType,
case when dh.type='入库' then ifnull(di.BasicNumber,0)
when dh.type='出库' and dh.SubType!='调拨' then 0 - ifnull(di.BasicNumber,0)
when dh.SubType='组装单' and di.MType='组合件' then ifnull(di.BasicNumber,0)
when dh.SubType='组装单' and di.MType='普通子件' then 0-ifnull(di.BasicNumber,0)
when dh.SubType='拆卸单' and di.MType='普通子件' then ifnull(di.BasicNumber,0)
when dh.SubType='拆卸单' and di.MType='组合件' then 0-ifnull(di.BasicNumber,0)
when dh.SubType='调拨' then 0-ifnull(di.BasicNumber,0)
else 0 end as b_num,
date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime,
depot.name as depotName,depotIn.name as depotInName
case
when type='入库' then ifnull(di.BasicNumber,0)
when type='出库' then 0-di.BasicNumber
@@ -126,11 +110,6 @@
date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime
from jsh_depothead dh
INNER JOIN jsh_depotitem di on dh.id=di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
left join jsh_depot depot on depot.id=di.depotId and ifnull(depot.delete_Flag,'0') !='1'
left join jsh_depot depotIn on depotIn.id=di.AnotherDepotId and ifnull(depotIn.delete_Flag,'0') !='1'
where 1=1
and dh.SubType not in('采购订单','销售订单')
and di.MaterialId =#{mId}
where ((dh.type!='其它' and dh.SubType!='调拨')
or (dh.type='其它' and dh.SubType='组装单')
or (dh.type='其它' and dh.SubType='拆卸单'))
@@ -146,28 +125,12 @@
select count(1)
from jsh_depothead dh
INNER JOIN jsh_depotitem di on dh.id=di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
left join jsh_depot depot on depot.id=di.depotId and ifnull(depot.delete_Flag,'0') !='1'
left join jsh_depot depotIn on depotIn.id=di.AnotherDepotId and ifnull(depotIn.delete_Flag,'0') !='1'
where 1=1
and dh.SubType not in('采购订单','销售订单')
and di.MaterialId =#{mId}
and ifnull(dh.delete_Flag,'0') !='1'
</select>
<select id="findByTypeAndDepotIdAndMaterialIdIn" resultType="java.lang.Integer">
select ifnull(sum(BasicNumber),0) as BasicNumber from jsh_depothead dh
INNER JOIN jsh_depotitem di on dh.id=di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
where dh.type='入库'
and di.MaterialId = #{mId} and di.DepotId = #{depotId}
and ifnull(dh.delete_Flag,'0') !='1'
</select>
<select id="findByTypeAndDepotIdAndMaterialIdOut" resultType="java.lang.Integer">
select ifnull(sum(BasicNumber),0) as BasicNumber from jsh_depothead dh
INNER JOIN jsh_depotitem di on dh.id=di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
where dh.type='出库'
where dh.type!='其它'
and dh.SubType!='调拨'
and di.MaterialId = #{mId} and di.DepotId = #{depotId}
and di.MaterialId =${mId}
and ifnull(dh.delete_Flag,'0') !='1'
</select>
<select id="getDetailList" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultWithInfoExMap">
select di.*,m.Name MName,m.Model MModel,m.Unit MaterialUnit,m.Color MColor,m.Standard MStandard,m.Mfrs MMfrs,
m.OtherField1 MOtherField1,m.OtherField2 MOtherField2,m.OtherField3 MOtherField3,
@@ -177,31 +140,26 @@
left join jsh_unit u on m.UnitId = u.id and ifnull(u.delete_Flag,'0') !='1'
left join jsh_depot dp1 on di.DepotId=dp1.id and ifnull(dp1.delete_Flag,'0') !='1'
left join jsh_depot dp2 on di.AnotherDepotId=dp2.id and ifnull(dp2.delete_Flag,'0') !='1'
where di.HeaderId = #{headerId}
where di.HeaderId = ${headerId}
and ifnull(di.delete_Flag,'0') !='1'
order by di.id asc
</select>
<select id="findByAll" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultByMaterial">
select m.id MId, m.Name MName, m.Model MModel, m.Unit MaterialUnit, m.Color MColor
select m.id MId, m.Name MName, m.Model MModel, m.Unit MaterialUnit, m.Color MColor,
m.PresetPriceOne, m.PriceStrategy, u.UName UName
from jsh_depotitem di
inner join jsh_material m on di.MaterialId=m.id and ifnull(m.delete_Flag,'0') !='1'
left join jsh_unit u on m.UnitId=u.id and ifnull(u.delete_Flag,'0') !='1'
where 1=1
<if test="headIds != null and headIds != ''">
and di.HeaderId in
<foreach item="headId" index="index" collection="headIds.split(',')" open="(" separator="," close=")">
#{headId}
</foreach>
<if test="headIds != null">
and di.HeaderId in (${headIds})
</if>
<if test="materialIds != null and materialIds != ''">
and di.MaterialId in
<foreach item="materialId" index="index" collection="materialIds.split(',')" open="(" separator="," close=")">
#{materialId}
</foreach>
<if test="materialIds != null">
and di.MaterialId in (${materialIds})
</if>
and ifnull(di.delete_Flag,'0') !='1'
group by m.id,m.Name, m.Model, m.Unit, m.Color
group by m.id,m.Name, m.Model, m.Unit, m.Color, m.PresetPriceOne, m.PriceStrategy, u.UName
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
@@ -212,17 +170,11 @@
from jsh_depotitem di
inner join jsh_material m on di.MaterialId=m.id and ifnull(m.delete_Flag,'0') !='1'
where 1=1
<if test="headIds != null and headIds != ''">
and di.HeaderId in
<foreach item="headId" index="index" collection="headIds.split(',')" open="(" separator="," close=")">
#{headId}
</foreach>
<if test="headIds != null">
and di.HeaderId in (${headIds})
</if>
<if test="materialIds != null and materialIds != ''">
and di.MaterialId in
<foreach item="materialId" index="index" collection="materialIds.split(',')" open="(" separator="," close=")">
#{materialId}
</foreach>
<if test="materialIds != null">
and di.MaterialId in (${materialIds})
</if>
and ifnull(di.delete_Flag,'0') !='1'
group by m.id) cc
@@ -242,14 +194,10 @@
<select id="buyOrSalePrice" resultType="java.math.BigDecimal">
select ifnull(sum(AllPrice),0) as AllPrice from jsh_depotitem di,jsh_depothead dh
where di.HeaderId = dh.id
and dh.type=#{type} and dh.subType=#{subType}
and di.MaterialId =#{MId}
<if test="MonthTime != null and MonthTime != ''">
<bind name="MonthTimeStart" value="_parameter.MonthTime + '-01 00:00:00'"/>
and dh.OperTime &gt;= #{MonthTimeStart}
<bind name="MonthTimeEnd" value="_parameter.MonthTime + '-31 23:59:59'"/>
and dh.OperTime &lt;= #{MonthTimeEnd}
</if>
and dh.type='${type}' and dh.subType='${subType}'
and di.MaterialId =${MId}
and dh.OperTime &gt;= '${MonthTime}-01 00:00:00'
and dh.OperTime &lt;= '${MonthTime}-31 23:59:59'
and ifnull(dh.delete_Flag,'0') !='1'
and ifnull(di.delete_Flag,'0') !='1'
</select>
@@ -407,7 +355,7 @@
WHERE
dh.type = '入库'
<if test="pid != null">
and di.DepotId= #{pid}
and di.DepotId= ${pid}
</if>
AND ifnull(dh.delete_Flag, '0') != '1' group by di.MaterialId
) intype ON intype.MaterialId = m.id
@@ -423,7 +371,7 @@
dh.type = '出库'
AND dh.SubType != '调拨'
<if test="pid != null">
and di.DepotId= #{pid}
and di.DepotId= ${pid}
</if>
AND ifnull(dh.delete_Flag, '0') != '1' group by di.MaterialId
) outtype ON outtype.MaterialId = m.id
@@ -452,7 +400,7 @@
WHERE
dh.type = '入库'
<if test="pid != null">
and di.DepotId= #{pid}
and di.DepotId= ${pid}
</if>
AND ifnull(dh.delete_Flag, '0') != '1' group by di.MaterialId
) intype ON intype.MaterialId = m.id
@@ -462,28 +410,6 @@
AND ifnull(m.delete_Flag, '0') != '1'
AND intype.BasicInNumber > 0
</select>
<select id="getCurrentRepByMaterialIdAndDepotId" resultType="java.math.BigDecimal">
select ((curep.inTotal+curep.transfInTotal+curep.assemInTotal+curep.disAssemInTotal)
-(curep.transfOutTotal+curep.outTotal+curep.assemOutTotal+curep.disAssemOutTotal)) as currentRepo
from
(select sum(if(dh.type='入库' <if test="depotId != null">and di.DepotId=#{depotId}</if>, di.BasicNumber,0)) as inTotal,
sum(if(dh.SubType='调拨' <if test="depotId != null">and di.AnotherDepotId=#{depotId}</if>,di.BasicNumber,0)) as transfInTotal,
sum(if(dh.SubType='调拨' <if test="depotId != null">and di.DepotId=#{depotId}</if>,di.BasicNumber,0)) as transfOutTotal,
sum(if(dh.type='出库' and dh.SubType!='调拨' <if test="depotId != null">and di.DepotId=#{depotId}</if>,di.BasicNumber,0)) as outTotal,
sum(if(dh.SubType='组装单' and di.MType='组合件' <if test="depotId != null">and di.DepotId=#{depotId}</if>,di.BasicNumber,0)) as assemInTotal,
sum(if(dh.SubType='组装单' and di.MType='普通子件' <if test="depotId != null">and di.DepotId=#{depotId}</if>,di.BasicNumber,0)) as assemOutTotal,
sum(if(dh.SubType='拆卸单' and di.MType='普通子件' <if test="depotId != null">and di.DepotId=#{depotId}</if>,di.BasicNumber,0)) as disAssemInTotal,
sum(if(dh.SubType='拆卸单' and di.MType='组合件' <if test="depotId != null"> and di.DepotId=#{depotId}</if>,di.BasicNumber,0)) as disAssemOutTotal
from
jsh_depothead dh,jsh_depotitem di
where 1=1
and dh.id=di.HeaderId
and dh.tenant_id=#{tenantId}
and di.tenant_id=#{tenantId}
and di.MaterialId=#{materialId}
and ifnull(dh.delete_Flag,'0') !='1'
and ifnull(di.delete_Flag,'0') !='1') as curep
</select>
<select id="getFinishNumber" resultType="java.math.BigDecimal">
select sum(BasicNumber) from jsh_depotitem

View File

@@ -9,16 +9,14 @@
select *
FROM jsh_depot
where 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
<if test="type != null">
and type=#{type}
and type=${type}
</if>
<if test="remark != null and remark != ''">
<bind name="remark" value="'%' + _parameter.remark + '%'"/>
and remark like #{remark}
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
order by sort asc
@@ -31,16 +29,14 @@
COUNT(id)
FROM jsh_depot
WHERE 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
<if test="type != null">
and type=#{type}
and type=${type}
</if>
<if test="remark != null and remark != ''">
<bind name="remark" value="'%' + _parameter.remark + '%'"/>
and remark like #{remark}
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>

View File

@@ -18,7 +18,6 @@
<result column="PushBtn" jdbcType="VARCHAR" property="pushbtn" />
<result column="icon" jdbcType="VARCHAR" property="icon" />
<result column="delete_Flag" jdbcType="VARCHAR" property="deleteFlag" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
@@ -91,8 +90,7 @@
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
Id, Number, Name, PNumber, URL, State, Sort, Enabled, Type, PushBtn, icon,delete_Flag,
tenant_id
Id, Number, Name, PNumber, URL, State, Sort, Enabled, Type, PushBtn, icon, delete_Flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.FunctionsExample" resultMap="BaseResultMap">
<!--
@@ -148,11 +146,11 @@
insert into jsh_functions (Id, Number, Name,
PNumber, URL, State, Sort,
Enabled, Type, PushBtn,
delete_Flag, icon,tenant_id)
icon, delete_Flag)
values (#{id,jdbcType=BIGINT}, #{number,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{pnumber,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{state,jdbcType=BIT}, #{sort,jdbcType=VARCHAR},
#{enabled,jdbcType=BIT}, #{type,jdbcType=VARCHAR}, #{pushbtn,jdbcType=VARCHAR},
#{icon,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT})
#{enabled,jdbcType=BIT}, #{type,jdbcType=VARCHAR}, #{pushbtn,jdbcType=VARCHAR},
#{icon,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Functions">
<!--
@@ -197,9 +195,6 @@
<if test="deleteFlag != null">
delete_Flag,
</if>
<if test="tenantId != null">
tenant_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@@ -238,9 +233,6 @@
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.FunctionsExample" resultType="java.lang.Integer">
@@ -296,9 +288,6 @@
<if test="record.deleteFlag != null">
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR},
</if>
<if test="record.tenantId != null">
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@@ -320,7 +309,6 @@
Enabled = #{record.enabled,jdbcType=BIT},
Type = #{record.type,jdbcType=VARCHAR},
PushBtn = #{record.pushbtn,jdbcType=VARCHAR},
tenant_id = #{record.tenantId,jdbcType=BIGINT}
icon = #{record.icon,jdbcType=VARCHAR},
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR}
<if test="_parameter != null">
@@ -367,9 +355,6 @@
<if test="deleteFlag != null">
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
</set>
where Id = #{id,jdbcType=BIGINT}
</update>
@@ -388,7 +373,6 @@
Enabled = #{enabled,jdbcType=BIT},
Type = #{type,jdbcType=VARCHAR},
PushBtn = #{pushbtn,jdbcType=VARCHAR},
tenant_id = #{tenantId,jdbcType=BIGINT}
icon = #{icon,jdbcType=VARCHAR},
delete_Flag = #{deleteFlag,jdbcType=VARCHAR}
where Id = #{id,jdbcType=BIGINT}

View File

@@ -5,12 +5,11 @@
select *
FROM jsh_functions
where 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
<if test="type != null">
and type=#{type}
and type='${type}'
</if>
and ifnull(delete_Flag,'0') !='1'
order by sort asc
@@ -23,12 +22,11 @@
COUNT(id)
FROM jsh_functions
WHERE 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
<if test="type != null">
and type=#{type}
and type='${type}'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>

View File

@@ -5,16 +5,14 @@
select *
FROM jsh_inoutitem
where 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
<if test="type != null">
and type=#{type}
and type='${type}'
</if>
<if test="remark != null and remark != ''">
<bind name="remark" value="'%' + _parameter.remark + '%'"/>
and remark like #{remark}
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
<if test="offset != null and rows != null">
@@ -26,16 +24,14 @@
COUNT(id)
FROM jsh_inoutitem
WHERE 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
<if test="type != null">
and type=#{type}
and type='${type}'
</if>
<if test="remark != null and remark != ''">
<bind name="remark" value="'%' + _parameter.remark + '%'"/>
and remark like #{remark}
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>

View File

@@ -10,29 +10,26 @@
FROM jsh_log l
left join jsh_user u on l.userID = u.id and ifnull(u.status,'0') not in('1','2')
where 1=1
<if test="operation != null and operation != ''">
<bind name="operation" value="'%' + _parameter.operation + '%'"/>
and l.operation like #{operation}
<if test="operation != null">
and l.operation like '%${operation}%'
</if>
<if test="usernameID != null">
and l.userID=#{usernameID}
and l.userID=${usernameID}
</if>
<if test="clientIp != null and clientIp != ''">
<bind name="clientIp" value="'%' + _parameter.clientIp + '%'"/>
and l.clientIp like #{clientIp}
<if test="clientIp != null">
and l.clientIp like '%${clientIp}%'
</if>
<if test="status != null">
and l.status=#{status}
and l.status=${status}
</if>
<if test="beginTime != null">
and l.createtime &gt;= #{beginTime}
and l.createtime &gt;= '${beginTime}'
</if>
<if test="endTime != null">
and l.createtime &lt;= #{endTime}
and l.createtime &lt;= '${endTime}'
</if>
<if test="contentdetails != null and contentdetails != ''">
<bind name="contentdetails" value="'%' + _parameter.contentdetails + '%'"/>
and l.contentdetails like #{contentdetails}
<if test="contentdetails != null">
and l.contentdetails like '%${contentdetails}%'
</if>
order by l.createtime desc
<if test="offset != null and rows != null">
@@ -44,29 +41,26 @@
COUNT(id)
FROM jsh_log
WHERE 1=1
<if test="operation != null and operation != ''">
<bind name="operation" value="'%' + _parameter.operation + '%'"/>
and operation like #{operation}
<if test="operation != null">
and operation like '%${operation}%'
</if>
<if test="usernameID != null">
and userID=#{usernameID}
and userID=${usernameID}
</if>
<if test="clientIp != null and clientIp != ''">
<bind name="clientIp" value="'%' + _parameter.clientIp + '%'"/>
and clientIp like #{clientIp}
<if test="clientIp != null">
and clientIp like '%${clientIp}%'
</if>
<if test="status != null">
and status = #{status}
and status = ${status}
</if>
<if test="beginTime != null"><![CDATA[
and createtime >= #{beginTime}
and createtime >= '${beginTime}'
]]></if>
<if test="endTime != null"><![CDATA[
and createtime <= #{endTime}
and createtime <= '${endTime}'
]]></if>
<if test="contentdetails != null and contentdetails != ''">
<bind name="contentdetails" value="'%' + _parameter.contentdetails + '%'"/>
and contentdetails like #{contentdetails}
<if test="contentdetails != null">
and contentdetails like '%${contentdetails}%'
</if>
</select>
</mapper>

View File

@@ -6,12 +6,11 @@
FROM jsh_materialcategory
where 1=1
and ifnull(status,'0') !='2'
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
<if test="parentId != null">
and parentId = #{parentId}
and parentId = ${parentId}
</if>
and Id !=1
<if test="offset != null and rows != null">
@@ -24,12 +23,11 @@
FROM jsh_materialcategory
WHERE 1=1
and ifnull(status,'0') !='2'
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
<if test="parentId != null">
and parentId = #{parentId}
and parentId = ${parentId}
</if>
and Id !=1
</select>

View File

@@ -16,19 +16,14 @@
left JOIN jsh_unit u on m.UnitId = u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_materialcategory mc on m.CategoryId = mc.id and ifnull(mc.status,'0') !='2'
where 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and m.name like #{name}
<if test="name != null">
and m.name like '%${name}%'
</if>
<if test="model != null and model != ''">
<bind name="model" value="'%' + _parameter.model + '%'"/>
and m.model like #{model}
<if test="model != null">
and m.model like '%${model}%'
</if>
<if test="categoryIds != null and categoryIds != ''">
and m.CategoryId in
<foreach item="did" index="index" collection="categoryIds.split(',')" open="(" separator="," close=")">
#{did}
</foreach>
<if test="categoryIds != null">
and m.CategoryId in (${categoryIds})
</if>
and ifnull(m.delete_Flag,'0') !='1'
order by m.id desc
@@ -44,19 +39,14 @@
left JOIN jsh_unit u on m.UnitId = u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_materialcategory mc on m.CategoryId = mc.id and ifnull(mc.status,'0') !='2'
WHERE 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and m.name like #{name}
<if test="name != null">
and m.name like '%${name}%'
</if>
<if test="model != null and model != ''">
<bind name="model" value="'%' + _parameter.model + '%'"/>
and m.model like #{model}
<if test="model != null">
and m.model like '%${model}%'
</if>
<if test="categoryIds != null and categoryIds != ''">
and m.CategoryId in
<foreach item="did" index="index" collection="categoryIds.split(',')" open="(" separator="," close=")">
#{did}
</foreach>
<if test="categoryIds != null">
and m.CategoryId in (${categoryIds})
</if>
and ifnull(m.delete_Flag,'0') !='1'
</select>
@@ -64,14 +54,14 @@
<select id="findUnitName" resultType="java.lang.String">
select u.UName from jsh_unit u
left join jsh_material m on m.UnitId=u.id and ifnull(m.delete_Flag,'0') !='1'
where m.id = #{mId}
where m.id = ${mId}
and ifnull(u.delete_Flag,'0') !='1'
</select>
<select id="findById" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
select m.*,u.UName from jsh_material m
left join jsh_unit u on m.UnitId=u.id and ifnull(u.delete_Flag,'0') !='1'
where m.id = #{id}
where m.id = ${id}
and ifnull(m.delete_Flag,'0') !='1'
</select>
@@ -106,19 +96,14 @@
left JOIN jsh_unit u on m.UnitId = u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_materialcategory mc on m.CategoryId = mc.id and ifnull(mc.status,'0') !='2'
where 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and m.name like #{name}
<if test="name != null">
and m.name like '%${name}%'
</if>
<if test="model != null and model != ''">
<bind name="model" value="'%' + _parameter.model + '%'"/>
and m.model like #{model}
<if test="model != null">
and m.model like '%${model}%'
</if>
<if test="categoryIds != null and categoryIds != ''">
and m.CategoryId in
<foreach item="did" index="index" collection="categoryIds.split(',')" open="(" separator="," close=")">
#{did}
</foreach>
<if test="categoryIds != null">
and m.CategoryId in (${categoryIds})
</if>
and ifnull(m.delete_Flag,'0') !='1'
order by m.id desc

View File

@@ -12,7 +12,6 @@
<result column="sort" jdbcType="VARCHAR" property="sort" />
<result column="anotherName" jdbcType="VARCHAR" property="anothername" />
<result column="delete_Flag" jdbcType="VARCHAR" property="deleteFlag" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
@@ -85,7 +84,7 @@
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, nativeName, enabled, sort, anotherName, delete_Flag, tenant_id
id, nativeName, enabled, sort, anotherName, delete_Flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialPropertyExample" resultMap="BaseResultMap">
<!--
@@ -139,11 +138,11 @@
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_materialproperty (id, nativeName, enabled,
sort, anotherName, delete_Flag,
tenant_id)
sort, anotherName, delete_Flag
)
values (#{id,jdbcType=BIGINT}, #{nativename,jdbcType=VARCHAR}, #{enabled,jdbcType=BIT},
#{sort,jdbcType=VARCHAR}, #{anothername,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=VARCHAR},
#{tenantId,jdbcType=BIGINT})
#{sort,jdbcType=VARCHAR}, #{anothername,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.MaterialProperty">
<!--
@@ -170,9 +169,6 @@
<if test="deleteFlag != null">
delete_Flag,
</if>
<if test="tenantId != null">
tenant_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@@ -193,9 +189,6 @@
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.MaterialPropertyExample" resultType="java.lang.Integer">
@@ -233,9 +226,6 @@
<if test="record.deleteFlag != null">
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR},
</if>
<if test="record.tenantId != null">
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@@ -252,8 +242,7 @@
enabled = #{record.enabled,jdbcType=BIT},
sort = #{record.sort,jdbcType=VARCHAR},
anotherName = #{record.anothername,jdbcType=VARCHAR},
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR},
tenant_id = #{record.tenantId,jdbcType=BIGINT}
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@@ -280,9 +269,6 @@
<if test="deleteFlag != null">
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@@ -296,8 +282,7 @@
enabled = #{enabled,jdbcType=BIT},
sort = #{sort,jdbcType=VARCHAR},
anotherName = #{anothername,jdbcType=VARCHAR},
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
tenant_id = #{tenantId,jdbcType=BIGINT}
delete_Flag = #{deleteFlag,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -5,9 +5,8 @@
select *
FROM jsh_materialproperty
where 1=1
<if test="name != null and name != ''">
<bind name="nativeName" value="'%' + _parameter.name + '%'"/>
and nativeName like #{nativeName}
<if test="name != null">
and nativeName like '%${name}%'
</if>
and ifnull(delete_Flag,'0') !='1'
<if test="offset != null and rows != null">
@@ -19,9 +18,8 @@
COUNT(id)
FROM jsh_materialproperty
WHERE 1=1
<if test="name != null and name != ''">
<bind name="nativeName" value="'%' + _parameter.name + '%'"/>
and nativeName like #{nativeName}
<if test="name != null">
and nativeName like '%${name}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>

View File

@@ -5,12 +5,11 @@
select *
FROM jsh_person
where 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
<if test="type != null">
and type=#{type}
and type='${type}'
</if>
and ifnull(delete_Flag,'0') !='1'
<if test="offset != null and rows != null">
@@ -22,12 +21,11 @@
COUNT(id)
FROM jsh_person
WHERE 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
<if test="type != null">
and type=#{type}
and type='${type}'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>

View File

@@ -6,9 +6,8 @@
FROM jsh_role
WHERE 1=1
and ifnull(delete_Flag,'0') !='1'
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
<if test="offset != null and rows != null">
limit #{offset},#{rows}
@@ -20,9 +19,8 @@
FROM jsh_role
WHERE 1=1
and ifnull(delete_Flag,'0') !='1'
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
<if test="name != null">
and name like '%${name}%'
</if>
</select>
<update id="batchDeleteRoleByIds">
@@ -35,14 +33,4 @@
</foreach>
)
</update>
<select id="getRoleList" resultMap="com.jsh.erp.datasource.mappers.RoleMapper.BaseResultMap">
SELECT *
FROM jsh_role
WHERE 1=1
and ifnull(delete_Flag,'0') !='1'
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and name like #{name}
</if>
</select>
</mapper>

View File

@@ -5,24 +5,20 @@
select *
FROM jsh_supplier
where 1=1
<if test="supplier != null and supplier != ''">
<bind name="supplier" value="'%' + _parameter.supplier + '%'"/>
and supplier like #{supplier}
<if test="supplier != null">
and supplier like '%${supplier}%'
</if>
<if test="type != null">
and type=#{type}
and type='${type}'
</if>
<if test="phonenum != null and phonenum != ''">
<bind name="phonenum" value="'%' + _parameter.phonenum + '%'"/>
and phonenum like #{phonenum}
<if test="phonenum != null">
and phonenum like '%${phonenum}%'
</if>
<if test="telephone != null and telephone != ''">
<bind name="telephone" value="'%' + _parameter.telephone + '%'"/>
and telephone like #{telephone}
<if test="telephone != null">
and telephone like '%${telephone}%'
</if>
<if test="description != null and description != ''">
<bind name="description" value="'%' + _parameter.description + '%'"/>
and description like #{description}
<if test="description != null">
and description like '%${description}%'
</if>
and ifnull(delete_Flag,'0') !='1'
order by id desc
@@ -35,24 +31,20 @@
COUNT(id)
FROM jsh_supplier
WHERE 1=1
<if test="supplier != null and supplier != ''">
<bind name="supplier" value="'%' + _parameter.supplier + '%'"/>
and supplier like #{supplier}
<if test="supplier != null">
and supplier like '%${supplier}%'
</if>
<if test="type != null">
and type=#{type}
and type='${type}'
</if>
<if test="phonenum != null and phonenum != ''">
<bind name="phonenum" value="'%' + _parameter.phonenum + '%'"/>
and phonenum like #{phonenum}
<if test="phonenum != null">
and phonenum like '%${phonenum}%'
</if>
<if test="telephone != null and telephone != ''">
<bind name="telephone" value="'%' + _parameter.telephone + '%'"/>
and telephone like #{telephone}
<if test="telephone != null">
and telephone like '%${telephone}%'
</if>
<if test="description != null and description != ''">
<bind name="description" value="'%' + _parameter.description + '%'"/>
and description like #{description}
<if test="description != null">
and description like '%${description}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
@@ -61,24 +53,20 @@
select *
FROM jsh_supplier
where 1=1
<if test="supplier != null and supplier != ''">
<bind name="supplier" value="'%' + _parameter.supplier + '%'"/>
and supplier like #{supplier}
<if test="supplier != null">
and supplier like '%${supplier}%'
</if>
<if test="type != null">
and type=#{type}
and type='${type}'
</if>
<if test="phonenum != null and phonenum != ''">
<bind name="phonenum" value="'%' + _parameter.phonenum + '%'"/>
and phonenum like #{phonenum}
<if test="phonenum != null">
and phonenum like '%${phonenum}%'
</if>
<if test="telephone != null and telephone != ''">
<bind name="telephone" value="'%' + _parameter.telephone + '%'"/>
and telephone like #{telephone}
<if test="telephone != null">
and telephone like '%${telephone}%'
</if>
<if test="description != null and description != ''">
<bind name="description" value="'%' + _parameter.description + '%'"/>
and description like #{description}
<if test="description != null">
and description like '%${description}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>

View File

@@ -5,9 +5,8 @@
select *
FROM jsh_systemconfig
where 1=1
<if test="companyName != null and companyName != ''">
<bind name="companyName" value="'%' + _parameter.companyName + '%'"/>
and company_name like #{companyName}
<if test="companyName != null">
and company_name like '%${companyName}%'
</if>
and ifnull(delete_Flag,'0') !='1'
<if test="offset != null and rows != null">
@@ -19,9 +18,8 @@
COUNT(id)
FROM jsh_systemconfig
WHERE 1=1
<if test="companyName != null and companyName != ''">
<bind name="companyName" value="'%' + _parameter.companyName + '%'"/>
and company_name like #{companyName}
<if test="companyName != null">
and company_name like '%${companyName}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>

View File

@@ -1,288 +1,288 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.jsh.erp.datasource.mappers.TenantMapper" >
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" property="id" jdbcType="BIGINT" />
<result column="tenant_id" property="tenantId" jdbcType="BIGINT" />
<result column="login_name" property="loginName" jdbcType="VARCHAR" />
<result column="user_num_limit" property="userNumLimit" jdbcType="INTEGER" />
<result column="bills_num_limit" property="billsNumLimit" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Example_Where_Clause" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" property="id" jdbcType="BIGINT" />
<result column="tenant_id" property="tenantId" jdbcType="BIGINT" />
<result column="login_name" property="loginName" jdbcType="VARCHAR" />
<result column="user_num_limit" property="userNumLimit" jdbcType="INTEGER" />
<result column="bills_num_limit" property="billsNumLimit" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Example_Where_Clause" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, tenant_id, login_name, user_num_limit, bills_num_limit, create_time
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.jsh.erp.datasource.entities.TenantExample" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct" >
distinct
</trim>
</if>
<include refid="Base_Column_List" />
from jsh_tenant
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from jsh_tenant
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_tenant
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_tenant
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_tenant (id, tenant_id, login_name,
user_num_limit, bills_num_limit, create_time
)
values (#{id,jdbcType=BIGINT}, #{tenantId,jdbcType=BIGINT}, #{loginName,jdbcType=VARCHAR},
#{userNumLimit,jdbcType=INTEGER}, #{billsNumLimit,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_tenant
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="tenantId != null" >
tenant_id,
</if>
<if test="loginName != null" >
login_name,
</if>
<if test="userNumLimit != null" >
user_num_limit,
</if>
<if test="billsNumLimit != null" >
bills_num_limit,
</if>
<if test="createTime != null" >
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="tenantId != null" >
#{tenantId,jdbcType=BIGINT},
</if>
<if test="loginName != null" >
#{loginName,jdbcType=VARCHAR},
</if>
<if test="userNumLimit != null" >
#{userNumLimit,jdbcType=INTEGER},
</if>
<if test="billsNumLimit != null" >
#{billsNumLimit,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample" resultType="java.lang.Integer" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from jsh_tenant
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_tenant
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.tenantId != null" >
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
<if test="record.loginName != null" >
login_name = #{record.loginName,jdbcType=VARCHAR},
</if>
<if test="record.userNumLimit != null" >
user_num_limit = #{record.userNumLimit,jdbcType=INTEGER},
</if>
<if test="record.billsNumLimit != null" >
bills_num_limit = #{record.billsNumLimit,jdbcType=INTEGER},
</if>
<if test="record.createTime != null" >
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_tenant
set id = #{record.id,jdbcType=BIGINT},
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, tenant_id, login_name, user_num_limit, bills_num_limit, create_time
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.jsh.erp.datasource.entities.TenantExample" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
from jsh_tenant
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from jsh_tenant
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_tenant
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from jsh_tenant
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_tenant (id, tenant_id, login_name,
user_num_limit, bills_num_limit, create_time
)
values (#{id,jdbcType=BIGINT}, #{tenantId,jdbcType=BIGINT}, #{loginName,jdbcType=VARCHAR},
#{userNumLimit,jdbcType=INTEGER}, #{billsNumLimit,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_tenant
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="tenantId != null" >
tenant_id,
</if>
<if test="loginName != null" >
login_name,
</if>
<if test="userNumLimit != null" >
user_num_limit,
</if>
<if test="billsNumLimit != null" >
bills_num_limit,
</if>
<if test="createTime != null" >
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="tenantId != null" >
#{tenantId,jdbcType=BIGINT},
</if>
<if test="loginName != null" >
#{loginName,jdbcType=VARCHAR},
</if>
<if test="userNumLimit != null" >
#{userNumLimit,jdbcType=INTEGER},
</if>
<if test="billsNumLimit != null" >
#{billsNumLimit,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.TenantExample" resultType="java.lang.Integer" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from jsh_tenant
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_tenant
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.tenantId != null" >
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
<if test="record.loginName != null" >
login_name = #{record.loginName,jdbcType=VARCHAR},
</if>
<if test="record.userNumLimit != null" >
user_num_limit = #{record.userNumLimit,jdbcType=INTEGER},
</if>
<if test="record.billsNumLimit != null" >
bills_num_limit = #{record.billsNumLimit,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_tenant
<set >
<if test="tenantId != null" >
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
<if test="loginName != null" >
login_name = #{loginName,jdbcType=VARCHAR},
</if>
<if test="userNumLimit != null" >
user_num_limit = #{userNumLimit,jdbcType=INTEGER},
</if>
<if test="billsNumLimit != null" >
bills_num_limit = #{billsNumLimit,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_tenant
set tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
<if test="record.createTime != null" >
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_tenant
set id = #{record.id,jdbcType=BIGINT},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
login_name = #{record.loginName,jdbcType=VARCHAR},
user_num_limit = #{record.userNumLimit,jdbcType=INTEGER},
bills_num_limit = #{record.billsNumLimit,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_tenant
<set >
<if test="tenantId != null" >
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
<if test="loginName != null" >
login_name = #{loginName,jdbcType=VARCHAR},
</if>
<if test="userNumLimit != null" >
user_num_limit = #{userNumLimit,jdbcType=INTEGER},
</if>
<if test="billsNumLimit != null" >
bills_num_limit = #{billsNumLimit,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.Tenant" >
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update jsh_tenant
set tenant_id = #{tenantId,jdbcType=BIGINT},
login_name = #{loginName,jdbcType=VARCHAR},
user_num_limit = #{userNumLimit,jdbcType=INTEGER},
bills_num_limit = #{billsNumLimit,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -5,9 +5,8 @@
select *
FROM jsh_unit
where 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and UName like #{name}
<if test="name != null">
and UName like '%${name}%'
</if>
and ifnull(delete_Flag,'0') !='1'
<if test="offset != null and rows != null">
@@ -19,9 +18,8 @@
COUNT(id)
FROM jsh_unit
WHERE 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'"/>
and UName like #{name}
<if test="name != null">
and UName like '%${name}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>

View File

@@ -12,7 +12,6 @@
<result column="Value" jdbcType="VARCHAR" property="value" />
<result column="BtnStr" jdbcType="VARCHAR" property="btnstr" />
<result column="delete_Flag" jdbcType="VARCHAR" property="deleteFlag" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
@@ -85,7 +84,7 @@
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
Id, Type, KeyId, Value, BtnStr, delete_Flag, tenant_id
Id, Type, KeyId, Value, BtnStr, delete_Flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.UserBusinessExample" resultMap="BaseResultMap">
<!--
@@ -139,11 +138,11 @@
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into jsh_userbusiness (Id, Type, KeyId,
Value, BtnStr, delete_Flag,
tenant_id)
Value, BtnStr, delete_Flag
)
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{keyid,jdbcType=VARCHAR},
#{value,jdbcType=VARCHAR}, #{btnstr,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=VARCHAR},
#{tenantId,jdbcType=BIGINT})
#{value,jdbcType=VARCHAR}, #{btnstr,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.UserBusiness">
<!--
@@ -170,9 +169,6 @@
<if test="deleteFlag != null">
delete_Flag,
</if>
<if test="tenantId != null">
tenant_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@@ -193,9 +189,6 @@
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.jsh.erp.datasource.entities.UserBusinessExample" resultType="java.lang.Integer">
@@ -233,9 +226,6 @@
<if test="record.deleteFlag != null">
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR},
</if>
<if test="record.tenantId != null">
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@@ -252,8 +242,7 @@
KeyId = #{record.keyid,jdbcType=VARCHAR},
Value = #{record.value,jdbcType=VARCHAR},
BtnStr = #{record.btnstr,jdbcType=VARCHAR},
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR},
tenant_id = #{record.tenantId,jdbcType=BIGINT}
delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@@ -280,9 +269,6 @@
<if test="deleteFlag != null">
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
</set>
where Id = #{id,jdbcType=BIGINT}
</update>
@@ -296,8 +282,7 @@
KeyId = #{keyid,jdbcType=VARCHAR},
Value = #{value,jdbcType=VARCHAR},
BtnStr = #{btnstr,jdbcType=VARCHAR},
delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
tenant_id = #{tenantId,jdbcType=BIGINT}
delete_Flag = #{deleteFlag,jdbcType=VARCHAR}
where Id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -1,26 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jsh.erp.datasource.mappers.UserMapperEx">
<resultMap extends="com.jsh.erp.datasource.mappers.UserMapper.BaseResultMap" id="ResultMapEx"
type="com.jsh.erp.datasource.entities.UserEx">
<result column="orgaId" jdbcType="BIGINT" property="orgaId"/>
<result column="org_abr" jdbcType="VARCHAR" property="orgAbr"/>
<result column="user_blng_orga_dspl_seq" jdbcType="VARCHAR" property="userBlngOrgaDsplSeq"/>
<result column="orgaUserRelId" jdbcType="BIGINT" property="orgaUserRelId"/>
<resultMap extends="com.jsh.erp.datasource.mappers.UserMapper.BaseResultMap" id="ResultMapEx" type="com.jsh.erp.datasource.entities.UserEx">
<result column="orgaId" jdbcType="BIGINT" property="orgaId" />
<result column="org_abr" jdbcType="VARCHAR" property="orgAbr" />
<result column="user_blng_orga_dspl_seq" jdbcType="VARCHAR" property="userBlngOrgaDsplSeq" />
<result column="orgaUserRelId" jdbcType="BIGINT" property="orgaUserRelId" />
</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="com.jsh.erp.datasource.mappers.UserMapper.BaseResultMap">
select *
FROM jsh_user
where 1=1
and ifnull(status,'0') not in('1','2')
<if test="userName != null and userName != ''">
<bind name="userName" value="'%' + _parameter.userName + '%'"/>
and username like #{userName}
<if test="userName != null">
and username like '%${userName}%'
</if>
<if test="loginName != null and loginName != ''">
<bind name="loginName" value="'%' + _parameter.loginName + '%'"/>
and loginame like #{loginName}
<if test="loginName != null">
and loginame like '%${loginName}%'
</if>
<if test="offset != null and rows != null">
limit #{offset},#{rows}
@@ -32,37 +28,34 @@
FROM jsh_user
WHERE 1=1
and ifnull(status,'0') not in('1','2')
<if test="userName != null and userName != ''">
<bind name="userName" value="'%' + _parameter.userName + '%'"/>
and username like #{userName}
<if test="userName != null">
and username like '%${userName}%'
</if>
<if test="loginName != null and loginName != ''">
<bind name="loginName" value="'%' + _parameter.loginName + '%'"/>
and loginame like #{loginName}
<if test="loginName != null">
and loginame like '%${loginName}%'
</if>
</select>
<select id="getUserList" parameterType="java.util.Map" resultMap="ResultMapEx">
select user.id, user.username, user.loginame, 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
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'
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 userName != ''">
<bind name="userName" value="'%' + _parameter.userName + '%'"/>
<bind name="userName" value="'%' + _parameter.userName + '%'" />
and user.userName like #{userName}
</if>
<if test="loginName != null and loginName != ''">
<bind name="loginName" value="'%' + _parameter.loginName + '%'"/>
<bind name="loginName" value="'%' + _parameter.loginName + '%'" />
and user.loginName like #{loginName}
</if>
order by user.id desc
</select>
<insert id="addUser" parameterType="com.jsh.erp.datasource.entities.UserEx"
useGeneratedKeys="true" keyProperty="id" keyColumn="id">
useGeneratedKeys="true" keyProperty="id" keyColumn="id">
insert into jsh_user (username, loginame,
password, position,
email, phonenum, ismanager,
@@ -116,12 +109,15 @@
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select id="getUserListByLoginName" 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.loginame, user.position, user.email, user.phonenum,
user.description, user.remark,user.isystem,user.tenant_id
user.description, user.remark,user.isystem
FROM jsh_user user
where 1=1
and ifnull(user.status,'0') not in('1','2')
<if test="userName != null and userName != ''">
and user.userName = #{userName}
</if>
<if test="loginame != null and loginame != ''">
and user.loginame = #{loginame}
</if>
@@ -188,42 +184,4 @@
and ifnull(org_stcd,'0') !='5'
order by sort asc
</select>
<select id="getUserListByUserNameAndTenantId" resultMap="com.jsh.erp.datasource.mappers.UserMapper.BaseResultMap">
select user.id, user.username, user.loginame, user.position, user.email, user.phonenum,
user.description, user.remark,user.isystem
FROM jsh_user user
where 1=1
and ifnull(user.status,'0') not in('1','2')
<if test="userName != null and userName != ''">
and user.userName = #{userName}
</if>
<choose>
<when test="tenantId != null">
and user.tenant_id = #{tenantId}
</when>
<otherwise>
AND user.tenant_id is null
</otherwise>
</choose>
order by user.id desc
</select>
<select id="addRegisterUserNotInclueUser" resultType="java.lang.String">
select registerUserTemplate(#{userId},#{tenantId},#{roleId}) from dual;
</select>
<select id="getUserListByloginNameAndPassword" resultMap="com.jsh.erp.datasource.mappers.UserMapper.BaseResultMap">
select user.id, user.username, user.loginame, user.position, user.email, user.phonenum,
user.description, user.remark,user.isystem,user.tenant_id
FROM jsh_user user
where 1=1
and ifnull(user.status,'0') not in('1','2')
<if test="loginame != null and loginame != ''">
and user.loginame = #{loginame}
</if>
<if test="password != null and password != ''">
and user.password = #{password}
</if>
order by user.id desc
</select>
</mapper>

View File

@@ -5,7 +5,7 @@
<generatorConfiguration>
<classPathEntry
location="C:\Users\cjl\.m2\repository\mysql\mysql-connector-java\5.1.47\mysql-connector-java-5.1.47.jar"/>
location="E:\maven-repository\default\mysql\mysql-connector-java\5.1.47\mysql-connector-java-5.1.47.jar"/>
<context id="DB2Tables" targetRuntime="MyBatis3" defaultModelType="flat">
<commentGenerator>