diff options
Diffstat (limited to 'appmarket-persistence')
19 files changed, 2481 insertions, 0 deletions
diff --git a/appmarket-persistence/pom.xml b/appmarket-persistence/pom.xml new file mode 100644 index 0000000..cea0e2e --- /dev/null +++ b/appmarket-persistence/pom.xml @@ -0,0 +1,55 @@ +<?xml version="1.0"?> +<project + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>app.market</groupId> + <artifactId>appmarket-root</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>appmarket-persistence</artifactId> + <packaging>jar</packaging> + <name>appmarket-persistence</name> + <url>http://maven.apache.org</url> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + <dependencies> + <!-- mybatis --> + <dependency> + <groupId>org.mybatis</groupId> + <artifactId>mybatis</artifactId> + <version>3.3.0</version> + </dependency> + <!-- mybatis/spring --> + <dependency> + <groupId>org.mybatis</groupId> + <artifactId>mybatis-spring</artifactId> + <version>1.2.2</version> + </dependency> + <!-- mysql --> + <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + <version>5.1.29</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>app.market</groupId> + <artifactId>appmarket-model</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>app.market</groupId> + <artifactId>appmarket-utils</artifactId> + <version>${project.version}</version> + </dependency> + + </dependencies> +</project> diff --git a/appmarket-persistence/src/main/java/app/market/persistence/interceptor/PaginationInterceptor.java b/appmarket-persistence/src/main/java/app/market/persistence/interceptor/PaginationInterceptor.java new file mode 100644 index 0000000..0e84e4d --- /dev/null +++ b/appmarket-persistence/src/main/java/app/market/persistence/interceptor/PaginationInterceptor.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2019 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package app.market.persistence.interceptor; + +import java.sql.Connection; +import java.util.Properties; +import java.util.regex.Pattern; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.reflect.FieldUtils; +import org.apache.ibatis.executor.statement.StatementHandler; +import org.apache.ibatis.mapping.BoundSql; +import org.apache.ibatis.plugin.Interceptor; +import org.apache.ibatis.plugin.Intercepts; +import org.apache.ibatis.plugin.Invocation; +import org.apache.ibatis.plugin.Plugin; +import org.apache.ibatis.plugin.Signature; +import org.apache.ibatis.session.RowBounds; + +@Intercepts(@Signature(type = StatementHandler.class, method = "prepare", args = { Connection.class })) +public class PaginationInterceptor implements Interceptor { + + private final static String SQL_SELECT_REGEX = "(?is)^\\s*SELECT.*$"; + + private final static String SQL_COUNT_REGEX = "(?is)^\\s*SELECT\\s+COUNT\\s*\\(\\s*(?:\\*|\\w+)\\s*\\).*$"; + + @Override + public Object intercept(Invocation inv) throws Throwable { + StatementHandler target = (StatementHandler) inv.getTarget(); + BoundSql boundSql = target.getBoundSql(); + String sql = boundSql.getSql(); + if ( StringUtils.isBlank( sql ) ) { + return inv.proceed(); + } + if ( sql.matches( SQL_SELECT_REGEX ) && !Pattern.matches( SQL_COUNT_REGEX, sql ) ) { + Object obj = FieldUtils.readField( target, "delegate", true ); + RowBounds rowBounds = (RowBounds) FieldUtils.readField( obj, "rowBounds", true ); + if ( rowBounds != null && rowBounds != RowBounds.DEFAULT ) { + FieldUtils.writeField( boundSql, "sql", newSql( sql, rowBounds ), true ); + FieldUtils.writeField( rowBounds, "offset", RowBounds.NO_ROW_OFFSET, true ); + FieldUtils.writeField( rowBounds, "limit", RowBounds.NO_ROW_LIMIT, true ); + } + } + return inv.proceed(); + } + + public String newSql(String oldSql, RowBounds rowBounds) { + String end = " limit " + rowBounds.getOffset() + "," + rowBounds.getLimit(); + return oldSql + end; + } + + @Override + public Object plugin(Object target) { + return Plugin.wrap( target, this ); + } + + @Override + public void setProperties(Properties arg0) { + } + +}
\ No newline at end of file diff --git a/appmarket-persistence/src/main/java/app/market/persistence/mapper/app/AppMapper.java b/appmarket-persistence/src/main/java/app/market/persistence/mapper/app/AppMapper.java new file mode 100644 index 0000000..ef413a0 --- /dev/null +++ b/appmarket-persistence/src/main/java/app/market/persistence/mapper/app/AppMapper.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2019 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package app.market.persistence.mapper.app; + +import java.util.List; +import app.market.model.app.App; +import app.market.model.app.AppExample; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.session.RowBounds; +import org.springframework.stereotype.Repository; + +@Repository(value = "AppMapper") +public interface AppMapper { + int countByExample(AppExample example); + + int deleteByExample(AppExample example); + + int deleteByPrimaryKey(String appId); + + int insert(App record); + + int insertSelective(App record); + + List<App> selectByExample(AppExample example); + + List<App> selectByExample(RowBounds rowBounds, AppExample example); + + App selectByPrimaryKey(String appId); + + App selectByCustomId(String appIdCustom); + + int updateByExampleSelective(@Param("record") App record, @Param("example") AppExample example); + + int updateByExample(@Param("record") App record, @Param("example") AppExample example); + + int updateByPrimaryKeySelective(App record); + + int updateByPrimaryKey(App record); + + int deleteByAppId(String appId); + + int SelectByCount(@Param("keyWord") String keyWord, @Param("appTypeId") String appTypeId, + @Param("deviceTypeId") String deviceTypeId, @Param("isPublic") String isPublic); + + List<App> SelectByList(@Param("offset") int offset, @Param("limit") int limit, @Param("keyWord") String keyWord, + @Param("order") String order, @Param("sort") String sort,@Param("appTypeId") String appTypeId, + @Param("deviceTypeId") String deviceTypeId, @Param("isPublic") String isPublic); +}
\ No newline at end of file diff --git a/appmarket-persistence/src/main/java/app/market/persistence/mapper/app/AppVersionMapper.java b/appmarket-persistence/src/main/java/app/market/persistence/mapper/app/AppVersionMapper.java new file mode 100644 index 0000000..822ca63 --- /dev/null +++ b/appmarket-persistence/src/main/java/app/market/persistence/mapper/app/AppVersionMapper.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2019 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package app.market.persistence.mapper.app; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import app.market.model.app.AppVersion; +import app.market.model.app.AppVersionExample; + +@Repository(value = "AppVersionMapper") +public interface AppVersionMapper { + int countByExample(AppVersionExample example); + + int deleteByExample(AppVersionExample example); + + int deleteByPrimaryKey(String versionId); + + int insert(AppVersion record); + + int insertSelective(AppVersion record); + + List<AppVersion> selectByExample(AppVersionExample example); + + AppVersion selectByPrimaryKey(String versionId); + + int updateByExampleSelective(@Param("record") AppVersion record, @Param("example") AppVersionExample example); + + int updateByExample(@Param("record") AppVersion record, @Param("example") AppVersionExample example); + + int updateByPrimaryKeySelective(AppVersion record); + + int updateByPrimaryKey(AppVersion record); + + int deleteByAppId(String appId); +}
\ No newline at end of file diff --git a/appmarket-persistence/src/main/java/app/market/persistence/mapper/authority/AuthorityMapper.java b/appmarket-persistence/src/main/java/app/market/persistence/mapper/authority/AuthorityMapper.java new file mode 100644 index 0000000..a64ed59 --- /dev/null +++ b/appmarket-persistence/src/main/java/app/market/persistence/mapper/authority/AuthorityMapper.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2019 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package app.market.persistence.mapper.authority; + +import java.util.List; +import app.market.model.authority.Authority; +import app.market.model.authority.AuthorityExample; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +@Repository(value = "AuthorityMapper") +public interface AuthorityMapper { + int countByExample(AuthorityExample example); + + int deleteByExample(AuthorityExample example); + + int deleteByPrimaryKey(String auId); + + int insert(Authority record); + + int insertSelective(Authority record); + + List<Authority> selectByExample(AuthorityExample example); + + Authority selectByPrimaryKey(String auId); + + int updateByExampleSelective(@Param("record") Authority record, @Param("example") AuthorityExample example); + + int updateByExample(@Param("record") Authority record, @Param("example") AuthorityExample example); + + int updateByPrimaryKeySelective(Authority record); + + int updateByPrimaryKey(Authority record); + + List<Authority> selectOption(); +}
\ No newline at end of file diff --git a/appmarket-persistence/src/main/java/app/market/persistence/mapper/authority/AuthorityResourceLinkMapper.java b/appmarket-persistence/src/main/java/app/market/persistence/mapper/authority/AuthorityResourceLinkMapper.java new file mode 100644 index 0000000..18b4c00 --- /dev/null +++ b/appmarket-persistence/src/main/java/app/market/persistence/mapper/authority/AuthorityResourceLinkMapper.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package app.market.persistence.mapper.authority; + +import java.util.List; +import app.market.model.authority.AuthorityResourceLinkExample; +import app.market.model.authority.AuthorityResourceLinkKey; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +@Repository(value = "AuthorityResourceLinkMapper") +public interface AuthorityResourceLinkMapper { + int countByExample(AuthorityResourceLinkExample example); + + int deleteByExample(AuthorityResourceLinkExample example); + + int deleteByPrimaryKey(AuthorityResourceLinkKey key); + + int insert(AuthorityResourceLinkKey record); + + int insertSelective(AuthorityResourceLinkKey record); + + List<AuthorityResourceLinkKey> selectByExample(AuthorityResourceLinkExample example); + + int updateByExampleSelective(@Param("record") AuthorityResourceLinkKey record, + @Param("example") AuthorityResourceLinkExample example); + + int updateByExample(@Param("record") AuthorityResourceLinkKey record, + @Param("example") AuthorityResourceLinkExample example); +}
\ No newline at end of file diff --git a/appmarket-persistence/src/main/java/app/market/persistence/mapper/resource/DictionaryMapper.java b/appmarket-persistence/src/main/java/app/market/persistence/mapper/resource/DictionaryMapper.java new file mode 100644 index 0000000..e5e3137 --- /dev/null +++ b/appmarket-persistence/src/main/java/app/market/persistence/mapper/resource/DictionaryMapper.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2019 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package app.market.persistence.mapper.resource; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import app.market.model.resource.Dictionary; +import app.market.model.resource.DictionaryExample; + +@Repository(value = "DictionaryMapper") +public interface DictionaryMapper { + int countByExample(DictionaryExample example); + + int deleteByExample(DictionaryExample example); + + int deleteByPrimaryKey(Integer dicId); + + int insert(Dictionary record); + + int insertSelective(Dictionary record); + + List<Dictionary> selectByExample(DictionaryExample example); + + Dictionary selectByPrimaryKey(Integer dicId); + + int updateByExampleSelective(@Param("record") Dictionary record, @Param("example") DictionaryExample example); + + int updateByExample(@Param("record") Dictionary record, @Param("example") DictionaryExample example); + + int updateByPrimaryKeySelective(Dictionary record); + + int updateByPrimaryKey(Dictionary record); + + List<Dictionary> selectItemsByTypeId(String typeId); +}
\ No newline at end of file diff --git a/appmarket-persistence/src/main/java/app/market/persistence/mapper/resource/ResourceMapper.java b/appmarket-persistence/src/main/java/app/market/persistence/mapper/resource/ResourceMapper.java new file mode 100644 index 0000000..54aed67 --- /dev/null +++ b/appmarket-persistence/src/main/java/app/market/persistence/mapper/resource/ResourceMapper.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2019 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package app.market.persistence.mapper.resource; + +import java.util.List; +import app.market.model.resource.Resource; +import app.market.model.resource.ResourceExample; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +@Repository(value = "ResourceMapper") +public interface ResourceMapper { + int countByExample(ResourceExample example); + + int deleteByExample(ResourceExample example); + + int deleteByPrimaryKey(String resId); + + int insert(Resource record); + + int insertSelective(Resource record); + + List<Resource> selectByExample(ResourceExample example); + + Resource selectByPrimaryKey(String resId); + + int updateByExampleSelective(@Param("record") Resource record, @Param("example") ResourceExample example); + + int updateByExample(@Param("record") Resource record, @Param("example") ResourceExample example); + + int updateByPrimaryKeySelective(Resource record); + + int updateByPrimaryKey(Resource record); + + List<Resource> selectResourcesByUserId(String userName); +}
\ No newline at end of file diff --git a/appmarket-persistence/src/main/java/app/market/persistence/mapper/user/UserAuthorityLinkMapper.java b/appmarket-persistence/src/main/java/app/market/persistence/mapper/user/UserAuthorityLinkMapper.java new file mode 100644 index 0000000..145cde7 --- /dev/null +++ b/appmarket-persistence/src/main/java/app/market/persistence/mapper/user/UserAuthorityLinkMapper.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package app.market.persistence.mapper.user; + +import java.util.List; +import app.market.model.user.UserAuthorityLinkExample; +import app.market.model.user.UserAuthorityLinkKey; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +@Repository(value = "UserAuthorityLinkMapper") +public interface UserAuthorityLinkMapper { + int countByExample(UserAuthorityLinkExample example); + + int deleteByExample(UserAuthorityLinkExample example); + + int deleteByPrimaryKey(UserAuthorityLinkKey key); + + int insert(UserAuthorityLinkKey record); + + int insertSelective(UserAuthorityLinkKey record); + + List<UserAuthorityLinkKey> selectByExample(UserAuthorityLinkExample example); + + int updateByExampleSelective(@Param("record") UserAuthorityLinkKey record, + @Param("example") UserAuthorityLinkExample example); + + int updateByExample(@Param("record") UserAuthorityLinkKey record, + @Param("example") UserAuthorityLinkExample example); +}
\ No newline at end of file diff --git a/appmarket-persistence/src/main/java/app/market/persistence/mapper/user/UserMapper.java b/appmarket-persistence/src/main/java/app/market/persistence/mapper/user/UserMapper.java new file mode 100644 index 0000000..e334146 --- /dev/null +++ b/appmarket-persistence/src/main/java/app/market/persistence/mapper/user/UserMapper.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2019 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package app.market.persistence.mapper.user; + +import java.util.List; +import app.market.model.user.User; +import app.market.model.user.UserExample; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.session.RowBounds; +import org.springframework.stereotype.Repository; + +@Repository(value = "UserMapper") +public interface UserMapper { + int countByExample(UserExample example); + + int deleteByExample(UserExample example); + + int deleteByPrimaryKey(String userId); + + int insert(User record); + + int insertSelective(User record); + + List<User> selectByExample(UserExample example); + + User selectByPrimaryKey(String userId); + + List<User> selectOptionByExample(UserExample example); + + User selectOneByExample(UserExample example); + + User selectByLoginId(String loginId); + + int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example); + + int updateByExample(@Param("record") User record, @Param("example") UserExample example); + + int updateByPrimaryKeySelective(User record); + + int updateByPrimaryKey(User record); + + int updatePassword(User record); + + int updateByPrimaryKeyWithBLOBs(User record); + + int insertOrUpdate(User record); + + List<User> selectByExample(RowBounds rowBounds, UserExample example); + + int deleteByUserName(String userName); + + int countByUserName(String userName); + + int countByUserId(String userId); + + User selectByUserName(String userName); +}
\ No newline at end of file diff --git a/appmarket-persistence/src/main/java/app/market/persistence/xml/app/AppMapper.xml b/appmarket-persistence/src/main/java/app/market/persistence/xml/app/AppMapper.xml new file mode 100644 index 0000000..d025f54 --- /dev/null +++ b/appmarket-persistence/src/main/java/app/market/persistence/xml/app/AppMapper.xml @@ -0,0 +1,368 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="app.market.persistence.mapper.app.AppMapper" > + <resultMap id="BaseResultMap" type="App" > + <id column="APP_ID" property="appId" jdbcType="CHAR" /> + <result column="APP_NAME" property="appName" jdbcType="VARCHAR" /> + <result column="APP_ABSTRACT" property="appAbstract" jdbcType="VARCHAR" /> + <result column="APP_TYPE_ID" property="typeId" jdbcType="CHAR" /> + <result column="APP_DEVICE_TYPE_ID" property="appDeviceTypeId" jdbcType="CHAR" /> + <result column="APP_DEVICE_TYPE_NAME" property="appDeviceTypeName" jdbcType="CHAR" /> + <result column="TYPE_NAME" property="typeName" jdbcType="VARCHAR" /> + <result column="DEVELOPER" property="developer" jdbcType="CHAR" /> + <result column="USER_NAME" property="developerName" jdbcType="VARCHAR" /> + <result column="VERSION_NAME" property="versionName" jdbcType="VARCHAR" /> + <result column="FILE_PATH" property="verFilePath" jdbcType="VARCHAR" /> + <result column="SIZE" property="verFileSize" jdbcType="INTEGER" /> + <result column="VERSION_CREATE_DATE" property="verCreateDate" jdbcType="TIMESTAMP" /> + <result column="APP_CREATE_DATE" property="createDate" jdbcType="TIMESTAMP" /> + <result column="APP_UPDATE_DATE" property="updateDate" jdbcType="TIMESTAMP" /> + <result column="APP_IS_DEL" property="isDel" jdbcType="CHAR" /> + <result column="MD5" property="hashcode" jdbcType="CHAR" /> + <result column="APP_IS_PUBLIC" property="appIsPublic" jdbcType="CHAR" /> + <result column="PUBLIC_LABLE" property="appIsPublicLable" jdbcType="CHAR" /> + <result column="APP_VERSION_ID" property="appVersionId" jdbcType="VARCHAR" /> + <result column="APP_ID_CUSTOM" property="appIdCustom" jdbcType="VARCHAR" /> + <result column="IMAGE_PATH" property="imagePath" jdbcType="VARCHAR" /> + </resultMap> + <sql id="Example_Where_Clause" > + <where > + <foreach collection="oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Update_By_Example_Where_Clause" > + <where > + <foreach collection="example.oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Base_Column_List" > + APP_ID, APP_NAME, APP_ABSTRACT, + APP_TYPE_ID,APP_ID_CUSTOM,IMAGE_PATH, + (select category.DIC_LABEL + from t_dictionary as category + where category.DIC_VALUE = APP_TYPE_ID and category.DIC_TYPE="0100" + ) as TYPE_NAME, + DEVELOPER,USER_NAME, + APP_VERSION_ID, APP_CREATE_DATE, APP_UPDATE_DATE, APP_IS_DEL, + FILE_PATH, SIZE, VERSION_CREATE_DATE, MD5, VERSION_NAME, + APP_IS_PUBLIC, + (select public.DIC_LABEL + from t_dictionary as public + where public.DIC_VALUE = APP_IS_PUBLIC and public.DIC_TYPE="0102" + ) as PUBLIC_LABLE, + APP_DEVICE_TYPE_ID, + (select device.DIC_LABEL + from t_dictionary as device + where device.DIC_VALUE = APP_DEVICE_TYPE_ID and device.DIC_TYPE="0101" + ) as APP_DEVICE_TYPE_NAME + </sql> + <select id="selectByExample" resultMap="BaseResultMap" parameterType="AppExample" > + select + <if test="distinct" > + distinct + </if> + 'true' as QUERYID, + <include refid="Base_Column_List" /> + from t_app + left join t_user on DEVELOPER = USER_ID + left join t_app_version on (APP_VERSION_ID = VERSION_ID and APP_ID = V_APP_ID) + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + <if test="orderByClause != null" > + order by ${orderByClause} + </if> + </select> + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > + select + <include refid="Base_Column_List" /> + from t_app + left join t_user on DEVELOPER = USER_ID + left join t_app_version on (APP_VERSION_ID = VERSION_ID and APP_ID = V_APP_ID) + where APP_ID = #{appId,jdbcType=CHAR} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > + delete from t_app + where APP_ID = #{appId,jdbcType=CHAR} + </delete> + <delete id="deleteByExample" parameterType="AppExample" > + delete from t_app + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </delete> + <insert id="insert" parameterType="App" > + insert into t_app (APP_ID, APP_NAME, APP_ABSTRACT, + APP_TYPE_ID, APP_DEVICE_TYPE_ID, DEVELOPER, APP_CREATE_DATE, + APP_UPDATE_DATE, APP_IS_DEL,APP_VERSION_ID, APP_IS_PUBLIC, + APP_ID_CUSTOM) + values (#{appId,jdbcType=CHAR}, #{appName,jdbcType=VARCHAR}, #{appAbstract,jdbcType=VARCHAR}, + #{typeId,jdbcType=CHAR}, #{appDeviceTypeId,jdbcType=CHAR}, #{developer,jdbcType=CHAR}, #{createDate,jdbcType=TIMESTAMP}, + #{updateDate,jdbcType=TIMESTAMP}, #{isDel,jdbcType=CHAR}, #{appVersionId,jdbcType=VARCHAR}, #{appIsPublic,jdbcType=CHAR}, + #{appIdCustom,jdbcType=VARCHAR}) + </insert> + <insert id="insertSelective" parameterType="App" > + insert into t_app + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="appId != null" > + APP_ID, + </if> + <if test="appName != null" > + APP_NAME, + </if> + <if test="appAbstract != null" > + APP_ABSTRACT, + </if> + <if test="typeId != null" > + APP_TYPE_ID, + </if> + <if test="appDeviceTypeId != null" > + APP_DEVICE_TYPE_ID, + </if> + <if test="developer != null" > + DEVELOPER, + </if> + <if test="createDate != null" > + APP_CREATE_DATE, + </if> + <if test="updateDate != null" > + APP_UPDATE_DATE, + </if> + <if test="isDel != null" > + APP_IS_DEL, + </if> + <if test="appVersionId != null" > + APP_VERSION_ID, + </if> + <if test="appIsPublic != null" > + APP_IS_PUBLIC, + </if> + <if test="appIdCustom != null" > + APP_ID_CUSTOM, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="appId != null" > + #{appId,jdbcType=CHAR}, + </if> + <if test="appName != null" > + #{appName,jdbcType=VARCHAR}, + </if> + <if test="appAbstract != null" > + #{appAbstract,jdbcType=VARCHAR}, + </if> + <if test="typeId != null" > + #{typeId,jdbcType=CHAR}, + </if> + <if test="appDeviceTypeId != null" > + #{appDeviceTypeId,jdbcType=CHAR}, + </if> + <if test="developer != null" > + #{developer,jdbcType=CHAR}, + </if> + <if test="createDate != null" > + #{createDate,jdbcType=TIMESTAMP}, + </if> + <if test="updateDate != null" > + #{updateDate,jdbcType=TIMESTAMP}, + </if> + <if test="isDel != null" > + #{isDel,jdbcType=CHAR}, + </if> + <if test="appVersionId != null" > + #{appVersionId,jdbcType=VARCHAR}, + </if> + <if test="appIsPublic != null" > + #{appIsPublic,jdbcType=CHAR}, + </if> + <if test="appIdCustom != null" > + #{appIdCustom,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <select id="countByExample" parameterType="AppExample" resultType="java.lang.Integer" > + select count(*) from t_app + left join t_user on DEVELOPER = USER_ID + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </select> + <update id="updateByExampleSelective" parameterType="map" > + update t_app + <set > + <if test="record.appId != null" > + APP_ID = #{record.appId,jdbcType=CHAR}, + </if> + <if test="record.appName != null" > + APP_NAME = #{record.appName,jdbcType=VARCHAR}, + </if> + <if test="record.appAbstract != null" > + APP_ABSTRACT = #{record.appAbstract,jdbcType=VARCHAR}, + </if> + <if test="record.typeId != null" > + APP_TYPE_ID = #{record.typeId,jdbcType=CHAR}, + </if> + <if test="record.appDeviceTypeId != null" > + APP_DEVICE_TYPE_ID = #{record.appDeviceTypeId,jdbcType=CHAR}, + </if> + <if test="record.developer != null" > + DEVELOPER = #{record.developer,jdbcType=CHAR}, + </if> + <if test="record.createDate != null" > + APP_CREATE_DATE = #{record.createDate,jdbcType=TIMESTAMP}, + </if> + <if test="record.updateDate != null" > + APP_UPDATE_DATE = #{record.updateDate,jdbcType=TIMESTAMP}, + </if> + <if test="record.isDel != null" > + APP_IS_DEL = #{record.isDel,jdbcType=CHAR}, + </if> + <if test="record.appVersionId != null" > + APP_VERSION_ID = #{record.appVersionId,jdbcType=VARCHAR}, + </if> + <if test="record.appIsPublic != null" > + APP_IS_PUBLIC = #{record.appIsPublic,jdbcType=CHAR}, + </if> + <if test="record.appIdCustom != null" > + APP_ID_CUSTOM = #{record.appIdCustom,jdbcType=VARCHAR}, + </if> + </set> + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByExample" parameterType="map" > + update t_app + set APP_ID = #{record.appId,jdbcType=CHAR}, + APP_NAME = #{record.appName,jdbcType=VARCHAR}, + APP_ABSTRACT = #{record.appAbstract,jdbcType=VARCHAR}, + APP_TYPE_ID = #{record.typeId,jdbcType=CHAR}, + APP_DEVICE_TYPE_ID = #{record.appDeviceTypeId,jdbcType=CHAR}, + DEVELOPER = #{record.developer,jdbcType=CHAR}, + APP_CREATE_DATE = #{record.createDate,jdbcType=TIMESTAMP}, + APP_UPDATE_DATE = #{record.updateDate,jdbcType=TIMESTAMP}, + APP_VERSION_ID = #{record.appVersionId,jdbcType=VARCHAR}, + APP_IS_DEL = #{record.isDel,jdbcType=CHAR}, + APP_IS_PUBLIC = #{record.appIsPublic,jdbcType=CHAR} + APP_ID_CUSTOM = #{record.appIdCustom,jdbcType=VARCHAR} + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByPrimaryKeySelective" parameterType="App" > + update t_app + <set > + <if test="appName != null" > + APP_NAME = #{appName,jdbcType=VARCHAR}, + </if> + <if test="appAbstract != null" > + APP_ABSTRACT = #{appAbstract,jdbcType=VARCHAR}, + </if> + <if test="typeId != null" > + APP_TYPE_ID = #{typeId,jdbcType=CHAR}, + </if> + <if test="appDeviceTypeId != null" > + APP_DEVICE_TYPE_ID = #{appDeviceTypeId,jdbcType=CHAR}, + </if> + <if test="developer != null" > + DEVELOPER = #{developer,jdbcType=CHAR}, + </if> + <if test="createDate != null" > + APP_CREATE_DATE = #{createDate,jdbcType=TIMESTAMP}, + </if> + <if test="updateDate != null" > + APP_UPDATE_DATE = #{updateDate,jdbcType=TIMESTAMP}, + </if> + <if test="appVersionId != null" > + APP_VERSION_ID = #{appVersionId,jdbcType=VARCHAR}, + </if> + <if test="isDel != null" > + APP_IS_DEL = #{isDel,jdbcType=CHAR}, + </if> + <if test="appIsPublic != null" > + APP_IS_PUBLIC = #{appIsPublic,jdbcType=CHAR}, + </if> + <if test="appIdCustom != null" > + APP_ID_CUSTOM = #{appIdCustom,jdbcType=VARCHAR}, + </if> + </set> + where APP_ID = #{appId,jdbcType=CHAR} + </update> + <update id="updateByPrimaryKey" parameterType="App" > + update t_app + set APP_NAME = #{appName,jdbcType=VARCHAR}, + APP_ABSTRACT = #{appAbstract,jdbcType=VARCHAR}, + APP_TYPE_ID = #{typeId,jdbcType=CHAR}, + APP_DEVICE_TYPE_ID = #{appDeviceTypeId,jdbcType=CHAR}, + DEVELOPER = #{developer,jdbcType=CHAR}, + APP_CREATE_DATE = #{createDate,jdbcType=TIMESTAMP}, + APP_UPDATE_DATE = #{updateDate,jdbcType=TIMESTAMP}, + APP_VERSION_ID = #{appVersionId,jdbcType=VARCHAR}, + APP_IS_DEL = #{isDel,jdbcType=CHAR}, + APP_IS_PUBLIC = #{appIsPublic,jdbcType=CHAR}, + APP_ID_CUSTOM = #{appIdCustom,jdbcType=VARCHAR} + where APP_ID = #{appId,jdbcType=CHAR} + </update> + <update id="deleteByAppId" parameterType="java.lang.String" > + update t_app + set APP_IS_DEL = "1", APP_ID_CUSTOM = concat(APP_ID_CUSTOM,"-",APP_ID) + where APP_ID = #{appId,jdbcType=CHAR} + </update> + <select id="selectByCustomId" resultMap="BaseResultMap" parameterType="java.lang.String" > + select + <include refid="Base_Column_List" /> + from t_app + left join t_user on DEVELOPER = USER_ID + left join t_app_version on (APP_VERSION_ID = VERSION_ID and APP_ID = V_APP_ID) + where APP_ID_CUSTOM = #{appIdCustom,jdbcType=VARCHAR} + </select> + +</mapper>
\ No newline at end of file diff --git a/appmarket-persistence/src/main/java/app/market/persistence/xml/app/AppVersionMapper.xml b/appmarket-persistence/src/main/java/app/market/persistence/xml/app/AppVersionMapper.xml new file mode 100644 index 0000000..d8ab1b8 --- /dev/null +++ b/appmarket-persistence/src/main/java/app/market/persistence/xml/app/AppVersionMapper.xml @@ -0,0 +1,298 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="app.market.persistence.mapper.app.AppVersionMapper" > + <resultMap id="BaseResultMap" type="AppVersion" > + <id column="VERSION_ID" property="versionId" jdbcType="CHAR" /> + <result column="V_APP_ID" property="vAppId" jdbcType="CHAR" /> + <result column="VERSION_NAME" property="versionName" jdbcType="VARCHAR" /> + <result column="SIZE" property="size" jdbcType="INTEGER" /> + <result column="COMMENT" property="comment" jdbcType="VARCHAR" /> + <result column="FILE_PATH" property="filePath" jdbcType="VARCHAR" /> + <result column="MD5" property="md5" jdbcType="CHAR" /> + <result column="VERSION_CREATE_DATE" property="versionCreateDate" jdbcType="TIMESTAMP" /> + <result column="VERSION_IS_DEL" property="versionIsDel" jdbcType="CHAR" /> + <result column="IMAGE_PATH" property="imagePath" jdbcType="VARCHAR" /> + </resultMap> + <sql id="Example_Where_Clause" > + <where > + <foreach collection="oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Update_By_Example_Where_Clause" > + <where > + <foreach collection="example.oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Base_Column_List" > + VERSION_ID, V_APP_ID, VERSION_NAME, SIZE, COMMENT, FILE_PATH, MD5, VERSION_CREATE_DATE, + VERSION_IS_DEL, IMAGE_PATH + </sql> + <select id="selectByExample" resultMap="BaseResultMap" parameterType="AppVersionExample" > + select + <if test="distinct" > + distinct + </if> + 'true' as QUERYID, + <include refid="Base_Column_List" /> + from t_app_version + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + <if test="orderByClause != null" > + order by ${orderByClause} + </if> + </select> + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > + select + <include refid="Base_Column_List" /> + from t_app_version + where VERSION_ID = #{versionId,jdbcType=CHAR} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > + delete from t_app_version + where VERSION_ID = #{versionId,jdbcType=CHAR} + </delete> + <delete id="deleteByExample" parameterType="AppVersionExample" > + delete from t_app_version + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </delete> + <insert id="insert" parameterType="AppVersion" > + insert into t_app_version (VERSION_ID, V_APP_ID, VERSION_NAME, + SIZE, COMMENT, FILE_PATH, + MD5, VERSION_CREATE_DATE, VERSION_IS_DEL, + IMAGE_PATH) + values (#{versionId,jdbcType=CHAR}, #{vAppId,jdbcType=CHAR}, #{versionName,jdbcType=VARCHAR}, + #{size,jdbcType=INTEGER}, #{comment,jdbcType=VARCHAR}, #{filePath,jdbcType=VARCHAR}, + #{md5,jdbcType=CHAR}, #{versionCreateDate,jdbcType=TIMESTAMP}, #{versionIsDel,jdbcType=CHAR}, + #{imagePath,jdbcType=VARCHAR}) + </insert> + <insert id="insertSelective" parameterType="AppVersion" > + insert into t_app_version + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="versionId != null" > + VERSION_ID, + </if> + <if test="vAppId != null" > + V_APP_ID, + </if> + <if test="versionName != null" > + VERSION_NAME, + </if> + <if test="size != null" > + SIZE, + </if> + <if test="comment != null" > + COMMENT, + </if> + <if test="filePath != null" > + FILE_PATH, + </if> + <if test="md5 != null" > + MD5, + </if> + <if test="versionCreateDate != null" > + VERSION_CREATE_DATE, + </if> + <if test="versionIsDel != null" > + VERSION_IS_DEL, + </if> + <if test="imagePath != null" > + IMAGE_PATH, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="versionId != null" > + #{versionId,jdbcType=CHAR}, + </if> + <if test="vAppId != null" > + #{vAppId,jdbcType=CHAR}, + </if> + <if test="versionName != null" > + #{versionName,jdbcType=VARCHAR}, + </if> + <if test="size != null" > + #{size,jdbcType=INTEGER}, + </if> + <if test="comment != null" > + #{comment,jdbcType=VARCHAR}, + </if> + <if test="filePath != null" > + #{filePath,jdbcType=VARCHAR}, + </if> + <if test="md5 != null" > + #{md5,jdbcType=CHAR}, + </if> + <if test="versionCreateDate != null" > + #{versionCreateDate,jdbcType=TIMESTAMP}, + </if> + <if test="versionIsDel != null" > + #{versionIsDel,jdbcType=CHAR}, + </if> + <if test="imagePath != null" > + #{imagePath,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <select id="countByExample" parameterType="AppVersionExample" resultType="java.lang.Integer" > + select count(*) from t_app_version + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </select> + <update id="updateByExampleSelective" parameterType="map" > + update t_app_version + <set > + <if test="record.versionId != null" > + VERSION_ID = #{record.versionId,jdbcType=CHAR}, + </if> + <if test="record.vAppId != null" > + V_APP_ID = #{record.vAppId,jdbcType=CHAR}, + </if> + <if test="record.versionName != null" > + VERSION_NAME = #{record.versionName,jdbcType=VARCHAR}, + </if> + <if test="record.size != null" > + SIZE = #{record.size,jdbcType=INTEGER}, + </if> + <if test="record.comment != null" > + COMMENT = #{record.comment,jdbcType=VARCHAR}, + </if> + <if test="record.filePath != null" > + FILE_PATH = #{record.filePath,jdbcType=VARCHAR}, + </if> + <if test="record.md5 != null" > + MD5 = #{record.md5,jdbcType=CHAR}, + </if> + <if test="record.versionCreateDate != null" > + VERSION_CREATE_DATE = #{record.versionCreateDate,jdbcType=TIMESTAMP}, + </if> + <if test="record.versionIsDel != null" > + VERSION_IS_DEL = #{record.versionIsDel,jdbcType=CHAR}, + </if> + <if test="record.imagePath != null" > + IMAGE_PATH = #{record.imagePath,jdbcType=VARCHAR}, + </if> + </set> + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByExample" parameterType="map" > + update t_app_version + set VERSION_ID = #{record.versionId,jdbcType=CHAR}, + V_APP_ID = #{record.vAppId,jdbcType=CHAR}, + VERSION_NAME = #{record.versionName,jdbcType=VARCHAR}, + SIZE = #{record.size,jdbcType=INTEGER}, + COMMENT = #{record.comment,jdbcType=VARCHAR}, + FILE_PATH = #{record.filePath,jdbcType=VARCHAR}, + MD5 = #{record.md5,jdbcType=CHAR}, + VERSION_CREATE_DATE = #{record.versionCreateDate,jdbcType=TIMESTAMP}, + VERSION_IS_DEL = #{record.versionIsDel,jdbcType=CHAR}, + IMAGE_PATH = #{record.imagePath,jdbcType=VARCHAR} + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByPrimaryKeySelective" parameterType="AppVersion" > + update t_app_version + <set > + <if test="vAppId != null" > + V_APP_ID = #{vAppId,jdbcType=CHAR}, + </if> + <if test="versionName != null" > + VERSION_NAME = #{versionName,jdbcType=VARCHAR}, + </if> + <if test="size != null" > + SIZE = #{size,jdbcType=INTEGER}, + </if> + <if test="comment != null" > + COMMENT = #{comment,jdbcType=VARCHAR}, + </if> + <if test="filePath != null" > + FILE_PATH = #{filePath,jdbcType=VARCHAR}, + </if> + <if test="md5 != null" > + MD5 = #{md5,jdbcType=CHAR}, + </if> + <if test="versionCreateDate != null" > + VERSION_CREATE_DATE = #{versionCreateDate,jdbcType=TIMESTAMP}, + </if> + <if test="versionIsDel != null" > + VERSION_IS_DEL = #{versionIsDel,jdbcType=CHAR}, + </if> + <if test="imagePath != null" > + IMAGE_PATH = #{imagePath,jdbcType=VARCHAR}, + </if> + </set> + where VERSION_ID = #{versionId,jdbcType=CHAR} + </update> + <update id="updateByPrimaryKey" parameterType="AppVersion" > + update t_app_version + set V_APP_ID = #{vAppId,jdbcType=CHAR}, + VERSION_NAME = #{versionName,jdbcType=VARCHAR}, + SIZE = #{size,jdbcType=INTEGER}, + COMMENT = #{comment,jdbcType=VARCHAR}, + FILE_PATH = #{filePath,jdbcType=VARCHAR}, + MD5 = #{md5,jdbcType=CHAR}, + VERSION_CREATE_DATE = #{versionCreateDate,jdbcType=TIMESTAMP}, + VERSION_IS_DEL = #{versionIsDel,jdbcType=CHAR}, + IMAGE_PATH = #{imagePath,jdbcType=VARCHAR} + where VERSION_ID = #{versionId,jdbcType=CHAR} + </update> + <update id="deleteByAppId" parameterType="java.lang.String" > + update t_app_version + set VERSION_IS_DEL = "1" + where V_APP_ID = #{appId,jdbcType=CHAR} + </update> + +</mapper>
\ No newline at end of file diff --git a/appmarket-persistence/src/main/java/app/market/persistence/xml/authority/AuthorityMapper.xml b/appmarket-persistence/src/main/java/app/market/persistence/xml/authority/AuthorityMapper.xml new file mode 100644 index 0000000..7843e0a --- /dev/null +++ b/appmarket-persistence/src/main/java/app/market/persistence/xml/authority/AuthorityMapper.xml @@ -0,0 +1,194 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="app.market.persistence.mapper.authority.AuthorityMapper" > + <resultMap id="BaseResultMap" type="Authority" > + <id column="AU_ID" property="auId" jdbcType="CHAR" /> + <result column="AU_NAME" property="auName" jdbcType="VARCHAR" /> + <result column="AU_IS_DEL" property="isDel" jdbcType="CHAR" /> + </resultMap> + <sql id="Example_Where_Clause" > + <where > + <foreach collection="oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Update_By_Example_Where_Clause" > + <where > + <foreach collection="example.oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Base_Column_List" > + AU_ID, AU_NAME, AU_IS_DEL + </sql> + <select id="selectByExample" resultMap="BaseResultMap" parameterType="AuthorityExample" > + select + <if test="distinct" > + distinct + </if> + 'true' as QUERYID, + <include refid="Base_Column_List" /> + from t_authority + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + <if test="orderByClause != null" > + order by ${orderByClause} + </if> + </select> + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > + select + <include refid="Base_Column_List" /> + from t_authority + where AU_ID = #{auId,jdbcType=CHAR} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > + delete from t_authority + where AU_ID = #{auId,jdbcType=CHAR} + </delete> + <delete id="deleteByExample" parameterType="AuthorityExample" > + delete from t_authority + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </delete> + <insert id="insert" parameterType="Authority" > + insert into t_authority (AU_ID, AU_NAME, AU_IS_DEL + ) + values (#{auId,jdbcType=CHAR}, #{auName,jdbcType=VARCHAR}, #{isDel,jdbcType=CHAR} + ) + </insert> + <insert id="insertSelective" parameterType="Authority" > + insert into t_authority + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="auId != null" > + AU_ID, + </if> + <if test="auName != null" > + AU_NAME, + </if> + <if test="isDel != null" > + AU_IS_DEL, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="auId != null" > + #{auId,jdbcType=CHAR}, + </if> + <if test="auName != null" > + #{auName,jdbcType=VARCHAR}, + </if> + <if test="isDel != null" > + #{isDel,jdbcType=CHAR}, + </if> + </trim> + </insert> + <select id="countByExample" parameterType="AuthorityExample" resultType="java.lang.Integer" > + select count(*) from t_authority + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </select> + <update id="updateByExampleSelective" parameterType="map" > + update t_authority + <set > + <if test="record.auId != null" > + AU_ID = #{record.auId,jdbcType=CHAR}, + </if> + <if test="record.auName != null" > + AU_NAME = #{record.auName,jdbcType=VARCHAR}, + </if> + <if test="record.isDel != null" > + AU_IS_DEL = #{record.isDel,jdbcType=CHAR}, + </if> + </set> + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByExample" parameterType="map" > + update t_authority + set AU_ID = #{record.auId,jdbcType=CHAR}, + AU_NAME = #{record.auName,jdbcType=VARCHAR}, + AU_IS_DEL = #{record.isDel,jdbcType=CHAR} + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByPrimaryKeySelective" parameterType="Authority" > + update t_authority + <set > + <if test="auName != null" > + AU_NAME = #{auName,jdbcType=VARCHAR}, + </if> + <if test="isDel != null" > + AU_IS_DEL = #{isDel,jdbcType=CHAR}, + </if> + </set> + where AU_ID = #{auId,jdbcType=CHAR} + </update> + <update id="updateByPrimaryKey" parameterType="Authority" > + update t_authority + set AU_NAME = #{auName,jdbcType=VARCHAR}, + AU_IS_DEL = #{isDel,jdbcType=CHAR} + where AU_ID = #{auId,jdbcType=CHAR} + </update> + <select id="selectOption" resultMap="BaseResultMap" parameterType="AuthorityExample" useCache="true"> + SELECT + <if test="distinct" > + distinct + </if> + 'true' AS QUERYID, AU_ID, AU_NAME + FROM + t_authority + WHERE + AU_IS_DEL = '0' + ORDER BY AU_ID + </select> +</mapper>
\ No newline at end of file diff --git a/appmarket-persistence/src/main/java/app/market/persistence/xml/authority/AuthorityResourceLinkMapper.xml b/appmarket-persistence/src/main/java/app/market/persistence/xml/authority/AuthorityResourceLinkMapper.xml new file mode 100644 index 0000000..bff6c1f --- /dev/null +++ b/appmarket-persistence/src/main/java/app/market/persistence/xml/authority/AuthorityResourceLinkMapper.xml @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="app.market.persistence.mapper.authority.AuthorityResourceLinkMapper" > + <resultMap id="BaseResultMap" type="AuthorityResourceLinkKey" > + <id column="R_RES_ID" property="resId" jdbcType="CHAR" /> + <id column="R_AU_ID" property="auId" jdbcType="CHAR" /> + </resultMap> + <sql id="Example_Where_Clause" > + <where > + <foreach collection="oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Update_By_Example_Where_Clause" > + <where > + <foreach collection="example.oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Base_Column_List" > + R_RES_ID, R_AU_ID + </sql> + <select id="selectByExample" resultMap="BaseResultMap" parameterType="AuthorityResourceLinkExample" > + select + <if test="distinct" > + distinct + </if> + 'true' as QUERYID, + <include refid="Base_Column_List" /> + from t_authority_resource_link + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + <if test="orderByClause != null" > + order by ${orderByClause} + </if> + </select> + <delete id="deleteByPrimaryKey" parameterType="AuthorityResourceLinkKey" > + delete from t_authority_resource_link + where R_RES_ID = #{resId,jdbcType=CHAR} + and R_AU_ID = #{auId,jdbcType=CHAR} + </delete> + <delete id="deleteByExample" parameterType="AuthorityResourceLinkExample" > + delete from t_authority_resource_link + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </delete> + <insert id="insert" parameterType="AuthorityResourceLinkKey" > + insert into t_authority_resource_link (R_RES_ID, R_AU_ID) + values (#{resId,jdbcType=CHAR}, #{auId,jdbcType=CHAR}) + </insert> + <insert id="insertSelective" parameterType="AuthorityResourceLinkKey" > + insert into t_authority_resource_link + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="resId != null" > + R_RES_ID, + </if> + <if test="auId != null" > + R_AU_ID, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="resId != null" > + #{resId,jdbcType=CHAR}, + </if> + <if test="auId != null" > + #{auId,jdbcType=CHAR}, + </if> + </trim> + </insert> + <select id="countByExample" parameterType="AuthorityResourceLinkExample" resultType="java.lang.Integer" > + select count(*) from t_authority_resource_link + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </select> + <update id="updateByExampleSelective" parameterType="map" > + update t_authority_resource_link + <set > + <if test="record.resId != null" > + R_RES_ID = #{record.resId,jdbcType=CHAR}, + </if> + <if test="record.auId != null" > + R_AU_ID = #{record.auId,jdbcType=CHAR}, + </if> + </set> + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByExample" parameterType="map" > + update t_authority_resource_link + set R_RES_ID = #{record.resId,jdbcType=CHAR}, + R_AU_ID = #{record.auId,jdbcType=CHAR} + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> +</mapper>
\ No newline at end of file diff --git a/appmarket-persistence/src/main/java/app/market/persistence/xml/resource/DictionaryMapper.xml b/appmarket-persistence/src/main/java/app/market/persistence/xml/resource/DictionaryMapper.xml new file mode 100644 index 0000000..92bfaf9 --- /dev/null +++ b/appmarket-persistence/src/main/java/app/market/persistence/xml/resource/DictionaryMapper.xml @@ -0,0 +1,202 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="app.market.persistence.mapper.resource.DictionaryMapper" > + <resultMap id="BaseResultMap" type="Dictionary" > + <id column="DIC_ID" property="dicId" jdbcType="INTEGER" /> + <result column="DIC_TYPE" property="dicType" jdbcType="VARCHAR" /> + <result column="DIC_VALUE" property="dicValue" jdbcType="VARCHAR" /> + <result column="DIC_LABEL" property="dicLabel" jdbcType="VARCHAR" /> + </resultMap> + <sql id="Example_Where_Clause" > + <where > + <foreach collection="oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Update_By_Example_Where_Clause" > + <where > + <foreach collection="example.oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Base_Column_List" > + DIC_ID, DIC_TYPE, DIC_VALUE, DIC_LABEL + </sql> + <select id="selectByExample" resultMap="BaseResultMap" parameterType="DictionaryExample" > + select + <if test="distinct" > + distinct + </if> + 'true' as QUERYID, + <include refid="Base_Column_List" /> + from t_dictionary + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + <if test="orderByClause != null" > + order by ${orderByClause} + </if> + </select> + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > + select + <include refid="Base_Column_List" /> + from t_dictionary + where DIC_ID = #{dicId,jdbcType=INTEGER} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > + delete from t_dictionary + where DIC_ID = #{dicId,jdbcType=INTEGER} + </delete> + <delete id="deleteByExample" parameterType="DictionaryExample" > + delete from t_dictionary + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </delete> + <insert id="insert" parameterType="Dictionary" useGeneratedKeys="true" keyProperty="DIC_ID"> + insert into t_dictionary (DIC_ID, DIC_TYPE, DIC_VALUE, DIC_LABEL) + select #{dicId,jdbcType=INTEGER}, + #{dicType,jdbcType=VARCHAR}, + (SELECT max(cast(DIC_VALUE as SIGNED))+1 FROM t_dictionary where DIC_TYPE = #{dicType,jdbcType=VARCHAR}), + #{dicLabel,jdbcType=VARCHAR} + </insert> + <insert id="insertSelective" parameterType="Dictionary" > + insert into t_dictionary + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="dicId != null" > + DIC_ID, + </if> + <if test="dicType != null" > + DIC_TYPE, + </if> + <if test="dicValue != null" > + DIC_VALUE, + </if> + <if test="dicLabel != null" > + DIC_LABEL, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="dicId != null" > + #{dicId,jdbcType=INTEGER}, + </if> + <if test="dicType != null" > + #{dicType,jdbcType=VARCHAR}, + </if> + <if test="dicValue != null" > + #{dicValue,jdbcType=VARCHAR}, + </if> + <if test="dicLabel != null" > + #{dicLabel,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <select id="countByExample" parameterType="DictionaryExample" resultType="java.lang.Integer" > + select count(*) from t_dictionary + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </select> + <update id="updateByExampleSelective" parameterType="map" > + update t_dictionary + <set > + <if test="record.dicId != null" > + DIC_ID = #{record.dicId,jdbcType=INTEGER}, + </if> + <if test="record.dicType != null" > + DIC_TYPE = #{record.dicType,jdbcType=VARCHAR}, + </if> + <if test="record.dicValue != null" > + DIC_VALUE = #{record.dicValue,jdbcType=VARCHAR}, + </if> + <if test="record.dicLabel != null" > + DIC_LABEL = #{record.dicLabel,jdbcType=VARCHAR}, + </if> + </set> + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByExample" parameterType="map" > + update t_dictionary + set DIC_LABEL = #{record.dicLabel,jdbcType=VARCHAR} + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByPrimaryKeySelective" parameterType="Dictionary" > + update t_dictionary + <set > + <if test="dicType != null" > + DIC_TYPE = #{dicType,jdbcType=VARCHAR}, + </if> + <if test="dicValue != null" > + DIC_VALUE = #{dicValue,jdbcType=VARCHAR}, + </if> + <if test="dicLabel != null" > + DIC_LABEL = #{dicLabel,jdbcType=VARCHAR}, + </if> + </set> + where DIC_ID = #{dicId,jdbcType=INTEGER} + </update> + <update id="updateByPrimaryKey" parameterType="Dictionary" > + update t_dictionary + set DIC_TYPE = #{dicType,jdbcType=VARCHAR}, + DIC_VALUE = #{dicValue,jdbcType=VARCHAR}, + DIC_LABEL = #{dicLabel,jdbcType=VARCHAR} + where DIC_ID = #{dicId,jdbcType=INTEGER} + </update> + <select id="selectItemsByTypeId" resultMap="BaseResultMap" parameterType="java.lang.String" > + select + <include refid="Base_Column_List" /> + from t_dictionary + where DIC_TYPE = #{dicType,jdbcType=VARCHAR} + order by DIC_VALUE + </select> +</mapper>
\ No newline at end of file diff --git a/appmarket-persistence/src/main/java/app/market/persistence/xml/resource/ResourceMapper.xml b/appmarket-persistence/src/main/java/app/market/persistence/xml/resource/ResourceMapper.xml new file mode 100644 index 0000000..876607e --- /dev/null +++ b/appmarket-persistence/src/main/java/app/market/persistence/xml/resource/ResourceMapper.xml @@ -0,0 +1,220 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="app.market.persistence.mapper.resource.ResourceMapper" > + <resultMap id="BaseResultMap" type="Resource" > + <id column="RES_ID" property="resId" jdbcType="CHAR" /> + <result column="RES_NAME" property="resName" jdbcType="VARCHAR" /> + <result column="RES_TYPE" property="resType" jdbcType="VARCHAR" /> + <result column="ACCESS_PATH" property="accessPath" jdbcType="VARCHAR" /> + <result column="HTTP_METHOD" property="httpMethod" jdbcType="VARCHAR" /> + </resultMap> + <sql id="Example_Where_Clause" > + <where > + <foreach collection="oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Update_By_Example_Where_Clause" > + <where > + <foreach collection="example.oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Base_Column_List" > + RES_ID, RES_NAME, RES_TYPE, ACCESS_PATH, HTTP_METHOD + </sql> + <select id="selectByExample" resultMap="BaseResultMap" parameterType="ResourceExample" > + select + <if test="distinct" > + distinct + </if> + 'true' as QUERYID, + <include refid="Base_Column_List" /> + from t_resource + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + <if test="orderByClause != null" > + order by ${orderByClause} + </if> + </select> + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > + select + <include refid="Base_Column_List" /> + from t_resource + where RES_ID = #{resId,jdbcType=CHAR} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > + delete from t_resource + where RES_ID = #{resId,jdbcType=CHAR} + </delete> + <delete id="deleteByExample" parameterType="ResourceExample" > + delete from t_resource + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </delete> + <insert id="insert" parameterType="Resource" > + insert into t_resource (RES_ID, RES_NAME, RES_TYPE, + ACCESS_PATH,HTTP_METHOD) + values (#{resId,jdbcType=CHAR}, #{resName,jdbcType=VARCHAR}, #{resType,jdbcType=VARCHAR}, + #{accessPath,jdbcType=VARCHAR}, #{httpMethod,jdbcType=VARCHAR}) + </insert> + <insert id="insertSelective" parameterType="Resource" > + insert into t_resource + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="resId != null" > + RES_ID, + </if> + <if test="resName != null" > + RES_NAME, + </if> + <if test="resType != null" > + RES_TYPE, + </if> + <if test="accessPath != null" > + ACCESS_PATH, + </if> + <if test="accessPath != null" > + HTTP_METHOD, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="resId != null" > + #{resId,jdbcType=CHAR}, + </if> + <if test="resName != null" > + #{resName,jdbcType=VARCHAR}, + </if> + <if test="resType != null" > + #{resType,jdbcType=VARCHAR}, + </if> + <if test="accessPath != null" > + #{accessPath,jdbcType=VARCHAR}, + </if> + <if test="accessPath != null" > + #{httpMethod,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <select id="countByExample" parameterType="ResourceExample" resultType="java.lang.Integer" > + select count(*) from t_resource + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </select> + <update id="updateByExampleSelective" parameterType="map" > + update t_resource + <set > + <if test="record.resId != null" > + RES_ID = #{record.resId,jdbcType=CHAR}, + </if> + <if test="record.resName != null" > + RES_NAME = #{record.resName,jdbcType=VARCHAR}, + </if> + <if test="record.resType != null" > + RES_TYPE = #{record.resType,jdbcType=VARCHAR}, + </if> + <if test="record.accessPath != null" > + ACCESS_PATH = #{record.accessPath,jdbcType=VARCHAR}, + </if> + <if test="record.httpMethod != null" > + HTTP_METHOD = #{record.httpMethod,jdbcType=VARCHAR}, + </if> + </set> + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByExample" parameterType="map" > + update t_resource + set RES_ID = #{record.resId,jdbcType=CHAR}, + RES_NAME = #{record.resName,jdbcType=VARCHAR}, + RES_TYPE = #{record.resType,jdbcType=VARCHAR}, + ACCESS_PATH = #{record.accessPath,jdbcType=VARCHAR}, + HTTP_METHOD = #{record.httpMethod,jdbcType=VARCHAR} + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByPrimaryKeySelective" parameterType="Resource" > + update t_resource + <set > + <if test="resName != null" > + RES_NAME = #{resName,jdbcType=VARCHAR}, + </if> + <if test="resType != null" > + RES_TYPE = #{resType,jdbcType=VARCHAR}, + </if> + <if test="accessPath != null" > + ACCESS_PATH = #{accessPath,jdbcType=VARCHAR}, + </if> + <if test="httpMethod != null" > + HTTP_METHOD = #{httpMethod,jdbcType=VARCHAR}, + </if> + </set> + where RES_ID = #{resId,jdbcType=CHAR} + </update> + <update id="updateByPrimaryKey" parameterType="Resource" > + update t_resource + set RES_NAME = #{resName,jdbcType=VARCHAR}, + RES_TYPE = #{resType,jdbcType=VARCHAR}, + ACCESS_PATH = #{accessPath,jdbcType=VARCHAR}, + HTTP_METHOD = #{httpMethod,jdbcType=VARCHAR} + where RES_ID = #{resId,jdbcType=CHAR} + </update> + <select id="selectResourcesByUserId" resultMap="BaseResultMap" parameterType="java.lang.String"> + select res.res_id as res_id, res_name, res_type, access_path,HTTP_METHOD + from t_resource as res + left join t_authority_resource_link as arlink on arlink.r_res_id=res.res_id + left join t_user_authority_link as urlink on urlink.a_au_id=arlink.r_au_id + left join t_user as user on user.user_id=urlink.a_user_id + where <!-- RES_TYPE = 'menu' and --> user.user_name = #{userName,jdbcType=VARCHAR} + </select> +</mapper>
\ No newline at end of file diff --git a/appmarket-persistence/src/main/java/app/market/persistence/xml/user/UserAuthorityLinkMapper.xml b/appmarket-persistence/src/main/java/app/market/persistence/xml/user/UserAuthorityLinkMapper.xml new file mode 100644 index 0000000..367aad2 --- /dev/null +++ b/appmarket-persistence/src/main/java/app/market/persistence/xml/user/UserAuthorityLinkMapper.xml @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="app.market.persistence.mapper.user.UserAuthorityLinkMapper" > + <resultMap id="BaseResultMap" type="UserAuthorityLinkKey" > + <id column="A_USER_ID" property="userId" jdbcType="CHAR" /> + <id column="A_AU_ID" property="auId" jdbcType="CHAR" /> + </resultMap> + <sql id="Example_Where_Clause" > + <where > + <foreach collection="oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Update_By_Example_Where_Clause" > + <where > + <foreach collection="example.oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Base_Column_List" > + A_USER_ID, A_AU_ID + </sql> + <select id="selectByExample" resultMap="BaseResultMap" parameterType="UserAuthorityLinkExample" > + select + <if test="distinct" > + distinct + </if> + 'true' as QUERYID, + <include refid="Base_Column_List" /> + from t_user_authority_link + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + <if test="orderByClause != null" > + order by ${orderByClause} + </if> + </select> + <delete id="deleteByPrimaryKey" parameterType="UserAuthorityLinkKey" > + delete from t_user_authority_link + where A_USER_ID = #{userId,jdbcType=CHAR} + and A_AU_ID = #{auId,jdbcType=CHAR} + </delete> + <delete id="deleteByExample" parameterType="UserAuthorityLinkExample" > + delete from t_user_authority_link + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </delete> + <insert id="insert" parameterType="UserAuthorityLinkKey" > + insert into t_user_authority_link (A_USER_ID, A_AU_ID) + values (#{userId,jdbcType=CHAR}, #{auId,jdbcType=CHAR}) + </insert> + <insert id="insertSelective" parameterType="UserAuthorityLinkKey" > + insert into t_user_authority_link + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="userId != null" > + A_USER_ID, + </if> + <if test="auId != null" > + A_AU_ID, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="userId != null" > + #{userId,jdbcType=CHAR}, + </if> + <if test="auId != null" > + #{auId,jdbcType=CHAR}, + </if> + </trim> + </insert> + <select id="countByExample" parameterType="UserAuthorityLinkExample" resultType="java.lang.Integer" > + select count(*) from t_user_authority_link + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </select> + <update id="updateByExampleSelective" parameterType="map" > + update t_user_authority_link + <set > + <if test="record.userId != null" > + A_USER_ID = #{record.userId,jdbcType=CHAR}, + </if> + <if test="record.auId != null" > + A_AU_ID = #{record.auId,jdbcType=CHAR}, + </if> + </set> + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByExample" parameterType="map" > + update t_user_authority_link + set A_USER_ID = #{record.userId,jdbcType=CHAR}, + A_AU_ID = #{record.auId,jdbcType=CHAR} + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> +</mapper>
\ No newline at end of file diff --git a/appmarket-persistence/src/main/java/app/market/persistence/xml/user/UserMapper.xml b/appmarket-persistence/src/main/java/app/market/persistence/xml/user/UserMapper.xml new file mode 100644 index 0000000..f1c63da --- /dev/null +++ b/appmarket-persistence/src/main/java/app/market/persistence/xml/user/UserMapper.xml @@ -0,0 +1,308 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="app.market.persistence.mapper.user.UserMapper" > + <resultMap id="BaseResultMap" type="User" > + <id column="USER_ID" property="userId" jdbcType="CHAR" /> + <result column="USER_PW" property="userPw" jdbcType="VARCHAR" /> + <result column="USER_NAME" property="userName" jdbcType="VARCHAR" /> + <result column="MAIL_ADDRESS" property="mailAddress" jdbcType="VARCHAR" /> + <result column="CREATE_DATE" property="createDate" jdbcType="TIMESTAMP" /> + <result column="UPDATE_DATE" property="updateDate" jdbcType="TIMESTAMP" /> + <result column="IS_DEL" property="isDel" jdbcType="CHAR" /> + <result column="A_AU_ID" property="auId" jdbcType="CHAR" /> + <result column="AU_NAME" property="auName" jdbcType="VARCHAR" /> + </resultMap> + <sql id="Example_Where_Clause" > + <where > + <foreach collection="oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Update_By_Example_Where_Clause" > + <where > + <foreach collection="example.oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Base_Column_List" > + USER_ID, USER_PW, USER_NAME, MAIL_ADDRESS, CREATE_DATE, UPDATE_DATE, IS_DEL, ual.A_AU_ID, au.AU_NAME + </sql> + <sql id="Base_Column_Protect_List" > + USER_ID, USER_NAME, MAIL_ADDRESS, CREATE_DATE, UPDATE_DATE, IS_DEL, ual.A_AU_ID, au.AU_NAME + </sql> + <select id="selectByExample" resultMap="BaseResultMap" parameterType="UserExample" > + select + <if test="distinct" > + distinct + </if> + 'true' as QUERYID, + <include refid="Base_Column_Protect_List" /> + from t_user + left join t_user_authority_link as ual on USER_ID = ual.A_USER_ID + left join t_authority as au on ual.A_AU_ID = au.AU_ID + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + <if test="orderByClause != null" > + order by ${orderByClause} + </if> + </select> + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > + select + <include refid="Base_Column_Protect_List" /> + from t_user + left join t_user_authority_link as ual on USER_ID = ual.A_USER_ID + left join t_authority as au on ual.A_AU_ID = au.AU_ID + where USER_ID = #{userId,jdbcType=CHAR} + </select> + <select id="selectOneByExample" resultMap="BaseResultMap" parameterType="UserExample" useCache="false"> + select + <include refid="Base_Column_Protect_List" /> + from t_user + left join t_user_authority_link as ual on USER_ID = ual.A_USER_ID + left join t_authority as au on ual.A_AU_ID = au.AU_ID + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > + delete from t_user + where USER_ID = #{userId,jdbcType=CHAR} + </delete> + <delete id="deleteByExample" parameterType="UserExample" > + delete from t_user + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </delete> + <insert id="insert" parameterType="User" > + insert into t_user (USER_ID, USER_PW, USER_NAME, + MAIL_ADDRESS, CREATE_DATE, UPDATE_DATE, + IS_DEL) + values (#{userId,jdbcType=CHAR}, #{userPw,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, + #{mailAddress,jdbcType=VARCHAR}, #{createDate,jdbcType=TIMESTAMP}, #{updateDate,jdbcType=TIMESTAMP}, + #{isDel,jdbcType=CHAR}) + </insert> + <insert id="insertSelective" parameterType="User" > + insert into t_user + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="userId != null" > + USER_ID, + </if> + <if test="userPw != null" > + USER_PW, + </if> + <if test="userName != null" > + USER_NAME, + </if> + <if test="mailAddress != null" > + MAIL_ADDRESS, + </if> + <if test="createDate != null" > + CREATE_DATE, + </if> + <if test="updateDate != null" > + UPDATE_DATE, + </if> + <if test="isDel != null" > + IS_DEL, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="userId != null" > + #{userId,jdbcType=CHAR}, + </if> + <if test="userPw != null" > + #{userPw,jdbcType=VARCHAR}, + </if> + <if test="userName != null" > + #{userName,jdbcType=VARCHAR}, + </if> + <if test="mailAddress != null" > + #{mailAddress,jdbcType=VARCHAR}, + </if> + <if test="createDate != null" > + #{createDate,jdbcType=TIMESTAMP}, + </if> + <if test="updateDate != null" > + #{updateDate,jdbcType=TIMESTAMP}, + </if> + <if test="isDel != null" > + #{isDel,jdbcType=CHAR}, + </if> + </trim> + </insert> + <select id="countByExample" parameterType="UserExample" resultType="java.lang.Integer" > + select count(*) from t_user + left join t_user_authority_link as ual on USER_ID = ual.A_USER_ID + left join t_authority as au on ual.A_AU_ID = au.AU_ID + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </select> + <update id="updateByExampleSelective" parameterType="map" > + update t_user + <set > + <if test="record.userId != null" > + USER_ID = #{record.userId,jdbcType=CHAR}, + </if> + <if test="record.userPw != null" > + USER_PW = #{record.userPw,jdbcType=VARCHAR}, + </if> + <if test="record.userName != null" > + USER_NAME = #{record.userName,jdbcType=VARCHAR}, + </if> + <if test="record.mailAddress != null" > + MAIL_ADDRESS = #{record.mailAddress,jdbcType=VARCHAR}, + </if> + <if test="record.createDate != null" > + CREATE_DATE = #{record.createDate,jdbcType=TIMESTAMP}, + </if> + <if test="record.updateDate != null" > + UPDATE_DATE = #{record.updateDate,jdbcType=TIMESTAMP}, + </if> + <if test="record.isDel != null" > + IS_DEL = #{record.isDel,jdbcType=CHAR}, + </if> + </set> + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByExample" parameterType="map" > + update t_user + set USER_ID = #{record.userId,jdbcType=CHAR}, + USER_PW = #{record.userPw,jdbcType=VARCHAR}, + USER_NAME = #{record.userName,jdbcType=VARCHAR}, + MAIL_ADDRESS = #{record.mailAddress,jdbcType=VARCHAR}, + CREATE_DATE = #{record.createDate,jdbcType=TIMESTAMP}, + UPDATE_DATE = #{record.updateDate,jdbcType=TIMESTAMP}, + IS_DEL = #{record.isDel,jdbcType=CHAR} + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByPrimaryKeySelective" parameterType="User" > + update t_user + <set > + <if test="userPw != null" > + USER_PW = #{userPw,jdbcType=VARCHAR}, + </if> + <if test="userName != null" > + USER_NAME = #{userName,jdbcType=VARCHAR}, + </if> + <if test="mailAddress != null" > + MAIL_ADDRESS = #{mailAddress,jdbcType=VARCHAR}, + </if> + <if test="createDate != null" > + CREATE_DATE = #{createDate,jdbcType=TIMESTAMP}, + </if> + <if test="updateDate != null" > + UPDATE_DATE = #{updateDate,jdbcType=TIMESTAMP}, + </if> + <if test="isDel != null" > + IS_DEL = #{isDel,jdbcType=CHAR}, + </if> + </set> + where USER_ID = #{userId,jdbcType=CHAR} + </update> + <update id="updateByPrimaryKey" parameterType="User" > + update t_user + set USER_PW = #{userPw,jdbcType=VARCHAR}, + USER_NAME = #{userName,jdbcType=VARCHAR}, + MAIL_ADDRESS = #{mailAddress,jdbcType=VARCHAR}, + CREATE_DATE = #{createDate,jdbcType=TIMESTAMP}, + UPDATE_DATE = #{updateDate,jdbcType=TIMESTAMP}, + IS_DEL = #{isDel,jdbcType=CHAR} + where USER_ID = #{userId,jdbcType=CHAR} + </update> + <update id="updatePassword" parameterType="User" > + update t_user + set USER_PW = #{userPw,jdbcType=VARCHAR} + where USER_NAME = #{userName,jdbcType=VARCHAR} + and USER_PW = #{userPwBak,jdbcType=VARCHAR} + </update> + <insert id="insertOrUpdate" parameterType="User" > + insert into t_user (USER_NAME, USER_PW, MAIL_ADDRESS, + CREATE_DATE, UPDATE_DATE, IS_DEL + ) + values (#{userName,jdbcType=VARCHAR}, #{userPw,jdbcType=VARCHAR}, #{mailAddress,jdbcType=VARCHAR}, + NOW(), NOW(), #{isDel,jdbcType=INTEGER}} + ) + ON DUPLICATE KEY UPDATE + t_user.USER_NAME = #{userName,jdbcType=VARCHAR}, + MAIL_ADDRESS = #{mailAddress,jdbcType=VARCHAR}, + UPDATE_DATE = NOW(), + IS_DEL = #{isDel,jdbcType=INTEGER}, + <if test="userPw != null" > + t_user.USER_PW = #{userPw,jdbcType=VARCHAR} + </if> + </insert> + <delete id="deleteByUserName" parameterType="java.lang.String" > + delete from t_user + where USER_NAME = #{userName,jdbcType=VARCHAR} + </delete> + <select id="countByUserName" parameterType="java.lang.String" resultType="java.lang.Integer" > + select count(*) from t_user + where USER_NAME = #{userName,jdbcType=VARCHAR} + </select> + <select id="countByUserId" parameterType="java.lang.String" resultType="java.lang.Integer" > + select count(*) from t_user + where USER_ID = #{userId,jdbcType=CHAR} + </select> + <select id="selectByUserName" resultMap="BaseResultMap" parameterType="java.lang.String" > + select + <include refid="Base_Column_Protect_List" /> + from t_user + left join t_user_authority_link as ual on USER_ID = ual.A_USER_ID + left join t_authority as au on ual.A_AU_ID = au.AU_ID + where USER_NAME = #{userName,jdbcType=VARCHAR} + </select> + +</mapper>
\ No newline at end of file diff --git a/appmarket-persistence/src/test/java/app/market/persisitence/AppTest.java b/appmarket-persistence/src/test/java/app/market/persisitence/AppTest.java new file mode 100644 index 0000000..c0af50c --- /dev/null +++ b/appmarket-persistence/src/test/java/app/market/persisitence/AppTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2019 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package app.market.persisitence; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} |