刘帅
2026-09-30 79abff09f66ab8430082e5af58b65d72d1fd5d4f
门店手机号展示问题bug
4个文件已修改
56 ■■■■■ 已修改文件
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/TStoreListVo.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-management/src/main/resources/mapper/TStoreMapper.xml 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-management/src/main/webapp/static/modular/system/tShop/tShop.js 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java
@@ -491,23 +491,8 @@
            // 不能用 roleid(菜单权限)判断,避免员工被授予角色 1 后被误当成运营商。
            list = storeService.listAll(page, provinceCode, cityCode, name, phone, shopName, null);
        }
        normalizePhoneFields(list);
        page.setRecords(list);
        return  super.packForBT(page);
    }
    /**
     * 统一将列表 DTO 的底层字段写回非 null 值。
     *
     * 部分运行环境使用字段序列化而非 JavaBean getter 序列化;仅在 getter 中做兜底时,
     * 此类环境仍可能把原始 null 输出为 JSON null。这里在返回前固化字段值,保证三个
     * 数据范围的列表接口均稳定返回 phone、userPhone 两个字符串字段。
     */
    private void normalizePhoneFields(List<TStoreListVo> stores) {
        for (TStoreListVo store : stores) {
            store.setPhone(store.getPhone());
            store.setUserPhone(store.getUserPhone());
        }
    }
    @RequestMapping(value = "/listOne")
cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/TStoreListVo.java
@@ -40,30 +40,12 @@
    private Integer state;
    private String userName;
    private String userPhone;
    /**
     * 兼容历史门店:历史数据可能只在店长账号中保存手机号。
     * 列表对外的 phone 统一返回可用的店长手机号。
     * 列表手机号仅来自 t_store.phone,避免店长账号关联变化影响门店信息展示。
     */
    public String getPhone() {
        return hasText(phone) ? phone : defaultString(userPhone);
    }
    /**
     * 兼容历史门店:当店长资料中未维护 phone 时,列表仍返回可用的门店手机号。
     * 返回空字符串而非 null,避免不同环境的 JSON 忽略 null 配置导致字段消失。
     */
    public String getUserPhone() {
        return hasText(userPhone) ? userPhone : defaultString(phone);
    }
    private boolean hasText(String value) {
        return value != null && !value.trim().isEmpty();
    }
    private String defaultString(String value) {
        return value == null ? "" : value;
        return phone == null ? "" : phone;
    }
    private String account;
cloud-server-management/src/main/resources/mapper/TStoreMapper.xml
@@ -37,8 +37,7 @@
    <select id="listAll" resultType="com.dsh.guns.modular.system.model.TStoreListVo">
        select t1.*,
               coalesce(t2.name, t4.name) as userName,
               coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, ''), '') as phone,
               coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, ''), '') as userPhone,
               coalesce(t1.phone, '') as phone,
               t3.name as yysName
        from t_store t1
        left join sys_user t2 on t1.storeStaffId = t2.id
@@ -56,7 +55,7 @@
            and coalesce(t2.name, t4.name) like concat("%",#{name},"%")
        </if>
        <if test="phone !=null and phone !=''">
            and coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%")
            and t1.phone like concat("%",#{phone},"%")
        </if>
        <if test="shopName !=null and shopName !=''">
            and t1.name like concat("%",#{shopName},"%")
@@ -185,8 +184,7 @@
    <select id="listAllStore" resultType="com.dsh.guns.modular.system.model.TStoreListVo">
        select t1.*,
               coalesce(t2.name, t4.name) as userName,
               coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, ''), '') as phone,
               coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, ''), '') as userPhone,
               coalesce(t1.phone, '') as phone,
               t3.name as yysName
        from t_store t1
        left join sys_user t2 on t1.storeStaffId = t2.id
@@ -204,7 +202,7 @@
            and coalesce(t2.name, t4.name) like concat("%",#{name},"%")
        </if>
        <if test="phone !=null and phone !=''">
            and coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%")
            and t1.phone like concat("%",#{phone},"%")
        </if>
        <if test="shopName !=null and shopName !=''">
            and t1.name like concat("%",#{shopName},"%")
@@ -214,8 +212,7 @@
    <select id="listAllStoresByIds" resultType="com.dsh.guns.modular.system.model.TStoreListVo">
        select t1.*,
               coalesce(t2.name, t4.name) as userName,
               coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, ''), '') as phone,
               coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, ''), '') as userPhone,
               coalesce(t1.phone, '') as phone,
               t3.name as yysName
        from t_store t1
        left join sys_user t2 on t1.storeStaffId = t2.id
@@ -236,7 +233,7 @@
            and coalesce(t2.name, t4.name) like concat("%",#{name},"%")
        </if>
        <if test="phone !=null and phone !=''">
            and coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%")
            and t1.phone like concat("%",#{phone},"%")
        </if>
        <if test="shopName !=null and shopName !=''">
            and t1.name like concat("%",#{shopName},"%")
cloud-server-management/src/main/webapp/static/modular/system/tShop/tShop.js
@@ -33,7 +33,7 @@
        },
        {title:  '店长姓名', field: 'userName', visible: true, align: 'center', valign: 'middle'
        },
        {title:  '店长手机号', field: 'userPhone', visible: true, align: 'center', valign: 'middle'
        {title:  '店长手机号', field: 'phone', visible: true, align: 'center', valign: 'middle'
        },
        {title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle'
            ,formatter:function (data) {
@@ -465,4 +465,4 @@
    }else {
        Feng.confirm("Apakah Anda pasti akan mengekspor informasi kendaraan?", operation);
    }
}
}