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

Merge pull request !41 from 乾坤平台/master
This commit is contained in:
乾坤平台
2019-04-01 21:05:18 +08:00
committed by 季圣华
85 changed files with 1632 additions and 224 deletions

View File

@@ -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>

View 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>

View 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>

View 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>

View 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>

View 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>

View File

@@ -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>

View 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="batchDeleteFunctionsByIds">
update jsh_functions
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>

View 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>

View 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>

View 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>

View 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>

View 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>

View File

@@ -15,8 +15,8 @@
ser.update_Time,mat.name as materialName,null as creator,null as updater,null as creatorName,
null as updaterName,ser.depothead_Id, dh.number as depotHeadNumber,concat(dh.SubType,dh.Type) as depotHeadType
FROM jsh_serial_number ser
left join jsh_material mat on mat.id = ser.material_Id
left join jsh_depothead dh on dh.id= ser.depothead_Id
left join jsh_material mat on mat.id = ser.material_Id and ifnull(mat.delete_Flag,'0') !='1'
left join jsh_depothead dh on dh.id= ser.depothead_Id and ifnull(dh.delete_Flag,'0') !='1'
where 1=1
<if test="serialNumber != null">
<bind name="serialNumber" value="'%' + _parameter.serialNumber + '%'" />
@@ -36,7 +36,7 @@
SELECT
COUNT(ser.id)
FROM jsh_serial_number ser
left JOIN jsh_material mat on mat.id = ser.material_Id
left JOIN jsh_material mat on mat.id = ser.material_Id and ifnull(mat.delete_Flag,'0') !='1'
where 1=1
<if test="serialNumber != null">
<bind name="serialNumber" value="'%' + _parameter.serialNumber + '%'" />
@@ -55,7 +55,7 @@
ser.update_Time,ser.creator,ser.updater,mat.name as materialName,cr.username as creatorName,
ur.username as updaterName,ser.depothead_Id
FROM jsh_serial_number ser
left JOIN jsh_material mat on mat.id = ser.material_Id
left JOIN jsh_material mat on mat.id = ser.material_Id and ifnull(mat.delete_Flag,'0') !='1'
left join jsh_user cr on ser.creator=cr.id and ifnull(cr.status,'0') not in('1','2')
left join jsh_user ur on ser.updater=ur.id and ifnull(ur.status,'0') not in('1','2')
where 1=1
@@ -231,7 +231,6 @@
update jsh_serial_number
set update_Time=#{updateTime},updater=#{updater},delete_Flag='1'
where 1=1
and ifnull(delete_Flag,'0') !='1'
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}

View File

@@ -20,6 +20,7 @@
<if test="description != null">
and description like '%${description}%'
</if>
and ifnull(delete_Flag,'0') !='1'
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
@@ -44,6 +45,7 @@
<if test="description != null">
and description like '%${description}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<select id="findByAll" parameterType="com.jsh.erp.datasource.entities.SupplierExample" resultMap="com.jsh.erp.datasource.mappers.SupplierMapper.BaseResultMap">
@@ -65,5 +67,16 @@
<if test="description != null">
and description like '%${description}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<update id="batchDeleteSupplierByIds">
update jsh_supplier
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>

View File

@@ -8,6 +8,7 @@
<if test="companyName != null">
and company_name like '%${companyName}%'
</if>
and ifnull(delete_Flag,'0') !='1'
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
@@ -20,5 +21,16 @@
<if test="companyName != null">
and company_name like '%${companyName}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<update id="batchDeleteSystemConfigByIds">
update jsh_systemconfig
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>

View File

@@ -8,6 +8,7 @@
<if test="name != null">
and UName 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 UName like '%${name}%'
</if>
and ifnull(delete_Flag,'0') !='1'
</select>
<update id="batchDeleteUnitByIds">
update jsh_unit
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>

View File

@@ -0,0 +1,15 @@
<?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.UserBusinessMapperEx">
<update id="batchDeleteUserBusinessByIds">
update jsh_serial_number
set delete_Flag='1'
where 1=1
and id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
</mapper>