WebsiteMapper.java
1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.uccc.admin.mapper;
import com.uccc.admin.domain.WebsiteConfig;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
/**
* Created by bert on 2021-10-07 00:57
*/
public interface WebsiteMapper {
static final String TABLE_NAME = "website_config";
@Select({
"<script>",
"select * from " + TABLE_NAME + " order by id asc",
"</script>",
})
List<WebsiteConfig> selectWebsiteConfigs();
@Update({
"<script>",
"UPDATE " + TABLE_NAME + " SET name = #{websiteConfig.name}",
"<when test='websiteConfig.value!=null'>",
",value = #{websiteConfig.value}" ,
"</when>",
"<when test='websiteConfig.title!=null'>",
",title = #{websiteConfig.title}" ,
"</when>",
"where id = #{websiteConfig.id}",
"</script>",
})
int updateWebsite(@Param("websiteConfig") WebsiteConfig websiteConfig);
@Select({
"<script>",
"select value from " + TABLE_NAME,
"where name = #{name}",
"</script>"
})
String selectConfigValueByName(@Param("name") String name);
}