| | |
| | | // 不能用 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") |
| | | @ResponseBody |
| | | public Object listOne(Integer id) { |
| | |
| | | |
| | | <select id="listAll" resultType="com.dsh.guns.modular.system.model.TStoreListVo"> |
| | | select t1.*, |
| | | t2.name as userName, |
| | | coalesce(nullif(t1.phone, ''), nullif(t2.phone, ''), nullif(t2.account, ''), '') as phone, |
| | | coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, ''), '') as userPhone, |
| | | 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, |
| | | t3.name as yysName |
| | | from t_store t1 |
| | | left join sys_user t2 on t1.storeStaffId = t2.id |
| | | left join (select objectId, max(id) as id from sys_user where objectType = 3 and status != 3 group by objectId) t4_ref on t4_ref.objectId = t1.id |
| | | left join sys_user t4 on t4_ref.id = t4.id |
| | | left join t_operator t3 on t1.operatorId = t3.id |
| | | where 1=1 |
| | | <if test="provinceCode !=null and provinceCode !=''"> |
| | |
| | | and t1.cityCode = #{cityCode} |
| | | </if> |
| | | <if test="name !=null and name !=''"> |
| | | and t2.name like concat("%",#{name},"%") |
| | | and coalesce(t2.name, t4.name) like concat("%",#{name},"%") |
| | | </if> |
| | | <if test="phone !=null and phone !=''"> |
| | | and coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%") |
| | | and coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%") |
| | | </if> |
| | | <if test="shopName !=null and shopName !=''"> |
| | | and t1.name like concat("%",#{shopName},"%") |
| | |
| | | </select> |
| | | <select id="listAllStore" resultType="com.dsh.guns.modular.system.model.TStoreListVo"> |
| | | select t1.*, |
| | | t2.name as userName, |
| | | coalesce(nullif(t1.phone, ''), nullif(t2.phone, ''), nullif(t2.account, ''), '') as phone, |
| | | coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, ''), '') as userPhone, |
| | | 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, |
| | | t3.name as yysName |
| | | from t_store t1 |
| | | left join sys_user t2 on t1.storeStaffId = t2.id |
| | | left join (select objectId, max(id) as id from sys_user where objectType = 3 and status != 3 group by objectId) t4_ref on t4_ref.objectId = t1.id |
| | | left join sys_user t4 on t4_ref.id = t4.id |
| | | left join t_operator t3 on t1.operatorId = t3.id |
| | | where t1.id =#{id} |
| | | <if test="provinceCode !=null and provinceCode !=''"> |
| | |
| | | and t1.cityCode = #{cityCode} |
| | | </if> |
| | | <if test="name !=null and name !=''"> |
| | | and t2.name like concat("%",#{name},"%") |
| | | and coalesce(t2.name, t4.name) like concat("%",#{name},"%") |
| | | </if> |
| | | <if test="phone !=null and phone !=''"> |
| | | and coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%") |
| | | and coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%") |
| | | </if> |
| | | <if test="shopName !=null and shopName !=''"> |
| | | and t1.name like concat("%",#{shopName},"%") |
| | |
| | | </select> |
| | | <select id="listAllStoresByIds" resultType="com.dsh.guns.modular.system.model.TStoreListVo"> |
| | | select t1.*, |
| | | t2.name as userName, |
| | | coalesce(nullif(t1.phone, ''), nullif(t2.phone, ''), nullif(t2.account, ''), '') as phone, |
| | | coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, ''), '') as userPhone, |
| | | 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, |
| | | t3.name as yysName |
| | | from t_store t1 |
| | | left join sys_user t2 on t1.storeStaffId = t2.id |
| | | left join (select objectId, max(id) as id from sys_user where objectType = 3 and status != 3 group by objectId) t4_ref on t4_ref.objectId = t1.id |
| | | left join sys_user t4 on t4_ref.id = t4.id |
| | | left join t_operator t3 on t1.operatorId = t3.id |
| | | where t1.id in |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | |
| | | and t1.cityCode = #{cityCode} |
| | | </if> |
| | | <if test="name !=null and name !=''"> |
| | | and t2.name like concat("%",#{name},"%") |
| | | and coalesce(t2.name, t4.name) like concat("%",#{name},"%") |
| | | </if> |
| | | <if test="phone !=null and phone !=''"> |
| | | and coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%") |
| | | and coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%") |
| | | </if> |
| | | <if test="shopName !=null and shopName !=''"> |
| | | and t1.name like concat("%",#{shopName},"%") |