优化收付款单的查询
This commit is contained in:
@@ -23,7 +23,7 @@ public interface AccountHeadMapperEx {
|
|||||||
@Param("accountId") Long accountId,
|
@Param("accountId") Long accountId,
|
||||||
@Param("status") String status,
|
@Param("status") String status,
|
||||||
@Param("remark") String remark,
|
@Param("remark") String remark,
|
||||||
@Param("ahIdList") List<Long> ahIdList,
|
@Param("number") String number,
|
||||||
@Param("offset") Integer offset,
|
@Param("offset") Integer offset,
|
||||||
@Param("rows") Integer rows);
|
@Param("rows") Integer rows);
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public interface AccountHeadMapperEx {
|
|||||||
@Param("accountId") Long accountId,
|
@Param("accountId") Long accountId,
|
||||||
@Param("status") String status,
|
@Param("status") String status,
|
||||||
@Param("remark") String remark,
|
@Param("remark") String remark,
|
||||||
@Param("ahIdList") List<Long> ahIdList);
|
@Param("number") String number);
|
||||||
|
|
||||||
BigDecimal findAllMoney(
|
BigDecimal findAllMoney(
|
||||||
@Param("supplierId") Integer supplierId,
|
@Param("supplierId") Integer supplierId,
|
||||||
|
|||||||
@@ -97,9 +97,8 @@ public class AccountHeadService {
|
|||||||
String [] creatorArray = getCreatorArray(roleType);
|
String [] creatorArray = getCreatorArray(roleType);
|
||||||
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||||
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||||
List<Long> ahIdList = accountItemService.getAhIdListByBillNumber(number);
|
|
||||||
List<AccountHeadVo4ListEx> list = accountHeadMapperEx.selectByConditionAccountHead(type, creatorArray, billNo,
|
List<AccountHeadVo4ListEx> list = accountHeadMapperEx.selectByConditionAccountHead(type, creatorArray, billNo,
|
||||||
beginTime, endTime, organId, creator, handsPersonId, accountId, status, remark, ahIdList, offset, rows);
|
beginTime, endTime, organId, creator, handsPersonId, accountId, status, remark, number, offset, rows);
|
||||||
if (null != list) {
|
if (null != list) {
|
||||||
for (AccountHeadVo4ListEx ah : list) {
|
for (AccountHeadVo4ListEx ah : list) {
|
||||||
if(ah.getChangeAmount() != null) {
|
if(ah.getChangeAmount() != null) {
|
||||||
@@ -128,9 +127,8 @@ public class AccountHeadService {
|
|||||||
String [] creatorArray = getCreatorArray(roleType);
|
String [] creatorArray = getCreatorArray(roleType);
|
||||||
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
beginTime = Tools.parseDayToTime(beginTime,BusinessConstants.DAY_FIRST_TIME);
|
||||||
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
endTime = Tools.parseDayToTime(endTime,BusinessConstants.DAY_LAST_TIME);
|
||||||
List<Long> ahIdList = accountItemService.getAhIdListByBillNumber(number);
|
|
||||||
result = accountHeadMapperEx.countsByAccountHead(type, creatorArray, billNo,
|
result = accountHeadMapperEx.countsByAccountHead(type, creatorArray, billNo,
|
||||||
beginTime, endTime, organId, creator, handsPersonId, accountId, status, remark, ahIdList);
|
beginTime, endTime, organId, creator, handsPersonId, accountId, status, remark, number);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
JshException.readFail(logger, e);
|
JshException.readFail(logger, e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -261,29 +261,4 @@ public class AccountItemService {
|
|||||||
public BigDecimal getEachAmountByBillId(Long billId) {
|
public BigDecimal getEachAmountByBillId(Long billId) {
|
||||||
return accountItemMapperEx.getEachAmountByBillId(billId).abs();
|
return accountItemMapperEx.getEachAmountByBillId(billId).abs();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Long> getAhIdListByBillNumber(String number) throws Exception {
|
|
||||||
if(StringUtil.isNotEmpty(number)) {
|
|
||||||
DepotHead depotHead = depotHeadService.getDepotHead(number);
|
|
||||||
if(depotHead.getId()!=null) {
|
|
||||||
List<Long> ahIdList = new ArrayList<>();
|
|
||||||
AccountItemExample example = new AccountItemExample();
|
|
||||||
example.createCriteria().andBillIdEqualTo(depotHead.getId()).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
|
||||||
List<AccountItem> list = accountItemMapper.selectByExample(example);
|
|
||||||
if (list != null && list.size() > 0) {
|
|
||||||
for(AccountItem accountItem: list) {
|
|
||||||
ahIdList.add(accountItem.getHeaderId());
|
|
||||||
}
|
|
||||||
return ahIdList;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
<select id="selectByConditionAccountHead" parameterType="com.jsh.erp.datasource.entities.AccountHeadExample" resultMap="ResultMapEx">
|
<select id="selectByConditionAccountHead" parameterType="com.jsh.erp.datasource.entities.AccountHeadExample" resultMap="ResultMapEx">
|
||||||
select ah.*, s.supplier OrganName, p.Name HandsPersonName, u.username userName, a.Name AccountName
|
select ah.*, s.supplier OrganName, p.Name HandsPersonName, u.username userName, a.Name AccountName
|
||||||
from jsh_account_head ah
|
from jsh_account_head ah
|
||||||
|
left join jsh_account_item ai on ah.id=ai.header_id and ifnull(ai.delete_flag,'0') !='1'
|
||||||
|
left join jsh_depot_head dh on dh.id=ai.bill_id and ifnull(dh.delete_flag,'0') !='1'
|
||||||
left join jsh_supplier s on ah.organ_id=s.id and ifnull(s.delete_Flag,'0') !='1'
|
left join jsh_supplier s on ah.organ_id=s.id and ifnull(s.delete_Flag,'0') !='1'
|
||||||
left join jsh_user u on ah.creator=u.id and ifnull(u.Status,'0') !='1'
|
left join jsh_user u on ah.creator=u.id and ifnull(u.Status,'0') !='1'
|
||||||
left join jsh_person p on ah.hands_person_id=p.id and ifnull(p.delete_Flag,'0') !='1'
|
left join jsh_person p on ah.hands_person_id=p.id and ifnull(p.delete_Flag,'0') !='1'
|
||||||
@@ -56,11 +58,9 @@
|
|||||||
<bind name="bindRemark" value="'%'+remark+'%'"/>
|
<bind name="bindRemark" value="'%'+remark+'%'"/>
|
||||||
and ah.remark like #{bindRemark}
|
and ah.remark like #{bindRemark}
|
||||||
</if>
|
</if>
|
||||||
<if test="ahIdList!=null and ahIdList.size()>0">
|
<if test="number != null and number !=''">
|
||||||
and ah.id in
|
<bind name="bindNumber" value="'%'+number+'%'"/>
|
||||||
<foreach collection="ahIdList" item="item" index="index" separator="," open="(" close=")">
|
and dh.number like #{bindNumber}
|
||||||
#{item}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
</if>
|
||||||
and ifnull(ah.delete_flag,'0') !='1'
|
and ifnull(ah.delete_flag,'0') !='1'
|
||||||
order by ah.id desc
|
order by ah.id desc
|
||||||
@@ -72,55 +72,55 @@
|
|||||||
|
|
||||||
<select id="countsByAccountHead" resultType="java.lang.Long">
|
<select id="countsByAccountHead" resultType="java.lang.Long">
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(id)
|
COUNT(ah.id)
|
||||||
FROM jsh_account_head
|
FROM jsh_account_head ah
|
||||||
|
left join jsh_account_item ai on ah.id=ai.header_id and ifnull(ai.delete_flag,'0') !='1'
|
||||||
|
left join jsh_depot_head dh on dh.id=ai.bill_id and ifnull(dh.delete_flag,'0') !='1'
|
||||||
WHERE 1=1
|
WHERE 1=1
|
||||||
<if test="billNo != null">
|
<if test="billNo != null">
|
||||||
<bind name="bindBillNo" value="'%'+billNo+'%'"/>
|
<bind name="bindBillNo" value="'%'+billNo+'%'"/>
|
||||||
and bill_no like #{bindBillNo}
|
and ah.bill_no like #{bindBillNo}
|
||||||
</if>
|
</if>
|
||||||
<if test="type != null">
|
<if test="type != null">
|
||||||
and type=#{type}
|
and ah.type=#{type}
|
||||||
</if>
|
</if>
|
||||||
<if test="beginTime != null">
|
<if test="beginTime != null">
|
||||||
and bill_time >= #{beginTime}
|
and ah.bill_time >= #{beginTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime != null">
|
<if test="endTime != null">
|
||||||
and bill_time <= #{endTime}
|
and ah.bill_time <= #{endTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="organId != null">
|
<if test="organId != null">
|
||||||
and organ_id=#{organId}
|
and ah.organ_id=#{organId}
|
||||||
</if>
|
</if>
|
||||||
<if test="handsPersonId != null">
|
<if test="handsPersonId != null">
|
||||||
and hands_person_id=#{handsPersonId}
|
and ah.hands_person_id=#{handsPersonId}
|
||||||
</if>
|
</if>
|
||||||
<if test="creator != null">
|
<if test="creator != null">
|
||||||
and creator=#{creator}
|
and ah.creator=#{creator}
|
||||||
</if>
|
</if>
|
||||||
<if test="creatorArray != null">
|
<if test="creatorArray != null">
|
||||||
and creator in (
|
and ah.creator in (
|
||||||
<foreach collection="creatorArray" item="creator" separator=",">
|
<foreach collection="creatorArray" item="creator" separator=",">
|
||||||
#{creator}
|
#{creator}
|
||||||
</foreach>
|
</foreach>
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="accountId != null">
|
<if test="accountId != null">
|
||||||
and account_id=#{accountId}
|
and ah.account_id=#{accountId}
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null and status != ''">
|
<if test="status != null and status != ''">
|
||||||
and status=#{status}
|
and ah.status=#{status}
|
||||||
</if>
|
</if>
|
||||||
<if test="remark != null and remark !=''">
|
<if test="remark != null and remark !=''">
|
||||||
<bind name="bindRemark" value="'%'+remark+'%'"/>
|
<bind name="bindRemark" value="'%'+remark+'%'"/>
|
||||||
and remark like #{bindRemark}
|
and ah.remark like #{bindRemark}
|
||||||
</if>
|
</if>
|
||||||
<if test="ahIdList!=null and ahIdList.size()>0">
|
<if test="number != null and number !=''">
|
||||||
and id in
|
<bind name="bindNumber" value="'%'+number+'%'"/>
|
||||||
<foreach collection="ahIdList" item="item" index="index" separator="," open="(" close=")">
|
and dh.number like #{bindNumber}
|
||||||
#{item}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
</if>
|
||||||
and ifnull(delete_flag,'0') !='1'
|
and ifnull(ah.delete_flag,'0') !='1'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findAllMoney" resultType="java.math.BigDecimal">
|
<select id="findAllMoney" resultType="java.math.BigDecimal">
|
||||||
|
|||||||
Reference in New Issue
Block a user