202505261745

This commit is contained in:
张潘 2025-05-26 17:45:52 +08:00
parent 18bede370a
commit aee37e75cc
18 changed files with 252 additions and 159 deletions

View File

@ -1,6 +1,7 @@
package com.ruoyi.system.domain; package com.ruoyi.system.domain;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -60,6 +61,8 @@ public class DiyCity extends BaseEntity
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Date updatedAt; private Date updatedAt;
private List<DiyCity> children;
public void setId(Integer id) public void setId(Integer id)
{ {
this.id = id; this.id = id;
@ -170,6 +173,14 @@ public class DiyCity extends BaseEntity
return updatedAt; return updatedAt;
} }
public List<DiyCity> getChildren() {
return children;
}
public void setChildren(List<DiyCity> children) {
this.children = children;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -1,6 +1,9 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.ArrayList;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DiyCityMapper; import com.ruoyi.system.mapper.DiyCityMapper;
@ -40,7 +43,31 @@ public class DiyCityServiceImpl implements IDiyCityService
@Override @Override
public List<DiyCity> selectDiyCityList(DiyCity diyCity) public List<DiyCity> selectDiyCityList(DiyCity diyCity)
{ {
return diyCityMapper.selectDiyCityList(diyCity); List<DiyCity> cities = diyCityMapper.selectDiyCityList(diyCity);
return buildTree(cities);
}
private List<DiyCity> buildTree(List<DiyCity> cities) {
Map<Integer, DiyCity> map = new HashMap<>();
List<DiyCity> roots = new ArrayList<>();
for (DiyCity city : cities) {
map.put(city.getId(), city);
city.setChildren(new ArrayList<>());
}
for (DiyCity city : cities) {
if (city.getParentId() == null) {
roots.add(city);
} else {
DiyCity parent = map.get(city.getParentId());
if (parent != null) {
parent.getChildren().add(city);
}
}
}
return roots;
} }
/** /**

View File

@ -46,9 +46,10 @@
<if test="link != null">link,</if> <if test="link != null">link,</if>
<if test="sort != null">sort,</if> <if test="sort != null">sort,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if>
<if test="deletedAt != null">deleted_at,</if> <if test="deletedAt != null">deleted_at,</if>
created_at,
updated_at
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="type != null">#{type},</if> <if test="type != null">#{type},</if>
@ -58,9 +59,10 @@
<if test="link != null">#{link},</if> <if test="link != null">#{link},</if>
<if test="sort != null">#{sort},</if> <if test="sort != null">#{sort},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if>
<if test="deletedAt != null">#{deletedAt},</if> <if test="deletedAt != null">#{deletedAt},</if>
NOW(),
NOW()
</trim> </trim>
</insert> </insert>

View File

@ -51,8 +51,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="address != null and address != ''">address,</if> <if test="address != null and address != ''">address,</if>
<if test="info != null and info != ''">info,</if> <if test="info != null and info != ''">info,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="createdAt != null">created_at,</if> created_at,
<if test="updatedAt != null">updated_at,</if> updated_at
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="uid != null">#{uid},</if> <if test="uid != null">#{uid},</if>
@ -62,8 +62,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="address != null and address != ''">#{address},</if> <if test="address != null and address != ''">#{address},</if>
<if test="info != null and info != ''">#{info},</if> <if test="info != null and info != ''">#{info},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="createdAt != null">#{createdAt},</if> NOW(),
<if test="updatedAt != null">#{updatedAt},</if> NOW()
</trim> </trim>
</insert> </insert>
@ -77,8 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="address != null and address != ''">address = #{address},</if> <if test="address != null and address != ''">address = #{address},</if>
<if test="info != null and info != ''">info = #{info},</if> <if test="info != null and info != ''">info = #{info},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="createdAt != null">created_at = #{createdAt},</if> updated_at=NOW()
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -104,9 +104,10 @@
<if test="sort != null and sort != ''">sort,</if> <if test="sort != null and sort != ''">sort,</if>
<if test="cateId != null">cate_id,</if> <if test="cateId != null">cate_id,</if>
<if test="userIds != null">user_ids,</if> <if test="userIds != null">user_ids,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if>
<if test="deletedAt != null">deleted_at,</if> <if test="deletedAt != null">deleted_at,</if>
created_at,
updated_at
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null and title != ''">#{title},</if> <if test="title != null and title != ''">#{title},</if>
@ -124,9 +125,10 @@
<if test="sort != null and sort != ''">#{sort},</if> <if test="sort != null and sort != ''">#{sort},</if>
<if test="cateId != null">#{cateId},</if> <if test="cateId != null">#{cateId},</if>
<if test="userIds != null">#{userIds},</if> <if test="userIds != null">#{userIds},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if>
<if test="deletedAt != null">#{deletedAt},</if> <if test="deletedAt != null">#{deletedAt},</if>
NOW(),
NOW()
</trim> </trim>
</insert> </insert>
@ -148,9 +150,9 @@
<if test="sort != null and sort != ''">sort = #{sort},</if> <if test="sort != null and sort != ''">sort = #{sort},</if>
<if test="cateId != null">cate_id = #{cateId},</if> <if test="cateId != null">cate_id = #{cateId},</if>
<if test="userIds != null">user_ids = #{userIds},</if> <if test="userIds != null">user_ids = #{userIds},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="deletedAt != null">deleted_at = #{deletedAt},</if> <if test="deletedAt != null">deleted_at = #{deletedAt},</if>
updated_at=NOW()
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -54,8 +54,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="provinceId != null">province_id,</if> <if test="provinceId != null">province_id,</if>
<if test="cityId != null">city_id,</if> <if test="cityId != null">city_id,</if>
<if test="districtId != null">district_id,</if> <if test="districtId != null">district_id,</if>
<if test="createdAt != null">created_at,</if> created_at,
<if test="updatedAt != null">updated_at,</if> updated_at
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null and title != ''">#{title},</if> <if test="title != null and title != ''">#{title},</if>
@ -66,8 +66,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="provinceId != null">#{provinceId},</if> <if test="provinceId != null">#{provinceId},</if>
<if test="cityId != null">#{cityId},</if> <if test="cityId != null">#{cityId},</if>
<if test="districtId != null">#{districtId},</if> <if test="districtId != null">#{districtId},</if>
<if test="createdAt != null">#{createdAt},</if> NOW(),
<if test="updatedAt != null">#{updatedAt},</if> NOW()
</trim> </trim>
</insert> </insert>
@ -82,8 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="provinceId != null">province_id = #{provinceId},</if> <if test="provinceId != null">province_id = #{provinceId},</if>
<if test="cityId != null">city_id = #{cityId},</if> <if test="cityId != null">city_id = #{cityId},</if>
<if test="districtId != null">district_id = #{districtId},</if> <if test="districtId != null">district_id = #{districtId},</if>
<if test="createdAt != null">created_at = #{createdAt},</if> updated_at=NOW()
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -42,16 +42,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodId != null">good_id,</if> <if test="goodId != null">good_id,</if>
<if test="goodNum != null">good_num,</if> <if test="goodNum != null">good_num,</if>
<if test="sku != null">sku,</if> <if test="sku != null">sku,</if>
<if test="createdAt != null">created_at,</if> created_at,
<if test="updatedAt != null">updated_at,</if> updated_at
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="uid != null">#{uid},</if> <if test="uid != null">#{uid},</if>
<if test="goodId != null">#{goodId},</if> <if test="goodId != null">#{goodId},</if>
<if test="goodNum != null">#{goodNum},</if> <if test="goodNum != null">#{goodNum},</if>
<if test="sku != null">#{sku},</if> <if test="sku != null">#{sku},</if>
<if test="createdAt != null">#{createdAt},</if> NOW(),
<if test="updatedAt != null">#{updatedAt},</if> NOW()
</trim> </trim>
</insert> </insert>
@ -62,8 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="goodId != null">good_id = #{goodId},</if> <if test="goodId != null">good_id = #{goodId},</if>
<if test="goodNum != null">good_num = #{goodNum},</if> <if test="goodNum != null">good_num = #{goodNum},</if>
<if test="sku != null">sku = #{sku},</if> <if test="sku != null">sku = #{sku},</if>
<if test="createdAt != null">created_at = #{createdAt},</if> updated_at=NOW()
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -48,8 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sku != null">sku,</if> <if test="sku != null">sku,</if>
<if test="totalPrice != null">total_price,</if> <if test="totalPrice != null">total_price,</if>
<if test="postage != null">postage,</if> <if test="postage != null">postage,</if>
<if test="createdAt != null">created_at,</if> created_at,
<if test="updatedAt != null">updated_at,</if> updated_at
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="productId != null">#{productId},</if> <if test="productId != null">#{productId},</if>
@ -58,8 +58,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sku != null">#{sku},</if> <if test="sku != null">#{sku},</if>
<if test="totalPrice != null">#{totalPrice},</if> <if test="totalPrice != null">#{totalPrice},</if>
<if test="postage != null">#{postage},</if> <if test="postage != null">#{postage},</if>
<if test="createdAt != null">#{createdAt},</if> NOW(),
<if test="updatedAt != null">#{updatedAt},</if> NOW()
</trim> </trim>
</insert> </insert>
@ -72,8 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sku != null">sku = #{sku},</if> <if test="sku != null">sku = #{sku},</if>
<if test="totalPrice != null">total_price = #{totalPrice},</if> <if test="totalPrice != null">total_price = #{totalPrice},</if>
<if test="postage != null">postage = #{postage},</if> <if test="postage != null">postage = #{postage},</if>
<if test="createdAt != null">created_at = #{createdAt},</if> updated_at=NOW()
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -91,8 +91,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mark != null">mark,</if> <if test="mark != null">mark,</if>
<if test="addressId != null">address_id,</if> <if test="addressId != null">address_id,</if>
<if test="sku != null">sku,</if> <if test="sku != null">sku,</if>
<if test="createdAt != null">created_at,</if> created_at,
<if test="updatedAt != null">updated_at,</if> updated_at
<if test="deletedAt != null">deleted_at,</if> <if test="deletedAt != null">deleted_at,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
@ -120,9 +120,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mark != null">#{mark},</if> <if test="mark != null">#{mark},</if>
<if test="addressId != null">#{addressId},</if> <if test="addressId != null">#{addressId},</if>
<if test="sku != null">#{sku},</if> <if test="sku != null">#{sku},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if>
<if test="deletedAt != null">#{deletedAt},</if> <if test="deletedAt != null">#{deletedAt},</if>
NOW(),
NOW()
</trim> </trim>
</insert> </insert>
@ -153,9 +154,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mark != null">mark = #{mark},</if> <if test="mark != null">mark = #{mark},</if>
<if test="addressId != null">address_id = #{addressId},</if> <if test="addressId != null">address_id = #{addressId},</if>
<if test="sku != null">sku = #{sku},</if> <if test="sku != null">sku = #{sku},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="deletedAt != null">deleted_at = #{deletedAt},</if> <if test="deletedAt != null">deleted_at = #{deletedAt},</if>
updated_at=NOW()
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -39,15 +39,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="title != null and title != ''">title,</if> <if test="title != null and title != ''">title,</if>
<if test="sort != null">sort,</if> <if test="sort != null">sort,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="createdAt != null">created_at,</if> created_at,
<if test="updatedAt != null">updated_at,</if> updated_at
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null and title != ''">#{title},</if> <if test="title != null and title != ''">#{title},</if>
<if test="sort != null">#{sort},</if> <if test="sort != null">#{sort},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="createdAt != null">#{createdAt},</if> NOW(),
<if test="updatedAt != null">#{updatedAt},</if> NOW()
</trim> </trim>
</insert> </insert>
@ -57,8 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="title != null and title != ''">title = #{title},</if> <if test="title != null and title != ''">title = #{title},</if>
<if test="sort != null">sort = #{sort},</if> <if test="sort != null">sort = #{sort},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="createdAt != null">created_at = #{createdAt},</if> updated_at=NOW()
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -48,8 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="uid != null">uid,</if> <if test="uid != null">uid,</if>
<if test="type != null">type,</if> <if test="type != null">type,</if>
<if test="num != null">num,</if> <if test="num != null">num,</if>
<if test="createdAt != null">created_at,</if> created_at,
<if test="updatedAt != null">updated_at,</if> updated_at
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">#{orderId},</if> <if test="orderId != null">#{orderId},</if>
@ -58,8 +58,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="uid != null">#{uid},</if> <if test="uid != null">#{uid},</if>
<if test="type != null">#{type},</if> <if test="type != null">#{type},</if>
<if test="num != null">#{num},</if> <if test="num != null">#{num},</if>
<if test="createdAt != null">#{createdAt},</if> NOW(),
<if test="updatedAt != null">#{updatedAt},</if> NOW()
</trim> </trim>
</insert> </insert>
@ -72,8 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="uid != null">uid = #{uid},</if> <if test="uid != null">uid = #{uid},</if>
<if test="type != null">type = #{type},</if> <if test="type != null">type = #{type},</if>
<if test="num != null">num = #{num},</if> <if test="num != null">num = #{num},</if>
<if test="createdAt != null">created_at = #{createdAt},</if> updated_at=NOW()
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -45,8 +45,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="title != null and title != ''">title,</if> <if test="title != null and title != ''">title,</if>
<if test="content != null and content != ''">content,</if> <if test="content != null and content != ''">content,</if>
<if test="type != null">type,</if> <if test="type != null">type,</if>
<if test="createdAt != null">created_at,</if> created_at,
<if test="updatedAt != null">updated_at,</if> updated_at
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="oid != null">#{oid},</if> <if test="oid != null">#{oid},</if>
@ -54,8 +54,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="title != null and title != ''">#{title},</if> <if test="title != null and title != ''">#{title},</if>
<if test="content != null and content != ''">#{content},</if> <if test="content != null and content != ''">#{content},</if>
<if test="type != null">#{type},</if> <if test="type != null">#{type},</if>
<if test="createdAt != null">#{createdAt},</if> NOW(),
<if test="updatedAt != null">#{updatedAt},</if> NOW()
</trim> </trim>
</insert> </insert>
@ -67,8 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="title != null and title != ''">title = #{title},</if> <if test="title != null and title != ''">title = #{title},</if>
<if test="content != null and content != ''">content = #{content},</if> <if test="content != null and content != ''">content = #{content},</if>
<if test="type != null">type = #{type},</if> <if test="type != null">type = #{type},</if>
<if test="createdAt != null">created_at = #{createdAt},</if> updated_at=NOW()
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSiteSkillList" parameterType="SiteSkill" resultMap="SiteSkillResult"> <select id="selectSiteSkillList" parameterType="SiteSkill" resultMap="SiteSkillResult">
<include refid="selectSiteSkillVo"/> <include refid="selectSiteSkillVo"/>
<where> <where>
<if test="title != null and title != ''"> and title = #{title}</if> <if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if>
<if test="sort != null "> and sort = #{sort}</if> <if test="sort != null "> and sort = #{sort}</if>
<if test="status != null "> and status = #{status}</if> <if test="status != null "> and status = #{status}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if> <if test="createdAt != null "> and created_at = #{createdAt}</if>

View File

@ -54,9 +54,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="addressInfo != null">address_info,</if> <if test="addressInfo != null">address_info,</if>
<if test="info != null and info != ''">info,</if> <if test="info != null and info != ''">info,</if>
<if test="isDefault != null">is_default,</if> <if test="isDefault != null">is_default,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if>
<if test="deletedAt != null">deleted_at,</if> <if test="deletedAt != null">deleted_at,</if>
created_at,
updated_at
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="uid != null">#{uid},</if> <if test="uid != null">#{uid},</if>
@ -68,9 +69,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="addressInfo != null">#{addressInfo},</if> <if test="addressInfo != null">#{addressInfo},</if>
<if test="info != null and info != ''">#{info},</if> <if test="info != null and info != ''">#{info},</if>
<if test="isDefault != null">#{isDefault},</if> <if test="isDefault != null">#{isDefault},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if>
<if test="deletedAt != null">#{deletedAt},</if> <if test="deletedAt != null">#{deletedAt},</if>
NOW(),
NOW()
</trim> </trim>
</insert> </insert>
@ -86,9 +88,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="addressInfo != null">address_info = #{addressInfo},</if> <if test="addressInfo != null">address_info = #{addressInfo},</if>
<if test="info != null and info != ''">info = #{info},</if> <if test="info != null and info != ''">info = #{info},</if>
<if test="isDefault != null">is_default = #{isDefault},</if> <if test="isDefault != null">is_default = #{isDefault},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="deletedAt != null">deleted_at = #{deletedAt},</if> <if test="deletedAt != null">deleted_at = #{deletedAt},</if>
updated_at=NOW()
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -5,8 +5,16 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit"> <meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<script type="text/javascript">
window._AMapSecurityConfig = {
securityJsCode: "8c58e51cb91b527f0fb863b3c97ef3c7",
};
</script>
<script src="https://webapi.amap.com/maps?v=2.0&key=03e2077b2c18a2ddeaadf34c434f75d4&plugin=AMap.Geocoder"></script>
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= webpackConfig.name %></title> <title><%= webpackConfig.name %></title>
<!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]--> <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
<style> <style>
html, html,

View File

@ -259,40 +259,7 @@ export default {
// //
total: 0, total: 0,
// //
DiyCityList: [ DiyCityList: [],
{
id: 1,
title: '西安市',
children: [
{ id: 5, title: '西咸新区' },
{ id: 2, title: '未央区' },
{ id: 7, title: '莲湖区' },
{ id: 10, title: '雁塔区' },
{ id: 11, title: '高新区' },
{ id: 12, title: '长安区' },
{ id: 13, title: '新城区' },
{ id: 14, title: '碑林区' },
{ id: 15, title: '灞桥区' },
{ id: 16, title: '临潼区' },
{ id: 17, title: '高陵区' }
]
},
{
id: 27,
title: '上海市',
children: []
},
{
id: 44,
title: '长沙市',
children: []
},
{
id: 52,
title: '合肥市',
children: []
}
],
// //
title: "", title: "",
// //
@ -335,12 +302,12 @@ export default {
methods: { methods: {
/** 查询自定义地区列表 */ /** 查询自定义地区列表 */
getList() { getList() {
this.loading = true this.loading = true;
listDiyCity(this.queryParams).then(response => { listDiyCity(this.queryParams).then(response => {
this.DiyCityList = response.rows this.DiyCityList = response;
this.total = response.total this.total = response.length;
this.loading = false this.loading = false;
}) });
}, },
// //
cancel() { cancel() {

View File

@ -63,11 +63,9 @@
<el-table v-loading="loading" :data="SiteSkillList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="SiteSkillList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="ID" align="center" prop="id" /> <el-table-column label="ID" align="center" width="55" prop="id" />
<el-table-column label="名称" align="center" prop="title" /> <el-table-column label="名称" align="center" prop="title" />
<el-table-column label="排序" align="center" prop="sort" /> <el-table-column label="排序" align="center" prop="sort" />
<el-table-column label="状态" align="center" prop="status" />
<el-table-column label="状态" width="85" align="center"> <el-table-column label="状态" width="85" align="center">
<template slot-scope="scope"> <template slot-scope="scope">

View File

@ -1,8 +1,8 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="师傅" prop="uid"> <el-form-item label="用户" prop="uid">
<el-select v-model="queryParams.uid" placeholder="请选择师傅" clearable filterable> <el-select v-model="queryParams.uid" placeholder="请选择用户" clearable filterable>
<el-option v-for="item in userDataList" :key="item.id" :label="item.name" :value="item.id" /> <el-option v-for="item in userDataList" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -144,10 +144,15 @@
/> />
<!-- 添加或修改用户收货地址对话框 --> <!-- 添加或修改用户收货地址对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="65%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="ID" prop="id">
<el-input v-model="form.id" placeholder="自动生成" :disabled="true" />
</el-form-item>
<el-form-item label="用户" prop="uid"> <el-form-item label="用户" prop="uid">
<el-input v-model="form.uid" placeholder="请输入用户" /> <el-select v-model="form.uid" placeholder="请选择用户" clearable filterable>
<el-option v-for="item in userDataList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="收货人" prop="name"> <el-form-item label="收货人" prop="name">
<el-input v-model="form.name" placeholder="请输入收货人" /> <el-input v-model="form.name" placeholder="请输入收货人" />
@ -155,58 +160,40 @@
<el-form-item label="电话" prop="phone"> <el-form-item label="电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入电话" /> <el-input v-model="form.phone" placeholder="请输入电话" />
</el-form-item> </el-form-item>
<el-form-item label="纬度" prop="latitude"> <el-form-item label="地址">
<el-input v-model="form.latitude" placeholder="请输入纬度" /> <el-input
</el-form-item> v-model="searchAddress"
<el-form-item label="经度" prop="longitude"> placeholder="请输入地址"
<el-input v-model="form.longitude" placeholder="请输入经度" /> style="width: 200px; margin-right: 8px;"
</el-form-item> @keyup.enter.native="searchMapAddress"
<el-form-item label="地图点选地址名称" prop="addressName"> />
<el-input v-model="form.addressName" placeholder="请输入地图点选地址名称" /> <el-button icon="el-icon-search" @click="searchMapAddress"></el-button>
</el-form-item> <el-input
<el-form-item label="地图点选地址" prop="addressInfo"> v-model="latlng"
<el-input v-model="form.addressInfo" placeholder="请输入地图点选地址" /> placeholder="经纬度"
style="width: 220px; margin-left: 8px;"
readonly
/>
</el-form-item> </el-form-item>
<div id="map" style="width: 100%; height: 250px; margin-bottom: 16px;"></div>
<el-form-item label="具体地址" prop="info"> <el-form-item label="具体地址" prop="info">
<el-input v-model="form.info" placeholder="请输入具体地址" /> <el-input v-model="form.info" placeholder="请输入具体地址" />
</el-form-item> </el-form-item>
<el-form-item label="默认 10" prop="isDefault"> <el-form-item label="默认" prop="isDefault">
<el-radio-group v-model="form.isDefault"> <el-radio-group v-model="form.isDefault">
<el-radio <el-radio v-for="dict in dict.type.user_address_status" :key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
v-for="dict in dict.type.user_address_status"
:key="dict.value"
:label="parseInt(dict.value)"
>{{dict.label}}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="${comment}" prop="createdAt"> <el-form-item label="创建时间" prop="createdAt">
<el-date-picker clearable <el-date-picker clearable v-model="form.createdAt" type="date" value-format="yyyy-MM-dd" placeholder="请选择创建时间"></el-date-picker>
v-model="form.createdAt"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择${comment}">
</el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="${comment}" prop="updatedAt"> <el-form-item label="更新时间" prop="updatedAt">
<el-date-picker clearable <el-date-picker clearable v-model="form.updatedAt" type="date" value-format="yyyy-MM-dd" placeholder="请选择更新时间"></el-date-picker>
v-model="form.updatedAt"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择${comment}">
</el-date-picker>
</el-form-item>
<el-form-item label="${comment}" prop="deletedAt">
<el-date-picker clearable
v-model="form.deletedAt"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择${comment}">
</el-date-picker>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"></el-button> <el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel">取消</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
@ -269,7 +256,13 @@ export default {
isDefault: [ isDefault: [
{ required: true, message: "默认 10否不能为空", trigger: "change" } { required: true, message: "默认 10否不能为空", trigger: "change" }
], ],
} },
searchAddress: '',
latlng: '',
map: null,
marker: null,
geocoder: null,
mapInited: false,
} }
}, },
created() { created() {
@ -289,6 +282,14 @@ export default {
// //
cancel() { cancel() {
this.open = false this.open = false
//
if (this.map) {
this.map.destroy();
this.map = null;
this.marker = null;
this.geocoder = null;
this.mapInited = false;
}
this.reset() this.reset()
}, },
// //
@ -336,6 +337,11 @@ export default {
this.reset() this.reset()
this.open = true this.open = true
this.title = "添加用户收货地址" this.title = "添加用户收货地址"
this.$nextTick(() => {
this.searchAddress = ''
this.latlng = ''
this.initMap()
})
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
@ -345,6 +351,11 @@ export default {
this.form = response.data this.form = response.data
this.open = true this.open = true
this.title = "修改用户收货地址" this.title = "修改用户收货地址"
this.$nextTick(() => {
this.searchAddress = ''
this.latlng = this.form.longitude && this.form.latitude ? `${this.form.longitude},${this.form.latitude}` : ''
this.initMap()
})
}) })
}, },
/** 提交按钮 */ /** 提交按钮 */
@ -382,7 +393,77 @@ export default {
this.download('system/UserAddress/export', { this.download('system/UserAddress/export', {
...this.queryParams ...this.queryParams
}, `UserAddress_${new Date().getTime()}.xlsx`) }, `UserAddress_${new Date().getTime()}.xlsx`)
},
initMap() {
//
if (this.map) {
this.map.destroy();
this.map = null;
this.marker = null;
this.geocoder = null;
this.mapInited = false;
} }
this.map = new AMap.Map('map', {
zoom: 16,
center: [this.form.longitude || 108.94141, this.form.latitude || 34.209883],
});
this.geocoder = new AMap.Geocoder();
if (this.form.longitude && this.form.latitude) {
this.setMapMarker([this.form.longitude, this.form.latitude]);
this.map.setCenter([this.form.longitude, this.form.latitude]);
}
this.map.on('click', (e) => {
const lnglat = [e.lnglat.lng, e.lnglat.lat];
this.setMapMarker(lnglat);
this.form.longitude = e.lnglat.lng;
this.form.latitude = e.lnglat.lat;
this.latlng = `${e.lnglat.lng},${e.lnglat.lat}`;
this.geocoder.getAddress(lnglat, (status, result) => {
// if (status === 'complete' && result.regeocode) {
// this.form.info = result.regeocode.formattedAddress;
// }
});
});
this.mapInited = true;
},
setMapMarker(lnglat) {
if (this.marker) {
this.marker.setMap(null);
}
this.marker = new AMap.Marker({
position: lnglat,
map: this.map,
});
},
searchMapAddress() {
if (!this.searchAddress) {
this.$message.warning('请输入要搜索的地址');
return;
}
if (!this.mapInited || !this.geocoder) {
this.$message.warning('地图未初始化,请稍后再试');
return;
}
this.geocoder.getLocation(this.searchAddress, (status, result) => {
if (status === 'complete' && result.geocodes.length) {
const lnglat = result.geocodes[0].location;
this.setMapMarker([lnglat.lng, lnglat.lat]);
this.map.setCenter([lnglat.lng, lnglat.lat]);
this.form.longitude = lnglat.lng;
this.form.latitude = lnglat.lat;
this.latlng = `${lnglat.lng},${lnglat.lat}`;
// this.form.info = result.geocodes[0].formattedAddress;
if ('addressName' in this.form) {
this.form.addressName = result.geocodes[0].formattedAddress;
}
if ('addressInfo' in this.form) {
this.form.addressInfo = result.geocodes[0].formattedAddress;
}
} else {
this.$message.warning('未找到该地址,请输入更详细的地址');
}
});
},
} }
} }
</script> </script>