添加申请退货

This commit is contained in:
sin 2019-04-26 00:26:08 +08:00
parent 01e5404e8c
commit 957b2eb893
7 changed files with 91 additions and 0 deletions

View File

@ -0,0 +1,16 @@
package cn.iocoder.mall.admin.sdk.dict;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @author Sin
* @time 2019-04-16 20:43
*/
@Data
@Accessors(chain = true)
public class Bean {
@DictVal(dicKey = "gender", dicValue = "1")
private String gender;
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.mall.admin.sdk.dict;
import java.lang.annotation.*;
/**
* 字典转换
*
* @author Sin
* @time 2019-04-16 20:22
*/
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface DictVal {
/**
* 字典的 key
*
* @return
*/
String dicKey();
/**
* 字典 value
*
* @return
*/
String dicValue();
/**
* - 暂时只有 dictDisplayName 字典值转换为 dictDisplayName 给用户界面
*
* @return
*/
String mode() default "dictDisplayName";
}

View File

@ -0,0 +1,23 @@
package cn.iocoder.mall.admin.sdk.dict;
import org.springframework.util.ReflectionUtils;
/**
* {@link DictVal} 处理器
*
* @author Sin
* @time 2019-04-16 20:43
*/
public class DictValProcessor {
public static void main(String[] args) {
}
public void processor(Class<?> clazz) {
// ReflectionUtils.ann
// clazz.getFi
// ReflectionUtils
}
}

View File

@ -28,6 +28,7 @@ public interface DataDictService {
* @return * @return
*/ */
CommonResult<DataDictBO> getDataDict(String dictKey, Object dictValue); CommonResult<DataDictBO> getDataDict(String dictKey, Object dictValue);
CommonResult<List<DataDictBO>> getDataDict(String dictKey);
/** /**
* 获取字典值 - 多个 * 获取字典值 - 多个

View File

@ -22,6 +22,9 @@ public interface DataDictMapper {
@Param("values") Collection<String> values @Param("values") Collection<String> values
); );
List<DataDictDO> selectByEnumValue(
@Param("enumValue") String enumValue
);
List<DataDictDO> selectList(); List<DataDictDO> selectList();

View File

@ -97,6 +97,13 @@ public class DataDictServiceImpl implements DataDictService {
return CommonResult.success(dataDictBO); return CommonResult.success(dataDictBO);
} }
@Override
public CommonResult<List<DataDictBO>> getDataDict(String dictKey) {
List<DataDictDO> dataDictDOList = dataDictMapper.selectByEnumValue(dictKey);
List<DataDictBO> dataDictBOList = DataDictConvert.INSTANCE.convert(dataDictDOList);
return CommonResult.success(dataDictBOList);
}
@Override @Override
public CommonResult<List<DataDictBO>> getDataDictList(String dictKey, Collection<?> dictValueList) { public CommonResult<List<DataDictBO>> getDataDictList(String dictKey, Collection<?> dictValueList) {
Set<String> convertDictValueList = dictValueList.stream().map(o -> String.valueOf(o)).collect(Collectors.toSet()); Set<String> convertDictValueList = dictValueList.stream().map(o -> String.valueOf(o)).collect(Collectors.toSet());

View File

@ -44,6 +44,13 @@
FROM data_dict FROM data_dict
WHERE deleted = 0 WHERE deleted = 0
</select> </select>
<select id="selectByEnumValue" resultType="cn.iocoder.mall.admin.dataobject.DataDictDO">
SELECT
<include refid="FIELDS"/>
FROM data_dict
WHERE deleted = 0
AND enum_value = #{enumValue}
</select>
<insert id="insert" parameterType="DataDictDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id"> <insert id="insert" parameterType="DataDictDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO data_dict ( INSERT INTO data_dict (