This commit is contained in:
linfso 2025-01-17 08:03:32 +08:00
parent c44987dc8a
commit f07fd67a3d
3 changed files with 24 additions and 10 deletions

View File

@ -44,7 +44,13 @@ public interface EmisSupplierMapper extends BaseMapper<EmisSupplier>
* @return 数量
*/
public int checkUnique(EmisSupplier emisSupplier);
/**
* 获取到最大编码
* @return
*/
public Long selectMaxSupplierCode();
/**
* 新增

View File

@ -75,6 +75,9 @@ public class EmisSupplierServiceImpl implements IEmisSupplierService
@Override
public int insertEmisSupplier(EmisSupplier emisSupplier)
{
Long code=emisSupplierMapper.selectMaxSupplierCode();
emisSupplier.setCode(code.toString());
return emisSupplierMapper.insertEmisSupplier(emisSupplier);
}

View File

@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xdadan.erp.emis.mapper.EmisSupplierMapper">
<resultMap type="EmisSupplier" id="EmisSupplierResult">
<resultMap type="EmisSupplier" id="EmisSupplierResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
<result property="id" column="id" />
<result property="code" column="code" />
<result property="name" column="name" />
@ -40,9 +40,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="code != null and code != ''"> and code like concat('%', #{code}, '%')</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="nameEn != null and nameEn != ''"> and name_en like concat('%', #{nameEn}, '%')</if>
<if test="settledType != null and settledType != ''"> and settled_type like concat('%', #{settledType}, '%')</if>
<if test="transType != null and transType != ''"> and trans_type like concat('%', #{transType}, '%')</if>
<if test="bizSite != null and bizSite != ''"> and biz_site like concat('%', #{bizSite}, '%')</if>
<if test="settledType != null and settledType != ''"> and settled_type=#{settledType}</if>
<if test="transType != null and transType != ''"> and trans_type=#{transType}</if>
<if test="bizSite != null and bizSite != ''"> and ( FIND_IN_SET(#{bizSite},biz_site) or #{bizSite}=owner_site) </if>
<if test="bizSiteName != null and bizSiteName != ''"> and biz_site_name like concat('%', #{bizSiteName}, '%')</if>
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
<if test="companyType != null and companyType != ''"> and company_type like concat('%', #{companyType}, '%')</if>
@ -113,7 +115,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertEmisSupplier" parameterType="EmisSupplier" useGeneratedKeys="true" keyProperty="id">
insert into emis_supplier
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="code != null and code != ''">code,</if>
<if test="name != null and name != ''">name,</if>
<if test="nameEn != null and nameEn != ''">name_en,</if>
@ -144,7 +145,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateSite != null and updateSite != ''">update_site,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="code != null and code != ''">#{code},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="nameEn != null and nameEn != ''">#{nameEn},</if>
@ -179,7 +179,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateEmisSupplier" parameterType="EmisSupplier">
update emis_supplier
<trim prefix="SET" suffixOverrides=",">
<if test="code != null and code != ''">code = #{code},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="nameEn != null and nameEn != ''">name_en = #{nameEn},</if>
<if test="settledType != null and settledType != ''">settled_type = #{settledType},</if>
@ -211,12 +210,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<select id="selectMaxSupplierCode" parameterType="String" resultType="Long">
select CONCAT(CONVERT(max(code),SIGNED)+1,'') as code
from emis_supplier
</select>
<delete id="deleteEmisSupplierById" parameterType="Long">
delete from emis_supplier where id = #{id}
update emis_supplier set del_flag='1' where id = #{id}
</delete>
<delete id="deleteEmisSupplierByIds" parameterType="String">
delete from emis_supplier where id in
update emis_supplier set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>