Fancy
2024-09-18 0d05424b5df05f2e6ef478934cdaad9c71e5d91d
product name and type
3个文件已修改
14 ■■■■ 已修改文件
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/daoPlt/PltProductMapper.java
@@ -27,7 +27,7 @@
    String selectMaxCode();
    boolean exists(@Param("name") String name, @Param("id") Long id);
    boolean exists(@Param("name") String name, @Param("type") String type ,  @Param("id") Long id);
    PltProduct selectByCode(String productCode);
}
pms-parent/pms-global/src/main/resources/mapper/PltProductMapper.xml
@@ -211,7 +211,7 @@
    select max(code) from plt_product
  </select>
    <select id="exists" resultType="java.lang.Boolean">
        select count(1) from plt_product where name = #{name}
        select count(1) from plt_product where name = #{name} and type = #{type}
        <if test="id != null">
            and id != #{id}
        </if>
pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java
@@ -76,9 +76,9 @@
    @Transactional
    public int save(PltProduct p) {
        //判断产品不能重名
        if (dao.exists(p.name, p.id)) {
            throw new RuntimeException("产品名称重复");
        //判断产品 名称和型号 不能重名
        if (dao.exists(p.name.trim(), p.type.trim() ,p.id)) {
            throw new RuntimeException("已经存在相同的产品名称&型号");
        }
        int flag=0;
        do {
@@ -114,8 +114,8 @@
    @Transactional
    public int update(PltProduct p) {
        if (dao.exists(p.name, p.id)) {
            throw new RuntimeException("产品名称重复");
        if (dao.exists(p.name.trim(), p.type.trim(),p.id)) {
            throw new RuntimeException("已经存在相同的产品名称&型号");
        }
        int count = dao.updateByPrimaryKeySelective(p);
        //删除旧数据,重新插入