维护产品类型表 jsh_materialcategory

序列号表	jsh_serial_number
用户表	jsh_user
机构表	jsh_organization
机构用户关系表	jsh_orga_user_rel
对应的删除标记
This commit is contained in:
qiankunpingtai
2019-03-28 15:23:53 +08:00
parent e437abb0b0
commit 7dc1cdaafc
13 changed files with 102 additions and 48 deletions

View File

@@ -41,7 +41,7 @@
<select id="getDepotList" parameterType="java.util.Map" resultMap="ResultMapEx">
select dep.*,usr.username as principalName
FROM jsh_depot dep
left join jsh_user usr on usr.id=dep.principal
left join jsh_user usr on usr.id=dep.principal and ifnull(usr.status,'0') not in('1','2')
where 1=1
<if test="name != null and name != ''">
<bind name="name" value="'%' + _parameter.name + '%'" />

View File

@@ -7,8 +7,8 @@
<select id="selectByConditionLog" parameterType="com.jsh.erp.datasource.entities.LogExample" resultMap="ResultExMap">
select l.*,u.username userName
FROM jsh_log l left join jsh_user u
on l.userID = u.id
FROM jsh_log l
left join jsh_user u on l.userID = u.id and ifnull(u.status,'0') not in('1','2')
where 1=1
<if test="operation != null">
and l.operation like '%${operation}%'

View File

@@ -5,6 +5,7 @@
select *
FROM jsh_materialcategory
where 1=1
and ifnull(status,'0') !='2'
<if test="name != null">
and name like '%${name}%'
</if>
@@ -21,6 +22,7 @@
COUNT(id)
FROM jsh_materialcategory
WHERE 1=1
and ifnull(status,'0') !='2'
<if test="name != null">
and name like '%${name}%'
</if>
@@ -56,7 +58,7 @@
<if test="currentId != null">
and id !=#{currentId}
</if>
and status !='2'
and ifnull(status,'0') !='2'
order by sort asc
</select>
@@ -65,7 +67,7 @@
<include refid="Base_Column_List"/>,#{currentId} as currentId
FROM jsh_materialcategory
WHERE ParentId = -1
and status !='2'
and ifnull(status,'0') !='2'
<if test="currentId != null">
and id !=#{currentId}
</if>
@@ -103,7 +105,7 @@
FROM jsh_materialcategory
where 1=1
and serial_no=#{serialNo}
and status !='2'
and ifnull(status,'0') !='2'
</select>
</mapper>

View File

@@ -30,7 +30,7 @@
<if test="currentId != null">
and id !=#{currentId}
</if>
and org_stcd !='5'
and ifnull(org_stcd,'0') !='5'
order by sort asc
</select>
@@ -42,7 +42,7 @@
<if test="currentId != null">
and id !=#{currentId}
</if>
and org_stcd !='5'
and ifnull(org_stcd,'0') !='5'
order by sort asc
</select>
<insert id="addOrganization" parameterType="com.jsh.erp.datasource.entities.Organization"
@@ -85,7 +85,7 @@
select * from jsh_organization
where
1=1
and org_stcd!='5'
and ifnull(org_stcd,'0') !='5'
and org_parent_no='-1'
and org_abr='根机构'
and id in (

View File

@@ -26,6 +26,7 @@
<bind name="materialName" value="'%' + _parameter.materialName + '%'" />
and mat.name like #{materialName}
</if>
and ifnull(ser.delete_Flag,'0') !='1'
order by ser.id desc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
@@ -45,6 +46,7 @@
<bind name="materialName" value="'%' + _parameter.materialName + '%'" />
and mat.name like #{materialName}
</if>
and ifnull(ser.delete_Flag,'0') !='1'
order by ser.id desc
</select>
<select id="findById" resultMap="SerialNumberExBaseResultMap">
@@ -54,10 +56,11 @@
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_user cr on ser.creator=cr.id
left join jsh_user ur on ser.updater=ur.id
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
and ser.id=#{id}
and ifnull(ser.delete_Flag,'0') !='1'
order by ser.id desc
</select>
<select id="findBySerialNumber" resultMap="SerialNumberExBaseResultMap">
@@ -69,6 +72,7 @@
<if test="serialNumber != null">
and ser.serial_Number=#{serialNumber}
</if>
and ifnull(ser.delete_Flag,'0') !='1'
order by ser.id desc
</select>
<insert id="addSerialNumber" parameterType="com.jsh.erp.datasource.entities.SerialNumberEx"
@@ -120,7 +124,7 @@
<if test="materialId != null">
and ser.material_Id=#{materialId}
</if>
and ser.delete_Flag !='1'
and ifnull(ser.delete_Flag,'0') !='1'
and ser.is_Sell !='1'
</select>
<select id="countSerialNumberByMaterialIdAndDepotheadId" resultType="java.lang.Integer">
@@ -135,7 +139,7 @@
and ser.depothead_Id=#{depotheadId}
</if>
and ser.is_Sell =#{isSell,jdbcType=VARCHAR}
and ser.delete_Flag !='1'
and ifnull(ser.delete_Flag,'0') !='1'
</select>
<update id="sellSerialNumber">
update jsh_serial_number
@@ -156,6 +160,7 @@
and material_Id = #{materialId}
</if>
and is_Sell != '1'
and ifnull(delete_Flag,'0') !='1'
<if test="count != null">
and id in
( select batchSN.id from
@@ -165,6 +170,7 @@
and selFrom.material_Id = #{materialId}
</if>
and selFrom.is_Sell != '1'
and ifnull(selFrom.delete_Flag,'0') !='1'
limit 0,#{count}
) batchSN
)
@@ -190,6 +196,7 @@
and depothead_Id = #{depotheadId,jdbcType=BIGINT}
</if>
and is_Sell != '0'
and ifnull(delete_Flag,'0') !='1'
<if test="count != null">
and id in
( select batchSN.id from
@@ -202,6 +209,7 @@
and selFrom.depothead_Id = #{depotheadId,jdbcType=BIGINT}
</if>
and selFrom.is_Sell !='0'
and ifnull(selFrom.delete_Flag,'0') !='1'
limit 0,#{count}
) batchSN
)
@@ -219,6 +227,17 @@
)
</foreach>
</insert>
<update id="batchDeleteSerialNumberByIds">
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}
</foreach>
)
</update>

