Commit 1a8b4d89 authored by 乾坤平台's avatar 乾坤平台 Committed by 季圣华
Browse files

!41 全局修改物理删除为逻辑删除,同时修改查询语句过滤删除标识

Merge pull request !41 from 乾坤平台/master
parents 35c6f559 1f2cf8c3
package com.jsh.erp.service.role;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.Role;
import com.jsh.erp.datasource.entities.RoleExample;
import com.jsh.erp.datasource.entities.User;
......@@ -8,14 +9,19 @@ import com.jsh.erp.datasource.entities.UserExample;
import com.jsh.erp.datasource.mappers.RoleMapper;
import com.jsh.erp.datasource.mappers.RoleMapperEx;
import com.jsh.erp.datasource.mappers.UserMapper;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.RegExpTools;
import com.jsh.erp.utils.StringUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -26,6 +32,10 @@ public class RoleService {
@Resource
private RoleMapperEx roleMapperEx;
@Resource
private LogService logService;
@Resource
private UserService userService;
public Role getRole(long id) {
return roleMapper.selectByPrimaryKey(id);
......@@ -76,4 +86,22 @@ public class RoleService {
List<Role> list = roleMapper.selectByExample(example);
return list;
}
/**
* create by: qiankunpingtai
* website:http://39.105.146.63/symphony/
* description:
* 逻辑删除角色信息
* create time: 2019/3/28 15:44
* @Param: ids
* @return int
*/
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteRoleByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SERIAL_NUMBER,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return roleMapperEx.batchDeleteRoleByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
}
......@@ -96,7 +96,7 @@ public class SerialNumberService {
public int checkIsNameExist(Long id, String serialNumber) {
SerialNumberExample example = new SerialNumberExample();
example.createCriteria().andIdNotEqualTo(id).andSerialNumberEqualTo(serialNumber);
example.createCriteria().andIdNotEqualTo(id).andSerialNumberEqualTo(serialNumber).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<SerialNumber> list = serialNumberMapper.selectByExample(example);
return list.size();
}
......@@ -292,14 +292,14 @@ public class SerialNumberService {
//查询商品下已分配的可用序列号数量
int SerialNumberSum= serialNumberMapperEx.countSerialNumberByMaterialIdAndDepotheadId(depotItem.getMaterialid(),null,BusinessConstants.IS_SELL_HOLD);
//BasicNumber=OperNumber*ratio
if(depotItem.getBasicnumber().intValue()>SerialNumberSum){
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().intValue(),userInfo);
sellSerialNumber(depotItem.getMaterialid(),depotItem.getHeaderid(),(depotItem.getBasicnumber()==null?0:depotItem.getBasicnumber()).intValue(),userInfo);
}
}
......
......@@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.Supplier;
import com.jsh.erp.datasource.entities.SupplierExample;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.SupplierMapper;
import com.jsh.erp.datasource.mappers.SupplierMapperEx;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.BaseResponseInfo;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
......@@ -19,6 +21,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -34,6 +37,8 @@ public class SupplierService {
private SupplierMapperEx supplierMapperEx;
@Resource
private LogService logService;
@Resource
private UserService userService;
public Supplier getSupplier(long id) {
return supplierMapper.selectByPrimaryKey(id);
......@@ -80,7 +85,7 @@ public class SupplierService {
public int checkIsNameExist(Long id, String name) {
SupplierExample example = new SupplierExample();
example.createCriteria().andIdNotEqualTo(id).andSupplierEqualTo(name);
example.createCriteria().andIdNotEqualTo(id).andSupplierEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Supplier> list = supplierMapper.selectByExample(example);
return list.size();
}
......@@ -173,4 +178,13 @@ public class SupplierService {
info.data = data;
return info;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteSupplierByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SUPPLIER,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return supplierMapperEx.batchDeleteSupplierByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
}
package com.jsh.erp.service.systemConfig;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.SystemConfig;
import com.jsh.erp.datasource.entities.SystemConfigExample;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.SystemConfigMapper;
import com.jsh.erp.datasource.mappers.SystemConfigMapperEx;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
@Service
......@@ -24,6 +31,10 @@ public class SystemConfigService {
@Resource
private SystemConfigMapperEx systemConfigMapperEx;
@Resource
private UserService userService;
@Resource
private LogService logService;
public SystemConfig getSystemConfig(long id) {
return systemConfigMapper.selectByPrimaryKey(id);
......@@ -69,8 +80,17 @@ public class SystemConfigService {
public int checkIsNameExist(Long id, String name) {
SystemConfigExample example = new SystemConfigExample();
example.createCriteria().andIdNotEqualTo(id).andCompanyNameEqualTo(name);
example.createCriteria().andIdNotEqualTo(id).andCompanyNameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<SystemConfig> list = systemConfigMapper.selectByExample(example);
return list.size();
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteSystemConfigByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_SYSTEM_CONFIG,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return systemConfigMapperEx.batchDeleteSystemConfigByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
}
package com.jsh.erp.service.unit;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.Unit;
import com.jsh.erp.datasource.entities.UnitExample;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.UnitMapper;
import com.jsh.erp.datasource.mappers.UnitMapperEx;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
@Service
......@@ -24,6 +31,10 @@ public class UnitService {
@Resource
private UnitMapperEx unitMapperEx;
@Resource
private UserService userService;
@Resource
private LogService logService;
public Unit getUnit(long id) {
return unitMapper.selectByPrimaryKey(id);
......@@ -70,8 +81,19 @@ public class UnitService {
public int checkIsNameExist(Long id, String name) {
UnitExample example = new UnitExample();
example.createCriteria().andIdNotEqualTo(id).andUnameEqualTo(name);
example.createCriteria().andIdNotEqualTo(id).andUnameEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
List<Unit> list = unitMapper.selectByExample(example);
return list.size();
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteUnitByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_UNIT,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return unitMapperEx.batchDeleteUnitByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
}
......@@ -28,10 +28,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.net.URLEncoder;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
@Service
public class UserService {
......@@ -193,7 +190,10 @@ public class UserService {
public int checkIsNameExist(Long id, String name) {
UserExample example = new UserExample();
example.createCriteria().andIdNotEqualTo(id).andLoginameEqualTo(name);
List <Byte> userStatus=new ArrayList<Byte>();
userStatus.add(BusinessConstants.USER_STATUS_DELETE);
userStatus.add(BusinessConstants.USER_STATUS_BANNED);
example.createCriteria().andIdNotEqualTo(id).andLoginameEqualTo(name).andStatusNotIn(userStatus);
List<User> list = userMapper.selectByExample(example);
return list.size();
}
......
......@@ -2,10 +2,13 @@ package com.jsh.erp.service.userBusiness;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.entities.UserBusiness;
import com.jsh.erp.datasource.entities.UserBusinessExample;
import com.jsh.erp.datasource.mappers.UserBusinessMapper;
import com.jsh.erp.datasource.mappers.UserBusinessMapperEx;
import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -16,6 +19,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
@Service
......@@ -25,7 +29,11 @@ public class UserBusinessService {
@Resource
private UserBusinessMapper userBusinessMapper;
@Resource
private UserBusinessMapperEx userBusinessMapperEx;
@Resource
private LogService logService;
@Resource
private UserService userService;
public UserBusiness getUserBusiness(long id) {
return userBusinessMapper.selectByPrimaryKey(id);
......@@ -126,5 +134,13 @@ public class UserBusinessService {
List<UserBusiness> list = userBusinessMapper.selectByExample(example);
return list;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int batchDeleteUserBusinessByIds(String ids) {
logService.insertLog(BusinessConstants.LOG_INTERFACE_NAME_USER_BUSINESS,
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
return userBusinessMapperEx.batchDeleteUserBusinessByIds(new Date(),userInfo==null?null:userInfo.getId(),idArray);
}
}
......@@ -11,9 +11,9 @@
<select id="selectByConditionAccountHead" parameterType="com.jsh.erp.datasource.entities.AccountHeadExample" resultMap="ResultMapEx">
select ah.*, s.supplier OrganName, p.Name HandsPersonName, a.Name AccountName
from jsh_accounthead ah
left join jsh_supplier s on ah.OrganId=s.id
left join jsh_person p on ah.HandsPersonId=p.id
left join jsh_account a on ah.AccountId=a.id
left join jsh_supplier s on ah.OrganId=s.id and ifnull(s.delete_Flag,'0') !='1'
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 ah.BillNo like '%${billNo}%'
......@@ -27,6 +27,7 @@
<if test="endTime != null">
and ah.BillTime &lt;= '%${endTime}%'
</if>
and ifnull(ah.delete_Flag,'0') !='1'
order by ah.Id desc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
......@@ -51,6 +52,7 @@
<if test="endTime != null">
and BillTime &lt;= '%${endTime}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getMaxId" resultType="java.lang.Long">
......@@ -58,19 +60,32 @@
</select>
<select id="findAllMoney" resultType="java.math.BigDecimal">
select sum(${modeName}) as allMoney from jsh_accounthead where Type='${type}'
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>
<select id="getDetailByNumber" parameterType="com.jsh.erp.datasource.entities.AccountHeadExample" resultMap="ResultMapEx">
select ah.*, s.supplier OrganName, p.Name HandsPersonName, a.Name AccountName
from jsh_accounthead ah
left join jsh_supplier s on ah.OrganId=s.id
left join jsh_person p on ah.HandsPersonId=p.id
left join jsh_account a on ah.AccountId=a.id
left join jsh_supplier s on ah.OrganId=s.id and ifnull(s.delete_Flag,'0') !='1'
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 ah.BillNo = '${billNo}'
</if>
and ifnull(ah.delete_Flag,'0') !='1'
</select>
<update id="batchDeleteAccountHeadByIds">
update jsh_accounthead
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>
\ No newline at end of file
......@@ -20,6 +20,7 @@
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
......@@ -38,13 +39,25 @@
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getDetailList" parameterType="com.jsh.erp.datasource.entities.AccountItemExample" resultMap="ResultWithInfoExMap">
select ai.*,a.Name AccountName,ioi.Name InOutItemName
from jsh_accountitem ai left join jsh_account a on ai.AccountId=a.id
left join jsh_inoutitem ioi on ai.InOutItemId = ioi.id
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}
and ifnull(ai.delete_Flag,'0') !='1'
order by ai.id asc
</select>
<update id="batchDeleteAccountItemByIds">
update jsh_accountitem
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>
\ No newline at end of file
......@@ -28,6 +28,7 @@
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
......@@ -47,64 +48,66 @@
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="findAccountInOutList" parameterType="com.jsh.erp.datasource.entities.AccountExample" resultMap="ResultInOutList">
<!--主表出入库涉及的账户 -->
select dh.Number,concat(dh.SubType,dh.Type) as newType,s.supplier,dh.ChangeAmount,date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime,'' as AList,'' as AMList
from jsh_depothead dh inner join jsh_supplier s on dh.OrganId = s.id
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}
</if>
and ifnull(dh.delete_Flag,'0') !='1'
<!--主表收入和支出涉及的账户 -->
UNION ALL
select ah.BillNo,ah.Type as newType,s.supplier,ah.ChangeAmount,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime,'' as AList,'' as AMList
from jsh_accounthead ah inner join jsh_supplier s on ah.OrganId=s.id
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}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
<!--明细中涉及的账户(收款,付款,收预付款) -->
UNION ALL
select ah.BillNo,ah.Type as newType,s.supplier,ai.EachAmount,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime,'' as AList,'' as AMList
from jsh_accounthead ah inner join jsh_supplier s on ah.OrganId=s.id
inner join jsh_accountitem ai on ai.HeaderId=ah.Id
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}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
<!--主表中转出的账户 -->
UNION ALL
select ah.BillNo,ah.Type as newType, '' as sName,ah.ChangeAmount,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime,'' as AList,'' as AMList
from jsh_accounthead ah inner join jsh_accountitem ai on ai.HeaderId=ah.Id
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}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
<!--明细中被转入的账户 -->
UNION ALL
select ah.BillNo,ah.Type as newType, '' as sName,ai.EachAmount,date_format(ah.BillTime,'%Y-%m-%d %H:%i:%S') as oTime,'' as AList,'' as AMList
from jsh_accounthead ah inner join jsh_accountitem ai on ai.HeaderId=ah.Id
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}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
<!--多账户的情况 -->
UNION ALL
select dh.Number,concat(dh.SubType,dh.Type) as newType,s.supplier,dh.ChangeAmount,date_format(dh.OperTime,'%Y-%m-%d %H:%i:%S') as oTime,
dh.AccountIdList as AList,dh.AccountMoneyList as AMList
from jsh_depothead dh inner join jsh_supplier s on dh.OrganId = s.id
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.AccountIdList like '%${accountId}%'
</if>
and ifnull(dh.delete_Flag,'0') !='1'
ORDER BY oTime desc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
......@@ -116,57 +119,68 @@
(
<!--主表出入库涉及的账户 -->
select count(1) a
from jsh_depothead dh inner join jsh_supplier s on dh.OrganId = s.id
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}
</if>
and ifnull(dh.delete_Flag,'0') !='1'
<!--主表收入和支出涉及的账户 -->
UNION ALL
select count(1) a
from jsh_accounthead ah inner join jsh_supplier s on ah.OrganId=s.id
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}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
<!--明细中涉及的账户(收款,付款,收预付款) -->
UNION ALL
select count(1) a
from jsh_accounthead ah inner join jsh_supplier s on ah.OrganId=s.id
inner join jsh_accountitem ai on ai.HeaderId=ah.Id
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}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
<!--主表中转出的账户 -->
UNION ALL
select count(1) a
from jsh_accounthead ah inner join jsh_accountitem ai on ai.HeaderId=ah.Id
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}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
<!--明细中被转入的账户 -->
UNION ALL
select count(1) a
from jsh_accounthead ah inner join jsh_accountitem ai on ai.HeaderId=ah.Id
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}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
<!--多账户的情况 -->
UNION ALL
select count(1) a
from jsh_depothead dh inner join jsh_supplier s on dh.OrganId = s.id
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.AccountIdList like '%${accountId}%'
</if>
and ifnull(dh.delete_Flag,'0') !='1'
) cc
</select>
<update id="batchDeleteAccountByIds">
update jsh_account
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>
\ No newline at end of file
......@@ -11,6 +11,7 @@
<if test="type != null">
and type='${type}'
</if>
and ifnull(delete_Flag,'0') !='1'
order by sort asc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
......@@ -27,5 +28,16 @@
<if test="type != null">
and type='${type}'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<update id="batchDeleteAppByIds">
update jsh_app
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>
\ No newline at end of file
......@@ -44,11 +44,11 @@
<select id="selectByConditionDepotHead" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="ResultMapEx">
select 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
left join jsh_supplier s on dh.OrganId=s.id
left join jsh_person p on dh.HandsPersonId=p.id
left join jsh_account a on dh.AccountId=a.id
left join jsh_depot dd on dh.AllocationProjectId=dd.id
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'
left join jsh_depot dd on dh.AllocationProjectId=dd.id and ifnull(dd.delete_Flag,'0') !='1'
where 1=1
<if test="type != null">
and dh.Type='${type}'
......@@ -68,6 +68,7 @@
<if test="endTime != null">
and dh.OperTime &lt;= (${endTime})
</if>
and ifnull(dh.delete_Flag,'0') !='1'
order by dh.Id desc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
......@@ -96,6 +97,7 @@
<if test="endTime != null">
and OperTime &lt;= (${endTime})
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getMaxId" resultType="java.lang.Long">
......@@ -103,17 +105,21 @@
</select>
<select id="findMaterialsListByHeaderId" resultType="java.lang.String">
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 where jsh_depotitem.HeaderId = ${id}
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}
and ifnull(jsh_depotitem.delete_Flag,'0') !='1'
</select>
<select id="findByAll" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultWithInfoExMap">
select dh.Number,m.`name` MName,m.Model,di.UnitPrice,di.OperNumber,di.AllPrice,s.supplier SName,d.dName DName,
date_format(dh.OperTime, '%Y-%m-%d') OperTime, concat(dh.SubType,dh.Type) as NewType
from jsh_depothead dh inner join jsh_depotitem di on di.HeaderId=dh.id
inner join jsh_material m on m.id=di.MaterialId
inner join jsh_supplier s on s.id=dh.OrganId
inner join (select id,name as dName from jsh_depot) d on d.id=di.DepotId
from jsh_depothead dh
inner join jsh_depotitem di on di.HeaderId=dh.id and ifnull(di.delete_Flag,'0') !='1'
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}'
<if test="oId != null">
and dh.OrganId = ${oId}
......@@ -127,6 +133,7 @@
<if test="type != null">
and dh.Type='${type}'
</if>
and ifnull(dh.delete_Flag,'0') !='1'
ORDER BY OperTime DESC,Number desc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
......@@ -135,10 +142,11 @@
<select id="findByAllCount" resultType="java.lang.Integer">
select count(1)
from jsh_depothead dh inner join jsh_depotitem di on di.HeaderId=dh.id
inner join jsh_material m on m.id=di.MaterialId
inner join jsh_supplier s on s.id=dh.OrganId
inner join (select id,name as dName from jsh_depot) d on d.id=di.DepotId
from jsh_depothead dh
inner join jsh_depotitem di on di.HeaderId=dh.id and ifnull(di.delete_Flag,'0') !='1'
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}'
<if test="oId != null">
and dh.OrganId = ${oId}
......@@ -152,14 +160,16 @@
<if test="type != null">
and dh.Type='${type}'
</if>
and ifnull(dh.delete_Flag,'0') !='1'
ORDER BY OperTime DESC,Number desc
</select>
<select id="findInOutMaterialCount" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultInOutMaterialCount">
select di.MaterialId, m.mName,m.Model,m.categoryName,
(select sum(jdi.BasicNumber) numSum from jsh_depothead jdh INNER JOIN jsh_depotitem jdi
on jdh.id=jdi.HeaderId where jdi.MaterialId=di.MaterialId
(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}'
<if test="oId != null">
and jdh.OrganId = ${oId}
......@@ -170,10 +180,12 @@
<if test="pid == null">
and jdi.DepotId in (${dids})
</if>
and ifnull(jdh.delete_Flag,'0') !='1'
) numSum,
(select sum(jdi.AllPrice) priceSum from jsh_depothead jdh INNER JOIN jsh_depotitem jdi
on jdh.id=jdi.HeaderId where jdi.MaterialId=di.MaterialId
(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}'
<if test="oId != null">
and jdh.OrganId = ${oId}
......@@ -184,10 +196,15 @@
<if test="pid == null">
and jdi.DepotId in (${dids})
</if>
and ifnull(jdh.delete_Flag,'0') !='1'
) priceSum
from jsh_depothead dh INNER JOIN jsh_depotitem di on dh.id=di.HeaderId
from jsh_depothead dh
INNER JOIN jsh_depotitem di on dh.id=di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
INNER JOIN (SELECT jsh_material.id,jsh_material.name mName, Model,jsh_materialcategory.`Name` categoryName
from jsh_material INNER JOIN jsh_materialcategory on jsh_material.CategoryId=jsh_materialcategory.Id) m
from jsh_material
INNER 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}'
<if test="oId != null">
and dh.OrganId = ${oId}
......@@ -198,6 +215,7 @@
<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
<if test="offset != null and rows != null">
limit #{offset},#{rows}
......@@ -206,10 +224,13 @@
<select id="findInOutMaterialCountTotal" resultType="java.lang.Integer">
select count(1) from
(select di.MaterialId, m.mName,m.Model,m.categoryName from jsh_depothead dh INNER JOIN jsh_depotitem di on dh.id=di.HeaderId
(select di.MaterialId, m.mName,m.Model,m.categoryName from jsh_depothead dh
INNER JOIN jsh_depotitem di on dh.id=di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
INNER JOIN (SELECT jsh_material.id,jsh_material.name mName, Model,jsh_materialcategory.`Name` categoryName
from jsh_material INNER JOIN jsh_materialcategory on jsh_material.CategoryId=jsh_materialcategory.Id) m
on m.Id=di.MaterialId where dh.type='${type}' and dh.OperTime >='${beginTime}' and dh.OperTime &lt;='${endTime}'
from jsh_material
INNER 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}'
<if test="oId != null">
and dh.OrganId = ${oId}
</if>
......@@ -219,25 +240,30 @@
<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
</select>
<select id="findStatementAccount" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultStatementAccount">
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 where s.type='${supType}' and (dh.SubType!='其它' and dh.SubType!='采购订单' and dh.SubType!='销售订单')
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}'
<if test="organId != null">
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 where s.type='${supType}'
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}'
<if test="organId != null">
and ah.OrganId=${organId}
</if>
and ifnull(ah.delete_Flag,'0') !='1'
ORDER BY oTime
<if test="offset != null and rows != null">
limit #{offset},#{rows}
......@@ -248,38 +274,44 @@
select sum(a) from
(
select count(1) a from jsh_depothead dh
inner join jsh_supplier s on s.id=dh.OrganId where s.type='${supType}' and (dh.SubType!='其它' and dh.SubType!='采购订单' and dh.SubType!='销售订单')
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}'
<if test="organId != null">
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 where s.type='${supType}'
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}'
<if test="organId != null">
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}'
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getDetailByNumber" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="ResultMapEx">
select 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
left join jsh_supplier s on dh.OrganId=s.id
left join jsh_person p on dh.HandsPersonId=p.id
left join jsh_account a on dh.AccountId=a.id
left join jsh_depot dd on dh.AllocationProjectId=dd.id
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'
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}'
</if>
and ifnull(dh.delete_Flag,'0') !='1'
</select>
<insert id="adddepotHead" parameterType="com.jsh.erp.datasource.entities.DepotHead"
......@@ -396,4 +428,15 @@
select _nextval(#{seq_name}) from dual;
</select>
<update id="batchDeleteDepotHeadByIds">
update jsh_depothead
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>
\ No newline at end of file
......@@ -55,6 +55,7 @@
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
......@@ -73,39 +74,52 @@
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getHeaderIdByMaterial" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="HeaderIdResultMap">
select dt.HeaderId from jsh_depotitem dt INNER JOIN jsh_material m on dt.MaterialId = m.Id
select dt.HeaderId from jsh_depotitem dt
INNER JOIN jsh_material m on dt.MaterialId = m.Id and ifnull(m.delete_Flag,'0') !='1'
where (m.`Name` like '%${materialParam}%' or m.Model like '%${materialParam}%')
<if test="depotIds != null">
and dt.DepotId in (${depotIds})
</if>
and ifnull(dt.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 type='入库' then di.BasicNumber when type='出库' then 0-di.BasicNumber else 0 end as b_num,
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 where type!='其它'
and SubType!='调拨'
and MaterialId =${mId} ORDER BY oTime desc
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 dh.SubType!='调拨'
and di.MaterialId =${mId}
and ifnull(dh.delete_Flag,'0') !='1'
ORDER BY oTime desc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
</select>
<select id="findDetailByTypeAndMaterialIdCounts" resultType="java.lang.Long">
select count(1)
from jsh_depothead dh INNER JOIN jsh_depotitem di on dh.id=di.HeaderId where type!='其它'
and SubType!='调拨'
and MaterialId =${mId}
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 dh.SubType!='调拨'
and di.MaterialId =${mId}
and ifnull(dh.delete_Flag,'0') !='1'
</select>
<select id="findStockNumByMaterialIdList" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultAndMaterialMap">
select di.*,m.Name mName,m.Model mModel from jsh_depotitem di inner join jsh_material m on di.MaterialId=m.Id where 1=1
select di.*,m.Name mName,m.Model mModel 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="mId != null">
and MaterialId=${mId}
and di.MaterialId=${mId}
</if>
and ifnull(di.delete_Flag,'0') !='1'
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
......@@ -115,34 +129,44 @@
<if test="mId != null">
and MaterialId=${mId}
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="findByTypeAndMaterialIdIn" 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 where type='入库'
and MaterialId = ${mId}
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 ifnull(dh.delete_Flag,'0') !='1'
</select>
<select id="findByTypeAndMaterialIdOut" 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 where type='出库'
and SubType!='调拨' and MaterialId = ${mId}
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 dh.SubType!='调拨'
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,
dp1.name DepotName,dp2.name AnotherDepotName, u.id UnitId, u.UName
from jsh_depotitem di left join jsh_material m on di.MaterialId=m.id
left join jsh_unit u on m.UnitId = u.id
left join jsh_depot dp1 on di.DepotId=dp1.id
left join jsh_depot dp2 on di.AnotherDepotId=dp2.id
from jsh_depotitem di
left 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'
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}
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
from jsh_depotitem di
inner join jsh_material m on di.MaterialId=m.id
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 di.HeaderId in (${headIds})
......@@ -150,6 +174,7 @@
<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
<if test="offset != null and rows != null">
limit #{offset},#{rows}
......@@ -159,7 +184,7 @@
<select id="findByAllCount" resultType="java.lang.Integer">
select count(1) from (select m.id
from jsh_depotitem di
inner join jsh_material m on di.MaterialId=m.id
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 di.HeaderId in (${headIds})
......@@ -167,112 +192,150 @@
<if test="materialIds != null">
and di.MaterialId in (${materialIds})
</if>
and ifnull(di.delete_Flag,'0') !='1'
group by m.id) cc
</select>
<select id="findByTypeInIsPrev" resultType="java.math.BigDecimal">
select sum(BasicNumber) as BasicNumber from jsh_depotitem di,jsh_depothead dh
where di.HeaderId = dh.id and
((type='入库' and DepotId=${ProjectId})
((dh.type='入库' and di.DepotId=${ProjectId})
or
(SubType='调拨' and AnotherDepotId=${ProjectId})
(dh.SubType='调拨' and di.AnotherDepotId=${ProjectId})
or
(AnotherDepotId=${ProjectId}))
and MaterialId = ${MId} and dh.OperTime &lt; '${MonthTime}-01 00:00:00'
(di.AnotherDepotId=${ProjectId}))
and di.MaterialId = ${MId}
and dh.OperTime &lt; '${MonthTime}-01 00:00:00'
and ifnull(dh.delete_Flag,'0') !='1'
and ifnull(di.delete_Flag,'0') !='1'
</select>
<select id="findByTypeInIsNotPrev" resultType="java.math.BigDecimal">
select sum(BasicNumber) as BasicNumber from jsh_depotitem di,jsh_depothead dh
where di.HeaderId = dh.id and
((type='入库' and DepotId=${ProjectId})
((dh.type='入库' and di.DepotId=${ProjectId})
or
(SubType='调拨' and AnotherDepotId=${ProjectId})
(dh.SubType='调拨' and di.AnotherDepotId=${ProjectId})
or
(AnotherDepotId=${ProjectId}))
and MaterialId = ${MId} and dh.OperTime &gt;= '${MonthTime}-01 00:00:00'
(di.AnotherDepotId=${ProjectId}))
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>
<select id="findByTypeOutIsPrev" resultType="java.math.BigDecimal">
select sum(BasicNumber) as BasicNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='出库'
and DepotId= ${ProjectId}
and MaterialId = ${MId}
and jsh_depothead.OperTime &lt; '${MonthTime}-01 00:00:00'
select sum(BasicNumber) as BasicNumber from jsh_depotitem di,jsh_depothead dh
where di.HeaderId = dh.id
and dh.type='出库'
and di.DepotId= ${ProjectId}
and di.MaterialId = ${MId}
and dh.OperTime &lt; '${MonthTime}-01 00:00:00'
and ifnull(dh.delete_Flag,'0') !='1'
and ifnull(di.delete_Flag,'0') !='1'
</select>
<select id="findByTypeOutIsNotPrev" resultType="java.math.BigDecimal">
select sum(BasicNumber) as BasicNumber from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='出库'
and DepotId= ${ProjectId}
and MaterialId = ${MId}
and jsh_depothead.OperTime &gt;= '${MonthTime}-01 00:00:00'
and jsh_depothead.OperTime &lt;= '${MonthTime}-31 23:59:59'
select sum(BasicNumber) as BasicNumber from jsh_depotitem di,jsh_depothead dh
where di.HeaderId = dh.id and dh.type='出库'
and di.DepotId= ${ProjectId}
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>
<select id="findPriceByTypeInIsPrev" resultType="java.math.BigDecimal">
select sum(AllPrice) as AllPrice from jsh_depotitem di,jsh_depothead dh
where di.HeaderId = dh.id and
((type='入库' and DepotId=${ProjectId})
((dh.type='入库' and di.DepotId=${ProjectId})
or
(SubType='调拨' and AnotherDepotId=${ProjectId})
(dh.SubType='调拨' and di.AnotherDepotId=${ProjectId})
or
(AnotherDepotId=${ProjectId}))
and MaterialId = ${MId} and dh.OperTime &lt; '${MonthTime}-01 00:00:00'
(di.AnotherDepotId=${ProjectId}))
and di.MaterialId = ${MId}
and dh.OperTime &lt; '${MonthTime}-01 00:00:00'
and ifnull(dh.delete_Flag,'0') !='1'
and ifnull(di.delete_Flag,'0') !='1'
</select>
<select id="findPriceByTypeInIsNotPrev" resultType="java.math.BigDecimal">
select sum(AllPrice) as AllPrice from jsh_depotitem di,jsh_depothead dh
where di.HeaderId = dh.id and
((type='入库' and DepotId=${ProjectId})
((dh.type='入库' and di.DepotId=${ProjectId})
or
(SubType='调拨' and AnotherDepotId=${ProjectId})
(dh.SubType='调拨' and di.AnotherDepotId=${ProjectId})
or
(AnotherDepotId=${ProjectId}))
and MaterialId = ${MId} and dh.OperTime &gt;= '${MonthTime}-01 00:00:00'
(di.AnotherDepotId=${ProjectId}))
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>
<select id="findPriceByTypeOutIsPrev" resultType="java.math.BigDecimal">
select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='出库'
and DepotId= ${ProjectId}
and MaterialId = ${MId}
and jsh_depothead.OperTime &lt; '${MonthTime}-01 00:00:00'
select sum(AllPrice) as AllPrice from jsh_depotitem di,jsh_depothead dh
where di.HeaderId = dh.id and dh.type='出库'
and di.DepotId= ${ProjectId}
and di.MaterialId = ${MId}
and dh.OperTime &lt; '${MonthTime}-01 00:00:00'
and ifnull(dh.delete_Flag,'0') !='1'
and ifnull(di.delete_Flag,'0') !='1'
</select>
<select id="findPriceByTypeOutIsNotPrev" resultType="java.math.BigDecimal">
select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead where jsh_depotitem.HeaderId = jsh_depothead.id and type='出库'
and DepotId= ${ProjectId}
and MaterialId = ${MId}
and jsh_depothead.OperTime &gt;= '${MonthTime}-01 00:00:00'
and jsh_depothead.OperTime &lt;= '${MonthTime}-31 23:59:59'
select sum(AllPrice) as AllPrice from jsh_depotitem di,jsh_depothead dh
where di.HeaderId = dh.id and dh.type='出库'
and di.DepotId= ${ProjectId}
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>
<select id="buyOrSaleNumber" resultType="java.math.BigDecimal">
select sum(BasicNumber) as BasicNumber from jsh_depotitem,jsh_depothead
where jsh_depotitem.HeaderId = jsh_depothead.id and type='${type}' and subType='${subType}'
and MaterialId =${MId} and jsh_depothead.OperTime &gt;= '${MonthTime}-01 00:00:00'
and jsh_depothead.OperTime &lt;= '${MonthTime}-31 23:59:59'
select sum(BasicNumber) as BasicNumber from jsh_depotitem di,jsh_depothead dh
where di.HeaderId = dh.id
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>
<select id="buyOrSalePrice" resultType="java.math.BigDecimal">
select sum(AllPrice) as AllPrice from jsh_depotitem,jsh_depothead
where jsh_depotitem.HeaderId = jsh_depothead.id and type='${type}' and subType='${subType}'
and MaterialId =${MId} and jsh_depothead.OperTime &gt;= '${MonthTime}-01 00:00:00'
and jsh_depothead.OperTime &lt;= '${MonthTime}-31 23:59:59'
select sum(AllPrice) 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}
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>
<select id="findGiftByTypeIn" resultType="java.math.BigDecimal">
select sum(BasicNumber) as BasicNumber from jsh_depotitem,jsh_depothead
where jsh_depotitem.HeaderId = jsh_depothead.id and jsh_depothead.SubType='${subType}'
and jsh_depotitem.AnotherDepotId=${ProjectId}
and jsh_depotitem.MaterialId =${MId}
select sum(BasicNumber) as BasicNumber from jsh_depotitem di,jsh_depothead dh
where di.HeaderId = dh.id
and dh.SubType='${subType}'
and di.AnotherDepotId=${ProjectId}
and di.MaterialId =${MId}
and ifnull(dh.delete_Flag,'0') !='1'
and ifnull(di.delete_Flag,'0') !='1'
</select>
<select id="findGiftByTypeOut" resultType="java.math.BigDecimal">
select sum(BasicNumber) as BasicNumber from jsh_depotitem,jsh_depothead
where jsh_depotitem.HeaderId = jsh_depothead.id and jsh_depothead.SubType='${subType}'
and jsh_depotitem.DepotId=${ProjectId}
and jsh_depotitem.MaterialId =${MId}
select sum(BasicNumber) as BasicNumber from jsh_depotitem di,jsh_depothead dh
where di.HeaderId = dh.id
and dh.SubType='${subType}'
and di.DepotId=${ProjectId}
and di.MaterialId =${MId}
and ifnull(dh.delete_Flag,'0') !='1'
and ifnull(di.delete_Flag,'0') !='1'
</select>
<select id="findDepotItemListBydepotheadId" resultType="com.jsh.erp.datasource.entities.DepotItem">
......@@ -285,12 +348,14 @@
from jsh_depotitem dep,jsh_material mat
where 1=1
<if test="depotheadId != null">
and HeaderId = #{depotheadId}
and dep.HeaderId = #{depotheadId}
</if>
and dep.materialid=mat.id
<if test="enableSerialNumber != null">
and mat.enableSerialNumber = #{enableSerialNumber}
</if>
and ifnull(dep.delete_Flag,'0') !='1'
and ifnull(mat.delete_Flag,'0') !='1'
</select>
<delete id="deleteDepotItemByDepotHeadIds">
delete from jsh_depotitem
......@@ -302,6 +367,27 @@
</foreach>
)
</delete>
<update id="batchDeleteDepotItemByDepotHeadIds">
update jsh_depotitem
set delete_Flag='1'
where 1=1
and HeaderId in
(
<foreach collection="depotheadIds" item="depotheadId" separator=",">
#{depotheadId}
</foreach>
)
</update>
<update id="batchDeleteDepotItemByIds">
update jsh_depotitem
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
......
......@@ -18,6 +18,7 @@
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
order by sort asc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
......@@ -37,6 +38,7 @@
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="getDepotList" parameterType="java.util.Map" resultMap="ResultMapEx">
select dep.*,usr.username as principalName
......@@ -54,8 +56,19 @@
<bind name="remark" value="'%' + _parameter.remark + '%'" />
and dep.remark like #{remark}
</if>
and ifnull(dep.delete_Flag,'0') !='1'
order by dep.sort asc
</select>
<update id="batchDeleteDepotByIds">
update jsh_depot
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
......
......@@ -11,6 +11,7 @@
<if test="type != null">
and type='${type}'
</if>
and ifnull(delete_Flag,'0') !='1'
order by sort asc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
......@@ -27,5 +28,16 @@
<if test="type != null">
and type='${type}'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<update id="batchDeleteFunctionsByIds">
update jsh_functions
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>
\ No newline at end of file
......@@ -14,6 +14,7 @@
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
......@@ -32,5 +33,16 @@
<if test="remark != null">
and remark like '%${remark}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<update id="batchDeleteInOutItemByIds">
update jsh_inoutitem
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>
\ No newline at end of file
......@@ -13,8 +13,8 @@
<select id="selectByConditionMaterial" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultMapList">
select m.*,u.uname unitName, mc.name categoryName
FROM jsh_material m
left JOIN jsh_unit u on m.UnitId = u.id
left JOIN jsh_materialcategory mc on m.CategoryId = mc.id
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 m.name like '%${name}%'
......@@ -25,6 +25,7 @@
<if test="categoryId != 1">
and m.CategoryId in (${categoryIds})
</if>
and ifnull(m.delete_Flag,'0') !='1'
order by m.id asc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
......@@ -35,8 +36,8 @@
SELECT
COUNT(m.id)
FROM jsh_material m
left JOIN jsh_unit u on m.UnitId = u.id
left JOIN jsh_materialcategory mc on m.CategoryId = mc.id
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 m.name like '%${name}%'
......@@ -47,18 +48,29 @@
<if test="categoryId != 1">
and m.CategoryId in (${categoryIds})
</if>
and ifnull(m.delete_Flag,'0') !='1'
</select>
<select id="findUnitName" resultType="java.lang.String">
select jsh_unit.UName from jsh_unit left join jsh_material on UnitId=jsh_unit.id where jsh_material.id = ${mId}
select jsh_unit.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}
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 where m.id = ${id}
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}
and ifnull(m.delete_Flag,'0') !='1'
</select>
<select id="findBySelect" 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 where m.enabled=1 ORDER BY Id asc
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.enabled=1
and ifnull(m.delete_Flag,'0') !='1'
ORDER BY Id asc
</select>
<update id="updatePriceNullByPrimaryKey" parameterType="java.lang.Long">
......@@ -81,8 +93,8 @@
<select id="findByAll" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultMapList">
select m.*,u.uname unitName, mc.name categoryName
FROM jsh_material m
left JOIN jsh_unit u on m.UnitId = u.id
left JOIN jsh_materialcategory mc on m.CategoryId = mc.id
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 m.name like '%${name}%'
......@@ -93,6 +105,7 @@
<if test="categoryId != 1">
and m.CategoryId in (${categoryIds})
</if>
and ifnull(m.delete_Flag,'0') !='1'
order by m.id asc
</select>
<select id="findByMaterialName" resultType="com.jsh.erp.datasource.entities.Material">
......@@ -102,6 +115,7 @@
<if test="name != null">
and m.name =#{name}
</if>
and ifnull(m.delete_Flag,'0') !='1'
</select>
<select id="getMaterialEnableSerialNumberList" parameterType="java.util.Map" resultMap="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap">
......@@ -121,8 +135,20 @@
<bind name="model" value="'%' + _parameter.model + '%'" />
and model like #{model}
</if>
and ifnull(delete_Flag,'0') !='1'
order by id desc
</select>
<update id="batchDeleteMaterialByIds">
update jsh_material
set delete_Flag='1'
where 1=1
and ifnull(delete_Flag,'0') !='1'
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>
\ No newline at end of file
......@@ -8,6 +8,7 @@
<if test="name != null">
and nativeName like '%${name}%'
</if>
and ifnull(delete_Flag,'0') !='1'
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
......@@ -20,5 +21,16 @@
<if test="name != null">
and nativeName like '%${name}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<update id="batchDeleteMaterialPropertyByIds">
update jsh_materialproperty
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>
\ No newline at end of file
......@@ -11,6 +11,7 @@
<if test="type != null">
and type='${type}'
</if>
and ifnull(delete_Flag,'0') !='1'
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
......@@ -26,5 +27,16 @@
<if test="type != null">
and type='${type}'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<update id="batchDeletePersonByIds">
update jsh_person
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>
\ No newline at end of file
......@@ -5,6 +5,7 @@
SELECT *
FROM jsh_role
WHERE 1=1
and ifnull(delete_Flag,'0') !='1'
<if test="name != null">
and name like '%${name}%'
</if>
......@@ -17,8 +18,19 @@
COUNT(id)
FROM jsh_role
WHERE 1=1
and ifnull(delete_Flag,'0') !='1'
<if test="name != null">
and name like '%${name}%'
</if>
</select>
<update id="batchDeleteRoleByIds">
update jsh_role
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment