Skip to content

Commit

Permalink
🔥优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
tiansh committed Mar 19, 2024
1 parent 0ede684 commit 113e69f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/main/java/cn/hellohao/service/impl/S3Imageupload.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.services.s3.model.DeleteObjectRequest;
import com.amazonaws.services.s3.model.ObjectListing;
import com.amazonaws.services.s3.model.PutObjectRequest;
import com.amazonaws.services.s3.model.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -59,6 +56,9 @@ public ReturnImage ImageuploadS3(
String ShortUIDName = entry.getKey().get("name");
file = entry.getValue();
stream = new FileInputStream(file);
//解决存储源不能浏览图片的问题
// ObjectMetadata objectMetadata = new ObjectMetadata();
// objectMetadata.addUserMetadata();
AS3.putObject(
new PutObjectRequest(
KEY.getBucketname(),
Expand Down
14 changes: 2 additions & 12 deletions src/main/resources/mapper/UserMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
</where>
</select>

<!-- 查询当前用户:根据邮箱,根据id -->
<select id="getUsers" parameterType="cn.hellohao.pojo.User" resultType="cn.hellohao.pojo.User">
SELECT id,
username,
Expand Down Expand Up @@ -85,7 +84,7 @@
</if>
</where>
</select>
<!-- 查询当前用户:根据id -->

<select id="getUsersid" parameterType="integer" resultType="cn.hellohao.pojo.User">
SELECT id,
username,
Expand All @@ -101,7 +100,7 @@
FROM user
WHERE id = #{id}
</select>
<!-- 查询当前用户:根据uid -->

<select id="getUsersMail" parameterType="string" resultType="cn.hellohao.pojo.User">
SELECT id,
username,
Expand All @@ -118,13 +117,6 @@
WHERE uid = #{uid}
</select>

<!-- 插入图片信息 -->
<!-- <insert id="insertimg" parameterType="cn.hellohao.pojo.Images">-->
<!-- INSERT INTO imgdata (id, imgname, imgurl, userid, updatetime,sizes,abnormal,source,imgtype,md5key,imguid,format,about,violation)-->
<!-- VALUES (NULL, #{imgname}, #{imgurl}, #{userid}, #{updatetime},#{sizes},#{abnormal},#{source},#{imgtype},#{md5key},#{imguid},#{format},#{about},null)-->
<!-- </insert>-->

<!-- 修改资料 -->
<update id="change" parameterType="cn.hellohao.pojo.User">
UPDATE `user`
<set>
Expand Down Expand Up @@ -185,12 +177,10 @@
SELECT count(username) FROM `user` where username=#{username}
</select>

<!-- 查询用户总数 -->
<select id="getUserTotal" resultType="integer">
SELECT count(*) FROM `user`
</select>

<!-- 获取用户的详细信息 -->
<select id="getuserlist" resultType="cn.hellohao.pojo.User" parameterType="string">
SELECT
id,
Expand Down

0 comments on commit 113e69f

Please sign in to comment.