View File

@@ -11,7 +11,7 @@
select *
FROM jsh_user
where 1=1
and status not in('1','2')
and ifnull(status,'0') not in('1','2')
<if test="userName != null">
and username like '%${userName}%'
</if>
@@ -27,7 +27,7 @@
COUNT(id)
FROM jsh_user
WHERE 1=1
and status not in('1','2')
and ifnull(status,'0') not in('1','2')
<if test="userName != null">
and username like '%${userName}%'
</if>
@@ -40,10 +40,10 @@
user.description, user.remark,user.isystem,org.id as orgaId,org.org_abr,rel.user_blng_orga_dspl_seq,
rel.id as orgaUserRelId
FROM jsh_user user
left join jsh_orga_user_rel rel on user.id=rel.user_id and rel.delete_flag!='1'
left join jsh_organization org on rel.orga_id=org.id
left join jsh_orga_user_rel rel on user.id=rel.user_id and ifnull(rel.delete_flag,'0') !='1'
left join jsh_organization org on rel.orga_id=org.id and ifnull(org.org_stcd,'0') !='5'
where 1=1
and user.status not in('1','2')
and ifnull(user.status,'0') not in('1','2')
<if test="userName != null and userName != ''">
<bind name="userName" value="'%' + _parameter.userName + '%'" />
and user.userName like #{userName}
@@ -114,7 +114,7 @@
user.description, user.remark,user.isystem
FROM jsh_user user
where 1=1
and user.status not in('1','2')
and ifnull(user.status,'0') not in('1','2')
<if test="userName != null and userName != ''">
and user.userName = #{userName}
</if>
@@ -161,7 +161,7 @@
org.id, org.org_abr as text,org.org_no as orgNo,org.sort as sort,null as iconCls,'0' as type
FROM jsh_organization org
WHERE org.org_parent_no = #{orgNo}
and org.org_stcd !='5'
and ifnull(org.org_stcd,'0') !='5'
union all
select
user.id,user.username as text, null as orgNo,rel.user_blng_orga_dspl_seq as sort,'icon-user' as iconCls,'1' as type
@@ -170,8 +170,8 @@
1=1
and user.id=rel.user_id
and rel.orga_id=#{orgId}
and rel.delete_flag !='1'
and user.status not in ('1','2')
and ifnull(rel.delete_flag,'0') !='1'
and ifnull(user.status,'0') not in('1','2')
) node
order by sort asc
</select>
@@ -181,7 +181,7 @@
id, org_abr as text,org_no as orgNo,'0' as type
FROM jsh_organization
WHERE org_parent_no = -1
and org_stcd !='5'
and ifnull(org_stcd,'0') !='5'
order by sort asc
</select>
</mapper>