优化表结构
This commit is contained in:
@@ -3,32 +3,32 @@
|
||||
<mapper namespace="com.jsh.erp.datasource.mappers.AccountHeadMapperEx">
|
||||
|
||||
<resultMap extends="com.jsh.erp.datasource.mappers.AccountHeadMapper.BaseResultMap" id="ResultMapEx" type="com.jsh.erp.datasource.entities.AccountHeadVo4ListEx">
|
||||
<result column="OrganName" jdbcType="VARCHAR" property="organname" />
|
||||
<result column="HandsPersonName" jdbcType="VARCHAR" property="handspersonname" />
|
||||
<result column="AccountName" jdbcType="VARCHAR" property="accountname" />
|
||||
<result column="OrganName" jdbcType="VARCHAR" property="organName" />
|
||||
<result column="HandsPersonName" jdbcType="VARCHAR" property="handsPersonName" />
|
||||
<result column="AccountName" jdbcType="VARCHAR" property="accountName" />
|
||||
</resultMap>
|
||||
|
||||
<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 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'
|
||||
from jsh_account_head ah
|
||||
left join jsh_supplier s on ah.organ_id=s.id and ifnull(s.delete_Flag,'0') !='1'
|
||||
left join jsh_person p on ah.hands_person_id=p.id and ifnull(p.delete_Flag,'0') !='1'
|
||||
left join jsh_account a on ah.account_id=a.id and ifnull(a.delete_Flag,'0') !='1'
|
||||
where 1=1
|
||||
<if test="billNo != null">
|
||||
and ah.BillNo like '%${billNo}%'
|
||||
and ah.bill_no like '%${billNo}%'
|
||||
</if>
|
||||
<if test="type != null">
|
||||
and ah.Type='${type}'
|
||||
and ah.type='${type}'
|
||||
</if>
|
||||
<if test="beginTime != null">
|
||||
and ah.BillTime >= '${beginTime}'
|
||||
and ah.bill_time >= '${beginTime}'
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and ah.BillTime <= '${endTime}'
|
||||
and ah.bill_time <= '${endTime}'
|
||||
</if>
|
||||
and ifnull(ah.delete_Flag,'0') !='1'
|
||||
order by ah.Id desc
|
||||
and ifnull(ah.delete_flag,'0') !='1'
|
||||
order by ah.id desc
|
||||
<if test="offset != null and rows != null">
|
||||
limit #{offset},#{rows}
|
||||
</if>
|
||||
@@ -38,49 +38,49 @@
|
||||
<select id="countsByAccountHead" resultType="java.lang.Long">
|
||||
SELECT
|
||||
COUNT(id)
|
||||
FROM jsh_accounthead
|
||||
FROM jsh_account_head
|
||||
WHERE 1=1
|
||||
<if test="billNo != null">
|
||||
and BillNo like '%${billNo}%'
|
||||
and bill_no like '%${billNo}%'
|
||||
</if>
|
||||
<if test="type != null">
|
||||
and Type='${type}'
|
||||
and type='${type}'
|
||||
</if>
|
||||
<if test="beginTime != null">
|
||||
and BillTime >= '${beginTime}'
|
||||
and bill_time >= '${beginTime}'
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and BillTime <= '${endTime}'
|
||||
and bill_time <= '${endTime}'
|
||||
</if>
|
||||
and ifnull(delete_Flag,'0') !='1'
|
||||
and ifnull(delete_flag,'0') !='1'
|
||||
</select>
|
||||
|
||||
<select id="getMaxId" resultType="java.lang.Long">
|
||||
select max(Id) as Id from jsh_accounthead
|
||||
select max(id) as id from jsh_account_head
|
||||
</select>
|
||||
|
||||
<select id="findAllMoney" resultType="java.math.BigDecimal">
|
||||
select sum(${modeName}) as allMoney from jsh_accounthead
|
||||
where Type='${type}'
|
||||
and OrganId =${supplierId} and BillTime <![CDATA[ <='${endTime}']]>
|
||||
and ifnull(delete_Flag,'0') !='1'
|
||||
select sum(${modeName}) as allMoney from jsh_account_head
|
||||
where type='${type}'
|
||||
and organ_id =${supplierId} and bill_time <![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 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'
|
||||
from jsh_account_head ah
|
||||
left join jsh_supplier s on ah.organ_id=s.id and ifnull(s.delete_Flag,'0') !='1'
|
||||
left join jsh_person p on ah.hands_person_id=p.id and ifnull(p.delete_Flag,'0') !='1'
|
||||
left join jsh_account a on ah.account_id=a.id and ifnull(a.delete_Flag,'0') !='1'
|
||||
where 1=1
|
||||
<if test="billNo != null">
|
||||
and ah.BillNo = '${billNo}'
|
||||
and ah.bill_no = '${billNo}'
|
||||
</if>
|
||||
and ifnull(ah.delete_Flag,'0') !='1'
|
||||
and ifnull(ah.delete_flag,'0') !='1'
|
||||
</select>
|
||||
<update id="batchDeleteAccountHeadByIds">
|
||||
update jsh_accounthead
|
||||
set delete_Flag='1'
|
||||
update jsh_account_head
|
||||
set delete_flag='1'
|
||||
where 1=1
|
||||
and id in (
|
||||
<foreach collection="ids" item="id" separator=",">
|
||||
@@ -91,37 +91,37 @@
|
||||
<select id="getAccountHeadListByAccountIds" resultMap="com.jsh.erp.datasource.mappers.AccountHeadMapper.BaseResultMap">
|
||||
select
|
||||
<include refid="com.jsh.erp.datasource.mappers.AccountHeadMapper.Base_Column_List" />
|
||||
from jsh_accounthead
|
||||
from jsh_account_head
|
||||
where 1=1
|
||||
and accountId in (
|
||||
and account_id in (
|
||||
<foreach collection="accountIds" item="accountId" separator=",">
|
||||
#{accountId}
|
||||
</foreach>
|
||||
)
|
||||
and ifnull(delete_Flag,'0') !='1'
|
||||
and ifnull(delete_flag,'0') !='1'
|
||||
</select>
|
||||
<select id="getAccountHeadListByOrganIds" resultMap="com.jsh.erp.datasource.mappers.AccountHeadMapper.BaseResultMap">
|
||||
select
|
||||
<include refid="com.jsh.erp.datasource.mappers.AccountHeadMapper.Base_Column_List" />
|
||||
from jsh_accounthead
|
||||
from jsh_account_head
|
||||
where 1=1
|
||||
and organId in (
|
||||
and organ_id in (
|
||||
<foreach collection="organIds" item="organId" separator=",">
|
||||
#{organId}
|
||||
</foreach>
|
||||
)
|
||||
and ifnull(delete_Flag,'0') !='1'
|
||||
and ifnull(delete_flag,'0') !='1'
|
||||
</select>
|
||||
<select id="getAccountHeadListByHandsPersonIds" resultMap="com.jsh.erp.datasource.mappers.AccountHeadMapper.BaseResultMap">
|
||||
select
|
||||
<include refid="com.jsh.erp.datasource.mappers.AccountHeadMapper.Base_Column_List" />
|
||||
from jsh_accounthead
|
||||
from jsh_account_head
|
||||
where 1=1
|
||||
and handsPersonId in (
|
||||
and hands_person_id in (
|
||||
<foreach collection="handsPersonIds" item="handsPersonId" separator=",">
|
||||
#{handsPersonId}
|
||||
</foreach>
|
||||
)
|
||||
and ifnull(delete_Flag,'0') !='1'
|
||||
and ifnull(delete_flag,'0') !='1'
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user