| | |
| | | delete from t_store_other_config where id =#{id} |
| | | </delete> |
| | | |
| | | <select id="listAll" resultType="com.dsh.guns.modular.system.model.TStoreListVo"> |
| | | <!-- |
| | | phone 明确映射为 t_store.phone。不要同时返回两个名为 phone 的列, |
| | | 否则 MyBatis 自动映射可能按 JDBC 列顺序覆盖该字段。 |
| | | --> |
| | | <resultMap id="storeListResultMap" type="com.dsh.guns.modular.system.model.TStoreListVo" autoMapping="true"> |
| | | <result property="phone" column="storePhone"/> |
| | | </resultMap> |
| | | |
| | | <select id="listAll" resultMap="storeListResultMap"> |
| | | 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, |
| | | t1.phone as storePhone, |
| | | t3.name as yysName |
| | | from t_store t1 |
| | | left join sys_user t2 on t1.storeStaffId = t2.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 t1.managerName 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 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 id="listAllStore" resultMap="storeListResultMap"> |
| | | 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, |
| | | t1.phone as storePhone, |
| | | t3.name as yysName |
| | | from t_store t1 |
| | | left join sys_user t2 on t1.storeStaffId = t2.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 t1.managerName 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 t1.phone like concat("%",#{phone},"%") |
| | | </if> |
| | | <if test="shopName !=null and shopName !=''"> |
| | | and t1.name like concat("%",#{shopName},"%") |
| | | </if> |
| | | order by t1.id desc |
| | | </select> |
| | | <select id="listAllStoresByIds" resultType="com.dsh.guns.modular.system.model.TStoreListVo"> |
| | | <select id="listAllStoresByIds" resultMap="storeListResultMap"> |
| | | 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, |
| | | t1.phone as storePhone, |
| | | t3.name as yysName |
| | | from t_store t1 |
| | | left join sys_user t2 on t1.storeStaffId = t2.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 t1.managerName 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 t1.phone like concat("%",#{phone},"%") |
| | | </if> |
| | | <if test="shopName !=null and shopName !=''"> |
| | | and t1.name like concat("%",#{shopName},"%") |